[PATCH 30/45] block: remove the nr_sects field in struct hd_struct
Coly Li
colyli at suse.de
Tue Nov 24 08:34:11 EST 2020
On 11/24/20 9:27 PM, Christoph Hellwig wrote:
> Now that the hd_struct always has a block device attached to it, there is
> no need for having two size field that just get out of sync.
>
> Additional the field in hd_struct did not use proper serializiation,
> possibly allowing for torn writes. By only using the block_device field
> this problem also gets fixed.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> Reviewed-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
For the bcache part, Acked-by: Coly Li <colyli at suse.de>
Thanks.
Coly Li
> ---
> block/bio.c | 4 +-
> block/blk-core.c | 2 +-
> block/blk.h | 53 ----------------------
> block/genhd.c | 55 +++++++++++-----------
> block/partitions/core.c | 17 ++++---
> drivers/block/loop.c | 1 -
> drivers/block/nbd.c | 2 +-
> drivers/block/xen-blkback/common.h | 4 +-
> drivers/md/bcache/super.c | 2 +-
> drivers/s390/block/dasd_ioctl.c | 4 +-
> drivers/target/target_core_pscsi.c | 7 +--
> fs/block_dev.c | 73 +-----------------------------
> fs/f2fs/super.c | 2 +-
> fs/pstore/blk.c | 2 +-
> include/linux/genhd.h | 29 +++---------
> kernel/trace/blktrace.c | 2 +-
> 16 files changed, 60 insertions(+), 199 deletions(-)
>
[snipped]
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index c55d3c58a7ef55..04fa40868fbe10 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -1408,7 +1408,7 @@ static int cached_dev_init(struct cached_dev *dc, unsigned int block_size)
> q->limits.raid_partial_stripes_expensive;
>
> ret = bcache_device_init(&dc->disk, block_size,
> - dc->bdev->bd_part->nr_sects - dc->sb.data_offset,
> + bdev_nr_sectors(dc->bdev) - dc->sb.data_offset,
> dc->bdev, &bcache_cached_ops);
> if (ret)
> return ret;
[snipped]
More information about the linux-mtd
mailing list