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

Christoph Hellwig
2020-01-30T16:15:22Z

On Thu, Jan 30, 2020 at 04:09:45PM +0000, Johannes Thumshirn wrote:
> > alloc_page - you should be able to use the already cached superblock
> > as the destination and source of I/O, assuming they are properly aligned
> > (and if not that could be fixed easily).
> >
>
> Care to elaborate? Who would have cached the superblock, when we haven't
> mounted the FS yet.

You use one allocation, which then gets owned by the in-memory suprblock
once probed. No need to allocate memory again to write it out.

>
> So here's the answer from that thread:
>
> "IIRC we had some funny bugs when mount and device scan (udev) raced
> just after mkfs, the page cache must be used so there's no way to read
> stale data."
> https://lore.kernel.org/linux-btrfs/20200117151352.GK3929@twin.jikos.cz/

Well, XFS has not used the page cache for any metadata since 2011, and
we've not run into those problems. But then again XFS doesn't use
the page cache for mkfs, does btrfs?