fs: Make wbc_to_tag() inline and use it in fs.
The logic in wbc_to_tag() is widely used in file systems, so modify this function to be inline and use it in file systems. This patch has only passed compilation tests, but it should be fine. Signed-off-by: Julian Sun <sunjunchao@bytedance.com> Reviewed-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>pull/1354/merge
parent
891bea757c
commit
4952f35f05
|
|
@ -2460,10 +2460,7 @@ static int extent_write_cache_pages(struct address_space *mapping,
|
||||||
&BTRFS_I(inode)->runtime_flags))
|
&BTRFS_I(inode)->runtime_flags))
|
||||||
wbc->tagged_writepages = 1;
|
wbc->tagged_writepages = 1;
|
||||||
|
|
||||||
if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
|
tag = wbc_to_tag(wbc);
|
||||||
tag = PAGECACHE_TAG_TOWRITE;
|
|
||||||
else
|
|
||||||
tag = PAGECACHE_TAG_DIRTY;
|
|
||||||
retry:
|
retry:
|
||||||
if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
|
if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
|
||||||
tag_pages_for_writeback(mapping, index, end);
|
tag_pages_for_writeback(mapping, index, end);
|
||||||
|
|
|
||||||
|
|
@ -1045,11 +1045,7 @@ void ceph_init_writeback_ctl(struct address_space *mapping,
|
||||||
ceph_wbc->index = ceph_wbc->start_index;
|
ceph_wbc->index = ceph_wbc->start_index;
|
||||||
ceph_wbc->end = -1;
|
ceph_wbc->end = -1;
|
||||||
|
|
||||||
if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages) {
|
ceph_wbc->tag = wbc_to_tag(wbc);
|
||||||
ceph_wbc->tag = PAGECACHE_TAG_TOWRITE;
|
|
||||||
} else {
|
|
||||||
ceph_wbc->tag = PAGECACHE_TAG_DIRTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
ceph_wbc->op_idx = -1;
|
ceph_wbc->op_idx = -1;
|
||||||
ceph_wbc->num_ops = 0;
|
ceph_wbc->num_ops = 0;
|
||||||
|
|
|
||||||
|
|
@ -2619,10 +2619,7 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)
|
||||||
handle_t *handle = NULL;
|
handle_t *handle = NULL;
|
||||||
int bpp = ext4_journal_blocks_per_folio(mpd->inode);
|
int bpp = ext4_journal_blocks_per_folio(mpd->inode);
|
||||||
|
|
||||||
if (mpd->wbc->sync_mode == WB_SYNC_ALL || mpd->wbc->tagged_writepages)
|
tag = wbc_to_tag(mpd->wbc);
|
||||||
tag = PAGECACHE_TAG_TOWRITE;
|
|
||||||
else
|
|
||||||
tag = PAGECACHE_TAG_DIRTY;
|
|
||||||
|
|
||||||
mpd->map.m_len = 0;
|
mpd->map.m_len = 0;
|
||||||
mpd->next_pos = mpd->start_pos;
|
mpd->next_pos = mpd->start_pos;
|
||||||
|
|
|
||||||
|
|
@ -2986,10 +2986,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
|
||||||
if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
|
if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
|
||||||
range_whole = 1;
|
range_whole = 1;
|
||||||
}
|
}
|
||||||
if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
|
tag = wbc_to_tag(wbc);
|
||||||
tag = PAGECACHE_TAG_TOWRITE;
|
|
||||||
else
|
|
||||||
tag = PAGECACHE_TAG_DIRTY;
|
|
||||||
retry:
|
retry:
|
||||||
retry = 0;
|
retry = 0;
|
||||||
if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
|
if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
|
||||||
|
|
|
||||||
|
|
@ -311,10 +311,7 @@ static int gfs2_write_cache_jdata(struct address_space *mapping,
|
||||||
range_whole = 1;
|
range_whole = 1;
|
||||||
cycled = 1; /* ignore range_cyclic tests */
|
cycled = 1; /* ignore range_cyclic tests */
|
||||||
}
|
}
|
||||||
if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
|
tag = wbc_to_tag(wbc);
|
||||||
tag = PAGECACHE_TAG_TOWRITE;
|
|
||||||
else
|
|
||||||
tag = PAGECACHE_TAG_DIRTY;
|
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
|
if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
|
||||||
|
|
|
||||||
|
|
@ -196,6 +196,13 @@ static inline void wait_on_inode(struct inode *inode)
|
||||||
!(READ_ONCE(inode->i_state) & I_NEW));
|
!(READ_ONCE(inode->i_state) & I_NEW));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline xa_mark_t wbc_to_tag(struct writeback_control *wbc)
|
||||||
|
{
|
||||||
|
if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
|
||||||
|
return PAGECACHE_TAG_TOWRITE;
|
||||||
|
return PAGECACHE_TAG_DIRTY;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_CGROUP_WRITEBACK
|
#ifdef CONFIG_CGROUP_WRITEBACK
|
||||||
|
|
||||||
#include <linux/cgroup.h>
|
#include <linux/cgroup.h>
|
||||||
|
|
|
||||||
|
|
@ -2434,12 +2434,6 @@ static bool folio_prepare_writeback(struct address_space *mapping,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static xa_mark_t wbc_to_tag(struct writeback_control *wbc)
|
|
||||||
{
|
|
||||||
if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
|
|
||||||
return PAGECACHE_TAG_TOWRITE;
|
|
||||||
return PAGECACHE_TAG_DIRTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
static pgoff_t wbc_end(struct writeback_control *wbc)
|
static pgoff_t wbc_end(struct writeback_control *wbc)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue