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>
This commit is contained in:
parent
65bdd16f8c
commit
02aed4a1f2
|
@ -1971,6 +1971,12 @@ static const struct blk_mq_ops loop_mq_ops = {
|
||||||
|
|
||||||
static int loop_add(int i)
|
static int loop_add(int i)
|
||||||
{
|
{
|
||||||
|
struct queue_limits lim = {
|
||||||
|
/*
|
||||||
|
* Random number picked from the historic block max_sectors cap.
|
||||||
|
*/
|
||||||
|
.max_hw_sectors = 2560u,
|
||||||
|
};
|
||||||
struct loop_device *lo;
|
struct loop_device *lo;
|
||||||
struct gendisk *disk;
|
struct gendisk *disk;
|
||||||
int err;
|
int err;
|
||||||
|
@ -2014,16 +2020,13 @@ static int loop_add(int i)
|
||||||
if (err)
|
if (err)
|
||||||
goto out_free_idr;
|
goto out_free_idr;
|
||||||
|
|
||||||
disk = lo->lo_disk = blk_mq_alloc_disk(&lo->tag_set, NULL, lo);
|
disk = lo->lo_disk = blk_mq_alloc_disk(&lo->tag_set, &lim, lo);
|
||||||
if (IS_ERR(disk)) {
|
if (IS_ERR(disk)) {
|
||||||
err = PTR_ERR(disk);
|
err = PTR_ERR(disk);
|
||||||
goto out_cleanup_tags;
|
goto out_cleanup_tags;
|
||||||
}
|
}
|
||||||
lo->lo_queue = lo->lo_disk->queue;
|
lo->lo_queue = lo->lo_disk->queue;
|
||||||
|
|
||||||
/* random number picked from the history block max_sectors cap */
|
|
||||||
blk_queue_max_hw_sectors(lo->lo_queue, 2560u);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* By default, we do buffer IO, so it doesn't make sense to enable
|
* By default, we do buffer IO, so it doesn't make sense to enable
|
||||||
* merge because the I/O submitted to backing file is handled page by
|
* merge because the I/O submitted to backing file is handled page by
|
||||||
|
|
Loading…
Reference in New Issue