OSDN Git Service

bcache: fix writeback target calc on large devices
authorMichael Lyle <mlyle@lyle.org>
Mon, 8 Jan 2018 20:21:30 +0000 (12:21 -0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 8 Jan 2018 20:29:00 +0000 (13:29 -0700)
commit616486ab52ab7f9739b066d958bdd20e65aefd74
tree9062523588ca23095a25a7d216d7ca7d8f7b055c
parent5138ac6748e381501894976f995fb7d1a63f80f4
bcache: fix writeback target calc on large devices

Bcache needs to scale the dirty data in the cache over the multiple
backing disks in order to calculate writeback rates for each.
The previous code did this by multiplying the target number of dirty
sectors by the backing device size, and expected it to fit into a
uint64_t; this blows up on relatively small backing devices.

The new approach figures out the bdev's share in 16384ths of the overall
cached data.  This is chosen to cope well when bdevs drastically vary in
size and to ensure that bcache can cross the petabyte boundary for each
backing device.

This has been improved based on Tang Junhui's feedback to ensure that
every device gets a share of dirty data, no matter how small it is
compared to the total backing pool.

The existing mechanism is very limited; this is purely a bug fix to
remove limits on volume size.  However, there still needs to be change
to make this "fair" over many volumes where some are idle.

Reported-by: Jack Douglas <jack@douglastechnology.co.uk>
Signed-off-by: Michael Lyle <mlyle@lyle.org>
Reviewed-by: Tang Junhui <tang.junhui@zte.com.cn>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/md/bcache/writeback.c
drivers/md/bcache/writeback.h