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 05:45:09PM +0100, 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.

Yes.  I actually have a half-finished patch doing the same lying around,
which I've not found time to rabse.

> (Fwiw, FMODE_NOACCOUNT and FMODE_BACKING could live in fops_flags as
>  well because they're also completely static but they aren't really
>  about file operations so they're better suited for FMODE_* imho.)

I'd still move them there.  I've also simply called fops_flags flags
so maybe it didn't bother me too much :)

> +/* File ops support async buffered reads */
> +#define FOP_BUF_RASYNC		BIT(0)
> +/* File ops support async nowait buffered writes */
> +#define FOP_BUF_WASYNC		BIT(1)

Can we spell out BUFFERED here when changing things?  BUF always confuses
me as it let's me thing of the buffer cache.

And can be please avoid this silly BIT() junk?  1u << N is shorter
and a lot more obvious than this random macro.

> +#define FOP_MMAP_SYNC		BIT(2)

Please throw in a comment for this one while you're at it.

> +/* File ops support non-exclusive O_DIRECT writes from multiple threads */
> +#define FOP_DIO_PARALLEL_WRITE	BIT(3)
> +
> +#define __fops_supported(f_op, flag) ((f_op)->fops_flags & (flag))
> +#define fops_buf_rasync(file) __fops_supported((file)->f_op, FOP_BUF_RASYNC)
> +#define fops_buf_wasync(file) __fops_supported((file)->f_op, FOP_BUF_WASYNC)
> +#define fops_mmap_sync(file) __fops_supported((file)->f_op, FOP_MMAP_SYNC)
> +#define fops_dio_parallel_write(file) __fops_supported((file)->f_op, FOP_DIO_PARALLEL_WRITE)

And please drop these helpers.  They just make grepping for the flags
a complete pain.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux