Skip to contentSkip to conversation

loop: remove a pointless blk_queue_max_hw_sectors call

PATCH In review Christoph Hellwig 2 participants 4 messages Dec 26, 2023 – Dec 27, 2023 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 loop: remove a pointless blk_queue_max_hw_sectors call

BLK_DEF_MAX_SECTORS is (as the name implies) already the default.

---
 drivers/block/loop.c | 2 --
 1 file changed, 2 deletions(-)
drivers/block/loop.c +0 -2
index 5bc2b4fcfa772d..371a318e691d02 100644
@@ -2038,8 +2038,6 @@ static int loop_add(int i)
 	}
 	lo->lo_queue = lo->lo_disk->queue;
 
-	blk_queue_max_hw_sectors(lo->lo_queue, BLK_DEF_MAX_SECTORS);
-
 	/*
 	 * 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
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 loop: don't update discard limits from loop_set_status

loop_set_status doesn't change anything relevant to the discard and write_zeroes setting, so don't bother calling loop_config_discard.

---
 drivers/block/loop.c | 2 --
 1 file changed, 2 deletions(-)
drivers/block/loop.c +0 -2
index 371a318e691d02..794bc92da165c3 100644
@@ -1303,8 +1303,6 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
 		loop_set_size(lo, new_size);
 	}
 
-	loop_config_discard(lo);
-
 	/* update dio if lo_offset or transfer is changed */
 	__loop_update_dio(lo, lo->use_dio);
 
Signature · 1 line
2.39.2
#2 lore raw
In reply to Christoph Hellwig

Hi,

Quoted 1 line · Christoph Hellwig

BLK_DEF_MAX_SECTORS is (as the name implies) already the default.

Looks like this not true. From blk_set_default_limits():

lim->max_sectors = lim->max_hw_sectors = BLK_SAFE_MAX_SECTORS;

So, the default is not BLK_DEF_MAX_SECTORS. Or am I missing something?

Thanks,
Kuai

Quoted 20 lines
---
  drivers/block/loop.c | 2 --
  1 file changed, 2 deletions(-)
drivers/block/loop.c +0 -2
index 5bc2b4fcfa772d..371a318e691d02 100644
@@ -2038,8 +2038,6 @@ static int loop_add(int i)
  	}
  	lo->lo_queue = lo->lo_disk->queue;
 
-	blk_queue_max_hw_sectors(lo->lo_queue, BLK_DEF_MAX_SECTORS);
-
  	/*
  	 * 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
#3 lore raw
Quoted 10 lines · Yu Kuai

Hi,

Quoted 1 line · Christoph Hellwig

BLK_DEF_MAX_SECTORS is (as the name implies) already the default.

Looks like this not true. From blk_set_default_limits():

lim->max_sectors = lim->max_hw_sectors = BLK_SAFE_MAX_SECTORS;

So, the default is not BLK_DEF_MAX_SECTORS. Or am I missing something?

No, you're not. The naming and our code is just a desaster..