]> www.infradead.org Git - users/hch/misc.git/commitdiff
ext4: increase IO priority of fastcommit
authorJulian Sun <sunjunchao@bytedance.com>
Wed, 27 Aug 2025 12:18:12 +0000 (20:18 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 25 Sep 2025 18:56:31 +0000 (14:56 -0400)
The following code paths may result in high latency or even task hangs:
   1. fastcommit io is throttled by wbt.
   2. jbd2_fc_wait_bufs() might wait for a long time while
JBD2_FAST_COMMIT_ONGOING is set in journal->flags, and then
jbd2_journal_commit_transaction() waits for the
JBD2_FAST_COMMIT_ONGOING bit for a long time while holding the write
lock of j_state_lock.
   3. start_this_handle() waits for read lock of j_state_lock which
results in high latency or task hang.

Given the fact that ext4_fc_commit() already modifies the current
process' IO priority to match that of the jbd2 thread, it should be
reasonable to match jbd2's IO submission flags as well.

Suggested-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Julian Sun <sunjunchao@bytedance.com>
Reviewed-by: Zhang Yi <yi.zhang@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Message-ID: <20250827121812.1477634-1-sunjunchao@bytedance.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/fast_commit.c

index 42bee1d4f9f97834d92d22cfc5d5e67d2e352458..fa66b08de9994ecf115e0422ea037d0677de0caa 100644 (file)
@@ -663,7 +663,7 @@ void ext4_fc_track_range(handle_t *handle, struct inode *inode, ext4_lblk_t star
 
 static void ext4_fc_submit_bh(struct super_block *sb, bool is_tail)
 {
-       blk_opf_t write_flags = REQ_SYNC;
+       blk_opf_t write_flags = JBD2_JOURNAL_REQ_FLAGS;
        struct buffer_head *bh = EXT4_SB(sb)->s_fc_bh;
 
        /* Add REQ_FUA | REQ_PREFLUSH only its tail */