Skip to content

Commit

Permalink
Btrfs: Fix btrfs_drop_extent_cache for skip pinned case
Browse files Browse the repository at this point in the history
The check for skip pinned case is wrong, it may breaks the
while loop too soon.

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Yan, Zheng authored and chrismason-xx committed Dec 17, 2009
1 parent 24bbcf0 commit 55ef689
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions fs/btrfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,14 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
}
flags = em->flags;
if (skip_pinned && test_bit(EXTENT_FLAG_PINNED, &em->flags)) {
if (em->start <= start &&
(!testend || em->start + em->len >= start + len)) {
if (testend && em->start + em->len >= start + len) {
free_extent_map(em);
write_unlock(&em_tree->lock);
break;
}
if (start < em->start) {
len = em->start - start;
} else {
start = em->start + em->len;
if (testend)
len = start + len - (em->start + em->len);
start = em->start + em->len;
}
free_extent_map(em);
write_unlock(&em_tree->lock);
continue;
Expand Down

0 comments on commit 55ef689

Please sign in to comment.