Re: [PATCH v3 0/5] btrfs: remove buffer heads form superblock handling

David Sterba
2020-01-30T16:16:31Z

On Thu, Jan 30, 2020 at 05:39:21AM -0800, Christoph Hellwig wrote:
> On Thu, Jan 30, 2020 at 01:15:30PM +0100, David Sterba wrote:
> > > Sure but with hch's proposed change to using read_cache_page_gfp() this
> > > doesn't make too much sense anymore at least for the read path.
> > >
> > > Maybe "use page cache for superblock reading"?
> >
> > That works too. We might need a new iteration that summarizes up all the
> > feedback so far, so we have same code to refer to.
>
> Per my question on the second patch: why even use the page cache at
> all. btrfs already caches the value outside the pagecache, so why
> even bother with the page cache overhead?

I'd like to remove the buffer_head interface in two steps. First remove
the wrappers and open code the calls, so the functionality is unchanged.
Then have another look if we can optimize that further, eg. removing the
page cache.

We've had subtle bugs when mount/scanning ioctl/mkfs interacted and did
not see a consistent state. See 6f60cbd3ae442cb35861bb522f388db123d42ec1
("btrfs: access superblock via pagecache in scan_one_device"). It's been
a few years so I don't recall all details, but it was quite hard to
catch. Mkfs followed by mount sometimes did not work.

So page cache is the common access point for all the parts and for now
we rely on that. If removing is possible, I'd like to see a good
explanation why and not such change lost in a well meant cleanup.