Re: [PATCH] [RFC]: fs: claw back a few FMODE_* bits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 27, 2024 at 11:19:06AM -0600, Jens Axboe wrote:
> On 3/27/24 10:45 AM, Christian Brauner wrote:
> > There's a bunch of flags that are purely based on what the file
> > operations support while also never being conditionally set or unset.
> > IOW, they're not subject to change for individual file opens. Imho, such
> > flags don't need to live in f_mode they might as well live in the fops
> > structs itself. And the fops struct already has that lonely
> > mmap_supported_flags member. We might as well turn that into a generic
> > fops_flags member and move a few flags from FMODE_* space into FOP_*
> > space. That gets us four FMODE_* bits back and the ability for new
> > static flags that are about file ops to not have to live in FMODE_*
> > space but in their own FOP_* space. It's not the most beautiful thing
> > ever but it gets the job done. Yes, there'll be an additional pointer
> > chase but hopefully that won't matter for these flags.
> 
> Not doing that extra dereference is kind of the point of the FMODE_*
> flags, at least the ones that I care about. Probably not a huge deal for
> these cases though, as we're generally going to call one of the f_op
> handlers shortly anyway. The cases where we don't, at least for
> io_uring, we already cache the state separately.
> 
> Hence more of a general observation than an objection to the patch. I do
> like freeing up FMODE space, as it's (pretty) full.

Yes, I'm actuely aware that for some flags having them FMODE_* bits
might be performance sensitive. Moving FMODE_PATH would probably be very
noticeable due to it's use in __fget_files_rcu() and there might be
other cases like FMODE_NOWAIT and so on.

So I was delibaretely moving flags that really remain static and that
are unlikely to be in a hot path. And we certainly need to be careful
about this.

I think in the long-run it can bring us benefits for new flag proposals
that we wouldn't be willing to accept if they had to live in FMODE_*
space. Either because they're a one-off (the MAP_SYNC flag comes to
mind) or because they're not performance sensitive and of course only if
they're static.

We should still push back on unnecessary FMODE_* bit additions but we
may be able to be a little less stingy with FOP_* bits for a bit.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux