diff options
author | Stefan Behrens <sbehrens@giantdisaster.de> | 2013-10-11 15:20:42 +0200 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-11-11 22:01:09 -0500 |
commit | 27087f370174ebb298cdf6dcb36b1e4dcbe34e93 (patch) | |
tree | df09525ed37796cda82c6b6df83475557405444c /fs/ncpfs/inode.c | |
parent | 30d133fc221a0ec50030c33aa7bf6931503894c7 (diff) |
Btrfs: init device stats for new devices
Device stats are only initialized (read from tree items) on mount.
Trying to read device stats after adding or replacing new devices will
return errors.
btrfs_init_new_device() and btrfs_init_dev_replace_tgtdev() are the two
functions that allocate and initialize new btrfs_device structures after
a filesystem is mounted. They set the device stats to zero by using
kzalloc() which is correct for new devices. The only missing thing was
to declare these stats as being valid (device->dev_stats_valid = 1) and
this patch adds this missing code.
This is the reproducer:
TEST_DEV1=/dev/sdzzzzz1
TEST_DEV2=/dev/sdzzzzz2
TEST_DEV3=/dev/sdzzzzz3
TEST_MNT=/mnt
mkfs.btrfs $TEST_DEV1
mount $TEST_DEV1 $TEST_MNT
btrfs device add $TEST_DEV2 $TEST_MNT
btrfs device stat $TEST_MNT
btrfs replace start -B $TEST_DEV2 $TEST_DEV3 $TEST_MNT
btrfs device stat $TEST_MNT
umount $TEST_MNT
Reported-by: Ondrej Kunc <kunc88@gmail.com>
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/ncpfs/inode.c')
0 files changed, 0 insertions, 0 deletions