diff mbox series

[1/5] block: use PAGE_SECTORS_SHIFT to set limits

Message ID 20230808135702.628588-2-dlemoal@kernel.org (mailing list archive)
State New, archived
Headers show
Series Some minor cleanups | expand

Commit Message

Damien Le Moal Aug. 8, 2023, 1:56 p.m. UTC
Replace occurences of "PAGE_SHIFT - 9" in blk-settings.c with the
cleaner PAGE_SECTORS_SHIFT macro.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 block/blk-settings.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Chaitanya Kulkarni Aug. 9, 2023, 2:04 a.m. UTC | #1
On 8/8/2023 6:56 AM, Damien Le Moal wrote:
> Replace occurences of "PAGE_SHIFT - 9" in blk-settings.c with the
> cleaner PAGE_SECTORS_SHIFT macro.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck
Hannes Reinecke Aug. 9, 2023, 6:07 a.m. UTC | #2
On 8/8/23 15:56, Damien Le Moal wrote:
> Replace occurences of "PAGE_SHIFT - 9" in blk-settings.c with the
> cleaner PAGE_SECTORS_SHIFT macro.
> 
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
>   block/blk-settings.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
Johannes Thumshirn Aug. 15, 2023, 10 a.m. UTC | #3
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/block/blk-settings.c b/block/blk-settings.c
index 0046b447268f..5e2dbd34436b 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -126,7 +126,7 @@  void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_secto
 	unsigned int max_sectors;
 
 	if ((max_hw_sectors << 9) < PAGE_SIZE) {
-		max_hw_sectors = 1 << (PAGE_SHIFT - 9);
+		max_hw_sectors = 1 << PAGE_SECTORS_SHIFT;
 		printk(KERN_INFO "%s: set to minimum %d\n",
 		       __func__, max_hw_sectors);
 	}
@@ -148,7 +148,7 @@  void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int max_hw_secto
 
 	if (!q->disk)
 		return;
-	q->disk->bdi->io_pages = max_sectors >> (PAGE_SHIFT - 9);
+	q->disk->bdi->io_pages = max_sectors >> PAGE_SECTORS_SHIFT;
 }
 EXPORT_SYMBOL(blk_queue_max_hw_sectors);
 
@@ -398,7 +398,7 @@  void disk_update_readahead(struct gendisk *disk)
 	 */
 	disk->bdi->ra_pages =
 		max(queue_io_opt(q) * 2 / PAGE_SIZE, VM_READAHEAD_PAGES);
-	disk->bdi->io_pages = queue_max_sectors(q) >> (PAGE_SHIFT - 9);
+	disk->bdi->io_pages = queue_max_sectors(q) >> PAGE_SECTORS_SHIFT;
 }
 EXPORT_SYMBOL_GPL(disk_update_readahead);