Linux 6.3 compat: writepage_t first arg struct folio*

The type def of writepage_t in kernel 6.3 is changed to take
struct folio* as the first argument. We need to detect this
change and pass correct function to write_cache_pages().

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Youzhong Yang <yyang@mathworks.com>
Closes #14699
This commit is contained in:
youzhongyang
2023-04-05 13:01:38 -04:00
committed by Tony Hutter
parent 35d43ba8ea
commit 04305bbd18
3 changed files with 53 additions and 3 deletions
+25 -3
View File
@@ -729,6 +729,29 @@ zpl_putpage(struct page *pp, struct writeback_control *wbc, void *data)
return (0);
}
#ifdef HAVE_WRITEPAGE_T_FOLIO
static int
zpl_putfolio(struct folio *pp, struct writeback_control *wbc, void *data)
{
(void) zpl_putpage(&pp->page, wbc, data);
return (0);
}
#endif
static inline int
zpl_write_cache_pages(struct address_space *mapping,
struct writeback_control *wbc, void *data)
{
int result;
#ifdef HAVE_WRITEPAGE_T_FOLIO
result = write_cache_pages(mapping, wbc, zpl_putfolio, data);
#else
result = write_cache_pages(mapping, wbc, zpl_putpage, data);
#endif
return (result);
}
static int
zpl_writepages(struct address_space *mapping, struct writeback_control *wbc)
{
@@ -752,7 +775,7 @@ zpl_writepages(struct address_space *mapping, struct writeback_control *wbc)
*/
boolean_t for_sync = (sync_mode == WB_SYNC_ALL);
wbc->sync_mode = WB_SYNC_NONE;
result = write_cache_pages(mapping, wbc, zpl_putpage, &for_sync);
result = zpl_write_cache_pages(mapping, wbc, &for_sync);
if (sync_mode != wbc->sync_mode) {
ZPL_ENTER(zfsvfs);
ZPL_VERIFY_ZP(zp);
@@ -768,8 +791,7 @@ zpl_writepages(struct address_space *mapping, struct writeback_control *wbc)
* details). That being said, this is a no-op in most cases.
*/
wbc->sync_mode = sync_mode;
result = write_cache_pages(mapping, wbc, zpl_putpage,
&for_sync);
result = zpl_write_cache_pages(mapping, wbc, &for_sync);
}
return (result);
}