btrfs-progs: check: repair dir_item and inode_ref in lowmem mode
authorSu Yue <suy.fnst@cn.fujitsu.com>
Tue, 29 Aug 2017 02:47:20 +0000 (10:47 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 16 Oct 2017 18:33:00 +0000 (20:33 +0200)
commit5da13ab9b5894f48c993405e0ad97a8c1fca6336
treebca5034a3e310b24a9e972bc3d669c9d582782d6
parent839b3c5214c7d0fb3fa87969ab0b9ece9e6baa77
btrfs-progs: check: repair dir_item and inode_ref in lowmem mode

Introduce repair_ternary_lowmem() to repair dir_item, dir_index
and inode_ref.
If two of the three are missing or mismatched, call btrfs_unlink() to
delete the existing one.
If one of three is missing or mismatched, call btrfs_add_link() to
add the missing one.

repair_dir_item() inserts an inode item corresponding to location in the
dir item if error contains INODE_ITEM_MISSING.
Also, it calls repair_ternary_lowmem() to repair relationship of
dir_item, dir_index and inode_ref.

check_inode_ref() calls repair_ternary_item() to fix up errors.

Signed-off-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c