* pass queue_limits to blk_alloc_disk for simple drivers
@ 2024-02-15 7:10 Christoph Hellwig
2024-02-15 7:10 ` [PATCH 1/9] block: pass a queue_limits argument to blk_alloc_disk Christoph Hellwig
` (11 more replies)
0 siblings, 12 replies; 20+ messages in thread
From: Christoph Hellwig @ 2024-02-15 7:10 UTC (permalink / raw)
To: Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
Hi Jens,
this series converts all "simple" bio based drivers that don't have
complex internal layering or other oddities to pass the queue_limits to
blk_mq_alloc_disk. None of these drivers updates the limits at runtime.
Diffstat:
arch/m68k/emu/nfblock.c | 10 ++++---
arch/xtensa/platforms/iss/simdisk.c | 8 +++--
block/genhd.c | 11 ++++---
drivers/block/brd.c | 26 +++++++++---------
drivers/block/drbd/drbd_main.c | 6 ++--
drivers/block/n64cart.c | 12 +++++---
drivers/block/null_blk/main.c | 7 ++--
drivers/block/pktcdvd.c | 7 ++--
drivers/block/ps3vram.c | 6 ++--
drivers/block/zram/zram_drv.c | 51 +++++++++++++++++-------------------
drivers/md/bcache/super.c | 48 +++++++++++++++++----------------
drivers/md/dm.c | 4 +-
drivers/md/md.c | 7 ++--
drivers/nvdimm/btt.c | 14 +++++----
drivers/nvdimm/pmem.c | 14 +++++----
drivers/nvme/host/multipath.c | 6 ++--
drivers/s390/block/dcssblk.c | 10 ++++---
include/linux/blkdev.h | 10 ++++---
18 files changed, 143 insertions(+), 114 deletions(-)
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 1/9] block: pass a queue_limits argument to blk_alloc_disk
2024-02-15 7:10 pass queue_limits to blk_alloc_disk for simple drivers Christoph Hellwig
@ 2024-02-15 7:10 ` Christoph Hellwig
2024-02-15 7:10 ` [PATCH 2/9] nfblock: pass queue_limits to blk_mq_alloc_disk Christoph Hellwig
` (10 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Christoph Hellwig @ 2024-02-15 7:10 UTC (permalink / raw)
To: Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
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>
---
arch/m68k/emu/nfblock.c | 6 ++++--
arch/xtensa/platforms/iss/simdisk.c | 8 +++++---
block/genhd.c | 11 ++++++-----
drivers/block/brd.c | 7 ++++---
drivers/block/drbd/drbd_main.c | 6 ++++--
drivers/block/n64cart.c | 6 ++++--
drivers/block/null_blk/main.c | 7 ++++---
drivers/block/pktcdvd.c | 7 ++++---
drivers/block/ps3vram.c | 6 +++---
drivers/block/zram/zram_drv.c | 6 +++---
drivers/md/bcache/super.c | 4 ++--
drivers/md/dm.c | 4 ++--
drivers/md/md.c | 7 ++++---
drivers/nvdimm/btt.c | 8 ++++----
drivers/nvdimm/pmem.c | 6 +++---
drivers/nvme/host/multipath.c | 6 +++---
drivers/s390/block/dcssblk.c | 6 +++---
include/linux/blkdev.h | 10 +++++++---
18 files changed, 69 insertions(+), 52 deletions(-)
diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c
index a708fbd5a844f8..539ff56b6968d0 100644
--- a/arch/m68k/emu/nfblock.c
+++ b/arch/m68k/emu/nfblock.c
@@ -117,9 +117,11 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
dev->bsize = bsize;
dev->bshift = ffs(bsize) - 10;
- dev->disk = blk_alloc_disk(NUMA_NO_NODE);
- if (!dev->disk)
+ dev->disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ if (IS_ERR(dev->disk)) {
+ err = PTR_ERR(dev->disk);
goto free_dev;
+ }
dev->disk->major = major_num;
dev->disk->first_minor = dev_id * 16;
diff --git a/arch/xtensa/platforms/iss/simdisk.c b/arch/xtensa/platforms/iss/simdisk.c
index 178cf96ca10acb..defc67909a9c74 100644
--- a/arch/xtensa/platforms/iss/simdisk.c
+++ b/arch/xtensa/platforms/iss/simdisk.c
@@ -264,16 +264,18 @@ static int __init simdisk_setup(struct simdisk *dev, int which,
struct proc_dir_entry *procdir)
{
char tmp[2] = { '0' + which, 0 };
- int err = -ENOMEM;
+ int err;
dev->fd = -1;
dev->filename = NULL;
spin_lock_init(&dev->lock);
dev->users = 0;
- dev->gd = blk_alloc_disk(NUMA_NO_NODE);
- if (!dev->gd)
+ dev->gd = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ if (IS_ERR(dev->gd)) {
+ err = PTR_ERR(dev->gd);
goto out;
+ }
dev->gd->major = simdisk_major;
dev->gd->first_minor = which;
dev->gd->minors = SIMDISK_MINORS;
diff --git a/block/genhd.c b/block/genhd.c
index 7a8fd57c51f73c..84c822d989daca 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -1391,20 +1391,21 @@ struct gendisk *__alloc_disk_node(struct request_queue *q, int node_id,
return NULL;
}
-struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass)
+struct gendisk *__blk_alloc_disk(struct queue_limits *lim, int node,
+ struct lock_class_key *lkclass)
{
- struct queue_limits lim = { };
+ struct queue_limits default_lim = { };
struct request_queue *q;
struct gendisk *disk;
- q = blk_alloc_queue(&lim, node);
+ q = blk_alloc_queue(lim ? lim : &default_lim, node);
if (IS_ERR(q))
- return NULL;
+ return ERR_CAST(q);
disk = __alloc_disk_node(q, node, lkclass);
if (!disk) {
blk_put_queue(q);
- return NULL;
+ return ERR_PTR(-ENOMEM);
}
set_bit(GD_OWNS_QUEUE, &disk->state);
return disk;
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 970bd6ff38c491..689a3c0c31f8b4 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -335,10 +335,11 @@ static int brd_alloc(int i)
debugfs_create_u64(buf, 0444, brd_debugfs_dir,
&brd->brd_nr_pages);
- disk = brd->brd_disk = blk_alloc_disk(NUMA_NO_NODE);
- if (!disk)
+ disk = brd->brd_disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ if (IS_ERR(disk)) {
+ err = PTR_ERR(disk);
goto out_free_dev;
-
+ }
disk->major = RAMDISK_MAJOR;
disk->first_minor = i * max_part;
disk->minors = max_part;
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 6bc86106c7b2ab..cea1e537fd56c1 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2708,9 +2708,11 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
drbd_init_set_defaults(device);
- disk = blk_alloc_disk(NUMA_NO_NODE);
- if (!disk)
+ disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ if (IS_ERR(disk)) {
+ err = PTR_ERR(disk);
goto out_no_disk;
+ }
device->vdisk = disk;
device->rq_queue = disk->queue;
diff --git a/drivers/block/n64cart.c b/drivers/block/n64cart.c
index d914156db2d8b2..c64d7ee7a44db5 100644
--- a/drivers/block/n64cart.c
+++ b/drivers/block/n64cart.c
@@ -131,9 +131,11 @@ static int __init n64cart_probe(struct platform_device *pdev)
if (IS_ERR(reg_base))
return PTR_ERR(reg_base);
- disk = blk_alloc_disk(NUMA_NO_NODE);
- if (!disk)
+ disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ if (IS_ERR(disk)) {
+ err = PTR_ERR(disk);
goto out;
+ }
disk->first_minor = 0;
disk->flags = GENHD_FL_NO_PART;
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index eeb895ec6f34ae..baf2b228d00801 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -2154,10 +2154,11 @@ static int null_add_dev(struct nullb_device *dev)
}
nullb->q = nullb->disk->queue;
} else if (dev->queue_mode == NULL_Q_BIO) {
- rv = -ENOMEM;
- nullb->disk = blk_alloc_disk(nullb->dev->home_node);
- if (!nullb->disk)
+ nullb->disk = blk_alloc_disk(NULL, nullb->dev->home_node);
+ if (IS_ERR(nullb->disk)) {
+ rv = PTR_ERR(nullb->disk);
goto out_cleanup_queues;
+ }
nullb->q = nullb->disk->queue;
rv = init_driver_queues(nullb);
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index d56d972aadb36f..abb82926b1c935 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2673,10 +2673,11 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev)
pd->write_congestion_on = write_congestion_on;
pd->write_congestion_off = write_congestion_off;
- ret = -ENOMEM;
- disk = blk_alloc_disk(NUMA_NO_NODE);
- if (!disk)
+ disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ if (IS_ERR(disk)) {
+ ret = PTR_ERR(disk);
goto out_mem;
+ }
pd->disk = disk;
disk->major = pktdev_major;
disk->first_minor = idx;
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
index 38d42af01b2535..bdcf083b45e234 100644
--- a/drivers/block/ps3vram.c
+++ b/drivers/block/ps3vram.c
@@ -730,10 +730,10 @@ static int ps3vram_probe(struct ps3_system_bus_device *dev)
ps3vram_proc_init(dev);
- gendisk = blk_alloc_disk(NUMA_NO_NODE);
- if (!gendisk) {
+ gendisk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ if (IS_ERR(gendisk)) {
dev_err(&dev->core, "blk_alloc_disk failed\n");
- error = -ENOMEM;
+ error = PTR_ERR(gendisk);
goto out_cache_cleanup;
}
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 6772e0c654fa7f..84982221fc6620 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -2195,11 +2195,11 @@ static int zram_add(void)
#endif
/* gendisk structure */
- zram->disk = blk_alloc_disk(NUMA_NO_NODE);
- if (!zram->disk) {
+ zram->disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ if (IS_ERR(zram->disk)) {
pr_err("Error allocating disk structure for device %d\n",
device_id);
- ret = -ENOMEM;
+ ret = PTR_ERR(zram->disk);
goto out_free_idr;
}
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index dc3f50f6971417..9955ecff383966 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -935,8 +935,8 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER))
goto out_ida_remove;
- d->disk = blk_alloc_disk(NUMA_NO_NODE);
- if (!d->disk)
+ d->disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ if (IS_ERR(d->disk))
goto out_bioset_exit;
set_capacity(d->disk, sectors);
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 8dcabf84d866e6..b5e6a10b9cfde3 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -2098,8 +2098,8 @@ static struct mapped_device *alloc_dev(int minor)
* established. If request-based table is loaded: blk-mq will
* override accordingly.
*/
- md->disk = blk_alloc_disk(md->numa_node_id);
- if (!md->disk)
+ md->disk = blk_alloc_disk(NULL, md->numa_node_id);
+ if (IS_ERR(md->disk))
goto bad;
md->queue = md->disk->queue;
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 2266358d807466..e255f426bf9ced 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5770,10 +5770,11 @@ struct mddev *md_alloc(dev_t dev, char *name)
*/
mddev->hold_active = UNTIL_STOP;
- error = -ENOMEM;
- disk = blk_alloc_disk(NUMA_NO_NODE);
- if (!disk)
+ disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ if (IS_ERR(disk)) {
+ error = PTR_ERR(disk);
goto out_free_mddev;
+ }
disk->major = MAJOR(mddev->unit);
disk->first_minor = unit << shift;
diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index bb3726b622ad9f..9a0eae01d5986e 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1496,11 +1496,11 @@ static int btt_blk_init(struct btt *btt)
{
struct nd_btt *nd_btt = btt->nd_btt;
struct nd_namespace_common *ndns = nd_btt->ndns;
- int rc = -ENOMEM;
+ int rc;
- btt->btt_disk = blk_alloc_disk(NUMA_NO_NODE);
- if (!btt->btt_disk)
- return -ENOMEM;
+ btt->btt_disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ if (IS_ERR(btt->btt_disk))
+ return PTR_ERR(btt->btt_disk);
nvdimm_namespace_disk_name(ndns, btt->btt_disk->disk_name);
btt->btt_disk->first_minor = 0;
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 4e8fdcb3f1c827..3a5df8d467c507 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -497,9 +497,9 @@ static int pmem_attach_disk(struct device *dev,
return -EBUSY;
}
- disk = blk_alloc_disk(nid);
- if (!disk)
- return -ENOMEM;
+ disk = blk_alloc_disk(NULL, nid);
+ if (IS_ERR(disk))
+ return PTR_ERR(disk);
q = disk->queue;
pmem->disk = disk;
diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
index 74de1e64aeead7..dc5d0d0a82d0e2 100644
--- a/drivers/nvme/host/multipath.c
+++ b/drivers/nvme/host/multipath.c
@@ -532,9 +532,9 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head)
!nvme_is_unique_nsid(ctrl, head) || !multipath)
return 0;
- head->disk = blk_alloc_disk(ctrl->numa_node);
- if (!head->disk)
- return -ENOMEM;
+ head->disk = blk_alloc_disk(NULL, ctrl->numa_node);
+ if (IS_ERR(head->disk))
+ return PTR_ERR(head->disk);
head->disk->fops = &nvme_ns_head_ops;
head->disk->private_data = head;
sprintf(head->disk->disk_name, "nvme%dn%d",
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 4b7ecd4fd4319c..0903b432ea9740 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -629,9 +629,9 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
dev_info->dev.release = dcssblk_release_segment;
dev_info->dev.groups = dcssblk_dev_attr_groups;
INIT_LIST_HEAD(&dev_info->lh);
- dev_info->gd = blk_alloc_disk(NUMA_NO_NODE);
- if (dev_info->gd == NULL) {
- rc = -ENOMEM;
+ dev_info->gd = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ if (IS_ERR(dev_info->gd)) {
+ rc = PTR_ERR(dev_info->gd);
goto seg_list_del;
}
dev_info->gd->major = dcssblk_major;
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 45746ba73670e8..a14ea934413850 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -766,22 +766,26 @@ static inline u64 sb_bdev_nr_blocks(struct super_block *sb)
int bdev_disk_changed(struct gendisk *disk, bool invalidate);
void put_disk(struct gendisk *disk);
-struct gendisk *__blk_alloc_disk(int node, struct lock_class_key *lkclass);
+struct gendisk *__blk_alloc_disk(struct queue_limits *lim, int node,
+ struct lock_class_key *lkclass);
/**
* blk_alloc_disk - allocate a gendisk structure
+ * @lim: queue limits to be used for this disk.
* @node_id: numa node to allocate on
*
* Allocate and pre-initialize a gendisk structure for use with BIO based
* drivers.
*
+ * Returns an ERR_PTR on error, else the allocated disk.
+ *
* Context: can sleep
*/
-#define blk_alloc_disk(node_id) \
+#define blk_alloc_disk(lim, node_id) \
({ \
static struct lock_class_key __key; \
\
- __blk_alloc_disk(node_id, &__key); \
+ __blk_alloc_disk(lim, node_id, &__key); \
})
int __register_blkdev(unsigned int major, const char *name,
--
2.39.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 2/9] nfblock: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 pass queue_limits to blk_alloc_disk for simple drivers Christoph Hellwig
2024-02-15 7:10 ` [PATCH 1/9] block: pass a queue_limits argument to blk_alloc_disk Christoph Hellwig
@ 2024-02-15 7:10 ` Christoph Hellwig
2024-02-15 7:10 ` [PATCH 3/9] brd: " Christoph Hellwig
` (9 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Christoph Hellwig @ 2024-02-15 7:10 UTC (permalink / raw)
To: Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
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>
---
arch/m68k/emu/nfblock.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/m68k/emu/nfblock.c b/arch/m68k/emu/nfblock.c
index 539ff56b6968d0..642fb80c5c4e31 100644
--- a/arch/m68k/emu/nfblock.c
+++ b/arch/m68k/emu/nfblock.c
@@ -96,6 +96,9 @@ static const struct block_device_operations nfhd_ops = {
static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
{
+ struct queue_limits lim = {
+ .logical_block_size = bsize,
+ };
struct nfhd_device *dev;
int dev_id = id - NFHD_DEV_OFFSET;
int err = -ENOMEM;
@@ -117,7 +120,7 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
dev->bsize = bsize;
dev->bshift = ffs(bsize) - 10;
- dev->disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ dev->disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
if (IS_ERR(dev->disk)) {
err = PTR_ERR(dev->disk);
goto free_dev;
@@ -130,7 +133,6 @@ static int __init nfhd_init_one(int id, u32 blocks, u32 bsize)
dev->disk->private_data = dev;
sprintf(dev->disk->disk_name, "nfhd%u", dev_id);
set_capacity(dev->disk, (sector_t)blocks * (bsize / 512));
- blk_queue_logical_block_size(dev->disk->queue, bsize);
err = add_disk(dev->disk);
if (err)
goto out_cleanup_disk;
--
2.39.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 3/9] brd: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 pass queue_limits to blk_alloc_disk for simple drivers Christoph Hellwig
2024-02-15 7:10 ` [PATCH 1/9] block: pass a queue_limits argument to blk_alloc_disk Christoph Hellwig
2024-02-15 7:10 ` [PATCH 2/9] nfblock: pass queue_limits to blk_mq_alloc_disk Christoph Hellwig
@ 2024-02-15 7:10 ` Christoph Hellwig
2024-02-17 0:42 ` Chaitanya Kulkarni
2024-02-15 7:10 ` [PATCH 4/9] n64cart: " Christoph Hellwig
` (8 subsequent siblings)
11 siblings, 1 reply; 20+ messages in thread
From: Christoph Hellwig @ 2024-02-15 7:10 UTC (permalink / raw)
To: Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
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>
---
drivers/block/brd.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 689a3c0c31f8b4..e322cef6596bfa 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -318,6 +318,16 @@ static int brd_alloc(int i)
struct gendisk *disk;
char buf[DISK_NAME_LEN];
int err = -ENOMEM;
+ struct queue_limits lim = {
+ /*
+ * This is so fdisk will align partitions on 4k, because of
+ * direct_access API needing 4k alignment, returning a PFN
+ * (This is only a problem on very small devices <= 4M,
+ * otherwise fdisk will align on 1M. Regardless this call
+ * is harmless)
+ */
+ .physical_block_size = PAGE_SIZE,
+ };
list_for_each_entry(brd, &brd_devices, brd_list)
if (brd->brd_number == i)
@@ -335,7 +345,7 @@ static int brd_alloc(int i)
debugfs_create_u64(buf, 0444, brd_debugfs_dir,
&brd->brd_nr_pages);
- disk = brd->brd_disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ disk = brd->brd_disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
if (IS_ERR(disk)) {
err = PTR_ERR(disk);
goto out_free_dev;
@@ -348,15 +358,6 @@ static int brd_alloc(int i)
strscpy(disk->disk_name, buf, DISK_NAME_LEN);
set_capacity(disk, rd_size * 2);
- /*
- * This is so fdisk will align partitions on 4k, because of
- * direct_access API needing 4k alignment, returning a PFN
- * (This is only a problem on very small devices <= 4M,
- * otherwise fdisk will align on 1M. Regardless this call
- * is harmless)
- */
- blk_queue_physical_block_size(disk->queue, PAGE_SIZE);
-
/* Tell the block layer that this is not a rotational device */
blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, disk->queue);
--
2.39.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 4/9] n64cart: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 pass queue_limits to blk_alloc_disk for simple drivers Christoph Hellwig
` (2 preceding siblings ...)
2024-02-15 7:10 ` [PATCH 3/9] brd: " Christoph Hellwig
@ 2024-02-15 7:10 ` Christoph Hellwig
2024-02-17 0:43 ` Chaitanya Kulkarni
2024-02-15 7:10 ` [PATCH 5/9] zram: " Christoph Hellwig
` (7 subsequent siblings)
11 siblings, 1 reply; 20+ messages in thread
From: Christoph Hellwig @ 2024-02-15 7:10 UTC (permalink / raw)
To: Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
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>
---
drivers/block/n64cart.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/block/n64cart.c b/drivers/block/n64cart.c
index c64d7ee7a44db5..27b2187e7a6d55 100644
--- a/drivers/block/n64cart.c
+++ b/drivers/block/n64cart.c
@@ -114,6 +114,10 @@ static const struct block_device_operations n64cart_fops = {
*/
static int __init n64cart_probe(struct platform_device *pdev)
{
+ struct queue_limits lim = {
+ .physical_block_size = 4096,
+ .logical_block_size = 4096,
+ };
struct gendisk *disk;
int err = -ENOMEM;
@@ -131,7 +135,7 @@ static int __init n64cart_probe(struct platform_device *pdev)
if (IS_ERR(reg_base))
return PTR_ERR(reg_base);
- disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
if (IS_ERR(disk)) {
err = PTR_ERR(disk);
goto out;
@@ -147,8 +151,6 @@ static int __init n64cart_probe(struct platform_device *pdev)
set_disk_ro(disk, 1);
blk_queue_flag_set(QUEUE_FLAG_NONROT, disk->queue);
- blk_queue_physical_block_size(disk->queue, 4096);
- blk_queue_logical_block_size(disk->queue, 4096);
err = add_disk(disk);
if (err)
--
2.39.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 5/9] zram: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 pass queue_limits to blk_alloc_disk for simple drivers Christoph Hellwig
` (3 preceding siblings ...)
2024-02-15 7:10 ` [PATCH 4/9] n64cart: " Christoph Hellwig
@ 2024-02-15 7:10 ` Christoph Hellwig
2024-02-19 12:04 ` Sergey Senozhatsky
2024-02-15 7:10 ` [PATCH 6/9] bcache: " Christoph Hellwig
` (6 subsequent siblings)
11 siblings, 1 reply; 20+ messages in thread
From: Christoph Hellwig @ 2024-02-15 7:10 UTC (permalink / raw)
To: Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
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>
---
drivers/block/zram/zram_drv.c | 47 +++++++++++++++++------------------
1 file changed, 23 insertions(+), 24 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 84982221fc6620..8ee0f7bef19053 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -2177,6 +2177,28 @@ ATTRIBUTE_GROUPS(zram_disk);
*/
static int zram_add(void)
{
+ struct queue_limits lim = {
+ .logical_block_size = ZRAM_LOGICAL_BLOCK_SIZE,
+ /*
+ * To ensure that we always get PAGE_SIZE aligned and
+ * n*PAGE_SIZED sized I/O requests.
+ */
+ .physical_block_size = PAGE_SIZE,
+ .io_min = PAGE_SIZE,
+ .io_opt = PAGE_SIZE,
+ .max_hw_discard_sectors = UINT_MAX,
+ /*
+ * zram_bio_discard() will clear all logical blocks if logical
+ * block size is identical with physical block size(PAGE_SIZE).
+ * But if it is different, we will skip discarding some parts of
+ * logical blocks in the part of the request range which isn't
+ * aligned to physical block size. So we can't ensure that all
+ * discarded logical blocks are zeroed.
+ */
+#if ZRAM_LOGICAL_BLOCK_SIZE == PAGE_SIZE
+ .max_write_zeroes_sectors = UINT_MAX,
+#endif
+ };
struct zram *zram;
int ret, device_id;
@@ -2195,7 +2217,7 @@ static int zram_add(void)
#endif
/* gendisk structure */
- zram->disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ zram->disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
if (IS_ERR(zram->disk)) {
pr_err("Error allocating disk structure for device %d\n",
device_id);
@@ -2216,29 +2238,6 @@ static int zram_add(void)
/* zram devices sort of resembles non-rotational disks */
blk_queue_flag_set(QUEUE_FLAG_NONROT, zram->disk->queue);
blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, zram->disk->queue);
-
- /*
- * To ensure that we always get PAGE_SIZE aligned
- * and n*PAGE_SIZED sized I/O requests.
- */
- blk_queue_physical_block_size(zram->disk->queue, PAGE_SIZE);
- blk_queue_logical_block_size(zram->disk->queue,
- ZRAM_LOGICAL_BLOCK_SIZE);
- blk_queue_io_min(zram->disk->queue, PAGE_SIZE);
- blk_queue_io_opt(zram->disk->queue, PAGE_SIZE);
- blk_queue_max_discard_sectors(zram->disk->queue, UINT_MAX);
-
- /*
- * zram_bio_discard() will clear all logical blocks if logical block
- * size is identical with physical block size(PAGE_SIZE). But if it is
- * different, we will skip discarding some parts of logical blocks in
- * the part of the request range which isn't aligned to physical block
- * size. So we can't ensure that all discarded logical blocks are
- * zeroed.
- */
- if (ZRAM_LOGICAL_BLOCK_SIZE == PAGE_SIZE)
- blk_queue_max_write_zeroes_sectors(zram->disk->queue, UINT_MAX);
-
blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, zram->disk->queue);
ret = device_add_disk(NULL, zram->disk, zram_disk_groups);
if (ret)
--
2.39.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 6/9] bcache: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 pass queue_limits to blk_alloc_disk for simple drivers Christoph Hellwig
` (4 preceding siblings ...)
2024-02-15 7:10 ` [PATCH 5/9] zram: " Christoph Hellwig
@ 2024-02-15 7:10 ` Christoph Hellwig
2024-02-17 0:44 ` Chaitanya Kulkarni
2024-02-15 7:10 ` [PATCH 7/9] btt: " Christoph Hellwig
` (5 subsequent siblings)
11 siblings, 1 reply; 20+ messages in thread
From: Christoph Hellwig @ 2024-02-15 7:10 UTC (permalink / raw)
To: Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
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>
---
drivers/md/bcache/super.c | 46 ++++++++++++++++++++-------------------
1 file changed, 24 insertions(+), 22 deletions(-)
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 9955ecff383966..d06a9649d30269 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -900,6 +900,16 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
struct request_queue *q;
const size_t max_stripes = min_t(size_t, INT_MAX,
SIZE_MAX / sizeof(atomic_t));
+ struct queue_limits lim = {
+ .max_hw_sectors = UINT_MAX,
+ .max_sectors = UINT_MAX,
+ .max_segment_size = UINT_MAX,
+ .max_segments = BIO_MAX_VECS,
+ .max_hw_discard_sectors = UINT_MAX,
+ .io_min = block_size,
+ .logical_block_size = block_size,
+ .physical_block_size = block_size,
+ };
uint64_t n;
int idx;
@@ -935,7 +945,20 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
BIOSET_NEED_BVECS|BIOSET_NEED_RESCUER))
goto out_ida_remove;
- d->disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ if (lim.logical_block_size > PAGE_SIZE && cached_bdev) {
+ /*
+ * This should only happen with BCACHE_SB_VERSION_BDEV.
+ * Block/page size is checked for BCACHE_SB_VERSION_CDEV.
+ */
+ pr_info("bcache%i: sb/logical block size (%u) greater than page size (%lu) falling back to device logical block size (%u)\n",
+ idx, lim.logical_block_size,
+ PAGE_SIZE, bdev_logical_block_size(cached_bdev));
+
+ /* This also adjusts physical block size/min io size if needed */
+ lim.logical_block_size = bdev_logical_block_size(cached_bdev);
+ }
+
+ d->disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
if (IS_ERR(d->disk))
goto out_bioset_exit;
@@ -949,27 +972,6 @@ static int bcache_device_init(struct bcache_device *d, unsigned int block_size,
d->disk->private_data = d;
q = d->disk->queue;
- q->limits.max_hw_sectors = UINT_MAX;
- q->limits.max_sectors = UINT_MAX;
- q->limits.max_segment_size = UINT_MAX;
- q->limits.max_segments = BIO_MAX_VECS;
- blk_queue_max_discard_sectors(q, UINT_MAX);
- q->limits.io_min = block_size;
- q->limits.logical_block_size = block_size;
- q->limits.physical_block_size = block_size;
-
- if (q->limits.logical_block_size > PAGE_SIZE && cached_bdev) {
- /*
- * This should only happen with BCACHE_SB_VERSION_BDEV.
- * Block/page size is checked for BCACHE_SB_VERSION_CDEV.
- */
- pr_info("%s: sb/logical block size (%u) greater than page size (%lu) falling back to device logical block size (%u)\n",
- d->disk->disk_name, q->limits.logical_block_size,
- PAGE_SIZE, bdev_logical_block_size(cached_bdev));
-
- /* This also adjusts physical block size/min io size if needed */
- blk_queue_logical_block_size(q, bdev_logical_block_size(cached_bdev));
- }
blk_queue_flag_set(QUEUE_FLAG_NONROT, d->disk->queue);
--
2.39.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 7/9] btt: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 pass queue_limits to blk_alloc_disk for simple drivers Christoph Hellwig
` (5 preceding siblings ...)
2024-02-15 7:10 ` [PATCH 6/9] bcache: " Christoph Hellwig
@ 2024-02-15 7:10 ` Christoph Hellwig
2024-02-15 18:16 ` Dave Jiang
2024-02-15 7:10 ` [PATCH 8/9] pmem: " Christoph Hellwig
` (4 subsequent siblings)
11 siblings, 1 reply; 20+ messages in thread
From: Christoph Hellwig @ 2024-02-15 7:10 UTC (permalink / raw)
To: Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
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>
---
drivers/nvdimm/btt.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
index 9a0eae01d5986e..4d0c527e857678 100644
--- a/drivers/nvdimm/btt.c
+++ b/drivers/nvdimm/btt.c
@@ -1496,9 +1496,13 @@ static int btt_blk_init(struct btt *btt)
{
struct nd_btt *nd_btt = btt->nd_btt;
struct nd_namespace_common *ndns = nd_btt->ndns;
+ struct queue_limits lim = {
+ .logical_block_size = btt->sector_size,
+ .max_hw_sectors = UINT_MAX,
+ };
int rc;
- btt->btt_disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ btt->btt_disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
if (IS_ERR(btt->btt_disk))
return PTR_ERR(btt->btt_disk);
@@ -1507,8 +1511,6 @@ static int btt_blk_init(struct btt *btt)
btt->btt_disk->fops = &btt_fops;
btt->btt_disk->private_data = btt;
- blk_queue_logical_block_size(btt->btt_disk->queue, btt->sector_size);
- blk_queue_max_hw_sectors(btt->btt_disk->queue, UINT_MAX);
blk_queue_flag_set(QUEUE_FLAG_NONROT, btt->btt_disk->queue);
blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, btt->btt_disk->queue);
--
2.39.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 8/9] pmem: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 pass queue_limits to blk_alloc_disk for simple drivers Christoph Hellwig
` (6 preceding siblings ...)
2024-02-15 7:10 ` [PATCH 7/9] btt: " Christoph Hellwig
@ 2024-02-15 7:10 ` Christoph Hellwig
2024-02-15 18:15 ` Dave Jiang
2024-02-17 0:45 ` Chaitanya Kulkarni
2024-02-15 7:10 ` [PATCH 9/9] dcssblk: " Christoph Hellwig
` (3 subsequent siblings)
11 siblings, 2 replies; 20+ messages in thread
From: Christoph Hellwig @ 2024-02-15 7:10 UTC (permalink / raw)
To: Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
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>
---
drivers/nvdimm/pmem.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
index 3a5df8d467c507..8dcc10b6db5b12 100644
--- a/drivers/nvdimm/pmem.c
+++ b/drivers/nvdimm/pmem.c
@@ -451,6 +451,11 @@ static int pmem_attach_disk(struct device *dev,
{
struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev);
struct nd_region *nd_region = to_nd_region(dev->parent);
+ struct queue_limits lim = {
+ .logical_block_size = pmem_sector_size(ndns),
+ .physical_block_size = PAGE_SIZE,
+ .max_hw_sectors = UINT_MAX,
+ };
int nid = dev_to_node(dev), fua;
struct resource *res = &nsio->res;
struct range bb_range;
@@ -497,7 +502,7 @@ static int pmem_attach_disk(struct device *dev,
return -EBUSY;
}
- disk = blk_alloc_disk(NULL, nid);
+ disk = blk_alloc_disk(&lim, nid);
if (IS_ERR(disk))
return PTR_ERR(disk);
q = disk->queue;
@@ -539,9 +544,6 @@ static int pmem_attach_disk(struct device *dev,
pmem->virt_addr = addr;
blk_queue_write_cache(q, true, fua);
- blk_queue_physical_block_size(q, PAGE_SIZE);
- blk_queue_logical_block_size(q, pmem_sector_size(ndns));
- blk_queue_max_hw_sectors(q, UINT_MAX);
blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, q);
if (pmem->pfn_flags & PFN_MAP)
--
2.39.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 9/9] dcssblk: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 pass queue_limits to blk_alloc_disk for simple drivers Christoph Hellwig
` (7 preceding siblings ...)
2024-02-15 7:10 ` [PATCH 8/9] pmem: " Christoph Hellwig
@ 2024-02-15 7:10 ` Christoph Hellwig
2024-02-15 22:04 ` pass queue_limits to blk_alloc_disk for simple drivers Dan Williams
` (2 subsequent siblings)
11 siblings, 0 replies; 20+ messages in thread
From: Christoph Hellwig @ 2024-02-15 7:10 UTC (permalink / raw)
To: Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
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>
---
drivers/s390/block/dcssblk.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 0903b432ea9740..9c8f529b827cb3 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -546,6 +546,9 @@ static const struct attribute_group *dcssblk_dev_attr_groups[] = {
static ssize_t
dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
+ struct queue_limits lim = {
+ .logical_block_size = 4096,
+ };
int rc, i, j, num_of_segments;
struct dcssblk_dev_info *dev_info;
struct segment_info *seg_info, *temp;
@@ -629,7 +632,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
dev_info->dev.release = dcssblk_release_segment;
dev_info->dev.groups = dcssblk_dev_attr_groups;
INIT_LIST_HEAD(&dev_info->lh);
- dev_info->gd = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ dev_info->gd = blk_alloc_disk(&lim, NUMA_NO_NODE);
if (IS_ERR(dev_info->gd)) {
rc = PTR_ERR(dev_info->gd);
goto seg_list_del;
@@ -639,7 +642,6 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
dev_info->gd->fops = &dcssblk_devops;
dev_info->gd->private_data = dev_info;
dev_info->gd->flags |= GENHD_FL_NO_PART;
- blk_queue_logical_block_size(dev_info->gd->queue, 4096);
blk_queue_flag_set(QUEUE_FLAG_DAX, dev_info->gd->queue);
seg_byte_size = (dev_info->end - dev_info->start + 1);
--
2.39.2
^ permalink raw reply related [flat|nested] 20+ messages in thread
* Re: [PATCH 8/9] pmem: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 ` [PATCH 8/9] pmem: " Christoph Hellwig
@ 2024-02-15 18:15 ` Dave Jiang
2024-02-17 0:45 ` Chaitanya Kulkarni
1 sibling, 0 replies; 20+ messages in thread
From: Dave Jiang @ 2024-02-15 18:15 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Ira Weiny, linux-m68k, linux-bcache,
nvdimm, linux-block
On 2/15/24 12:10 AM, Christoph Hellwig wrote:
> 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>
> ---
> drivers/nvdimm/pmem.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c
> index 3a5df8d467c507..8dcc10b6db5b12 100644
> --- a/drivers/nvdimm/pmem.c
> +++ b/drivers/nvdimm/pmem.c
> @@ -451,6 +451,11 @@ static int pmem_attach_disk(struct device *dev,
> {
> struct nd_namespace_io *nsio = to_nd_namespace_io(&ndns->dev);
> struct nd_region *nd_region = to_nd_region(dev->parent);
> + struct queue_limits lim = {
> + .logical_block_size = pmem_sector_size(ndns),
> + .physical_block_size = PAGE_SIZE,
> + .max_hw_sectors = UINT_MAX,
> + };
> int nid = dev_to_node(dev), fua;
> struct resource *res = &nsio->res;
> struct range bb_range;
> @@ -497,7 +502,7 @@ static int pmem_attach_disk(struct device *dev,
> return -EBUSY;
> }
>
> - disk = blk_alloc_disk(NULL, nid);
> + disk = blk_alloc_disk(&lim, nid);
> if (IS_ERR(disk))
> return PTR_ERR(disk);
> q = disk->queue;
> @@ -539,9 +544,6 @@ static int pmem_attach_disk(struct device *dev,
> pmem->virt_addr = addr;
>
> blk_queue_write_cache(q, true, fua);
> - blk_queue_physical_block_size(q, PAGE_SIZE);
> - blk_queue_logical_block_size(q, pmem_sector_size(ndns));
> - blk_queue_max_hw_sectors(q, UINT_MAX);
> blk_queue_flag_set(QUEUE_FLAG_NONROT, q);
> blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, q);
> if (pmem->pfn_flags & PFN_MAP)
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 7/9] btt: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 ` [PATCH 7/9] btt: " Christoph Hellwig
@ 2024-02-15 18:16 ` Dave Jiang
0 siblings, 0 replies; 20+ messages in thread
From: Dave Jiang @ 2024-02-15 18:16 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Ira Weiny, linux-m68k, linux-bcache,
nvdimm, linux-block
On 2/15/24 12:10 AM, Christoph Hellwig wrote:
> 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>
> ---
> drivers/nvdimm/btt.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c
> index 9a0eae01d5986e..4d0c527e857678 100644
> --- a/drivers/nvdimm/btt.c
> +++ b/drivers/nvdimm/btt.c
> @@ -1496,9 +1496,13 @@ static int btt_blk_init(struct btt *btt)
> {
> struct nd_btt *nd_btt = btt->nd_btt;
> struct nd_namespace_common *ndns = nd_btt->ndns;
> + struct queue_limits lim = {
> + .logical_block_size = btt->sector_size,
> + .max_hw_sectors = UINT_MAX,
> + };
> int rc;
>
> - btt->btt_disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
> + btt->btt_disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
> if (IS_ERR(btt->btt_disk))
> return PTR_ERR(btt->btt_disk);
>
> @@ -1507,8 +1511,6 @@ static int btt_blk_init(struct btt *btt)
> btt->btt_disk->fops = &btt_fops;
> btt->btt_disk->private_data = btt;
>
> - blk_queue_logical_block_size(btt->btt_disk->queue, btt->sector_size);
> - blk_queue_max_hw_sectors(btt->btt_disk->queue, UINT_MAX);
> blk_queue_flag_set(QUEUE_FLAG_NONROT, btt->btt_disk->queue);
> blk_queue_flag_set(QUEUE_FLAG_SYNCHRONOUS, btt->btt_disk->queue);
>
^ permalink raw reply [flat|nested] 20+ messages in thread
* RE: pass queue_limits to blk_alloc_disk for simple drivers
2024-02-15 7:10 pass queue_limits to blk_alloc_disk for simple drivers Christoph Hellwig
` (8 preceding siblings ...)
2024-02-15 7:10 ` [PATCH 9/9] dcssblk: " Christoph Hellwig
@ 2024-02-15 22:04 ` Dan Williams
2024-02-17 0:51 ` Himanshu Madhani
2024-02-20 13:22 ` Jens Axboe
11 siblings, 0 replies; 20+ messages in thread
From: Dan Williams @ 2024-02-15 22:04 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
Christoph Hellwig wrote:
> Hi Jens,
>
> this series converts all "simple" bio based drivers that don't have
> complex internal layering or other oddities to pass the queue_limits to
> blk_mq_alloc_disk. None of these drivers updates the limits at runtime.
>
>
> Diffstat:
> arch/m68k/emu/nfblock.c | 10 ++++---
> arch/xtensa/platforms/iss/simdisk.c | 8 +++--
> block/genhd.c | 11 ++++---
> drivers/block/brd.c | 26 +++++++++---------
> drivers/block/drbd/drbd_main.c | 6 ++--
> drivers/block/n64cart.c | 12 +++++---
> drivers/block/null_blk/main.c | 7 ++--
> drivers/block/pktcdvd.c | 7 ++--
> drivers/block/ps3vram.c | 6 ++--
> drivers/block/zram/zram_drv.c | 51 +++++++++++++++++-------------------
> drivers/md/bcache/super.c | 48 +++++++++++++++++----------------
> drivers/md/dm.c | 4 +-
> drivers/md/md.c | 7 ++--
> drivers/nvdimm/btt.c | 14 +++++----
> drivers/nvdimm/pmem.c | 14 +++++----
> drivers/nvme/host/multipath.c | 6 ++--
> drivers/s390/block/dcssblk.c | 10 ++++---
> include/linux/blkdev.h | 10 ++++---
> 18 files changed, 143 insertions(+), 114 deletions(-)
For the series,
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 3/9] brd: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 ` [PATCH 3/9] brd: " Christoph Hellwig
@ 2024-02-17 0:42 ` Chaitanya Kulkarni
0 siblings, 0 replies; 20+ messages in thread
From: Chaitanya Kulkarni @ 2024-02-17 0:42 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
On 2/14/24 23:10, Christoph Hellwig wrote:
> 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>
> ---
>
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 4/9] n64cart: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 ` [PATCH 4/9] n64cart: " Christoph Hellwig
@ 2024-02-17 0:43 ` Chaitanya Kulkarni
0 siblings, 0 replies; 20+ messages in thread
From: Chaitanya Kulkarni @ 2024-02-17 0:43 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
On 2/14/24 23:10, Christoph Hellwig wrote:
> 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>
> ---
>
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 6/9] bcache: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 ` [PATCH 6/9] bcache: " Christoph Hellwig
@ 2024-02-17 0:44 ` Chaitanya Kulkarni
0 siblings, 0 replies; 20+ messages in thread
From: Chaitanya Kulkarni @ 2024-02-17 0:44 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
On 2/14/24 23:10, Christoph Hellwig wrote:
> 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>
> ---
>
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 8/9] pmem: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 ` [PATCH 8/9] pmem: " Christoph Hellwig
2024-02-15 18:15 ` Dave Jiang
@ 2024-02-17 0:45 ` Chaitanya Kulkarni
1 sibling, 0 replies; 20+ messages in thread
From: Chaitanya Kulkarni @ 2024-02-17 0:45 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
On 2/14/24 23:10, Christoph Hellwig wrote:
> 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>
> ---
>
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: pass queue_limits to blk_alloc_disk for simple drivers
2024-02-15 7:10 pass queue_limits to blk_alloc_disk for simple drivers Christoph Hellwig
` (9 preceding siblings ...)
2024-02-15 22:04 ` pass queue_limits to blk_alloc_disk for simple drivers Dan Williams
@ 2024-02-17 0:51 ` Himanshu Madhani
2024-02-20 13:22 ` Jens Axboe
11 siblings, 0 replies; 20+ messages in thread
From: Himanshu Madhani @ 2024-02-17 0:51 UTC (permalink / raw)
To: Christoph Hellwig, Jens Axboe
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
On 2/14/24 23:10, Christoph Hellwig wrote:
> Hi Jens,
>
> this series converts all "simple" bio based drivers that don't have
> complex internal layering or other oddities to pass the queue_limits to
> blk_mq_alloc_disk. None of these drivers updates the limits at runtime.
>
>
> Diffstat:
> arch/m68k/emu/nfblock.c | 10 ++++---
> arch/xtensa/platforms/iss/simdisk.c | 8 +++--
> block/genhd.c | 11 ++++---
> drivers/block/brd.c | 26 +++++++++---------
> drivers/block/drbd/drbd_main.c | 6 ++--
> drivers/block/n64cart.c | 12 +++++---
> drivers/block/null_blk/main.c | 7 ++--
> drivers/block/pktcdvd.c | 7 ++--
> drivers/block/ps3vram.c | 6 ++--
> drivers/block/zram/zram_drv.c | 51 +++++++++++++++++-------------------
> drivers/md/bcache/super.c | 48 +++++++++++++++++----------------
> drivers/md/dm.c | 4 +-
> drivers/md/md.c | 7 ++--
> drivers/nvdimm/btt.c | 14 +++++----
> drivers/nvdimm/pmem.c | 14 +++++----
> drivers/nvme/host/multipath.c | 6 ++--
> drivers/s390/block/dcssblk.c | 10 ++++---
> include/linux/blkdev.h | 10 ++++---
> 18 files changed, 143 insertions(+), 114 deletions(-)
>
for the series,
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
--
Himanshu Madhani Oracle Linux Engineering
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 5/9] zram: pass queue_limits to blk_mq_alloc_disk
2024-02-15 7:10 ` [PATCH 5/9] zram: " Christoph Hellwig
@ 2024-02-19 12:04 ` Sergey Senozhatsky
0 siblings, 0 replies; 20+ messages in thread
From: Sergey Senozhatsky @ 2024-02-19 12:04 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky,
Coly Li, Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny,
linux-m68k, linux-bcache, nvdimm, linux-block
On (24/02/15 08:10), Christoph Hellwig wrote:
>
> 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>
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: pass queue_limits to blk_alloc_disk for simple drivers
2024-02-15 7:10 pass queue_limits to blk_alloc_disk for simple drivers Christoph Hellwig
` (10 preceding siblings ...)
2024-02-17 0:51 ` Himanshu Madhani
@ 2024-02-20 13:22 ` Jens Axboe
11 siblings, 0 replies; 20+ messages in thread
From: Jens Axboe @ 2024-02-20 13:22 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Geert Uytterhoeven, Minchan Kim, Sergey Senozhatsky, Coly Li,
Vishal Verma, Dan Williams, Dave Jiang, Ira Weiny, linux-m68k,
linux-bcache, nvdimm, linux-block
On Thu, 15 Feb 2024 08:10:46 +0100, Christoph Hellwig wrote:
> this series converts all "simple" bio based drivers that don't have
> complex internal layering or other oddities to pass the queue_limits to
> blk_mq_alloc_disk. None of these drivers updates the limits at runtime.
>
> Diffstat:
> arch/m68k/emu/nfblock.c | 10 ++++---
> arch/xtensa/platforms/iss/simdisk.c | 8 +++--
> block/genhd.c | 11 ++++---
> drivers/block/brd.c | 26 +++++++++---------
> drivers/block/drbd/drbd_main.c | 6 ++--
> drivers/block/n64cart.c | 12 +++++---
> drivers/block/null_blk/main.c | 7 ++--
> drivers/block/pktcdvd.c | 7 ++--
> drivers/block/ps3vram.c | 6 ++--
> drivers/block/zram/zram_drv.c | 51 +++++++++++++++++-------------------
> drivers/md/bcache/super.c | 48 +++++++++++++++++----------------
> drivers/md/dm.c | 4 +-
> drivers/md/md.c | 7 ++--
> drivers/nvdimm/btt.c | 14 +++++----
> drivers/nvdimm/pmem.c | 14 +++++----
> drivers/nvme/host/multipath.c | 6 ++--
> drivers/s390/block/dcssblk.c | 10 ++++---
> include/linux/blkdev.h | 10 ++++---
> 18 files changed, 143 insertions(+), 114 deletions(-)
>
> [...]
Applied, thanks!
[1/9] block: pass a queue_limits argument to blk_alloc_disk
commit: 74fa8f9c553f7b5ccab7d103acae63cc2e080465
[2/9] nfblock: pass queue_limits to blk_mq_alloc_disk
commit: 2cfe0104bc1b4a94f81e386f5ff11041f39c1882
[3/9] brd: pass queue_limits to blk_mq_alloc_disk
commit: b5baaba4ce5c8a0e36b5232b16c0731e3eb0d939
[4/9] n64cart: pass queue_limits to blk_mq_alloc_disk
commit: cc7f05c7ec0b26e1eda8ec7a99452032d08d305e
[5/9] zram: pass queue_limits to blk_mq_alloc_disk
commit: 4190b3f291d9563a438bf32424a3f049442fc3a5
[6/9] bcache: pass queue_limits to blk_mq_alloc_disk
commit: b3f0846e720ee59291e3c5235f8a46e70dbc652c
[7/9] btt: pass queue_limits to blk_mq_alloc_disk
commit: 77c059222c31b0480c61964f361b28a4ce111e52
[8/9] pmem: pass queue_limits to blk_mq_alloc_disk
commit: c3d9c3031e18f145d8a12026d4d704125fe901ac
[9/9] dcssblk: pass queue_limits to blk_mq_alloc_disk
commit: af190c53c995bf7c742c3387f6537534f8b92322
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2024-02-20 13:22 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-15 7:10 pass queue_limits to blk_alloc_disk for simple drivers Christoph Hellwig
2024-02-15 7:10 ` [PATCH 1/9] block: pass a queue_limits argument to blk_alloc_disk Christoph Hellwig
2024-02-15 7:10 ` [PATCH 2/9] nfblock: pass queue_limits to blk_mq_alloc_disk Christoph Hellwig
2024-02-15 7:10 ` [PATCH 3/9] brd: " Christoph Hellwig
2024-02-17 0:42 ` Chaitanya Kulkarni
2024-02-15 7:10 ` [PATCH 4/9] n64cart: " Christoph Hellwig
2024-02-17 0:43 ` Chaitanya Kulkarni
2024-02-15 7:10 ` [PATCH 5/9] zram: " Christoph Hellwig
2024-02-19 12:04 ` Sergey Senozhatsky
2024-02-15 7:10 ` [PATCH 6/9] bcache: " Christoph Hellwig
2024-02-17 0:44 ` Chaitanya Kulkarni
2024-02-15 7:10 ` [PATCH 7/9] btt: " Christoph Hellwig
2024-02-15 18:16 ` Dave Jiang
2024-02-15 7:10 ` [PATCH 8/9] pmem: " Christoph Hellwig
2024-02-15 18:15 ` Dave Jiang
2024-02-17 0:45 ` Chaitanya Kulkarni
2024-02-15 7:10 ` [PATCH 9/9] dcssblk: " Christoph Hellwig
2024-02-15 22:04 ` pass queue_limits to blk_alloc_disk for simple drivers Dan Williams
2024-02-17 0:51 ` Himanshu Madhani
2024-02-20 13:22 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).