Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drbd: pass the max_hw_sectors limit to blk_alloc_disk

Pass a queue_limits structure with the max_hw_sectors limit to
blk_alloc_disk instead of updating the limit on the allocated gendisk.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20240305134041.137006-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Christoph Hellwig and committed by
Jens Axboe
aa067325 5f2ad31f

+9 -4
+9 -4
drivers/block/drbd/drbd_main.c
··· 2690 2690 int id; 2691 2691 int vnr = adm_ctx->volume; 2692 2692 enum drbd_ret_code err = ERR_NOMEM; 2693 + struct queue_limits lim = { 2694 + /* 2695 + * Setting the max_hw_sectors to an odd value of 8kibyte here. 2696 + * This triggers a max_bio_size message upon first attach or 2697 + * connect. 2698 + */ 2699 + .max_hw_sectors = DRBD_MAX_BIO_SIZE_SAFE >> 8, 2700 + }; 2693 2701 2694 2702 device = minor_to_device(minor); 2695 2703 if (device) ··· 2716 2708 2717 2709 drbd_init_set_defaults(device); 2718 2710 2719 - disk = blk_alloc_disk(NULL, NUMA_NO_NODE); 2711 + disk = blk_alloc_disk(&lim, NUMA_NO_NODE); 2720 2712 if (IS_ERR(disk)) { 2721 2713 err = PTR_ERR(disk); 2722 2714 goto out_no_disk; ··· 2737 2729 2738 2730 blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, disk->queue); 2739 2731 blk_queue_write_cache(disk->queue, true, true); 2740 - /* Setting the max_hw_sectors to an odd value of 8kibyte here 2741 - This triggers a max_bio_size message upon first attach or connect */ 2742 - blk_queue_max_hw_sectors(disk->queue, DRBD_MAX_BIO_SIZE_SAFE >> 8); 2743 2732 2744 2733 device->md_io.page = alloc_page(GFP_KERNEL); 2745 2734 if (!device->md_io.page)