Skip to content

Commit d6b9f4e

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: rename and document BLK_DEF_MAX_SECTORS
Give BLK_DEF_MAX_SECTORS a _CAP postfix and document what it is used for. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20231227092305.279567-5-hch@lst.de Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 3d77976 commit d6b9f4e

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

block/blk-settings.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_secto
139139
if (limits->max_user_sectors)
140140
max_sectors = min(max_sectors, limits->max_user_sectors);
141141
else
142-
max_sectors = min(max_sectors, BLK_DEF_MAX_SECTORS);
142+
max_sectors = min(max_sectors, BLK_DEF_MAX_SECTORS_CAP);
143143

144144
max_sectors = round_down(max_sectors,
145145
limits->logical_block_size >> SECTOR_SHIFT);

block/blk-sysfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ queue_max_sectors_store(struct request_queue *q, const char *page, size_t count)
241241
if (max_sectors_kb == 0) {
242242
q->limits.max_user_sectors = 0;
243243
max_sectors_kb = min(max_hw_sectors_kb,
244-
BLK_DEF_MAX_SECTORS >> 1);
244+
BLK_DEF_MAX_SECTORS_CAP >> 1);
245245
} else {
246246
if (max_sectors_kb > max_hw_sectors_kb ||
247247
max_sectors_kb < page_kb)

drivers/scsi/sd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3500,7 +3500,7 @@ static int sd_revalidate_disk(struct gendisk *disk)
35003500
} else {
35013501
q->limits.io_opt = 0;
35023502
rw_max = min_not_zero(logical_to_sectors(sdp, dev_max),
3503-
(sector_t)BLK_DEF_MAX_SECTORS);
3503+
(sector_t)BLK_DEF_MAX_SECTORS_CAP);
35043504
}
35053505

35063506
/*

include/linux/blkdev.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,14 @@ enum blk_default_limits {
10561056
BLK_SEG_BOUNDARY_MASK = 0xFFFFFFFFUL,
10571057
};
10581058

1059-
#define BLK_DEF_MAX_SECTORS 2560u
1059+
/*
1060+
* Default upper limit for the software max_sectors limit used for
1061+
* regular file system I/O. This can be increased through sysfs.
1062+
*
1063+
* Not to be confused with the max_hw_sector limit that is entirely
1064+
* controlled by the driver, usually based on hardware limits.
1065+
*/
1066+
#define BLK_DEF_MAX_SECTORS_CAP 2560u
10601067

10611068
static inline unsigned long queue_segment_boundary(const struct request_queue *q)
10621069
{

0 commit comments

Comments
 (0)