John Garry
0f225f8787
null_blk: Delete nullb.{queue_depth, nr_queues}
...
Since commit 8b631f9cf0 ("null_blk: remove the bio based I/O path"),
struct nullb members queue_depth and nr_queues are only ever written, so
delete them.
With that, null_exit_hctx() can also be deleted.
Signed-off-by: John Garry <john.g.garry@oracle.com >
Link: https://lore.kernel.org/r/20240222083420.6026-1-john.g.garry@oracle.com
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-22 10:08:47 -07:00
Christoph Hellwig
4068550870
pktcdvd: set queue limits at disk allocation time
...
Remove pkt_init_queue and just pass the two parameters directly to
blk_alloc_disk.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240222073647.3776769-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-22 10:08:20 -07:00
Christoph Hellwig
6f420d6a2d
pktcdvd: stop setting q->queuedata
...
The two users can get the private data from the gendisk with one less
pointer dereference, and we can drop the useless q parameter from
pkt_make_request_write.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240222073647.3776769-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-22 10:08:20 -07:00
Christoph Hellwig
a3911966bd
block: fix virt_boundary handling in blk_validate_limits
...
Don't set the default max_segment_size value when a virt_boundary is
used.
Fixes: d690cb8ae1 ("block: add an API to atomically update queue limits")
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be >
Signed-off-by: Christoph Hellwig <hch@lst.de >
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be >
Link: https://lore.kernel.org/r/20240221125010.3609444-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-21 07:21:28 -07:00
Christoph Hellwig
e440626b1c
null_blk: pass queue_limits to blk_mq_alloc_disk
...
Pass the queue limits directly to blk_mq_alloc_disk instead of
setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Tested-by: Damien Le Moal <dlemoal@kernel.org >
Link: https://lore.kernel.org/r/20240220093248.3290292-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-20 06:21:27 -07:00
Christoph Hellwig
0a39e550c1
null_blk: remove null_gendisk_register
...
null_gendisk_register isn't a very useful abstraction given that it
doesn't even allocate the gendisk. Merge it into the only caller
instead.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Tested-by: Damien Le Moal <dlemoal@kernel.org >
Link: https://lore.kernel.org/r/20240220093248.3290292-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-20 06:21:27 -07:00
Christoph Hellwig
72ca28765f
null_blk: refactor tag_set setup
...
Move the tagset initialization out of null_add_dev into a new
null_setup_tagset helper, and move the shared vs local differences
out of null_init_tag_set into the callers.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Tested-by: Damien Le Moal <dlemoal@kernel.org >
Link: https://lore.kernel.org/r/20240220093248.3290292-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-20 06:21:27 -07:00
Christoph Hellwig
e32b085536
null_blk: initialize the tag_set timeout in null_init_tag_set
...
Otherwise it will be reset to the always same value when initializing a
device using the shared tag_set.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Tested-by: Damien Le Moal <dlemoal@kernel.org >
Link: https://lore.kernel.org/r/20240220093248.3290292-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-20 06:21:27 -07:00
Christoph Hellwig
8b631f9cf0
null_blk: remove the bio based I/O path
...
The bio based I/O path complicates null_blk and also make various
data structures, including the per-command one way bigger than
required for the main request based interface. As the bio-based
path is mostly used by stacking drivers and simple memory based
drivers, and brd is a good example driver for the latter there is
no need to have a bio based path in null_blk. Remove the path
to simplify the driver and make future block layer API changes
simpler by not having to deal with the complex two API setup in
null_blk.
Note that the queue_mode field in struct nullb_device is kept as
that is simpler than having two different places to check the
value and fully open coding the debugfs helpers as the existing
ones won't work without a named struct member.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com >
Tested-by: Damien Le Moal <dlemoal@kernel.org >
Link: https://lore.kernel.org/r/20240220093248.3290292-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-20 06:21:27 -07:00
Christoph Hellwig
616f876617
mmc: pass queue_limits to blk_mq_alloc_disk
...
Pass the queue limit set at initialization time directly to
blk_mq_alloc_disk instead of updating it right after the allocation.
This requires refactoring the code a bit so that what was mmc_setup_queue
before also allocates the gendisk now and actually sets all limits.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Acked-by: Ulf Hansson <ulf.hansson@linaro.org >
Link: https://lore.kernel.org/r/20240215070300.2200308-18-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 17:00:29 -07:00
Christoph Hellwig
494ea040bc
ublk: pass queue_limits to blk_mq_alloc_disk
...
Pass the limits ublk imposes directly to blk_mq_alloc_disk instead of
setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240215070300.2200308-17-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:32 -07:00
Christoph Hellwig
066be10aef
scm_blk: pass queue_limits to blk_mq_alloc_disk
...
Pass the few limits scm_block imposes directly to blk_mq_alloc_disk
instead of setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240215070300.2200308-16-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:32 -07:00
Christoph Hellwig
21b700c081
ubiblock: pass queue_limits to blk_mq_alloc_disk
...
Pass the few limits ubiblock imposes directly to blk_mq_alloc_disk
instead of setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com >
Link: https://lore.kernel.org/r/20240215070300.2200308-15-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:32 -07:00
Christoph Hellwig
3ec44e52bf
mtd_blkdevs: pass queue_limits to blk_mq_alloc_disk
...
Pass the few limits mtd_blkdevs imposes directly to blk_mq_alloc_disk
instead of setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240215070300.2200308-14-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:32 -07:00
Christoph Hellwig
9f633ecd43
mspro_block: pass queue_limits to blk_mq_alloc_disk
...
Pass the few limits mspro_block imposes directly to blk_mq_alloc_disk
instead of setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240215070300.2200308-13-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:31 -07:00
Christoph Hellwig
f93b43ae3f
ms_block: pass queue_limits to blk_mq_alloc_disk
...
Pass the few limits ms_block imposes directly to blk_mq_alloc_disk
instead of setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240215070300.2200308-12-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:31 -07:00
Christoph Hellwig
a339cf2bbf
gdrom: pass queue_limits to blk_mq_alloc_disk
...
Pass the few limits gdrom imposes directly to blk_mq_alloc_disk instead
of setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240215070300.2200308-11-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:31 -07:00
Christoph Hellwig
d0fa9a8b0a
sunvdc: pass queue_limits to blk_mq_alloc_disk
...
Pass the few limits sunvdc imposes directly to blk_mq_alloc_disk instead
of setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240215070300.2200308-10-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:31 -07:00
Christoph Hellwig
e6ed9892f1
rnbd-clt: pass queue_limits to blk_mq_alloc_disk
...
Pass the limits rnbd-clt imposes directly to blk_mq_alloc_disk instead
of setting them one at a time.
While at it don't set an explicit number of discard segments, as 1 is
the default (which most drivers rely on).
Signed-off-by: Christoph Hellwig <hch@lst.de >
Acked-by: Jack Wang <jinpu.wang@ionos.com >
Link: https://lore.kernel.org/r/20240215070300.2200308-9-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:31 -07:00
Christoph Hellwig
24f30b770c
rbd: pass queue_limits to blk_mq_alloc_disk
...
Pass the limits rbd imposes directly to blk_mq_alloc_disk instead
of setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240215070300.2200308-8-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:31 -07:00
Christoph Hellwig
a7f18b74db
ps3disk: pass queue_limits to blk_mq_alloc_disk
...
Pass the few limits ps3disk imposes directly to blk_mq_alloc_disk instead
of setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240215070300.2200308-7-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:31 -07:00
Christoph Hellwig
9a0d497028
nbd: pass queue_limits to blk_mq_alloc_disk
...
Pass the few limits nbd imposes directly to blk_mq_alloc_disk instead
of setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240215070300.2200308-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:31 -07:00
Christoph Hellwig
68c3135fb5
mtip: pass queue_limits to blk_mq_alloc_disk
...
Pass the few limits mtip imposes directly to blk_mq_alloc_disk instead
of setting them one at a time and drop the pointless setting of a io_min
that is equal to the physical block size.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240215070300.2200308-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:31 -07:00
Christoph Hellwig
48bc8c7ba6
floppy: pass queue_limits to blk_mq_alloc_disk
...
Pass the few limits floppy imposes directly to blk_mq_alloc_disk instead
of setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Denis Efremov <efremov@linux.com >
Link: https://lore.kernel.org/r/20240215070300.2200308-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:31 -07:00
Christoph Hellwig
9999200f58
aoe: pass queue_limits to blk_mq_alloc_disk
...
Pass the few limits aoe imposes directly to blk_mq_alloc_disk instead
of setting them one at a time and improve the way the default
max_hw_sectors is initialized while we're at it.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240215070300.2200308-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:31 -07:00
Christoph Hellwig
5d6789ce33
ubd: pass queue_limits to blk_mq_alloc_disk
...
Pass the few limits ubd imposes directly to blk_mq_alloc_disk instead
of setting them one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Link: https://lore.kernel.org/r/20240215070300.2200308-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:59:31 -07:00
Christoph Hellwig
af190c53c9
dcssblk: pass queue_limits to blk_mq_alloc_disk
...
Pass the queue limits directly to blk_alloc_disk instead of setting them
one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Dan Williams <dan.j.williams@intel.com >
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Link: https://lore.kernel.org/r/20240215071055.2201424-10-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:58:24 -07:00
Christoph Hellwig
c3d9c3031e
pmem: pass queue_limits to blk_mq_alloc_disk
...
Pass the queue limits directly to blk_alloc_disk instead of setting them
one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Dave Jiang <dave.jiang@intel.com >
Reviewed-by: Dan Williams <dan.j.williams@intel.com >
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Link: https://lore.kernel.org/r/20240215071055.2201424-9-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:58:24 -07:00
Christoph Hellwig
77c059222c
btt: pass queue_limits to blk_mq_alloc_disk
...
Pass the queue limits directly to blk_alloc_disk instead of setting them
one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Dave Jiang <dave.jiang@intel.com >
Reviewed-by: Dan Williams <dan.j.williams@intel.com >
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Link: https://lore.kernel.org/r/20240215071055.2201424-8-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:58:24 -07:00
Christoph Hellwig
b3f0846e72
bcache: pass queue_limits to blk_mq_alloc_disk
...
Pass the queue limits directly to blk_alloc_disk instead of setting them
one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Dan Williams <dan.j.williams@intel.com >
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Link: https://lore.kernel.org/r/20240215071055.2201424-7-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:58:24 -07:00
Christoph Hellwig
4190b3f291
zram: pass queue_limits to blk_mq_alloc_disk
...
Pass the queue limits directly to blk_alloc_disk instead of setting them
one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org >
Reviewed-by: Dan Williams <dan.j.williams@intel.com >
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Link: https://lore.kernel.org/r/20240215071055.2201424-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:58:24 -07:00
Christoph Hellwig
cc7f05c7ec
n64cart: pass queue_limits to blk_mq_alloc_disk
...
Pass the queue limits directly to blk_alloc_disk instead of setting them
one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Dan Williams <dan.j.williams@intel.com >
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Link: https://lore.kernel.org/r/20240215071055.2201424-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:58:24 -07:00
Christoph Hellwig
b5baaba4ce
brd: pass queue_limits to blk_mq_alloc_disk
...
Pass the queue limits directly to blk_alloc_disk instead of setting them
one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Dan Williams <dan.j.williams@intel.com >
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Link: https://lore.kernel.org/r/20240215071055.2201424-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:58:23 -07:00
Christoph Hellwig
2cfe0104bc
nfblock: pass queue_limits to blk_mq_alloc_disk
...
Pass the queue limits directly to blk_alloc_disk instead of setting them
one at a time.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Dan Williams <dan.j.williams@intel.com >
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Link: https://lore.kernel.org/r/20240215071055.2201424-3-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:58:23 -07:00
Christoph Hellwig
74fa8f9c55
block: pass a queue_limits argument to blk_alloc_disk
...
Pass a queue_limits to blk_alloc_disk and apply it if non-NULL. This
will allow allocating queues with valid queue limits instead of setting
the values one at a time later.
Also change blk_alloc_disk to return an ERR_PTR instead of just NULL
which can't distinguish errors.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Dan Williams <dan.j.williams@intel.com >
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Link: https://lore.kernel.org/r/20240215071055.2201424-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-19 16:58:23 -07:00
Navid Emamdoost
31edf4bbe0
nbd: null check for nla_nest_start
...
nla_nest_start() may fail and return NULL. Insert a check and set errno
based on other call sites within the same source code.
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com >
Reviewed-by: Michal Kubecek <mkubecek@suse.cz >
Fixes: 47d902b90a ("nbd: add a status netlink command")
Signed-off-by: Kees Cook <keescook@chromium.org >
Link: https://lore.kernel.org/r/20240218042534.it.206-kees@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-18 06:01:18 -07:00
Jens Axboe
d69591caec
Merge tag 'md-6.9-20240216' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into for-6.9/block
...
Pull MD changes from Song:
"1. Cleanup redundant checks, by Yu Kuai.
2. Remove deprecated headers, by Marc Zyngier and Song Liu.
3. Concurrency fixes, by Li Lingfeng.
4. Memory leak fix, by Li Nan."
* tag 'md-6.9-20240216' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md :
md: fix kmemleak of rdev->serial
md/multipath: Remove md-multipath.h
md/linear: Get rid of md-linear.h
md: use RCU lock to protect traversal in md_spares_need_change()
md: get rdev->mddev with READ_ONCE()
md: remove redundant md_wakeup_thread()
md: remove redundant check of 'mddev->sync_thread'
2024-02-16 15:43:58 -07:00
Christoph Hellwig
473516b361
loop: use the atomic queue limits update API
...
Pass the default limits to blk_mq_alloc_disk and then use the
queue_limits_{start,commit}_update API to change the limits in an
atomic way on existing loop gendisks.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Keith Busch <kbusch@kernel.org >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Ming Lei <ming.lei@redhat.com >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20240213073425.1621680-16-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-13 08:56:59 -07:00
Christoph Hellwig
02aed4a1f2
loop: pass queue_limits to blk_mq_alloc_disk
...
Pass the max_hw_sector limit loop sets at initialization time directly to
blk_mq_alloc_disk instead of updating it right after the allocation.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Keith Busch <kbusch@kernel.org >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Ming Lei <ming.lei@redhat.com >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20240213073425.1621680-15-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-13 08:56:59 -07:00
Christoph Hellwig
65bdd16f8c
loop: cleanup loop_config_discard
...
Initialize the local variables for the discard max sectors and
granularity to zero as a sensible default, and then merge the
calls assigning them to the queue limits.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Keith Busch <kbusch@kernel.org >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Ming Lei <ming.lei@redhat.com >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20240213073425.1621680-14-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-13 08:56:59 -07:00
Christoph Hellwig
8b83725656
virtio_blk: pass queue_limits to blk_mq_alloc_disk
...
Call virtblk_read_limits and most of virtblk_probe_zoned_device before
allocating the gendisk and thus request_queue and make them read into
a queue_limits structure instead. Pass this initialized queue_limits
to blk_mq_alloc_disk to set the queue up with the right parameters
from the start and only leave a few final touches for zoned devices
to be done just before adding the disk.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Keith Busch <kbusch@kernel.org >
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Ming Lei <ming.lei@redhat.com >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20240213073425.1621680-13-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-13 08:56:59 -07:00
Christoph Hellwig
718628adfc
virtio_blk: split virtblk_probe
...
Split out a virtblk_read_limits helper that just reads the various
queue limits to separate it from the higher level probing logic.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Keith Busch <kbusch@kernel.org >
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Ming Lei <ming.lei@redhat.com >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20240213073425.1621680-12-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-13 08:56:59 -07:00
Christoph Hellwig
27e32cd23f
block: pass a queue_limits argument to blk_mq_alloc_disk
...
Pass a queue_limits to blk_mq_alloc_disk and apply it if non-NULL. This
will allow allocating queues with valid queue limits instead of setting
the values one at a time later.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Keith Busch <kbusch@kernel.org >
Reviewed-by: John Garry <john.g.garry@oracle.com >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Ming Lei <ming.lei@redhat.com >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20240213073425.1621680-11-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-13 08:56:59 -07:00
Christoph Hellwig
9ac4dd8c47
block: pass a queue_limits argument to blk_mq_init_queue
...
Pass a queue_limits to blk_mq_init_queue and apply it if non-NULL. This
will allow allocating queues with valid queue limits instead of setting
the values one at a time later.
Also rename the function to blk_mq_alloc_queue as that is a much better
name for a function that allocates a queue and always pass the queuedata
argument instead of having a separate version for the extra argument.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Keith Busch <kbusch@kernel.org >
Reviewed-by: John Garry <john.g.garry@oracle.com >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Ming Lei <ming.lei@redhat.com >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20240213073425.1621680-10-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-13 08:56:59 -07:00
Christoph Hellwig
ad751ba1f8
block: pass a queue_limits argument to blk_alloc_queue
...
Pass a queue_limits to blk_alloc_queue and apply it after validating and
capping the values using blk_validate_limits. This will allow allocating
queues with valid queue limits instead of setting the values one at a
time later.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20240213073425.1621680-9-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-13 08:56:59 -07:00
Christoph Hellwig
ff956a3be9
block: use queue_limits_commit_update in queue_discard_max_store
...
Convert queue_discard_max_store to use queue_limits_commit_update to
check and update the max_discard_sectors limit and freeze the queue
before doing so to ensure we don't have requests in flight while
changing the limits.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Keith Busch <kbusch@kernel.org >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Ming Lei <ming.lei@redhat.com >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20240213073425.1621680-8-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-13 08:56:59 -07:00
Christoph Hellwig
4f563a6473
block: add a max_user_discard_sectors queue limit
...
Add a new max_user_discard_sectors limit that mirrors max_user_sectors
and stores the value that the user manually set. This now allows
updates of the max_hw_discard_sectors to not worry about the user
limit.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Keith Busch <kbusch@kernel.org >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Ming Lei <ming.lei@redhat.com >
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20240213073425.1621680-7-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-13 08:56:59 -07:00
Christoph Hellwig
0327ca9d53
block: use queue_limits_commit_update in queue_max_sectors_store
...
Convert queue_max_sectors_store to use queue_limits_commit_update to
check and update the max_sectors limit and freeze the queue before
doing so to ensure we don't have requests in flight while changing
the limits.
Note that this removes the previously held queue_lock that doesn't
protect against any other reader or writer.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Keith Busch <kbusch@kernel.org >
Reviewed-by: John Garry <john.g.garry@oracle.com >
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com >
Reviewed-by: Ming Lei <ming.lei@redhat.com >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20240213073425.1621680-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-13 08:56:59 -07:00
Christoph Hellwig
d690cb8ae1
block: add an API to atomically update queue limits
...
Add a new queue_limits_{start,commit}_update pair of functions that
allows taking an atomic snapshot of queue limits, update it, and
commit it if it passes validity checking. Also use the low-level
validation helper to implement blk_set_default_limits instead of
duplicating the initialization.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20240213073425.1621680-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-13 08:56:59 -07:00
Christoph Hellwig
c490f226a0
block: decouple blk_set_stacking_limits from blk_set_default_limits
...
blk_set_stacking_limits uses very little from blk_set_default_limits.
Open code these initializations in preparation for rewriting
blk_set_default_limits.
Signed-off-by: Christoph Hellwig <hch@lst.de >
Reviewed-by: Damien Le Moal <dlemoal@kernel.org >
Reviewed-by: Hannes Reinecke <hare@suse.de >
Link: https://lore.kernel.org/r/20240213073425.1621680-4-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk >
2024-02-13 08:56:59 -07:00