Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ocfs2: don't opencode filemap_fdatawrite_range in ocfs2_journal_submit_inode_data_buffers

Use filemap_fdatawrite_range instead of opencoding the logic using
filemap_fdatawrite_wbc. There is a slight change in the conversion
as nr_to_write is now set to LONG_MAX instead of double the number
of the pages in the range. LONG_MAX is the usual nr_to_write for
WB_SYNC_ALL writeback, and the value expected by lower layers here.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://patch.msgid.link/20251024080431.324236-4-hch@lst.de
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Christoph Hellwig and committed by
Christian Brauner
890f141d 3c2e5cee

+2 -9
+2 -9
fs/ocfs2/journal.c
··· 902 902 903 903 static int ocfs2_journal_submit_inode_data_buffers(struct jbd2_inode *jinode) 904 904 { 905 - struct address_space *mapping = jinode->i_vfs_inode->i_mapping; 906 - struct writeback_control wbc = { 907 - .sync_mode = WB_SYNC_ALL, 908 - .nr_to_write = mapping->nrpages * 2, 909 - .range_start = jinode->i_dirty_start, 910 - .range_end = jinode->i_dirty_end, 911 - }; 912 - 913 - return filemap_fdatawrite_wbc(mapping, &wbc); 905 + return filemap_fdatawrite_range(jinode->i_vfs_inode->i_mapping, 906 + jinode->i_dirty_start, jinode->i_dirty_end); 914 907 } 915 908 916 909 int ocfs2_journal_init(struct ocfs2_super *osb, int *dirty)