diff mbox

[6/6] Btrfs: comment for loop in tree_mod_log_insert_move

Message ID 1351000527-24952-7-git-send-email-list.btrfs@jan-o-sch.net (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Schmidt Oct. 23, 2012, 1:55 p.m. UTC
Emphasis the way tree_mod_log_insert_move avoids adding
MOD_LOG_KEY_REMOVE_WHILE_MOVING operations, depending on the direction of
the move operation.

Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
---
 fs/btrfs/ctree.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Comments

Liu Bo Oct. 23, 2012, 3:32 p.m. UTC | #1
On 10/23/2012 09:55 PM, Jan Schmidt wrote:
> Emphasis the way tree_mod_log_insert_move avoids adding
> MOD_LOG_KEY_REMOVE_WHILE_MOVING operations, depending on the direction of
> the move operation.
> 

Good work.

Reviewed-by: Liu Bo <bo.li.liu@oracle.com>

thanks,
liubo

> Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
> ---
>  fs/btrfs/ctree.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> index bed06e8..c608b3c 100644
> --- a/fs/btrfs/ctree.c
> +++ b/fs/btrfs/ctree.c
> @@ -596,6 +596,11 @@ tree_mod_log_insert_move(struct btrfs_fs_info *fs_info,
>  	if (tree_mod_dont_log(fs_info, eb))
>  		return 0;
>  
> +	/*
> +	 * When we override something during the move, we log these removals.
> +	 * This can only happen when we move towards the beginning of the
> +	 * buffer, i.e. dst_slot < src_slot.
> +	 */
>  	for (i = 0; i + dst_slot < src_slot && i < nr_items; i++) {
>  		ret = tree_mod_log_insert_key_locked(fs_info, eb, i + dst_slot,
>  					      MOD_LOG_KEY_REMOVE_WHILE_MOVING);
> 

--
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/ctree.c b/fs/btrfs/ctree.c
index bed06e8..c608b3c 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -596,6 +596,11 @@  tree_mod_log_insert_move(struct btrfs_fs_info *fs_info,
 	if (tree_mod_dont_log(fs_info, eb))
 		return 0;
 
+	/*
+	 * When we override something during the move, we log these removals.
+	 * This can only happen when we move towards the beginning of the
+	 * buffer, i.e. dst_slot < src_slot.
+	 */
 	for (i = 0; i + dst_slot < src_slot && i < nr_items; i++) {
 		ret = tree_mod_log_insert_key_locked(fs_info, eb, i + dst_slot,
 					      MOD_LOG_KEY_REMOVE_WHILE_MOVING);