linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] fs: Make wbc_to_tag() extern and use it in fs.
@ 2025-09-29  9:55 Julian Sun via Linux-f2fs-devel
  2025-09-29 10:15 ` Qu Wenruo via Linux-f2fs-devel
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Julian Sun via Linux-f2fs-devel @ 2025-09-29  9:55 UTC (permalink / raw)
  To: linux-fsdevel, linux-f2fs-devel, linux-ext4, ceph-devel,
	linux-btrfs
  Cc: brauner, tytso, agruenba, jack, willy, clm, adilger.kernel,
	dsterba, jaegeuk, idryomov, xiubli

The logic in wbc_to_tag() is widely used in file systems, so modify this
function to be extern 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>
---
 fs/btrfs/extent_io.c      | 5 +----
 fs/ceph/addr.c            | 6 +-----
 fs/ext4/inode.c           | 5 +----
 fs/f2fs/data.c            | 5 +----
 fs/gfs2/aops.c            | 5 +----
 include/linux/writeback.h | 1 +
 mm/page-writeback.c       | 2 +-
 7 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index b21cb72835cc..0fea58287175 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -2390,10 +2390,7 @@ static int extent_write_cache_pages(struct address_space *mapping,
 			       &BTRFS_I(inode)->runtime_flags))
 		wbc->tagged_writepages = 1;
 
-	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
-		tag = PAGECACHE_TAG_TOWRITE;
-	else
-		tag = PAGECACHE_TAG_DIRTY;
+	tag = wbc_to_tag(wbc);
 retry:
 	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
 		tag_pages_for_writeback(mapping, index, end);
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
index 322ed268f14a..63b75d214210 100644
--- a/fs/ceph/addr.c
+++ b/fs/ceph/addr.c
@@ -1045,11 +1045,7 @@ void ceph_init_writeback_ctl(struct address_space *mapping,
 	ceph_wbc->index = ceph_wbc->start_index;
 	ceph_wbc->end = -1;
 
-	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages) {
-		ceph_wbc->tag = PAGECACHE_TAG_TOWRITE;
-	} else {
-		ceph_wbc->tag = PAGECACHE_TAG_DIRTY;
-	}
+	ceph_wbc->tag = wbc_to_tag(wbc);
 
 	ceph_wbc->op_idx = -1;
 	ceph_wbc->num_ops = 0;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 5b7a15db4953..196eba7fa39c 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2619,10 +2619,7 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)
 	handle_t *handle = NULL;
 	int bpp = ext4_journal_blocks_per_folio(mpd->inode);
 
-	if (mpd->wbc->sync_mode == WB_SYNC_ALL || mpd->wbc->tagged_writepages)
-		tag = PAGECACHE_TAG_TOWRITE;
-	else
-		tag = PAGECACHE_TAG_DIRTY;
+	tag = wbc_to_tag(mpd->wbc);
 
 	mpd->map.m_len = 0;
 	mpd->next_pos = mpd->start_pos;
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 7961e0ddfca3..101e962845db 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3003,10 +3003,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
 		if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
 			range_whole = 1;
 	}
-	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
-		tag = PAGECACHE_TAG_TOWRITE;
-	else
-		tag = PAGECACHE_TAG_DIRTY;
+	tag = wbc_to_tag(wbc);
 retry:
 	retry = 0;
 	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 47d74afd63ac..12394fc5dd29 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -311,10 +311,7 @@ static int gfs2_write_cache_jdata(struct address_space *mapping,
 			range_whole = 1;
 		cycled = 1; /* ignore range_cyclic tests */
 	}
-	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
-		tag = PAGECACHE_TAG_TOWRITE;
-	else
-		tag = PAGECACHE_TAG_DIRTY;
+	tag = wbc_to_tag(wbc);
 
 retry:
 	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index a2848d731a46..884811596e10 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -370,6 +370,7 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
 void writeback_set_ratelimit(void);
 void tag_pages_for_writeback(struct address_space *mapping,
 			     pgoff_t start, pgoff_t end);
+xa_mark_t wbc_to_tag(struct writeback_control *wbc);
 
 bool filemap_dirty_folio(struct address_space *mapping, struct folio *folio);
 bool folio_redirty_for_writepage(struct writeback_control *, struct folio *);
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 3e248d1c3969..243808e19445 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -2434,7 +2434,7 @@ static bool folio_prepare_writeback(struct address_space *mapping,
 	return true;
 }
 
-static xa_mark_t wbc_to_tag(struct writeback_control *wbc)
+xa_mark_t wbc_to_tag(struct writeback_control *wbc)
 {
 	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
 		return PAGECACHE_TAG_TOWRITE;
-- 
2.39.5



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [f2fs-dev] [PATCH] fs: Make wbc_to_tag() extern and use it in fs.
  2025-09-29  9:55 [f2fs-dev] [PATCH] fs: Make wbc_to_tag() extern and use it in fs Julian Sun via Linux-f2fs-devel
@ 2025-09-29 10:15 ` Qu Wenruo via Linux-f2fs-devel
  2025-09-29 10:57   ` Julian Sun
  2025-09-29 10:18 ` Jan Kara
  2025-09-30  1:47 ` kernel test robot
  2 siblings, 1 reply; 5+ messages in thread
From: Qu Wenruo via Linux-f2fs-devel @ 2025-09-29 10:15 UTC (permalink / raw)
  To: Julian Sun, linux-fsdevel, linux-f2fs-devel, linux-ext4,
	ceph-devel, linux-btrfs
  Cc: brauner, tytso, agruenba, jack, willy, clm, adilger.kernel,
	dsterba, jaegeuk, idryomov, xiubli



在 2025/9/29 19:25, Julian Sun 写道:
> The logic in wbc_to_tag() is widely used in file systems, so modify this
> function to be extern 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>
> ---
>   fs/btrfs/extent_io.c      | 5 +----
>   fs/ceph/addr.c            | 6 +-----
>   fs/ext4/inode.c           | 5 +----
>   fs/f2fs/data.c            | 5 +----
>   fs/gfs2/aops.c            | 5 +----
>   include/linux/writeback.h | 1 +
>   mm/page-writeback.c       | 2 +-
>   7 files changed, 7 insertions(+), 22 deletions(-)
> 
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index b21cb72835cc..0fea58287175 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -2390,10 +2390,7 @@ static int extent_write_cache_pages(struct address_space *mapping,
>   			       &BTRFS_I(inode)->runtime_flags))
>   		wbc->tagged_writepages = 1;
>   
> -	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> -		tag = PAGECACHE_TAG_TOWRITE;
> -	else
> -		tag = PAGECACHE_TAG_DIRTY;
> +	tag = wbc_to_tag(wbc);
>   retry:
>   	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
>   		tag_pages_for_writeback(mapping, index, end);
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 322ed268f14a..63b75d214210 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -1045,11 +1045,7 @@ void ceph_init_writeback_ctl(struct address_space *mapping,
>   	ceph_wbc->index = ceph_wbc->start_index;
>   	ceph_wbc->end = -1;
>   
> -	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages) {
> -		ceph_wbc->tag = PAGECACHE_TAG_TOWRITE;
> -	} else {
> -		ceph_wbc->tag = PAGECACHE_TAG_DIRTY;
> -	}
> +	ceph_wbc->tag = wbc_to_tag(wbc);
>   
>   	ceph_wbc->op_idx = -1;
>   	ceph_wbc->num_ops = 0;
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 5b7a15db4953..196eba7fa39c 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -2619,10 +2619,7 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)
>   	handle_t *handle = NULL;
>   	int bpp = ext4_journal_blocks_per_folio(mpd->inode);
>   
> -	if (mpd->wbc->sync_mode == WB_SYNC_ALL || mpd->wbc->tagged_writepages)
> -		tag = PAGECACHE_TAG_TOWRITE;
> -	else
> -		tag = PAGECACHE_TAG_DIRTY;
> +	tag = wbc_to_tag(mpd->wbc);
>   
>   	mpd->map.m_len = 0;
>   	mpd->next_pos = mpd->start_pos;
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 7961e0ddfca3..101e962845db 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -3003,10 +3003,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
>   		if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
>   			range_whole = 1;
>   	}
> -	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> -		tag = PAGECACHE_TAG_TOWRITE;
> -	else
> -		tag = PAGECACHE_TAG_DIRTY;
> +	tag = wbc_to_tag(wbc);
>   retry:
>   	retry = 0;
>   	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
> index 47d74afd63ac..12394fc5dd29 100644
> --- a/fs/gfs2/aops.c
> +++ b/fs/gfs2/aops.c
> @@ -311,10 +311,7 @@ static int gfs2_write_cache_jdata(struct address_space *mapping,
>   			range_whole = 1;
>   		cycled = 1; /* ignore range_cyclic tests */
>   	}
> -	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> -		tag = PAGECACHE_TAG_TOWRITE;
> -	else
> -		tag = PAGECACHE_TAG_DIRTY;
> +	tag = wbc_to_tag(wbc);
>   
>   retry:
>   	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> diff --git a/include/linux/writeback.h b/include/linux/writeback.h
> index a2848d731a46..884811596e10 100644
> --- a/include/linux/writeback.h
> +++ b/include/linux/writeback.h
> @@ -370,6 +370,7 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
>   void writeback_set_ratelimit(void);
>   void tag_pages_for_writeback(struct address_space *mapping,
>   			     pgoff_t start, pgoff_t end);
> +xa_mark_t wbc_to_tag(struct writeback_control *wbc);
>   
>   bool filemap_dirty_folio(struct address_space *mapping, struct folio *folio);
>   bool folio_redirty_for_writepage(struct writeback_control *, struct folio *);
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index 3e248d1c3969..243808e19445 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -2434,7 +2434,7 @@ static bool folio_prepare_writeback(struct address_space *mapping,
>   	return true;
>   }
>   
> -static xa_mark_t wbc_to_tag(struct writeback_control *wbc)
> +xa_mark_t wbc_to_tag(struct writeback_control *wbc)

The function is small enough, why not export it as an inline function?

The current version also lacks EXPORT_SYMBOL(), it may cause problems 
for fses built as a module.

Thanks,
Qu

>   {
>   	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
>   		return PAGECACHE_TAG_TOWRITE;



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [f2fs-dev] [PATCH] fs: Make wbc_to_tag() extern and use it in fs.
  2025-09-29  9:55 [f2fs-dev] [PATCH] fs: Make wbc_to_tag() extern and use it in fs Julian Sun via Linux-f2fs-devel
  2025-09-29 10:15 ` Qu Wenruo via Linux-f2fs-devel
@ 2025-09-29 10:18 ` Jan Kara
  2025-09-30  1:47 ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2025-09-29 10:18 UTC (permalink / raw)
  To: Julian Sun
  Cc: brauner, xiubli, tytso, agruenba, jack, willy, linux-f2fs-devel,
	clm, dsterba, jaegeuk, linux-fsdevel, adilger.kernel, ceph-devel,
	linux-ext4, idryomov, linux-btrfs

On Mon 29-09-25 17:55:44, Julian Sun wrote:
> The logic in wbc_to_tag() is widely used in file systems, so modify this
> function to be extern 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>

Yeah, good idea. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/btrfs/extent_io.c      | 5 +----
>  fs/ceph/addr.c            | 6 +-----
>  fs/ext4/inode.c           | 5 +----
>  fs/f2fs/data.c            | 5 +----
>  fs/gfs2/aops.c            | 5 +----
>  include/linux/writeback.h | 1 +
>  mm/page-writeback.c       | 2 +-
>  7 files changed, 7 insertions(+), 22 deletions(-)
> 
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index b21cb72835cc..0fea58287175 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -2390,10 +2390,7 @@ static int extent_write_cache_pages(struct address_space *mapping,
>  			       &BTRFS_I(inode)->runtime_flags))
>  		wbc->tagged_writepages = 1;
>  
> -	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> -		tag = PAGECACHE_TAG_TOWRITE;
> -	else
> -		tag = PAGECACHE_TAG_DIRTY;
> +	tag = wbc_to_tag(wbc);
>  retry:
>  	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
>  		tag_pages_for_writeback(mapping, index, end);
> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> index 322ed268f14a..63b75d214210 100644
> --- a/fs/ceph/addr.c
> +++ b/fs/ceph/addr.c
> @@ -1045,11 +1045,7 @@ void ceph_init_writeback_ctl(struct address_space *mapping,
>  	ceph_wbc->index = ceph_wbc->start_index;
>  	ceph_wbc->end = -1;
>  
> -	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages) {
> -		ceph_wbc->tag = PAGECACHE_TAG_TOWRITE;
> -	} else {
> -		ceph_wbc->tag = PAGECACHE_TAG_DIRTY;
> -	}
> +	ceph_wbc->tag = wbc_to_tag(wbc);
>  
>  	ceph_wbc->op_idx = -1;
>  	ceph_wbc->num_ops = 0;
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 5b7a15db4953..196eba7fa39c 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -2619,10 +2619,7 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)
>  	handle_t *handle = NULL;
>  	int bpp = ext4_journal_blocks_per_folio(mpd->inode);
>  
> -	if (mpd->wbc->sync_mode == WB_SYNC_ALL || mpd->wbc->tagged_writepages)
> -		tag = PAGECACHE_TAG_TOWRITE;
> -	else
> -		tag = PAGECACHE_TAG_DIRTY;
> +	tag = wbc_to_tag(mpd->wbc);
>  
>  	mpd->map.m_len = 0;
>  	mpd->next_pos = mpd->start_pos;
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 7961e0ddfca3..101e962845db 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -3003,10 +3003,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
>  		if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
>  			range_whole = 1;
>  	}
> -	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> -		tag = PAGECACHE_TAG_TOWRITE;
> -	else
> -		tag = PAGECACHE_TAG_DIRTY;
> +	tag = wbc_to_tag(wbc);
>  retry:
>  	retry = 0;
>  	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
> index 47d74afd63ac..12394fc5dd29 100644
> --- a/fs/gfs2/aops.c
> +++ b/fs/gfs2/aops.c
> @@ -311,10 +311,7 @@ static int gfs2_write_cache_jdata(struct address_space *mapping,
>  			range_whole = 1;
>  		cycled = 1; /* ignore range_cyclic tests */
>  	}
> -	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> -		tag = PAGECACHE_TAG_TOWRITE;
> -	else
> -		tag = PAGECACHE_TAG_DIRTY;
> +	tag = wbc_to_tag(wbc);
>  
>  retry:
>  	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> diff --git a/include/linux/writeback.h b/include/linux/writeback.h
> index a2848d731a46..884811596e10 100644
> --- a/include/linux/writeback.h
> +++ b/include/linux/writeback.h
> @@ -370,6 +370,7 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
>  void writeback_set_ratelimit(void);
>  void tag_pages_for_writeback(struct address_space *mapping,
>  			     pgoff_t start, pgoff_t end);
> +xa_mark_t wbc_to_tag(struct writeback_control *wbc);
>  
>  bool filemap_dirty_folio(struct address_space *mapping, struct folio *folio);
>  bool folio_redirty_for_writepage(struct writeback_control *, struct folio *);
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index 3e248d1c3969..243808e19445 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -2434,7 +2434,7 @@ static bool folio_prepare_writeback(struct address_space *mapping,
>  	return true;
>  }
>  
> -static xa_mark_t wbc_to_tag(struct writeback_control *wbc)
> +xa_mark_t wbc_to_tag(struct writeback_control *wbc)
>  {
>  	if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
>  		return PAGECACHE_TAG_TOWRITE;
> -- 
> 2.39.5
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [f2fs-dev] [PATCH] fs: Make wbc_to_tag() extern and use it in fs.
  2025-09-29 10:15 ` Qu Wenruo via Linux-f2fs-devel
@ 2025-09-29 10:57   ` Julian Sun
  0 siblings, 0 replies; 5+ messages in thread
From: Julian Sun @ 2025-09-29 10:57 UTC (permalink / raw)
  To: Qu Wenruo
  Cc: brauner, xiubli, tytso, agruenba, Julian Sun, jack, willy,
	linux-f2fs-devel, clm, dsterba, jaegeuk, linux-fsdevel,
	adilger.kernel, ceph-devel, linux-ext4, idryomov, linux-btrfs

On Mon, Sep 29, 2025 at 6:16 PM Qu Wenruo <wqu@suse.com> wrote:
>
>
>
> 在 2025/9/29 19:25, Julian Sun 写道:
> > The logic in wbc_to_tag() is widely used in file systems, so modify this
> > function to be extern 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>
> > ---
> >   fs/btrfs/extent_io.c      | 5 +----
> >   fs/ceph/addr.c            | 6 +-----
> >   fs/ext4/inode.c           | 5 +----
> >   fs/f2fs/data.c            | 5 +----
> >   fs/gfs2/aops.c            | 5 +----
> >   include/linux/writeback.h | 1 +
> >   mm/page-writeback.c       | 2 +-
> >   7 files changed, 7 insertions(+), 22 deletions(-)
> >
> > diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> > index b21cb72835cc..0fea58287175 100644
> > --- a/fs/btrfs/extent_io.c
> > +++ b/fs/btrfs/extent_io.c
> > @@ -2390,10 +2390,7 @@ static int extent_write_cache_pages(struct address_space *mapping,
> >                              &BTRFS_I(inode)->runtime_flags))
> >               wbc->tagged_writepages = 1;
> >
> > -     if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> > -             tag = PAGECACHE_TAG_TOWRITE;
> > -     else
> > -             tag = PAGECACHE_TAG_DIRTY;
> > +     tag = wbc_to_tag(wbc);
> >   retry:
> >       if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> >               tag_pages_for_writeback(mapping, index, end);
> > diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c
> > index 322ed268f14a..63b75d214210 100644
> > --- a/fs/ceph/addr.c
> > +++ b/fs/ceph/addr.c
> > @@ -1045,11 +1045,7 @@ void ceph_init_writeback_ctl(struct address_space *mapping,
> >       ceph_wbc->index = ceph_wbc->start_index;
> >       ceph_wbc->end = -1;
> >
> > -     if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages) {
> > -             ceph_wbc->tag = PAGECACHE_TAG_TOWRITE;
> > -     } else {
> > -             ceph_wbc->tag = PAGECACHE_TAG_DIRTY;
> > -     }
> > +     ceph_wbc->tag = wbc_to_tag(wbc);
> >
> >       ceph_wbc->op_idx = -1;
> >       ceph_wbc->num_ops = 0;
> > diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> > index 5b7a15db4953..196eba7fa39c 100644
> > --- a/fs/ext4/inode.c
> > +++ b/fs/ext4/inode.c
> > @@ -2619,10 +2619,7 @@ static int mpage_prepare_extent_to_map(struct mpage_da_data *mpd)
> >       handle_t *handle = NULL;
> >       int bpp = ext4_journal_blocks_per_folio(mpd->inode);
> >
> > -     if (mpd->wbc->sync_mode == WB_SYNC_ALL || mpd->wbc->tagged_writepages)
> > -             tag = PAGECACHE_TAG_TOWRITE;
> > -     else
> > -             tag = PAGECACHE_TAG_DIRTY;
> > +     tag = wbc_to_tag(mpd->wbc);
> >
> >       mpd->map.m_len = 0;
> >       mpd->next_pos = mpd->start_pos;
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index 7961e0ddfca3..101e962845db 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -3003,10 +3003,7 @@ static int f2fs_write_cache_pages(struct address_space *mapping,
> >               if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
> >                       range_whole = 1;
> >       }
> > -     if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> > -             tag = PAGECACHE_TAG_TOWRITE;
> > -     else
> > -             tag = PAGECACHE_TAG_DIRTY;
> > +     tag = wbc_to_tag(wbc);
> >   retry:
> >       retry = 0;
> >       if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> > diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
> > index 47d74afd63ac..12394fc5dd29 100644
> > --- a/fs/gfs2/aops.c
> > +++ b/fs/gfs2/aops.c
> > @@ -311,10 +311,7 @@ static int gfs2_write_cache_jdata(struct address_space *mapping,
> >                       range_whole = 1;
> >               cycled = 1; /* ignore range_cyclic tests */
> >       }
> > -     if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> > -             tag = PAGECACHE_TAG_TOWRITE;
> > -     else
> > -             tag = PAGECACHE_TAG_DIRTY;
> > +     tag = wbc_to_tag(wbc);
> >
> >   retry:
> >       if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> > diff --git a/include/linux/writeback.h b/include/linux/writeback.h
> > index a2848d731a46..884811596e10 100644
> > --- a/include/linux/writeback.h
> > +++ b/include/linux/writeback.h
> > @@ -370,6 +370,7 @@ int do_writepages(struct address_space *mapping, struct writeback_control *wbc);
> >   void writeback_set_ratelimit(void);
> >   void tag_pages_for_writeback(struct address_space *mapping,
> >                            pgoff_t start, pgoff_t end);
> > +xa_mark_t wbc_to_tag(struct writeback_control *wbc);
> >
> >   bool filemap_dirty_folio(struct address_space *mapping, struct folio *folio);
> >   bool folio_redirty_for_writepage(struct writeback_control *, struct folio *);
> > diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> > index 3e248d1c3969..243808e19445 100644
> > --- a/mm/page-writeback.c
> > +++ b/mm/page-writeback.c
> > @@ -2434,7 +2434,7 @@ static bool folio_prepare_writeback(struct address_space *mapping,
> >       return true;
> >   }
> >
> > -static xa_mark_t wbc_to_tag(struct writeback_control *wbc)
> > +xa_mark_t wbc_to_tag(struct writeback_control *wbc)
>
> The function is small enough, why not export it as an inline function?
>

Good idea, will fix it in patch v2.
> The current version also lacks EXPORT_SYMBOL(), it may cause problems
> for fses built as a module.
>
> Thanks,
> Qu
>
> >   {
> >       if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_writepages)
> >               return PAGECACHE_TAG_TOWRITE;
>
>

Thanks,
-- 
Julian Sun <sunjunchao2870@gmail.com>


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [f2fs-dev] [PATCH] fs: Make wbc_to_tag() extern and use it in fs.
  2025-09-29  9:55 [f2fs-dev] [PATCH] fs: Make wbc_to_tag() extern and use it in fs Julian Sun via Linux-f2fs-devel
  2025-09-29 10:15 ` Qu Wenruo via Linux-f2fs-devel
  2025-09-29 10:18 ` Jan Kara
@ 2025-09-30  1:47 ` kernel test robot
  2 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2025-09-30  1:47 UTC (permalink / raw)
  To: Julian Sun, linux-fsdevel, linux-f2fs-devel, linux-ext4,
	ceph-devel, linux-btrfs
  Cc: brauner, tytso, agruenba, jack, willy, clm, adilger.kernel,
	oe-kbuild-all, dsterba, jaegeuk, idryomov, xiubli

Hi Julian,

kernel test robot noticed the following build errors:

[auto build test ERROR on kdave/for-next]
[also build test ERROR on ceph-client/testing ceph-client/for-linus tytso-ext4/dev jaegeuk-f2fs/dev-test jaegeuk-f2fs/dev gfs2/for-next akpm-mm/mm-everything linus/master v6.17 next-20250929]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Julian-Sun/fs-Make-wbc_to_tag-extern-and-use-it-in-fs/20250929-175656
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
patch link:    https://lore.kernel.org/r/20250929095544.308392-1-sunjunchao%40bytedance.com
patch subject: [PATCH] fs: Make wbc_to_tag() extern and use it in fs.
config: s390-randconfig-001-20250930 (https://download.01.org/0day-ci/archive/20250930/202509300954.4OaImb0r-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 12.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250930/202509300954.4OaImb0r-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202509300954.4OaImb0r-lkp@intel.com/

All errors (new ones prefixed by >>, old ones prefixed by <<):

WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/base/regmap/regmap-mmio.o
>> ERROR: modpost: "wbc_to_tag" [fs/btrfs/btrfs.ko] undefined!

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-09-30  1:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-29  9:55 [f2fs-dev] [PATCH] fs: Make wbc_to_tag() extern and use it in fs Julian Sun via Linux-f2fs-devel
2025-09-29 10:15 ` Qu Wenruo via Linux-f2fs-devel
2025-09-29 10:57   ` Julian Sun
2025-09-29 10:18 ` Jan Kara
2025-09-30  1:47 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).