public inbox for [email protected]
 help / color / mirror / Atom feed
From: Christoph Hellwig <[email protected]>
To: Christian Brauner <[email protected]>
Cc: [email protected], Jan Kara <[email protected]>,
	Christoph Hellwig <[email protected]>, Jens Axboe <[email protected]>,
	Alexander Viro <[email protected]>,
	[email protected]
Subject: Re: [PATCH] [RFC]: fs: claw back a few FMODE_* bits
Date: Thu, 28 Mar 2024 06:35:33 +0100	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <20240327-begibt-wacht-b9b9f4d1145a@brauner>

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.


  parent reply	other threads:[~2024-03-28  5:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 16:45 [PATCH] [RFC]: fs: claw back a few FMODE_* bits Christian Brauner
2024-03-27 17:19 ` Jens Axboe
2024-03-28  9:40   ` Christian Brauner
2024-03-28  1:18 ` Dave Chinner
2024-03-28  5:36   ` Christoph Hellwig
2024-03-28  8:06   ` Christian Brauner
2024-03-28  8:13     ` Christoph Hellwig
2024-03-28  9:41       ` Christian Brauner
2024-04-01 23:16     ` Dave Chinner
2024-03-28  5:35 ` Christoph Hellwig [this message]
2024-03-28  9:29   ` Christian Brauner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox