dio: fix typos in comments
PATCH 1/2 dio: fix typos in comments
Signed-off-by Namhyung Kim <[email protected]>
Cc Jiri Kosina <[email protected]>
--- fs/direct-io.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
fs/direct-io.c +3 -3
@@ -641,11 +641,11 @@ static int dio_send_cur_page(struct dio *dio)/* * See whether this new request is contiguous with the old. * -* Btrfs cannot handl having logically non-contiguous requests -* submitted. For exmple if you have +* Btrfs cannot handle having logically non-contiguous requests +* submitted. For example if you have * * Logical: [0-4095][HOLE][8192-12287] -* Phyiscal: [0-4095] [4096-8181] +* Physical: [0-4095] [4096-8191] * * We cannot submit those pages together as one BIO. So if our * current logical offset in the file does not equal what would
Signature · 1 line
1.7.3.4.600.g982838b0
PATCH 2/2 dio: simple cleanup for direct_io_worker()
Use DIV_ROUND_UP() and offset_in_page() to make code simpler.
Signed-off-by Namhyung Kim <[email protected]>
--- fs/direct-io.c | 13 ++++++++----- 1 files changed, 8 insertions(+), 5 deletions(-)
fs/direct-io.c +8 -5
@@ -1020,16 +1020,19 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,for (seg =0 ; seg < nr_segs; seg++) { user_addr = (unsigned long )iov[seg].iov_base; dio->pages_in_io += - ((user_addr+iov[seg].iov_len +PAGE_SIZE -1 )/PAGE_SIZE + (DIV_ROUND_UP (user_addr + iov[seg].iov_len,PAGE_SIZE ) - user_addr/PAGE_SIZE ); }for (seg =0 ; seg < nr_segs; seg++) { +unsigned page_offset; + user_addr = (unsigned long )iov[seg].iov_base; dio->size += bytes = iov[seg].iov_len; + page_offset =offset_in_page (user_addr);/* Index into the first page of the first block */ - dio->first_block_in_page = (user_addr & ~PAGE_MASK ) >> blkbits; + dio->first_block_in_page = page_offset >> blkbits; dio->final_block_in_request = dio->block_in_file + (bytes >> blkbits);/* Page fetching state */
@@ -1038,11 +1041,11 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode, dio->curr_page =0 ; dio->total_pages =0 ; -if (user_addr & (PAGE_SIZE -1 )) { +if (page_offset) { dio->total_pages++; - bytes -=PAGE_SIZE - (user_addr & (PAGE_SIZE -1 )); + bytes -=PAGE_SIZE - page_offset; } - dio->total_pages += (bytes +PAGE_SIZE -1 ) /PAGE_SIZE ; + dio->total_pages +=DIV_ROUND_UP (bytes,PAGE_SIZE ); dio->curr_user_address = user_addr; ret =do_direct_IO (dio);
Signature · 1 line
1.7.3.4.600.g982838b0