diff mbox series

[06/13] jfs: Convert drop_metapage and remove_metapage to take a folio

Message ID 20240201224605.4055895-7-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series JFS folio conversion | expand

Commit Message

Matthew Wilcox Feb. 1, 2024, 10:45 p.m. UTC
All callers now have a folio, so pass it in instead of the page.
Removes a couple of calls to compound_head().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/jfs/jfs_metapage.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

Comments

kernel test robot Feb. 2, 2024, 5:18 p.m. UTC | #1
Hi Matthew,

kernel test robot noticed the following build errors:

[auto build test ERROR on kleikamp-shaggy/jfs-next]
[also build test ERROR on linus/master v6.8-rc2 next-20240202]
[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/Matthew-Wilcox-Oracle/jfs-Convert-metapage_read_folio-to-use-folio-APIs/20240202-064805
base:   https://github.com/kleikamp/linux-shaggy jfs-next
patch link:    https://lore.kernel.org/r/20240201224605.4055895-7-willy%40infradead.org
patch subject: [PATCH 06/13] jfs: Convert drop_metapage and remove_metapage to take a folio
config: loongarch-defconfig (https://download.01.org/0day-ci/archive/20240203/202402030124.yWFowXZd-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240203/202402030124.yWFowXZd-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/202402030124.yWFowXZd-lkp@intel.com/

All errors (new ones prefixed by >>):

   fs/jfs/jfs_metapage.c: In function 'remove_metapage':
>> fs/jfs/jfs_metapage.c:128:38: error: passing argument 1 of 'folio_detach_private' from incompatible pointer type [-Werror=incompatible-pointer-types]
     128 |                 folio_detach_private(&folio->page);
         |                                      ^~~~~~~~~~~~
         |                                      |
         |                                      struct page *
   In file included from include/linux/buffer_head.h:15,
                    from fs/jfs/jfs_metapage.c:14:
   include/linux/pagemap.h:508:56: note: expected 'struct folio *' but argument is of type 'struct page *'
     508 | static inline void *folio_detach_private(struct folio *folio)
         |                                          ~~~~~~~~~~~~~~^~~~~
   cc1: some warnings being treated as errors


vim +/folio_detach_private +128 fs/jfs/jfs_metapage.c

   114	
   115	static inline void remove_metapage(struct folio *folio, struct metapage *mp)
   116	{
   117		struct meta_anchor *a = mp_anchor(&folio->page);
   118		int l2mp_blocks = L2PSIZE - folio->mapping->host->i_blkbits;
   119		int index;
   120	
   121		index = (mp->index >> l2mp_blocks) & (MPS_PER_PAGE - 1);
   122	
   123		BUG_ON(a->mp[index] != mp);
   124	
   125		a->mp[index] = NULL;
   126		if (--a->mp_count == 0) {
   127			kfree(a);
 > 128			folio_detach_private(&folio->page);
   129			kunmap(&folio->page);
   130		}
   131	}
   132
kernel test robot Feb. 5, 2024, 11:29 a.m. UTC | #2
Hi Matthew,

kernel test robot noticed the following build errors:

[auto build test ERROR on kleikamp-shaggy/jfs-next]
[also build test ERROR on linus/master v6.8-rc3 next-20240205]
[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/Matthew-Wilcox-Oracle/jfs-Convert-metapage_read_folio-to-use-folio-APIs/20240202-064805
base:   https://github.com/kleikamp/linux-shaggy jfs-next
patch link:    https://lore.kernel.org/r/20240201224605.4055895-7-willy%40infradead.org
patch subject: [PATCH 06/13] jfs: Convert drop_metapage and remove_metapage to take a folio
config: powerpc-allyesconfig (https://download.01.org/0day-ci/archive/20240205/202402051937.xQSqcqKO-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 7dd790db8b77c4a833c06632e903dc4f13877a64)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240205/202402051937.xQSqcqKO-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/202402051937.xQSqcqKO-lkp@intel.com/

All errors (new ones prefixed by >>):

>> fs/jfs/jfs_metapage.c:128:24: error: incompatible pointer types passing 'struct page *' to parameter of type 'struct folio *' [-Werror,-Wincompatible-pointer-types]
     128 |                 folio_detach_private(&folio->page);
         |                                      ^~~~~~~~~~~~
   include/linux/pagemap.h:508:56: note: passing argument to parameter 'folio' here
     508 | static inline void *folio_detach_private(struct folio *folio)
         |                                                        ^
   1 error generated.


vim +128 fs/jfs/jfs_metapage.c

   114	
   115	static inline void remove_metapage(struct folio *folio, struct metapage *mp)
   116	{
   117		struct meta_anchor *a = mp_anchor(&folio->page);
   118		int l2mp_blocks = L2PSIZE - folio->mapping->host->i_blkbits;
   119		int index;
   120	
   121		index = (mp->index >> l2mp_blocks) & (MPS_PER_PAGE - 1);
   122	
   123		BUG_ON(a->mp[index] != mp);
   124	
   125		a->mp[index] = NULL;
   126		if (--a->mp_count == 0) {
   127			kfree(a);
 > 128			folio_detach_private(&folio->page);
   129			kunmap(&folio->page);
   130		}
   131	}
   132
diff mbox series

Patch

diff --git a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
index 4515dc1ac40e..56bd11f9ded5 100644
--- a/fs/jfs/jfs_metapage.c
+++ b/fs/jfs/jfs_metapage.c
@@ -112,10 +112,10 @@  static inline int insert_metapage(struct folio *folio, struct metapage *mp)
 	return 0;
 }
 
-static inline void remove_metapage(struct page *page, struct metapage *mp)
+static inline void remove_metapage(struct folio *folio, struct metapage *mp)
 {
-	struct meta_anchor *a = mp_anchor(page);
-	int l2mp_blocks = L2PSIZE - page->mapping->host->i_blkbits;
+	struct meta_anchor *a = mp_anchor(&folio->page);
+	int l2mp_blocks = L2PSIZE - folio->mapping->host->i_blkbits;
 	int index;
 
 	index = (mp->index >> l2mp_blocks) & (MPS_PER_PAGE - 1);
@@ -125,8 +125,8 @@  static inline void remove_metapage(struct page *page, struct metapage *mp)
 	a->mp[index] = NULL;
 	if (--a->mp_count == 0) {
 		kfree(a);
-		detach_page_private(page);
-		kunmap(page);
+		folio_detach_private(&folio->page);
+		kunmap(&folio->page);
 	}
 }
 
@@ -156,10 +156,10 @@  static inline int insert_metapage(struct folio *folio, struct metapage *mp)
 	return 0;
 }
 
-static inline void remove_metapage(struct page *page, struct metapage *mp)
+static inline void remove_metapage(struct folio *folio, struct metapage *mp)
 {
-	detach_page_private(page);
-	kunmap(page);
+	folio_detach_private(folio);
+	kunmap(&folio->page);
 }
 
 #define inc_io(page) do {} while(0)
@@ -214,12 +214,12 @@  void metapage_exit(void)
 	kmem_cache_destroy(metapage_cache);
 }
 
-static inline void drop_metapage(struct page *page, struct metapage *mp)
+static inline void drop_metapage(struct folio *folio, struct metapage *mp)
 {
 	if (mp->count || mp->nohomeok || test_bit(META_dirty, &mp->flag) ||
 	    test_bit(META_io, &mp->flag))
 		return;
-	remove_metapage(page, mp);
+	remove_metapage(folio, mp);
 	INCREMENT(mpStat.pagefree);
 	free_metapage(mp);
 }
@@ -539,7 +539,7 @@  static bool metapage_release_folio(struct folio *folio, gfp_t gfp_mask)
 		}
 		if (mp->lsn)
 			remove_from_logsync(mp);
-		remove_metapage(&folio->page, mp);
+		remove_metapage(folio, mp);
 		INCREMENT(mpStat.pagefree);
 		free_metapage(mp);
 	}
@@ -774,7 +774,7 @@  void release_metapage(struct metapage * mp)
 		remove_from_logsync(mp);
 
 	/* Try to keep metapages from using up too much memory */
-	drop_metapage(&folio->page, mp);
+	drop_metapage(folio, mp);
 
 	folio_unlock(folio);
 	folio_put(folio);