]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
btrfs: replace: Reset on-disk dev stats value after replace
authorMisono Tomohiro <misono.tomohiro@jp.fujitsu.com>
Tue, 31 Jul 2018 07:20:21 +0000 (16:20 +0900)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:46:49 +0000 (19:46 -0600)
commit1b10d9e8e8ea370b71e3f4610dc5adc847595e0b
tree09a630fde5393b7a83a38d0426490173123c7ac7
parent0ede0a53e01b1723012344150c2e711d9ff4bfa7
btrfs: replace: Reset on-disk dev stats value after replace

BugLink: https://bugs.launchpad.net/bugs/1835972
[ Upstream commit 1e7e1f9e3aba00c9b9c323bfeeddafe69ff21ff6 ]

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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/btrfs/dev-replace.c