diff mbox

[1/2] Btrfs: cleanup extents after we finish logging inode

Message ID 1346086340-14776-1-git-send-email-bo.li.liu@oracle.com (mailing list archive)
State New, archived
Headers show

Commit Message

Liu Bo Aug. 27, 2012, 4:52 p.m. UTC
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 <bo.li.liu@oracle.com>
---
 fs/btrfs/tree-log.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

Comments

Josef Bacik Aug. 27, 2012, 5:05 p.m. UTC | #1
On Mon, Aug 27, 2012 at 10:52:19AM -0600, Liu Bo wrote:
> 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 <bo.li.liu@oracle.com>
> ---
>  fs/btrfs/tree-log.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index 5190cd6..e7365d7 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)) {
> -- 

Ah thanks I had been meaning to do this but I kept forgetting.  I'll add it to
btrfs-next.  Thanks,

Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 5190cd6..e7365d7 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)) {