Btrfs: Fix ordering of key field checks in btrfs_previous_item

Check objectid of item before checking the item type, otherwise we may return
zero for a key that is actually too low.

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-07-24 11:06:53 -04:00 коммит произвёл Chris Mason
Родитель 1fcbac581b
Коммит 0a4eefbb74
1 изменённых файлов: 2 добавлений и 2 удалений

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

@ -4296,10 +4296,10 @@ int btrfs_previous_item(struct btrfs_root *root,
path->slots[0]--; path->slots[0]--;
btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]); btrfs_item_key_to_cpu(leaf, &found_key, path->slots[0]);
if (found_key.type == type)
return 0;
if (found_key.objectid < min_objectid) if (found_key.objectid < min_objectid)
break; break;
if (found_key.type == type)
return 0;
if (found_key.objectid == min_objectid && if (found_key.objectid == min_objectid &&
found_key.type < type) found_key.type < type)
break; break;