btrfs: balance: print to system log when balance ends or is paused
authorAnand Jain <anand.jain@oracle.com>
Tue, 20 Nov 2018 08:12:57 +0000 (16:12 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 17 Dec 2018 13:51:39 +0000 (14:51 +0100)
Print a kernel log message when the balance ends, either for cancel or
completed or if it is paused.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c

index cdba4f03d465396c20693c2e954a5d8869dbe3b0..2085d4d3a6fe9179e093707031abc1de3459f125 100644 (file)
@@ -4287,6 +4287,13 @@ int btrfs_balance(struct btrfs_fs_info *fs_info,
        ret = __btrfs_balance(fs_info);
 
        mutex_lock(&fs_info->balance_mutex);
        ret = __btrfs_balance(fs_info);
 
        mutex_lock(&fs_info->balance_mutex);
+       if (ret == -ECANCELED && atomic_read(&fs_info->balance_pause_req))
+               btrfs_info(fs_info, "balance: paused");
+       else if (ret == -ECANCELED && atomic_read(&fs_info->balance_cancel_req))
+               btrfs_info(fs_info, "balance: canceled");
+       else
+               btrfs_info(fs_info, "balance: ended with status: %d", ret);
+
        clear_bit(BTRFS_FS_BALANCE_RUNNING, &fs_info->flags);
 
        if (bargs) {
        clear_bit(BTRFS_FS_BALANCE_RUNNING, &fs_info->flags);
 
        if (bargs) {