• Josef Bacik's avatar
    Btrfs: make sure nbytes are right after log replay · 4bc4bee4
    Josef Bacik authored
    While trying to track down a tree log replay bug I noticed that fsck was always
    complaining about nbytes not being right for our fsynced file.  That is because
    the new fsync stuff doesn't wait for ordered extents to complete, so the inodes
    nbytes are not necessarily updated properly when we log it.  So to fix this we
    need to set nbytes to whatever it is on the inode that is on disk, so when we
    replay the extents we can just add the bytes that are being added as we replay
    the extent.  This makes it work for the case that we have the wrong nbytes or
    the case that we logged everything and nbytes is actually correct.  With this
    I'm no longer getting nbytes errors out of btrfsck.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
    Signed-off-by: default avatarChris Mason <chris.mason@fusionio.com>
    4bc4bee4
tree-log.c 110 KB