Btrfs-progs: fix fsck dealing with finding backrefs first
authorJosef Bacik <jbacik@fusionio.com>
Mon, 3 Jun 2013 19:15:28 +0000 (15:15 -0400)
committerChris Mason <chris.mason@fusionio.com>
Wed, 19 Jun 2013 17:52:48 +0000 (13:52 -0400)
commitb3be7aea12b3f974895191026cb012f6fa78203c
treedf89bb4c46087258fed567d2860f899d741775b3
parent7a70b159af8ef70b87771251a7ba45818ef19cfa
Btrfs-progs: fix fsck dealing with finding backrefs first

There is a problem where if we find a backref extent record first that doesn't
match a extent item we will delete some of the duplicates but not others.  In
order to deal with this we need to make sure we only pay attention to duplicates
that actually have duplicate extent items.  If a extent_rec has a duplicate but
the record itself doesn't have an associated extent item we promote the
duplicate to the extent record and just discard the original extent_rec since it
was just added by the backref.  We copy the backref onto the promoted extent
record and then continue processing.  This allowed me to fix a file system that
previously was not able to be fixed by fsck.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
cmds-check.c