diff options
author | Misono Tomohiro <misono.tomohiro@jp.fujitsu.com> | 2018-07-31 03:20:21 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-08-06 07:13:01 -0400 |
commit | 1e7e1f9e3aba00c9b9c323bfeeddafe69ff21ff6 (patch) | |
tree | cb57869516b7c2b81f599405e8c1040b86804f42 /fs/btrfs/dev-replace.c | |
parent | 85c39548199b966062578fb99d4d4ecdeae2afae (diff) |
btrfs: replace: Reset on-disk dev stats value after replace
on-disk devs stats value is updated in btrfs_run_dev_stats(),
which is called during commit transaction, if device->dev_stats_ccnt
is not zero.
Since current replace operation does not touch dev_stats_ccnt,
on-disk dev stats value is not updated. Therefore "btrfs device stats"
may return old device's value after umount/mount
(Example: See "btrfs ins dump-t -t DEV $DEV" after btrfs/100 finish).
Fix this by just incrementing dev_stats_ccnt in
btrfs_dev_replace_finishing() when replace is succeeded and this will
update the values.
Signed-off-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/dev-replace.c')
-rw-r--r-- | fs/btrfs/dev-replace.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index 5a72f9933e58..dec01970d8c5 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c | |||
@@ -672,6 +672,12 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info, | |||
672 | btrfs_rm_dev_replace_unblocked(fs_info); | 672 | btrfs_rm_dev_replace_unblocked(fs_info); |
673 | 673 | ||
674 | /* | 674 | /* |
675 | * Increment dev_stats_ccnt so that btrfs_run_dev_stats() will | ||
676 | * update on-disk dev stats value during commit transaction | ||
677 | */ | ||
678 | atomic_inc(&tgt_device->dev_stats_ccnt); | ||
679 | |||
680 | /* | ||
675 | * this is again a consistent state where no dev_replace procedure | 681 | * this is again a consistent state where no dev_replace procedure |
676 | * is running, the target device is part of the filesystem, the | 682 | * is running, the target device is part of the filesystem, the |
677 | * source device is not part of the filesystem anymore and its 1st | 683 | * source device is not part of the filesystem anymore and its 1st |