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

Ahmad Fatoum a.fatoum at barebox.org
Fri Jun 26 01:42:20 PDT 2026


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 <a.fatoum at barebox.org>
---
 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




More information about the barebox mailing list