block: remove the nr_sects field in struct hd_struct
authorChristoph Hellwig <hch@lst.de>
Thu, 26 Nov 2020 17:43:37 +0000 (18:43 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 1 Dec 2020 21:53:40 +0000 (14:53 -0700)
commita782483cc1f875355690625d8253a232f2581418
tree492d3bf67cdd2535afd826dde93aa35dcfb42180
parente6cb53827ed60019bbbc5cf189dd204b3b0e8121
block: remove the nr_sects field in struct hd_struct

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.

Additionally the field in hd_struct did not use proper serialization,
possibly allowing for torn writes.  By only using the block_device field
this problem also gets fixed.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Acked-by: Coly Li <colyli@suse.de> [bcache]
Acked-by: Chao Yu <yuchao0@huawei.com> [f2fs]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
16 files changed:
block/bio.c
block/blk-core.c
block/blk.h
block/genhd.c
block/partitions/core.c
drivers/block/loop.c
drivers/block/nbd.c
drivers/block/xen-blkback/common.h
drivers/md/bcache/super.c
drivers/s390/block/dasd_ioctl.c
drivers/target/target_core_pscsi.c
fs/block_dev.c
fs/f2fs/super.c
fs/pstore/blk.c
include/linux/genhd.h
kernel/trace/blktrace.c