Commit 80ad663d authored by Tang Junhui's avatar Tang Junhui Committed by Khalid Elmously

bcache: fix incorrect sysfs output value of strip size

BugLink: https://bugs.launchpad.net/bugs/1784665

Stripe size is shown as zero when no strip in back end device:
[root@ceph132 ~]# cat /sys/block/sdd/bcache/stripe_size
0.0k

Actually it should be 1T Bytes (1 << 31 sectors), but in sysfs
interface, stripe_size was changed from sectors to bytes, and move
9 bits left, so the 32 bits variable overflows.

This patch change the variable to a 64 bits type before moving bits.
Signed-off-by: default avatarTang Junhui <tang.junhui@zte.com.cn>
Reviewed-by: default avatarMichael Lyle <mlyle@lyle.org>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
(cherry picked from commit 688892b3)
Signed-off-by: default avatarAndrea Righi <andrea.righi@canonical.com>
Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
Acked-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 43711a47
...@@ -169,7 +169,7 @@ SHOW(__bch_cached_dev) ...@@ -169,7 +169,7 @@ SHOW(__bch_cached_dev)
sysfs_hprint(dirty_data, sysfs_hprint(dirty_data,
bcache_dev_sectors_dirty(&dc->disk) << 9); bcache_dev_sectors_dirty(&dc->disk) << 9);
sysfs_hprint(stripe_size, dc->disk.stripe_size << 9); sysfs_hprint(stripe_size, ((uint64_t)dc->disk.stripe_size) << 9);
var_printf(partial_stripes_expensive, "%u"); var_printf(partial_stripes_expensive, "%u");
var_hprint(sequential_cutoff); var_hprint(sequential_cutoff);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment