aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2017-02-01 09:58:02 -0500
committerFilipe Manana <fdmanana@suse.com>2017-02-23 19:38:10 -0500
commit3168021cf9b4906f7bd9871770235f14c5a17715 (patch)
tree2c8464809935015142f6ad1af673201ca699c93b
parent91e1f56a8b3c94cb5ac9ce12b806134dc33c1eeb (diff)
Btrfs: do not create explicit holes when replaying log tree if NO_HOLES enabled
We log holes explicitly by using file extent items, however when replaying a log tree, if a logged file extent item corresponds to a hole and the NO_HOLES feature is enabled we do not need to copy the file extent item into the fs/subvolume tree, as the absence of such file extent items is the purpose of the NO_HOLES feature. So skip the copying of file extent items representing holes when the NO_HOLES feature is enabled. Signed-off-by: Filipe Manana <fdmanana@suse.com>
-rw-r--r--fs/btrfs/tree-log.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 3806853cde08..3cc972330ab3 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -673,6 +673,10 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
673 unsigned long dest_offset; 673 unsigned long dest_offset;
674 struct btrfs_key ins; 674 struct btrfs_key ins;
675 675
676 if (btrfs_file_extent_disk_bytenr(eb, item) == 0 &&
677 btrfs_fs_incompat(fs_info, NO_HOLES))
678 goto update_inode;
679
676 ret = btrfs_insert_empty_item(trans, root, path, key, 680 ret = btrfs_insert_empty_item(trans, root, path, key,
677 sizeof(*item)); 681 sizeof(*item));
678 if (ret) 682 if (ret)
@@ -825,6 +829,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
825 } 829 }
826 830
827 inode_add_bytes(inode, nbytes); 831 inode_add_bytes(inode, nbytes);
832update_inode:
828 ret = btrfs_update_inode(trans, root, inode); 833 ret = btrfs_update_inode(trans, root, inode);
829out: 834out:
830 if (inode) 835 if (inode)