Re: [PATCH 00/13] Parallelizing filesystem writeback

Kundan Kumar
2025-06-06T05:04:57Z

On Tue, Jun 3, 2025 at 7:35 PM Christoph Hellwig <hch@lst.de> wrote:
>
> On Tue, Jun 03, 2025 at 04:04:45PM +0200, Christoph Hellwig wrote:
> > On Tue, Jun 03, 2025 at 07:22:18PM +0530, Anuj gupta wrote:
> > > > A mount option is about the worst possible interface for behavior
> > > > that depends on file system implementation and possibly hardware
> > > > chacteristics. This needs to be set by the file systems, possibly
> > > > using generic helpers using hardware information.
> > >
> > > Right, that makes sense. Instead of using a mount option, we can
> > > introduce generic helpers to initialize multiple writeback contexts
> > > based on underlying hardware characteristics — e.g., number of CPUs or
> > > NUMA topology. Filesystems like XFS and EXT4 can then call these helpers
> > > during mount to opt into parallel writeback in a controlled way.
> >
> > Yes. A mount option might still be useful to override this default,
> > but it should not be needed for the normal use case.
>
> .. actually a sysfs file on the bdi is probably the better interface
> for the override than a mount option.

Hi Christoph,

Thanks for the suggestion — I agree the default should come from a
filesystem-level helper, not a mount option.

I looked into the sysfs override idea, but one challenge is that
nr_wb_ctx must be finalized before any writes occur. That leaves only
a narrow window — after the bdi is registered but before any inodes
are dirtied — where changing it is safe.

This makes the sysfs knob a bit fragile unless we tightly guard it
(e.g., mark it read-only after init). A mount option, even just as an
override, feels simpler and more predictable, since it’s set before
the FS becomes active.