Btrfs: fix missing log when BTRFS_INODE_NEEDS_FULL_SYNC is set
authorMiao Xie <miaox@cn.fujitsu.com>
Thu, 1 Nov 2012 07:35:23 +0000 (07:35 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Wed, 12 Dec 2012 22:15:22 +0000 (17:15 -0500)
If we set BTRFS_INODE_NEEDS_FULL_SYNC, we should log all the extent,
but now we forget to take it into account, and set a wrong max key,
if so, we will skip the file extent metadata when doing logging. Fix it.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/tree-log.c

index d1947af67bcd2a40dfd3e0fa09de6b02caea3cc4..40b9efd20e4311b0f922b41f60035da488d59920 100644 (file)
@@ -3394,7 +3394,10 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
 
 
        /* today the code can only do partial logging of directories */
-       if (inode_only == LOG_INODE_EXISTS || S_ISDIR(inode->i_mode))
+       if (S_ISDIR(inode->i_mode) ||
+           (!test_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
+                      &BTRFS_I(inode)->runtime_flags) &&
+            inode_only == LOG_INODE_EXISTS))
                max_key.type = BTRFS_XATTR_ITEM_KEY;
        else
                max_key.type = (u8)-1;