[PATCH 09/26] block: use logical block size for reparse checks

Ahmad Fatoum <[email protected]> Fri, 26 Jun 2026 10:42:20 +0200
Newsgroups org.infradead.lists.barebox
Message-ID <[email protected]>
A reparse of the partition table at close time is queued if the two
first sectors are written.

In preparation for allowing non-512-byte sectors, replace the hardcoded
512-byte sector size with the block size encoded into the block device.

Assisted-by: Codex:gpt-5.5
Signed-off-by: Ahmad Fatoum <[email protected]>
---
 common/block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/block.c b/common/block.c
index f4b2a692407a..20ec3665d900 100644
--- a/common/block.c
+++ b/common/block.c
@@ -326,7 +326,7 @@ static ssize_t block_op_write(struct cdev *cdev, const void *buf, size_t count,
 	 * written to LBA1, so LBA1 must change as well when the partioning
 	 * is changed.
 	 */
-	if (offset < 2 * SECTOR_SIZE)
+	if (offset < 2 * BLOCKSIZE(blk))
 		blk->need_reparse = true;
 
 	if (offset & mask) {
-- 
2.47.3