public inbox for linux-erofs@ozlabs.org
 help / color / mirror / Atom feed
From: Utkal Singh <singhutkal015@gmail.com>
To: linux-erofs@lists.ozlabs.org
Subject: [RFC] fsck.erofs: design discussion for multi-threaded extraction
Date: Sun, 22 Mar 2026 05:57:52 +0000	[thread overview]
Message-ID: <20260322060028.15146-1-singhutkal015@gmail.com> (raw)

Hi Gao Xiang and EROFS community,

I have been contributing to erofs-utils since early March [1]. I would like to discuss a design for multi-threaded extraction in fsck.erofs and get feedback before writing more code.

Current state:
  - fsck.erofs is strictly single-threaded; erofs_verify_inode_data()
    serializes all decompression inside erofsfsck_check_inode()
  - lib/workqueue.c already provides erofs_alloc_workqueue(),
    erofs_queue_work(), and erofs_destroy_workqueue(), used by mkfs.erofs
    for multi-threaded compression (cfg.c_mt_workers, --workers=#)
  - Fragment cache was introduced in 1.8.5 (lib/fragments.c)

Proposed design:

  Since EROFS pclusters are independent, decompression can be
  parallelized while file creation and metadata application (chown,
  chmod, utimensat, xattrs) stay serialized in the main thread.

  Pipeline sketch:
    Main thread: inode walk -> erofs_queue_work() -> collect result
                 -> write output + apply metadata
    Worker N:    erofs_verify_inode_data() for one file

  I plan to reuse the existing erofs_workqueue infrastructure and
  follow the --workers=# convention already used in mkfs.erofs.

Design questions I would appreciate guidance on:

  Q1. Is the existing erofs_workqueue sufficient for fsck, or should
      max_jobs be bounded more tightly to control memory pressure for
      large images?

  Q2. For fragment-deduplicated files (fragment cache from 1.8.5),
      should workers share a mutex around fragment reads, or should
      fragment reads remain in the main thread?

  Q3. Is per-file the right parallelism granularity, or would
      per-pcluster be better for large single compressed files?

  Q4. Should fsck follow --workers=# (matching mkfs) or use -T#?

[1] https://lore.kernel.org/linux-erofs/CAGSu4WPCYtq-+hVc-tg_A4u3a3zxnizx7ui7QSO0R8V1DirJSg@mail.gmail.com/

Thanks,
Utkal Singh


                 reply	other threads:[~2026-03-22  6:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260322060028.15146-1-singhutkal015@gmail.com \
    --to=singhutkal015@gmail.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