Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yifan Zhao <stopire@gmail.com>
To: linux-erofs@lists.ozlabs.org
Cc: xiang@kernel.org, Yifan Zhao <stopire@gmail.com>
Subject: [PATCH 3/4] erofs-utils: lib: fix rebuilding empty chunk-based files
Date: Thu, 17 Sep 2026 11:53:48 +0800	[thread overview]
Message-ID: <20260917035349.1339521-3-stopire@gmail.com> (raw)
In-Reply-To: <20260917035349.1339521-1-stopire@gmail.com>

Switch empty files to FLAT_PLAIN before setting u.i_blkaddr to
EROFS_NULL_ADDR, which would otherwise overwrite u.chunkformat.

Fixes: b0b1711d4611 ("erofs-utils: support building image with reserved space")
Assisted-by: Codex:gpt-6-astra
Signed-off-by: Yifan Zhao <stopire@gmail.com>
---
 lib/rebuild.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/rebuild.c b/lib/rebuild.c
index ebac1c5..c378885 100644
--- a/lib/rebuild.c
+++ b/lib/rebuild.c
@@ -335,6 +335,7 @@ static int erofs_rebuild_update_inode(struct erofs_sb_info *dst_sb,
 	}
 	case S_IFREG:
 		if (!inode->i_size) {
+			inode->datalayout = EROFS_INODE_FLAT_PLAIN;
 			inode->u.i_blkaddr = EROFS_NULL_ADDR;
 			break;
 		}
-- 
2.55.0



  parent reply	other threads:[~2026-09-17  3:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17  3:53 [PATCH 1/4] erofs-utils: fsck: fix hole handling during extraction Yifan Zhao
2026-09-17  3:53 ` [PATCH 2/4] erofs-utils: mkfs: validate chunksize before computing chunkbits Yifan Zhao
2026-09-17  3:53 ` Yifan Zhao [this message]
2026-09-17  3:53 ` [PATCH 4/4] erofs-utils: fsck: avoid truncating lseek() return values Yifan Zhao

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=20260917035349.1339521-3-stopire@gmail.com \
    --to=stopire@gmail.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=xiang@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