From: Liu Bo Date: Mon, 27 Aug 2012 16:52:19 +0000 (-0600) Subject: Btrfs: cleanup extents after we finish logging inode X-Git-Tag: firefly_0821_release~3680^2~1721^2~102 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=06d3d22b456c2f87aeb1eb4517eeabb47e21fcc9;p=firefly-linux-kernel-4.4.55.git Btrfs: cleanup extents after we finish logging inode This is based on Josef's "Btrfs: turbo charge fsync". We should cleanup those extents after we've finished logging inode, otherwise we may do redundant work on them. Signed-off-by: Liu Bo --- diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 94db438494df..58075d711d24 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -3167,6 +3167,12 @@ next_slot: err = ret; goto out_unlock; } + } else { + struct extent_map_tree *tree = &BTRFS_I(inode)->extent_tree; + struct extent_map *em, *n; + + list_for_each_entry_safe(em, n, &tree->modified_extents, list) + list_del_init(&em->list); } if (inode_only == LOG_INODE_ALL && S_ISDIR(inode->i_mode)) {