mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
mm: don't opencode filemap_fdatawrite_range in filemap_invalidate_inode
Use filemap_fdatawrite_range instead of opencoding the logic using filemap_fdatawrite_wbc. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://patch.msgid.link/20251024080431.324236-2-hch@lst.de Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
d6e6215907
commit
a21134b5d6
12
mm/filemap.c
12
mm/filemap.c
@@ -4457,16 +4457,8 @@ int filemap_invalidate_inode(struct inode *inode, bool flush,
|
||||
unmap_mapping_pages(mapping, first, nr, false);
|
||||
|
||||
/* Write back the data if we're asked to. */
|
||||
if (flush) {
|
||||
struct writeback_control wbc = {
|
||||
.sync_mode = WB_SYNC_ALL,
|
||||
.nr_to_write = LONG_MAX,
|
||||
.range_start = start,
|
||||
.range_end = end,
|
||||
};
|
||||
|
||||
filemap_fdatawrite_wbc(mapping, &wbc);
|
||||
}
|
||||
if (flush)
|
||||
filemap_fdatawrite_range(mapping, start, end);
|
||||
|
||||
/* Wait for writeback to complete on all folios and discard. */
|
||||
invalidate_inode_pages2_range(mapping, start / PAGE_SIZE, end / PAGE_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user