* [PATCH 1/2] ext4: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
@ 2024-02-29 14:24 Ritesh Harjani (IBM)
2024-02-29 14:24 ` [PATCH 2/2] ext2: " Ritesh Harjani (IBM)
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Ritesh Harjani (IBM) @ 2024-02-29 14:24 UTC (permalink / raw)
To: linux-ext4; +Cc: Jan Kara, Christoph Hellwig, Ritesh Harjani
From: Christoph Hellwig <hch@lst.de>
Since commit a2ad63daa88b ("VFS: add FMODE_CAN_ODIRECT file flag") file
systems can just set the FMODE_CAN_ODIRECT flag at open time instead of
wiring up a dummy direct_IO method to indicate support for direct I/O.
Signed-off-by: Christoph Hellwig <hch@lst.de>
[RH: Rebased to upstream]
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
Stumbled upon [1], while I was trying to enable this flag in ext4_file_open().
Looks like it might have slipped through the cracks.
Hence sending this patch with Christoph as the author.
[1]: https://lore.kernel.org/linux-ext4/20230612053731.585947-1-hch@lst.de/
fs/ext4/file.c | 2 +-
fs/ext4/inode.c | 4 ----
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index 54d6ff22585c..965febab1d04 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -886,7 +886,7 @@ static int ext4_file_open(struct inode *inode, struct file *filp)
}
filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC |
- FMODE_DIO_PARALLEL_WRITE;
+ FMODE_DIO_PARALLEL_WRITE | FMODE_CAN_ODIRECT;
return dquot_file_open(inode, filp);
}
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 2ccf3b5e3a7c..60a03b2ca178 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -3530,7 +3530,6 @@ static const struct address_space_operations ext4_aops = {
.bmap = ext4_bmap,
.invalidate_folio = ext4_invalidate_folio,
.release_folio = ext4_release_folio,
- .direct_IO = noop_direct_IO,
.migrate_folio = buffer_migrate_folio,
.is_partially_uptodate = block_is_partially_uptodate,
.error_remove_folio = generic_error_remove_folio,
@@ -3547,7 +3546,6 @@ static const struct address_space_operations ext4_journalled_aops = {
.bmap = ext4_bmap,
.invalidate_folio = ext4_journalled_invalidate_folio,
.release_folio = ext4_release_folio,
- .direct_IO = noop_direct_IO,
.migrate_folio = buffer_migrate_folio_norefs,
.is_partially_uptodate = block_is_partially_uptodate,
.error_remove_folio = generic_error_remove_folio,
@@ -3564,7 +3562,6 @@ static const struct address_space_operations ext4_da_aops = {
.bmap = ext4_bmap,
.invalidate_folio = ext4_invalidate_folio,
.release_folio = ext4_release_folio,
- .direct_IO = noop_direct_IO,
.migrate_folio = buffer_migrate_folio,
.is_partially_uptodate = block_is_partially_uptodate,
.error_remove_folio = generic_error_remove_folio,
@@ -3573,7 +3570,6 @@ static const struct address_space_operations ext4_da_aops = {
static const struct address_space_operations ext4_dax_aops = {
.writepages = ext4_dax_writepages,
- .direct_IO = noop_direct_IO,
.dirty_folio = noop_dirty_folio,
.bmap = ext4_bmap,
.swap_activate = ext4_iomap_swap_activate,
--
2.39.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] ext2: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
2024-02-29 14:24 [PATCH 1/2] ext4: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method Ritesh Harjani (IBM)
@ 2024-02-29 14:24 ` Ritesh Harjani (IBM)
2024-03-13 18:14 ` Jan Kara
2024-03-13 18:13 ` [PATCH 1/2] ext4: " Jan Kara
2024-05-02 14:54 ` Theodore Ts'o
2 siblings, 1 reply; 5+ messages in thread
From: Ritesh Harjani (IBM) @ 2024-02-29 14:24 UTC (permalink / raw)
To: linux-ext4; +Cc: Jan Kara, Christoph Hellwig, Ritesh Harjani (IBM)
Since commit a2ad63daa88b ("VFS: add FMODE_CAN_ODIRECT file flag") file
systems can just set the FMODE_CAN_ODIRECT flag at open time instead of
wiring up a dummy direct_IO method to indicate support for direct I/O.
Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
fs/ext2/file.c | 8 +++++++-
fs/ext2/inode.c | 2 --
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/fs/ext2/file.c b/fs/ext2/file.c
index 4ddc36f4dbd4..10b061ac5bc0 100644
--- a/fs/ext2/file.c
+++ b/fs/ext2/file.c
@@ -302,6 +302,12 @@ static ssize_t ext2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
return generic_file_write_iter(iocb, from);
}
+static int ext2_file_open(struct inode *inode, struct file *filp)
+{
+ filp->f_mode |= FMODE_CAN_ODIRECT;
+ return dquot_file_open(inode, filp);
+}
+
const struct file_operations ext2_file_operations = {
.llseek = generic_file_llseek,
.read_iter = ext2_file_read_iter,
@@ -311,7 +317,7 @@ const struct file_operations ext2_file_operations = {
.compat_ioctl = ext2_compat_ioctl,
#endif
.mmap = ext2_file_mmap,
- .open = dquot_file_open,
+ .open = ext2_file_open,
.release = ext2_release_file,
.fsync = ext2_fsync,
.get_unmapped_area = thp_get_unmapped_area,
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 5a4272b2c6b0..6f719d784eb9 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -965,7 +965,6 @@ const struct address_space_operations ext2_aops = {
.write_begin = ext2_write_begin,
.write_end = ext2_write_end,
.bmap = ext2_bmap,
- .direct_IO = noop_direct_IO,
.writepages = ext2_writepages,
.migrate_folio = buffer_migrate_folio,
.is_partially_uptodate = block_is_partially_uptodate,
@@ -974,7 +973,6 @@ const struct address_space_operations ext2_aops = {
static const struct address_space_operations ext2_dax_aops = {
.writepages = ext2_dax_writepages,
- .direct_IO = noop_direct_IO,
.dirty_folio = noop_dirty_folio,
};
--
2.39.2
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 2/2] ext2: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
2024-02-29 14:24 ` [PATCH 2/2] ext2: " Ritesh Harjani (IBM)
@ 2024-03-13 18:14 ` Jan Kara
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2024-03-13 18:14 UTC (permalink / raw)
To: Ritesh Harjani (IBM); +Cc: linux-ext4, Jan Kara, Christoph Hellwig
On Thu 29-02-24 19:54:13, Ritesh Harjani (IBM) wrote:
> Since commit a2ad63daa88b ("VFS: add FMODE_CAN_ODIRECT file flag") file
> systems can just set the FMODE_CAN_ODIRECT flag at open time instead of
> wiring up a dummy direct_IO method to indicate support for direct I/O.
>
> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Thanks. I'll take this into my tree once the merge window closes.
Honza
> ---
> fs/ext2/file.c | 8 +++++++-
> fs/ext2/inode.c | 2 --
> 2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ext2/file.c b/fs/ext2/file.c
> index 4ddc36f4dbd4..10b061ac5bc0 100644
> --- a/fs/ext2/file.c
> +++ b/fs/ext2/file.c
> @@ -302,6 +302,12 @@ static ssize_t ext2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
> return generic_file_write_iter(iocb, from);
> }
>
> +static int ext2_file_open(struct inode *inode, struct file *filp)
> +{
> + filp->f_mode |= FMODE_CAN_ODIRECT;
> + return dquot_file_open(inode, filp);
> +}
> +
> const struct file_operations ext2_file_operations = {
> .llseek = generic_file_llseek,
> .read_iter = ext2_file_read_iter,
> @@ -311,7 +317,7 @@ const struct file_operations ext2_file_operations = {
> .compat_ioctl = ext2_compat_ioctl,
> #endif
> .mmap = ext2_file_mmap,
> - .open = dquot_file_open,
> + .open = ext2_file_open,
> .release = ext2_release_file,
> .fsync = ext2_fsync,
> .get_unmapped_area = thp_get_unmapped_area,
> diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
> index 5a4272b2c6b0..6f719d784eb9 100644
> --- a/fs/ext2/inode.c
> +++ b/fs/ext2/inode.c
> @@ -965,7 +965,6 @@ const struct address_space_operations ext2_aops = {
> .write_begin = ext2_write_begin,
> .write_end = ext2_write_end,
> .bmap = ext2_bmap,
> - .direct_IO = noop_direct_IO,
> .writepages = ext2_writepages,
> .migrate_folio = buffer_migrate_folio,
> .is_partially_uptodate = block_is_partially_uptodate,
> @@ -974,7 +973,6 @@ const struct address_space_operations ext2_aops = {
>
> static const struct address_space_operations ext2_dax_aops = {
> .writepages = ext2_dax_writepages,
> - .direct_IO = noop_direct_IO,
> .dirty_folio = noop_dirty_folio,
> };
>
> --
> 2.39.2
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] ext4: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
2024-02-29 14:24 [PATCH 1/2] ext4: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method Ritesh Harjani (IBM)
2024-02-29 14:24 ` [PATCH 2/2] ext2: " Ritesh Harjani (IBM)
@ 2024-03-13 18:13 ` Jan Kara
2024-05-02 14:54 ` Theodore Ts'o
2 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2024-03-13 18:13 UTC (permalink / raw)
To: Ritesh Harjani (IBM); +Cc: linux-ext4, Jan Kara, Christoph Hellwig
On Thu 29-02-24 19:54:12, Ritesh Harjani (IBM) wrote:
> From: Christoph Hellwig <hch@lst.de>
>
> Since commit a2ad63daa88b ("VFS: add FMODE_CAN_ODIRECT file flag") file
> systems can just set the FMODE_CAN_ODIRECT flag at open time instead of
> wiring up a dummy direct_IO method to indicate support for direct I/O.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> [RH: Rebased to upstream]
> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Looks good! Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> Stumbled upon [1], while I was trying to enable this flag in ext4_file_open().
> Looks like it might have slipped through the cracks.
> Hence sending this patch with Christoph as the author.
> [1]: https://lore.kernel.org/linux-ext4/20230612053731.585947-1-hch@lst.de/
>
> fs/ext4/file.c | 2 +-
> fs/ext4/inode.c | 4 ----
> 2 files changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/fs/ext4/file.c b/fs/ext4/file.c
> index 54d6ff22585c..965febab1d04 100644
> --- a/fs/ext4/file.c
> +++ b/fs/ext4/file.c
> @@ -886,7 +886,7 @@ static int ext4_file_open(struct inode *inode, struct file *filp)
> }
>
> filp->f_mode |= FMODE_NOWAIT | FMODE_BUF_RASYNC |
> - FMODE_DIO_PARALLEL_WRITE;
> + FMODE_DIO_PARALLEL_WRITE | FMODE_CAN_ODIRECT;
> return dquot_file_open(inode, filp);
> }
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 2ccf3b5e3a7c..60a03b2ca178 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -3530,7 +3530,6 @@ static const struct address_space_operations ext4_aops = {
> .bmap = ext4_bmap,
> .invalidate_folio = ext4_invalidate_folio,
> .release_folio = ext4_release_folio,
> - .direct_IO = noop_direct_IO,
> .migrate_folio = buffer_migrate_folio,
> .is_partially_uptodate = block_is_partially_uptodate,
> .error_remove_folio = generic_error_remove_folio,
> @@ -3547,7 +3546,6 @@ static const struct address_space_operations ext4_journalled_aops = {
> .bmap = ext4_bmap,
> .invalidate_folio = ext4_journalled_invalidate_folio,
> .release_folio = ext4_release_folio,
> - .direct_IO = noop_direct_IO,
> .migrate_folio = buffer_migrate_folio_norefs,
> .is_partially_uptodate = block_is_partially_uptodate,
> .error_remove_folio = generic_error_remove_folio,
> @@ -3564,7 +3562,6 @@ static const struct address_space_operations ext4_da_aops = {
> .bmap = ext4_bmap,
> .invalidate_folio = ext4_invalidate_folio,
> .release_folio = ext4_release_folio,
> - .direct_IO = noop_direct_IO,
> .migrate_folio = buffer_migrate_folio,
> .is_partially_uptodate = block_is_partially_uptodate,
> .error_remove_folio = generic_error_remove_folio,
> @@ -3573,7 +3570,6 @@ static const struct address_space_operations ext4_da_aops = {
>
> static const struct address_space_operations ext4_dax_aops = {
> .writepages = ext4_dax_writepages,
> - .direct_IO = noop_direct_IO,
> .dirty_folio = noop_dirty_folio,
> .bmap = ext4_bmap,
> .swap_activate = ext4_iomap_swap_activate,
> --
> 2.39.2
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] ext4: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
2024-02-29 14:24 [PATCH 1/2] ext4: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method Ritesh Harjani (IBM)
2024-02-29 14:24 ` [PATCH 2/2] ext2: " Ritesh Harjani (IBM)
2024-03-13 18:13 ` [PATCH 1/2] ext4: " Jan Kara
@ 2024-05-02 14:54 ` Theodore Ts'o
2 siblings, 0 replies; 5+ messages in thread
From: Theodore Ts'o @ 2024-05-02 14:54 UTC (permalink / raw)
To: linux-ext4, Ritesh Harjani (IBM)
Cc: Theodore Ts'o, Jan Kara, Christoph Hellwig
On Thu, 29 Feb 2024 19:54:12 +0530, Ritesh Harjani (IBM) wrote:
> Since commit a2ad63daa88b ("VFS: add FMODE_CAN_ODIRECT file flag") file
> systems can just set the FMODE_CAN_ODIRECT flag at open time instead of
> wiring up a dummy direct_IO method to indicate support for direct I/O.
>
>
Applied, thanks!
[1/2] ext4: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method
commit: a0c7cce824a54dbb83bb722df19f1ddcfa5f8d25
Best regards,
--
Theodore Ts'o <tytso@mit.edu>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-05-02 14:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-29 14:24 [PATCH 1/2] ext4: set FMODE_CAN_ODIRECT instead of a dummy direct_IO method Ritesh Harjani (IBM)
2024-02-29 14:24 ` [PATCH 2/2] ext2: " Ritesh Harjani (IBM)
2024-03-13 18:14 ` Jan Kara
2024-03-13 18:13 ` [PATCH 1/2] ext4: " Jan Kara
2024-05-02 14:54 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox