]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
btrfs: relocation: Output current relocation stage at btrfs_relocate_block_group()
authorQu Wenruo <wqu@suse.com>
Fri, 29 Nov 2019 04:40:59 +0000 (12:40 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 20 Jan 2020 15:40:51 +0000 (16:40 +0100)
There are two relocation stages but both print the same message. Add the
description of the stage. This can help debugging or provides
informative message to users.

  BTRFS info (device dm-5): balance: start -d -m -s
  BTRFS info (device dm-5): relocating block group 30408704 flags metadata|dup
  BTRFS info (device dm-5): found 2 extents, stage: move data extents
  BTRFS info (device dm-5): relocating block group 22020096 flags system|dup
  BTRFS info (device dm-5): found 1 extents, stage: move data extents
  BTRFS info (device dm-5): relocating block group 13631488 flags data
  BTRFS info (device dm-5): found 1 extents, stage: move data extents
  BTRFS info (device dm-5): found 1 extents, stage: update data pointers
  BTRFS info (device dm-5): balance: ended with status: 0

Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/relocation.c

index da5abd62db2232d48e128e6b37123f4bbfbd9072..1875e84b9bf7e3028f9b1c169c0fdedb24eccecb 100644 (file)
@@ -4332,6 +4332,15 @@ static void describe_relocation(struct btrfs_fs_info *fs_info,
                   block_group->start, buf);
 }
 
+static const char *stage_to_string(int stage)
+{
+       if (stage == MOVE_DATA_EXTENTS)
+               return "move data extents";
+       if (stage == UPDATE_DATA_PTRS)
+               return "update data pointers";
+       return "unknown";
+}
+
 /*
  * function to relocate all extents in a block group.
  */
@@ -4406,12 +4415,15 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start)
                                 rc->block_group->length);
 
        while (1) {
+               int finishes_stage;
+
                mutex_lock(&fs_info->cleaner_mutex);
                ret = relocate_block_group(rc);
                mutex_unlock(&fs_info->cleaner_mutex);
                if (ret < 0)
                        err = ret;
 
+               finishes_stage = rc->stage;
                /*
                 * We may have gotten ENOSPC after we already dirtied some
                 * extents.  If writeout happens while we're relocating a
@@ -4437,8 +4449,8 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start)
                if (rc->extents_found == 0)
                        break;
 
-               btrfs_info(fs_info, "found %llu extents", rc->extents_found);
-
+               btrfs_info(fs_info, "found %llu extents, stage: %s",
+                          rc->extents_found, stage_to_string(finishes_stage));
        }
 
        WARN_ON(rc->block_group->pinned > 0);