Skip to content

Commit aa06732

Browse files
Christoph Hellwigaxboe
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 5f2ad31 commit aa06732

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

drivers/block/drbd/drbd_main.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2690,6 +2690,14 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
26902690
int id;
26912691
int vnr = adm_ctx->volume;
26922692
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+
};
26932701

26942702
device = minor_to_device(minor);
26952703
if (device)
@@ -2708,7 +2716,7 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
27082716

27092717
drbd_init_set_defaults(device);
27102718

2711-
disk = blk_alloc_disk(NULL, NUMA_NO_NODE);
2719+
disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
27122720
if (IS_ERR(disk)) {
27132721
err = PTR_ERR(disk);
27142722
goto out_no_disk;
@@ -2729,9 +2737,6 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
27292737

27302738
blk_queue_flag_set(QUEUE_FLAG_STABLE_WRITES, disk->queue);
27312739
blk_queue_write_cache(disk->queue, true, true);
2732-
/* Setting the max_hw_sectors to an odd value of 8kibyte here
2733-
This triggers a max_bio_size message upon first attach or connect */
2734-
blk_queue_max_hw_sectors(disk->queue, DRBD_MAX_BIO_SIZE_SAFE >> 8);
27352740

27362741
device->md_io.page = alloc_page(GFP_KERNEL);
27372742
if (!device->md_io.page)

0 commit comments

Comments
 (0)