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>
This commit is contained in:
Yan, Zheng 2009-11-12 09:36:44 +00:00 коммит произвёл Chris Mason
Родитель 24bbcf0442
Коммит 55ef689900
1 изменённых файлов: 3 добавлений и 7 удалений

Просмотреть файл

@ -179,18 +179,14 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
} }
flags = em->flags; flags = em->flags;
if (skip_pinned && test_bit(EXTENT_FLAG_PINNED, &em->flags)) { if (skip_pinned && test_bit(EXTENT_FLAG_PINNED, &em->flags)) {
if (em->start <= start && if (testend && em->start + em->len >= start + len) {
(!testend || em->start + em->len >= start + len)) {
free_extent_map(em); free_extent_map(em);
write_unlock(&em_tree->lock); write_unlock(&em_tree->lock);
break; break;
} }
if (start < em->start) { start = em->start + em->len;
len = em->start - start; if (testend)
} else {
len = start + len - (em->start + em->len); len = start + len - (em->start + em->len);
start = em->start + em->len;
}
free_extent_map(em); free_extent_map(em);
write_unlock(&em_tree->lock); write_unlock(&em_tree->lock);
continue; continue;