Re: [PATCH 1/6] fs: iomap: Atomic write support

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

 



On 13/02/2024 08:20, John Garry wrote:
On 13/02/2024 06:55, Christoph Hellwig wrote:
On Mon, Feb 05, 2024 at 11:29:57AM +0000, John Garry wrote:
Also, what's the meaning of REQ_OP_READ | REQ_ATOMIC?
REQ_ATOMIC will be ignored for REQ_OP_READ. I'm following the same policy
as something like RWF_SYNC for a read.
We've been rather sloppy with these flags in the past, which isn't
a good thing.  Let's add proper checking for new interfaces.

How about something like this:

----8<----

-static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
+static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags, int type)
 {
  int kiocb_flags = 0;

...

+ if (flags & RWF_ATOMIC) {
+ 	if (type == READ)
+ 		return -EOPNOTSUPP;
+ 	if (!(ki->ki_filp->f_mode & FMODE_CAN_ATOMIC_WRITE))
+ 		return -EOPNOTSUPP;
+ }
  kiocb_flags |= (__force int) (flags & RWF_SUPPORTED);
  if (flags & RWF_SYNC)
 	 kiocb_flags |= IOCB_DSYNC;

---->8----

I don't see a better place to add this check.

John




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux