1
0
Fork 0
alistair23-linux/drivers/block
Damien Le Moal bf50545696 block: Introduce blk_revalidate_disk_zones()
Drivers exposing zoned block devices have to initialize and maintain
correctness (i.e. revalidate) of the device zone bitmaps attached to
the device request queue (seq_zones_bitmap and seq_zones_wlock).

To simplify coding this, introduce a generic helper function
blk_revalidate_disk_zones() suitable for most (and likely all) cases.
This new function always update the seq_zones_bitmap and seq_zones_wlock
bitmaps as well as the queue nr_zones field when called for a disk
using a request based queue. For a disk using a BIO based queue, only
the number of zones is updated since these queues do not have
schedulers and so do not need the zone bitmaps.

With this change, the zone bitmap initialization code in sd_zbc.c can be
replaced with a call to this function in sd_zbc_read_zones(), which is
called from the disk revalidate block operation method.

A call to blk_revalidate_disk_zones() is also added to the null_blk
driver for devices created with the zoned mode enabled.

Finally, to ensure that zoned devices created with dm-linear or
dm-flakey expose the correct number of zones through sysfs, a call to
blk_revalidate_disk_zones() is added to dm_table_set_restrictions().

The zone bitmaps allocated and initialized with
blk_revalidate_disk_zones() are freed automatically from
__blk_release_queue() using the block internal function
blk_queue_free_zone_bitmaps().

Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2018-10-25 11:17:40 -06:00
..
aoe aoe: convert aoeblk to blk-mq 2018-10-14 12:47:52 -06:00
drbd drivers/block: remove redundant 'default n' from Kconfig-s 2018-10-10 14:11:08 -06:00
mtip32xx mtip32xx: fully switch to the generic DMA API 2018-10-18 15:14:50 -06:00
paride paride: convert pf to blk-mq 2018-10-15 20:08:15 -06:00
rsxx pci-v4.20-changes 2018-10-25 06:50:48 -07:00
xen-blkback xen/blkback: remove unused pers_gnts_lock from struct xen_blkif_ring 2018-08-27 12:12:04 -04:00
zram drivers/block: remove redundant 'default n' from Kconfig-s 2018-10-10 14:11:08 -06:00
Kconfig drivers/block: Remove DAC960 driver 2018-10-17 09:42:30 -06:00
Makefile drivers/block: Remove DAC960 driver 2018-10-17 09:42:30 -06:00
amiflop.c amiflop: convert to blk-mq 2018-10-16 09:49:52 -06:00
ataflop.c ataflop: convert to blk-mq 2018-10-16 09:50:09 -06:00
brd.c block: make bdev_ops->rw_page() take a REQ_OP instead of bool 2018-07-18 08:44:14 -06:00
cryptoloop.c block: cryptoloop - Fix build warning 2017-09-26 07:41:22 -06:00
floppy.c floppy: convert to blk-mq 2018-10-16 09:50:14 -06:00
loop.c blkcg: remove bio->bi_css and instead use bio->bi_blkg 2018-09-21 20:29:13 -06:00
loop.h loop: remember whether sysfs_create_group() was done 2018-05-07 15:26:36 -06:00
nbd.c nbd: don't allow invalid blocksize settings 2018-09-04 11:54:58 -06:00
null_blk.h block: add a report_zones method 2018-10-25 11:17:40 -06:00
null_blk_main.c block: Introduce blk_revalidate_disk_zones() 2018-10-25 11:17:40 -06:00
null_blk_zoned.c block: add a report_zones method 2018-10-25 11:17:40 -06:00
pktcdvd.c pktcdvd: fix fall-through annotation 2018-10-02 08:36:58 -06:00
ps3disk.c ps3disk: convert to blk-mq 2018-10-15 20:07:56 -06:00
ps3vram.c block: genhd: add 'groups' argument to device_add_disk 2018-09-28 08:30:28 -06:00
rbd.c rbd: support cloning across namespaces 2018-09-06 16:18:04 +02:00
rbd_types.h rbd: RBD_V{1,2}_DATA_FORMAT macros 2017-02-20 12:16:15 +01:00
skd_main.c skd: fix unchecked return values 2018-10-25 11:17:39 -06:00
skd_s1120.h skd: Use __packed only when needed 2017-08-18 08:45:29 -06:00
sunvdc.c for-4.20/block-20181021 2018-10-22 17:46:08 +01:00
swim.c swim: convert to blk-mq 2018-10-16 09:49:18 -06:00
swim3.c swim3: convert to blk-mq 2018-10-16 09:49:36 -06:00
swim_asm.S
sx8.c sx8: switch to the generic DMA API 2018-10-18 15:14:45 -06:00
umem.c umem: switch to the generic DMA API 2018-10-18 15:14:47 -06:00
umem.h
virtio_blk.c virtio-blk: modernize sysfs attribute creation 2018-09-28 08:30:33 -06:00
xen-blkfront.c xen/blkfront: avoid NULL blkfront_info dereference on device removal 2018-10-25 11:17:39 -06:00
xsysace.c xsysace: convert to blk-mq 2018-10-15 20:08:24 -06:00
z2ram.c z2ram: convert to blk-mq 2018-10-16 09:50:43 -06:00