summaryrefslogtreecommitdiff
path: root/drivers/block/pktcdvd.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-02-22 10:36:47 +0300
committerJens Axboe <axboe@kernel.dk>2024-02-22 20:08:20 +0300
commit4068550870360410261638479ffaf8364c366dd8 (patch)
treef107926fb5626ec58feb62b4f077177829f90afe /drivers/block/pktcdvd.c
parent6f420d6a2dd8d4a795eab2839b0e08663269f9f8 (diff)
downloadlinux-4068550870360410261638479ffaf8364c366dd8.tar.xz
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>
Diffstat (limited to 'drivers/block/pktcdvd.c')
-rw-r--r--drivers/block/pktcdvd.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index 0cd65b27c197..12fcc881b04f 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2484,14 +2484,6 @@ end_io:
bio_io_error(bio);
}
-static void pkt_init_queue(struct pktcdvd_device *pd)
-{
- struct request_queue *q = pd->disk->queue;
-
- blk_queue_logical_block_size(q, CD_FRAMESIZE);
- blk_queue_max_hw_sectors(q, PACKET_MAX_SECTORS);
-}
-
static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
{
struct device *ddev = disk_to_dev(pd->disk);
@@ -2535,8 +2527,6 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
pd->bdev_handle = bdev_handle;
set_blocksize(bdev_handle->bdev, CD_FRAMESIZE);
- pkt_init_queue(pd);
-
atomic_set(&pd->cdrw.pending_bios, 0);
pd->cdrw.thread = kthread_run(kcdrwd, pd, "%s", pd->disk->disk_name);
if (IS_ERR(pd->cdrw.thread)) {
@@ -2633,6 +2623,10 @@ static const struct block_device_operations pktcdvd_ops = {
*/
static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev)
{
+ struct queue_limits lim = {
+ .max_hw_sectors = PACKET_MAX_SECTORS,
+ .logical_block_size = CD_FRAMESIZE,
+ };
int idx;
int ret = -ENOMEM;
struct pktcdvd_device *pd;
@@ -2672,7 +2666,7 @@ 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;
- disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
+ disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
if (IS_ERR(disk)) {
ret = PTR_ERR(disk);
goto out_mem;