Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 322372
b: refs/heads/master
c: 24c03fa
h: refs/heads/master
v: v3
  • Loading branch information
Liu Bo authored and Chris Mason committed Aug 28, 2012
1 parent 098c252 commit 5710911
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 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: bd7de2c9a449e26a5493d918618eb20ae60d56bd
refs/heads/master: 24c03fa5cf3d02c327cf9f2fc39f72664b1bd7e1
24 changes: 20 additions & 4 deletions trunk/fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -5992,11 +5992,27 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
* in the case of read we need to unlock only the end area that we
* aren't using if there is any left over space.
*/
if (lockstart < lockend)
clear_extent_bit(&BTRFS_I(inode)->io_tree, lockstart, lockend,
unlock_bits, 1, 0, &cached_state, GFP_NOFS);
else
if (lockstart < lockend) {
if (create && len < lockend - lockstart) {
clear_extent_bit(&BTRFS_I(inode)->io_tree, lockstart,
lockstart + len - 1, unlock_bits, 1, 0,
&cached_state, GFP_NOFS);
/*
* Beside unlock, we also need to cleanup reserved space
* for the left range by attaching EXTENT_DO_ACCOUNTING.
*/
clear_extent_bit(&BTRFS_I(inode)->io_tree,
lockstart + len, lockend,
unlock_bits | EXTENT_DO_ACCOUNTING,
1, 0, NULL, GFP_NOFS);
} else {
clear_extent_bit(&BTRFS_I(inode)->io_tree, lockstart,
lockend, unlock_bits, 1, 0,
&cached_state, GFP_NOFS);
}
} else {
free_extent_state(cached_state);
}

free_extent_map(em);

Expand Down

0 comments on commit 5710911

Please sign in to comment.