Re: [PATCH 4/7] xfs: Implement fallocate query support mode

Theodore Ts'o
2017-09-19T14:57:36Z

On Mon, Sep 18, 2017 at 03:55:40PM -0600, Andreas Dilger wrote:
> > And like hch said, why not {f,}pathconf?
>
> The problem with pathconf() is that this is just made up by GlibC, and
> doesn't actually communicate with the kernel or the filesystem at all.
> For example, _PC_LINK_MAX does not return different values for ext2/ext4
> filesystems based on feature flags, only what is hard-coded into GlibC
> based on the filesystem magic. This is not going to work as a per-file
> source of information.
>
> For example, even though EXT4_LINK_MAX has been 65000 for many years,
> GlibC reports 32000 for an ext4 filesystem since it only uses the magic:

Maybe the right answer is we should define a new pathconfat(2) system
call which can be used as part of a C library's implementation of
pathconf() and fpathconf()? glibc probably won't use it for years, of
course. But we can at least provide the information via an interface
which we can control, and which is capable of returning correct
results?

- Ted