From: Keith Busch <kbusch@meta.com>
To: <linux-block@vger.kernel.org>, <axboe@kernel.dk>
Cc: <hch@lst.de>, <martin.petersen@oracle.com>,
Keith Busch <kbusch@kernel.org>
Subject: [PATCH] block: save user max_sectors limit
Date: Wed, 21 Dec 2022 08:27:58 -0800 [thread overview]
Message-ID: <20221221162758.407742-1-kbusch@meta.com> (raw)
From: Keith Busch <kbusch@kernel.org>
The user can set the max_sectors limit to any valid value via sysfs
/sys/block/<dev>/queue/max_sectors_kb attribute. If the device limits
are ever rescanned, though, the limit reverts back to the potentially
artificially low BLK_DEF_MAX_SECTORS value.
Preserve the user's setting as long as it's valid and greater than the
default.
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
block/blk-settings.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 0477c4d527fee..523348926a800 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -135,7 +135,8 @@ void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_secto
limits->max_hw_sectors = max_hw_sectors;
max_sectors = min_not_zero(max_hw_sectors, limits->max_dev_sectors);
- max_sectors = min_t(unsigned int, max_sectors, BLK_DEF_MAX_SECTORS);
+ max_sectors = min_t(unsigned int, max_sectors, max(limits->max_sectors,
+ BLK_DEF_MAX_SECTORS));
max_sectors = round_down(max_sectors,
limits->logical_block_size >> SECTOR_SHIFT);
limits->max_sectors = max_sectors;
--
2.30.2
next reply other threads:[~2022-12-21 16:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-21 16:27 Keith Busch [this message]
[not found] ` <202212221657.yQawgPsu-lkp@intel.com>
2022-12-22 8:40 ` [PATCH] block: save user max_sectors limit Christoph Hellwig
2022-12-22 15:40 ` Keith Busch
2022-12-22 16:07 ` Martin K. Petersen
-- strict thread matches above, loose matches on Subject: below --
2022-12-22 17:52 Keith Busch
2022-12-23 6:00 ` Christoph Hellwig
2022-12-27 16:49 ` Keith Busch
2022-12-27 16:53 ` Christoph Hellwig
2022-12-27 2:13 ` Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221221162758.407742-1-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).