public inbox for linux-erofs@ozlabs.org
 help / color / mirror / Atom feed
From: Lucas Karpinski <lkarpinski@nvidia.com>
To: linux-erofs@lists.ozlabs.org
Cc: jcalmels@nvidia.com, Lucas Karpinski <lkarpinski@nvidia.com>
Subject: [PATCH v2 3/5] erofs-utils: lib: preserve primarydevice_blocks if already larger
Date: Mon,  9 Mar 2026 12:38:19 -0400	[thread overview]
Message-ID: <20260309-merge-fs-v2-3-2dd0ef53db4d@nvidia.com> (raw)
In-Reply-To: <20260309-merge-fs-v2-0-2dd0ef53db4d@nvidia.com>

Change erofs_importer_flush_all() to use max(). This allows callers to
pre-allocate space for data beyond the metadata region.

Signed-off-by: Lucas Karpinski <lkarpinski@nvidia.com>
---
 lib/importer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/importer.c b/lib/importer.c
index 26c86a0..56c8ea8 100644
--- a/lib/importer.c
+++ b/lib/importer.c
@@ -126,8 +126,9 @@ int erofs_importer_flush_all(struct erofs_importer *im)
 
 	fsalignblks = im->params->fsalignblks ?
 		roundup_pow_of_two(im->params->fsalignblks) : 1;
-	sbi->primarydevice_blocks = roundup(erofs_mapbh(sbi->bmgr, NULL),
-					    fsalignblks);
+	sbi->primarydevice_blocks = max_t(erofs_blk_t, sbi->primarydevice_blocks,
+					  roundup(erofs_mapbh(sbi->bmgr, NULL),
+						  fsalignblks));
 	err = erofs_write_device_table(sbi);
 	if (err)
 		return err;

-- 
Git-155)


  parent reply	other threads:[~2026-03-09 16:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09 16:38 [PATCH v2 0/5] erofs-utils: implement the FULLDATA rebuild mode Lucas Karpinski
2026-03-09 16:38 ` [PATCH v2 1/5] erofs-utils: lib: pass uniaddr_offset to erofs_rebuild_load_tree Lucas Karpinski
2026-03-09 16:38 ` [PATCH v2 2/5] erofs-utils: lib: add helper function erofs_uuid_unparse_as_tag Lucas Karpinski
2026-03-09 16:38 ` Lucas Karpinski [this message]
2026-03-09 16:38 ` [PATCH v2 4/5] erofs-utils: mfks: add rebuild FULLDATA for combined EROFS images Lucas Karpinski
2026-03-10 10:24   ` Gao Xiang
2026-03-09 16:38 ` [PATCH v2 5/5] erofs-utils: manpages: update to reflect fulldata support Lucas Karpinski

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=20260309-merge-fs-v2-3-2dd0ef53db4d@nvidia.com \
    --to=lkarpinski@nvidia.com \
    --cc=jcalmels@nvidia.com \
    --cc=linux-erofs@lists.ozlabs.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