diff options
author | Yan, Zheng <zheng.yan@oracle.com> | 2009-11-12 04:36:44 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-12-17 12:33:35 -0500 |
commit | 55ef68990029fcd8d04d42fc184aa7fb18cf309e (patch) | |
tree | 0487a5d15586e94de29be3c8701cb64eb1ae2f9b /fs | |
parent | 24bbcf0442ee04660a5a030efdbb6d03f1c275cb (diff) |
Btrfs: Fix btrfs_drop_extent_cache for skip pinned case
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/file.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 3d2e45ce5d25..3bfe9f03990b 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -179,18 +179,14 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, | |||
179 | } | 179 | } |
180 | flags = em->flags; | 180 | flags = em->flags; |
181 | if (skip_pinned && test_bit(EXTENT_FLAG_PINNED, &em->flags)) { | 181 | if (skip_pinned && test_bit(EXTENT_FLAG_PINNED, &em->flags)) { |
182 | if (em->start <= start && | 182 | if (testend && em->start + em->len >= start + len) { |
183 | (!testend || em->start + em->len >= start + len)) { | ||
184 | free_extent_map(em); | 183 | free_extent_map(em); |
185 | write_unlock(&em_tree->lock); | 184 | write_unlock(&em_tree->lock); |
186 | break; | 185 | break; |
187 | } | 186 | } |
188 | if (start < em->start) { | 187 | start = em->start + em->len; |
189 | len = em->start - start; | 188 | if (testend) |
190 | } else { | ||
191 | len = start + len - (em->start + em->len); | 189 | len = start + len - (em->start + em->len); |
192 | start = em->start + em->len; | ||
193 | } | ||
194 | free_extent_map(em); | 190 | free_extent_map(em); |
195 | write_unlock(&em_tree->lock); | 191 | write_unlock(&em_tree->lock); |
196 | continue; | 192 | continue; |