mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Curtin <ericcurtin17@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Eric Curtin <eric.curtin@docker.com>,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org
Subject: [RFC PATCH v2 07/13] null_blk: Size the nullb_page bitmap for PAGE_SIZE_MAX
Date: Wed,  2 Dec 2026 03:16:28 +0000	[thread overview]
Message-ID: <20261202031647.1690622-8-ericcurtin17@gmail.com> (raw)
In-Reply-To: <20261202031647.1690622-1-ericcurtin17@gmail.com>

From: Eric Curtin <eric.curtin@docker.com>

With arm64 boot-time page size selection PAGE_SIZE is not a
compile-time constant, but struct nullb_page embeds a bitmap with one
bit per sector of a page plus two flag bits.

Add MAP_SZ_MAX, based on PAGE_SIZE_MAX, and use it to declare the
bitmap. The runtime logic (NULLB_PAGE_LOCK and NULLB_PAGE_FREE) keeps
using MAP_SZ, derived from the actual page size, so the extra bitmap
space is simply unused on smaller pages.

No functional change for compile-time page sizes.

Signed-off-by: Eric Curtin <eric.curtin@docker.com>
---
 drivers/block/null_blk/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index ec0d7ba4d938..f5a02a861daf 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -46,6 +46,7 @@ enum nullb_device_flags {
 };
 
 #define MAP_SZ		((PAGE_SIZE >> SECTOR_SHIFT) + 2)
+#define MAP_SZ_MAX	((PAGE_SIZE_MAX >> SECTOR_SHIFT) + 2)
 /*
  * nullb_page is a page in memory for nullb devices.
  *
@@ -60,7 +61,7 @@ enum nullb_device_flags {
  */
 struct nullb_page {
 	struct page *page;
-	DECLARE_BITMAP(bitmap, MAP_SZ);
+	DECLARE_BITMAP(bitmap, MAP_SZ_MAX);
 };
 #define NULLB_PAGE_LOCK (MAP_SZ - 1)
 #define NULLB_PAGE_FREE (MAP_SZ - 2)

  parent reply	other threads:[~2026-12-02  3:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  3:16 [RFC PATCH v2 00/13] block/storage: Prepare for boot-time page size selection on arm64 Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 01/13] scsi: core: Add dma_boundary_page for page-size DMA boundaries Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 02/13] mtd: mtdswap: Initialise mtdswap_ops with a page size variable Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 03/13] mmc: mmc_test: Allocate the scratch buffer with the test buffer Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 04/13] md: Remove compile-time PAGE_SIZE use in md, dm and bcache Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 05/13] zram: Remove PAGE_SIZE use in preprocessor conditionals Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 06/13] xen/blkback: Size indirect_pages for the largest page size Eric Curtin
2026-12-02  3:16 ` Eric Curtin [this message]
2026-12-02  3:16 ` [RFC PATCH v2 08/13] drbd: Use PAGE_SHIFT_MIN in preprocessor checks Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 09/13] nvme: Check the DSM range buffer against PAGE_SIZE_MIN Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 10/13] dm: Initialise swap_bios from the runtime PAGE_SIZE Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 11/13] virtio: Handle boot-time PAGE_SIZE in balloon, blk and 9p transport Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 12/13] ata: sata_sil24: Use flexible arrays for the command block SGEs Eric Curtin
2026-12-02  3:16 ` [RFC PATCH v2 13/13] mm: Use PAGE_SIZE_MIN/MAX where a compile-time constant is required Eric Curtin

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=20261202031647.1690622-8-ericcurtin17@gmail.com \
    --to=ericcurtin17@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=eric.curtin@docker.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®