Use the standard writepages method (ext4_do_writepages()) to perform
writeout of ordered data during journal commit.
Signed-off-by: Jan Kara <[email protected]>
---
fs/ext4/ext4.h | 1 +
fs/ext4/inode.c | 16 ++++++++++++++++
fs/ext4/super.c | 3 +--
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index 1b3bffc04fd0..07b55cc48578 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -2999,6 +2999,7 @@ extern void ext4_set_inode_flags(struct inode *, bool init);
extern int ext4_alloc_da_blocks(struct inode *inode);
extern void ext4_set_aops(struct inode *inode);
extern int ext4_writepage_trans_blocks(struct inode *);
+extern int ext4_normal_submit_inode_data_buffers(struct jbd2_inode *jinode);
extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,
loff_t lstart, loff_t lend);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 00c4d12f8270..c131b611dabf 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2950,6 +2950,22 @@ static int ext4_writepages(struct address_space *mapping,
return ret;
}
+int ext4_normal_submit_inode_data_buffers(struct jbd2_inode *jinode)
+{
+ struct writeback_control wbc = {
+ .sync_mode = WB_SYNC_ALL,
+ .nr_to_write = LONG_MAX,
+ .range_start = jinode->i_dirty_start,
+ .range_end = jinode->i_dirty_end,
+ };
+ struct mpage_da_data mpd = {
+ .inode = jinode->i_vfs_inode,
+ .wbc = &wbc,
+ .can_map = 0,
+ };
+ return ext4_do_writepages(&mpd);
+}
+
static int ext4_dax_writepages(struct address_space *mapping,
struct writeback_control *wbc)
{
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 7cdd2138c897..c02329dd7574 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -540,8 +540,7 @@ static int ext4_journal_submit_inode_data_buffers(struct jbd2_inode *jinode)
if (ext4_should_journal_data(jinode->i_vfs_inode))
ret = ext4_journalled_submit_inode_data_buffers(jinode);
else
- ret = jbd2_journal_submit_inode_data_buffers(jinode);
-
+ ret = ext4_normal_submit_inode_data_buffers(jinode);
return ret;
}
--
2.35.3
On 22/11/30 05:35PM, Jan Kara wrote:
> Use the standard writepages method (ext4_do_writepages()) to perform
> writeout of ordered data during journal commit.
Neat!!
Please feel free to add:
Reviewed-by: Ritesh Harjani (IBM) <[email protected]>
>
> Signed-off-by: Jan Kara <[email protected]>
> ---
> fs/ext4/ext4.h | 1 +
> fs/ext4/inode.c | 16 ++++++++++++++++
> fs/ext4/super.c | 3 +--
> 3 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
> index 1b3bffc04fd0..07b55cc48578 100644
> --- a/fs/ext4/ext4.h
> +++ b/fs/ext4/ext4.h
> @@ -2999,6 +2999,7 @@ extern void ext4_set_inode_flags(struct inode *, bool init);
> extern int ext4_alloc_da_blocks(struct inode *inode);
> extern void ext4_set_aops(struct inode *inode);
> extern int ext4_writepage_trans_blocks(struct inode *);
> +extern int ext4_normal_submit_inode_data_buffers(struct jbd2_inode *jinode);
> extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
> extern int ext4_zero_partial_blocks(handle_t *handle, struct inode *inode,
> loff_t lstart, loff_t lend);
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 00c4d12f8270..c131b611dabf 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -2950,6 +2950,22 @@ static int ext4_writepages(struct address_space *mapping,
> return ret;
> }
>
> +int ext4_normal_submit_inode_data_buffers(struct jbd2_inode *jinode)
> +{
> + struct writeback_control wbc = {
> + .sync_mode = WB_SYNC_ALL,
> + .nr_to_write = LONG_MAX,
> + .range_start = jinode->i_dirty_start,
> + .range_end = jinode->i_dirty_end,
> + };
> + struct mpage_da_data mpd = {
> + .inode = jinode->i_vfs_inode,
> + .wbc = &wbc,
> + .can_map = 0,
> + };
> + return ext4_do_writepages(&mpd);
> +}
> +
> static int ext4_dax_writepages(struct address_space *mapping,
> struct writeback_control *wbc)
> {
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 7cdd2138c897..c02329dd7574 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -540,8 +540,7 @@ static int ext4_journal_submit_inode_data_buffers(struct jbd2_inode *jinode)
> if (ext4_should_journal_data(jinode->i_vfs_inode))
> ret = ext4_journalled_submit_inode_data_buffers(jinode);
> else
> - ret = jbd2_journal_submit_inode_data_buffers(jinode);
> -
> + ret = ext4_normal_submit_inode_data_buffers(jinode);
> return ret;
> }
>
> --
> 2.35.3
>