]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
Btrfs: make sure nbytes are right after log replay
authorJosef Bacik <jbacik@fusionio.com>
Fri, 5 Apr 2013 20:50:09 +0000 (20:50 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 25 Apr 2013 19:25:38 +0000 (20:25 +0100)
commit595b57bbaf350dceda50bb2021153ab0bf7632b2
tree3a91a28116c8f99e4716a8116c04604095907c0a
parentee3c9aabb636fcfc21d53c506362620b55fdd8c6
Btrfs: make sure nbytes are right after log replay

commit 4bc4bee4595662d8bff92180d5c32e3313a704b0 upstream.

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.

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/btrfs/tree-log.c