Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 199004
b: refs/heads/master
c: c2c6ca4
h: refs/heads/master
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed May 25, 2010
1 parent 8c4cb38 commit b1db383
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: facd07b07d2a7988f5ce849558838cc953847637
refs/heads/master: c2c6ca417e2db7a519e6e92c82f4a933d940d076
20 changes: 18 additions & 2 deletions trunk/fs/direct-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,26 @@ static int dio_send_cur_page(struct dio *dio)
int ret = 0;

if (dio->bio) {
loff_t cur_offset = dio->block_in_file << dio->blkbits;
loff_t bio_next_offset = dio->logical_offset_in_bio +
dio->bio->bi_size;

/*
* See whether this new request is contiguous with the old
* See whether this new request is contiguous with the old.
*
* Btrfs cannot handl having logically non-contiguous requests
* submitted. For exmple if you have
*
* Logical: [0-4095][HOLE][8192-12287]
* Phyiscal: [0-4095] [4096-8181]
*
* We cannot submit those pages together as one BIO. So if our
* current logical offset in the file does not equal what would
* be the next logical offset in the bio, submit the bio we
* have.
*/
if (dio->final_block_in_bio != dio->cur_page_block)
if (dio->final_block_in_bio != dio->cur_page_block ||
cur_offset != bio_next_offset)
dio_bio_submit(dio);
/*
* Submit now if the underlying fs is about to perform a
Expand Down

0 comments on commit b1db383

Please sign in to comment.