Bring back read page alignmnet

This commit is contained in:
Michal Moskal 2017-07-26 11:52:51 +01:00
parent 33863b8b96
commit f4c9e85924

View File

@ -709,9 +709,7 @@ static int do_read(struct fsg_common *common)
u32 amount_left;
loff_t file_offset, file_offset_tmp;
unsigned int amount;
// partial_page handling causes hangs
// same thing in do_write() --mmoskal
//unsigned int partial_page;
unsigned int partial_page;
ssize_t nread;
/* Get the starting Logical Block Address and check that it's
@ -756,12 +754,10 @@ static int do_read(struct fsg_common *common)
amount = min(amount_left, FSG_BUFLEN);
amount = min((loff_t) amount,
curlun->file_length - file_offset);
/*
partial_page = file_offset & (PAGE_CACHE_SIZE - 1);
if (partial_page > 0)
amount = min(amount, (unsigned int) PAGE_CACHE_SIZE -
partial_page);
*/
/* Wait for the next buffer to become available */
bh = common->next_buffhd_to_fill;
while (bh->state != BUF_STATE_EMPTY) {
@ -844,7 +840,7 @@ static int do_write(struct fsg_common *common)
u32 amount_left_to_req, amount_left_to_write;
loff_t usb_offset, file_offset, file_offset_tmp;
unsigned int amount;
//unsigned int partial_page;
unsigned int partial_page;
ssize_t nwritten;
int rc;
@ -908,12 +904,10 @@ static int do_write(struct fsg_common *common)
amount = min(amount_left_to_req, FSG_BUFLEN);
amount = min((loff_t) amount, curlun->file_length -
usb_offset);
/*
partial_page = usb_offset & (PAGE_CACHE_SIZE - 1);
if (partial_page > 0)
amount = min(amount,
(unsigned int) PAGE_CACHE_SIZE - partial_page);
*/
if (amount == 0) {
get_some_more = 0;