Re: How capacious and well-indexed are ext4, xfs and btrfs directories?

David Howells
2021-05-26T00:01:01Z

Andreas Dilger <adilger@dilger.ca> wrote:

> > Any thoughts on how that might scale? vfs_tmpfile() doesn't appear to
> > require the directory inode lock. I presume the directory is required for
> > security purposes in addition to being a way to specify the target
> > filesystem.
>
> I don't see how that would help much?

When it comes to dealing with a file I don't have cached, I can't probe the
cache file to find out whether it has data that I can read until I've opened
it (or found out it doesn't exist). When it comes to writing to a new cache
file, I can't start writing until the file is created and opened - but this
will potentially hold up close, data sync and writes that conflict (and have
to implicitly sync). If I can use vfs_tmpfile() to defer synchronous
directory accesses, that could be useful.

As mentioned, creating a link to a temporary cache file (ie. modifying the
directory) could be deferred to a background thread whilst allowing file I/O
to progress to the tmpfile.

David