fs: add FMODE_DIO_PARALLEL_WRITE flag
JIRA: https://issues.redhat.com/browse/RHEL-12076 commit d8aeb44a9ae324c4b823689fabb30b6621d93c88 Author: Jens Axboe <axboe@kernel.dk> Date: Tue Mar 7 09:40:28 2023 -0700 fs: add FMODE_DIO_PARALLEL_WRITE flag Some filesystems support multiple threads writing to the same file with O_DIRECT without requiring exclusive access to it. io_uring can use this hint to avoid serializing dio writes to this inode, instead allowing them to run in parallel. XFS and ext4 both fall into this category, so set the flag for both of them. Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
This commit is contained in:
parent
21ad2bca33
commit
beaafcc2c0
|
@ -900,7 +900,8 @@ static int ext4_file_open(struct inode *inode, struct file *filp)
|
|||
return ret;
|
||||
}
|
||||
|
||||
filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC;
|
||||
filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC |
|
||||
FMODE_DIO_PARALLEL_WRITE;
|
||||
return dquot_file_open(inode, filp);
|
||||
}
|
||||
|
||||
|
|
|
@ -1171,7 +1171,8 @@ xfs_file_open(
|
|||
{
|
||||
if (xfs_is_shutdown(XFS_M(inode->i_sb)))
|
||||
return -EIO;
|
||||
file->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC | FMODE_BUF_WASYNC;
|
||||
file->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC | FMODE_BUF_WASYNC |
|
||||
FMODE_DIO_PARALLEL_WRITE;
|
||||
return generic_file_open(inode, file);
|
||||
}
|
||||
|
||||
|
|
|
@ -159,6 +159,9 @@ typedef int (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
|
|||
/* File supports DIRECT IO */
|
||||
#define FMODE_CAN_ODIRECT ((__force fmode_t)0x400000)
|
||||
|
||||
/* File supports non-exclusive O_DIRECT writes from multiple threads */
|
||||
#define FMODE_DIO_PARALLEL_WRITE ((__force fmode_t)0x1000000)
|
||||
|
||||
/* File was opened by fanotify and shouldn't generate fanotify events */
|
||||
#define FMODE_NONOTIFY ((__force fmode_t)0x4000000)
|
||||
|
||||
|
|
Loading…
Reference in New Issue