JFS folio conversion
Subsystems (3)
Matthew Wilcox (Oracle)
maintainercover JFS folio conversion
This patchset removes uses of struct page from the I/O paths of JFS. write_begin and write_end are still passed a struct page, but they convert to a folio as their first thing. The logmgr still uses a struct page, but I think that's one we actually don't want to convert since it's never inserted into the page cache.
I've included the removal of i_blocks_per_page() in this series as JFS is the last user.
Tested with xfstests; some failures observed, but they don't seem to be related to these patches. I haven't tried with PAGE_SIZE > 4kB, so the MPS_PER_PAGE > 1 paths are untested.
Matthew Wilcox (Oracle) (13):
jfs: Convert metapage_read_folio to use folio APIs
jfs: Convert metapage_writepage to metapage_write_folio
jfs: Convert __get_metapage to use a folio
jfs: Convert insert_metapage() to take a folio
jfs; Convert release_metapage to use a folio
jfs: Convert drop_metapage and remove_metapage to take a folio
jfs: Convert dec_io to take a folio
jfs; Convert __invalidate_metapages to use a folio
jfs: Convert page_to_mp to folio_to_mp
jfs: Convert inc_io and mp_anchor to take a folio
jfs: Convert force_metapage to use a folio
jfs: Change metapage->page to metapage->folio
fs: Remove i_blocks_per_page
fs/jfs/jfs_logmgr.c | 2 +- fs/jfs/jfs_metapage.c | 298 ++++++++++++++++++++-------------------- fs/jfs/jfs_metapage.h | 16 +-- include/linux/pagemap.h | 6 - 4 files changed, 155 insertions(+), 167 deletions(-)
Signature · 1 line
2.43.0
Matthew Wilcox (Oracle)
maintainerPATCH 1/13 jfs: Convert metapage_read_folio to use folio APIs
Use bio_add_folio_nofail() as we just allocated the bio and know it cannot fail. Other than that, this is a 1:1 conversion from page APIs to folio APIs.
--- fs/jfs/jfs_metapage.c | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-)
fs/jfs/jfs_metapage.c +13 -22
@@ -266,14 +266,14 @@ static void last_read_complete(struct page *page)static void metapage_read_end_io (struct bio *bio) { -struct page *page = bio->bi_private; +struct folio *folio = bio->bi_private;if (bio->bi_status) {printk (KERN_ERR "metapage_read_end_io: I/O error\n" ); -SetPageError (page); +folio_set_error (folio); } -dec_io (page, last_read_complete); +dec_io (&folio->page, last_read_complete);bio_put (bio); }
@@ -469,20 +469,18 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)static int metapage_read_folio (struct file *fp,struct folio *folio) { -struct page *page = &folio->page; -struct inode *inode = page->mapping->host; +struct inode *inode = folio->mapping->host;struct bio *bio =NULL ;int block_offset; -int blocks_per_page =i_blocks_per_page (inode, page); +int blocks_per_page =i_blocks_per_folio (inode, folio);sector_t page_start;/* address of page in fs blocks */ sector_t pblock;int xlen;unsigned int len;int offset; -BUG_ON (!PageLocked (page)); - page_start = (sector_t )page->index << - (PAGE_SHIFT - inode->i_blkbits); +BUG_ON (!folio_test_locked (folio)); + page_start =folio_pos (folio) >> inode->i_blkbits; block_offset =0 ;while (block_offset < blocks_per_page) {
@@ -490,9 +488,9 @@ static int metapage_read_folio(struct file *fp, struct folio *folio) pblock =metapage_get_blocks (inode, page_start + block_offset, &xlen);if (pblock) { -if (!PagePrivate (page)) -insert_metapage (page,NULL ); -inc_io (page); +if (!folio->private) +insert_metapage (&folio->page,NULL ); +inc_io (&folio->page);if (bio)submit_bio (bio);
@@ -501,11 +499,10 @@ static int metapage_read_folio(struct file *fp, struct folio *folio) bio->bi_iter.bi_sector = pblock << (inode->i_blkbits -9 ); bio->bi_end_io = metapage_read_end_io; - bio->bi_private = page; + bio->bi_private = folio; len = xlen << inode->i_blkbits; offset = block_offset << inode->i_blkbits; -if (bio_add_page (bio, page, len, offset) < len) - goto add_failed; +bio_add_folio_nofail (bio, folio, len, offset); block_offset += xlen; }else block_offset++;
@@ -513,15 +510,9 @@ static int metapage_read_folio(struct file *fp, struct folio *folio)if (bio)submit_bio (bio);else -unlock_page (page); +folio_unlock (folio);return 0 ; - -add_failed: -printk (KERN_ERR "JFS: bio_add_page failed unexpectedly\n" ); -bio_put (bio); -dec_io (page, last_read_complete); -return -EIO ; }static bool metapage_release_folio (struct folio *folio,gfp_t gfp_mask)
Signature · 1 line
2.43.0
Matthew Wilcox (Oracle)
maintainerPATCH 2/13 jfs: Convert metapage_writepage to metapage_write_folio
In reply to Matthew Wilcox (Oracle)Implement writepages rather than writepage by using write_cache_pages() to call metapage_write_folio(). Use bio_add_folio_nofail() as we know we just allocated the bio. Replace the call to SetPageError (which is never checked) with a call to mapping_set_error (which ... might be checked somewhere?)
--- fs/jfs/jfs_metapage.c | 75 +++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 34 deletions(-)
fs/jfs/jfs_metapage.c +41 -34
@@ -4,6 +4,7 @@* Portions Copyright (C) Christoph Hellwig, 2001-2002 */ +#include <linux/blkdev.h> #include <linux/fs.h> #include <linux/mm.h> #include <linux/module.h>
@@ -321,23 +322,25 @@ static void last_write_complete(struct page *page)static void metapage_write_end_io (struct bio *bio) { -struct page *page = bio->bi_private; +struct folio *folio = bio->bi_private; -BUG_ON (!PagePrivate (page)); +BUG_ON (!folio->private);if (bio->bi_status) { +int err =blk_status_to_errno (bio->bi_status);printk (KERN_ERR "metapage_write_end_io: I/O error\n" ); -SetPageError (page); +mapping_set_error (folio->mapping, err); } -dec_io (page, last_write_complete); +dec_io (&folio->page, last_write_complete);bio_put (bio); } -static int metapage_writepage (struct page *page,struct writeback_control *wbc) +static int metapage_write_folio (struct folio *folio, +struct writeback_control *wbc,void *unused) {struct bio *bio =NULL ;int block_offset;/* block offset of mp within page */ -struct inode *inode = page->mapping->host; +struct inode *inode = folio->mapping->host;int blocks_per_mp =JFS_SBI (inode->i_sb)->nbperpage;int len;int xlen;
@@ -353,14 +356,13 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)int offset;int bad_blocks =0 ; - page_start = (sector_t )page->index << - (PAGE_SHIFT - inode->i_blkbits); -BUG_ON (!PageLocked (page)); -BUG_ON (PageWriteback (page)); -set_page_writeback (page); + page_start =folio_pos (folio) >> inode->i_blkbits; +BUG_ON (!folio_test_locked (folio)); +BUG_ON (folio_test_writeback (folio)); +folio_start_writeback (folio);for (offset =0 ; offset <PAGE_SIZE ; offset +=PSIZE ) { - mp =page_to_mp (page, offset); + mp =page_to_mp (&folio->page, offset);if (!mp || !test_bit (META_dirty, &mp->flag))continue ;
@@ -389,22 +391,20 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc)continue ; }/* Not contiguous */ -if (bio_add_page (bio, page, bio_bytes, bio_offset) < - bio_bytes) - goto add_failed; +bio_add_folio_nofail (bio, folio, bio_bytes, bio_offset);/* * Increment counter before submitting i/o to keep * count from hitting zero before we're through */ -inc_io (page); +inc_io (&folio->page);if (!bio->bi_iter.bi_size) goto dump_bio;submit_bio (bio); nr_underway++; bio =NULL ; }else -inc_io (page); - xlen = (PAGE_SIZE - offset) >> inode->i_blkbits; +inc_io (&folio->page); + xlen = (folio_size (folio) - offset) >> inode->i_blkbits; pblock =metapage_get_blocks (inode, lblock, &xlen);if (!pblock) {printk (KERN_ERR "JFS: metapage_get_blocks failed\n" );
@@ -420,7 +420,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) bio =bio_alloc (inode->i_sb->s_bdev,1 ,REQ_OP_WRITE ,GFP_NOFS ); bio->bi_iter.bi_sector = pblock << (inode->i_blkbits -9 ); bio->bi_end_io = metapage_write_end_io; - bio->bi_private = page; + bio->bi_private = folio;/* Don't call bio_add_page yet, we may add to this vec */ bio_offset = offset;
@@ -430,8 +430,7 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) next_block = lblock + len; }if (bio) { -if (bio_add_page (bio, page, bio_bytes, bio_offset) < bio_bytes) - goto add_failed; +bio_add_folio_nofail (bio, folio, bio_bytes, bio_offset);if (!bio->bi_iter.bi_size) goto dump_bio;
@@ -439,34 +438,42 @@ static int metapage_writepage(struct page *page, struct writeback_control *wbc) nr_underway++; }if (redirty) -redirty_page_for_writepage (wbc, page); +folio_redirty_for_writepage (wbc, folio); -unlock_page (page); +folio_unlock (folio);if (bad_blocks) goto err_out;if (nr_underway ==0 ) -end_page_writeback (page); +folio_end_writeback (folio);return 0 ; -add_failed: -/* We should never reach here, since we're only adding one vec */ -printk (KERN_ERR "JFS: bio_add_page failed unexpectedly\n" ); - goto skip; dump_bio:print_hex_dump (KERN_ERR ,"JFS: dump of bio: " ,DUMP_PREFIX_ADDRESS ,16 ,4 , bio,sizeof (*bio),0 ); -skip:bio_put (bio); -unlock_page (page); -dec_io (page, last_write_complete); +folio_unlock (folio); +dec_io (&folio->page, last_write_complete); err_out:while (bad_blocks--) -dec_io (page, last_write_complete); +dec_io (&folio->page, last_write_complete);return -EIO ; } +static int metapage_writepages (struct address_space *mapping, +struct writeback_control *wbc) +{ +struct blk_plug plug; +int err; + +blk_start_plug (&plug); + err =write_cache_pages (mapping, wbc, metapage_write_folio,NULL ); +blk_finish_plug (&plug); + +return err; +} +static int metapage_read_folio (struct file *fp,struct folio *folio) {struct inode *inode = folio->mapping->host;
@@ -556,7 +563,7 @@ static void metapage_invalidate_folio(struct folio *folio, size_t offset,const struct address_space_operations jfs_metapage_aops = { .read_folio = metapage_read_folio, - .writepage = metapage_writepage, + .writepages = metapage_writepages, .release_folio = metapage_release_folio, .invalidate_folio = metapage_invalidate_folio, .dirty_folio = filemap_dirty_folio,
@@ -698,7 +705,7 @@ static int metapage_write_one(struct page *page)if (folio_clear_dirty_for_io (folio)) {folio_get (folio); - ret =metapage_writepage (page, &wbc); + ret =metapage_write_folio (folio, &wbc,NULL );if (ret ==0 )folio_wait_writeback (folio);folio_put (folio);
Signature · 1 line
2.43.0
Matthew Wilcox (Oracle)
maintainerPATCH 3/13 jfs: Convert __get_metapage to use a folio
In reply to Matthew Wilcox (Oracle)Remove four hidden calls to compound_head().
--- fs/jfs/jfs_metapage.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
fs/jfs/jfs_metapage.c +14 -14
@@ -577,7 +577,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,int l2bsize;struct address_space *mapping;struct metapage *mp =NULL ; -struct page *page; +struct folio *folio;unsigned long page_index;unsigned long page_offset;
@@ -608,22 +608,22 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, }if (new && (PSIZE ==PAGE_SIZE )) { - page =grab_cache_page (mapping, page_index); -if (!page) { -jfs_err ("grab_cache_page failed!" ); + folio =filemap_grab_folio (mapping, page_index); +if (IS_ERR (folio)) { +jfs_err ("filemap_grab_folio failed!" );return NULL ; } -SetPageUptodate (page); +folio_mark_uptodate (folio); }else { - page =read_mapping_page (mapping, page_index,NULL ); -if (IS_ERR (page)) { + folio =read_mapping_folio (mapping, page_index,NULL ); +if (IS_ERR (folio)) {jfs_err ("read_mapping_page failed!" );return NULL ; } -lock_page (page); +folio_lock (folio); } - mp =page_to_mp (page, page_offset); + mp =page_to_mp (&folio->page, page_offset);if (mp) {if (mp->logical_size != size) { jfs_error(inode->i_sb,
@@ -649,16 +649,16 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, mp =alloc_metapage (GFP_NOFS );if (!mp) goto unlock; - mp->page = page; + mp->page = &folio->page; mp->sb = inode->i_sb; mp->flag =0 ; mp->xflag =COMMIT_PAGE ; mp->count =1 ; mp->nohomeok =0 ; mp->logical_size = size; - mp->data =page_address (page) + page_offset; + mp->data =folio_address (folio) + page_offset; mp->index = lblock; -if (unlikely (insert_metapage (page, mp))) { +if (unlikely (insert_metapage (&folio->page, mp))) {free_metapage (mp); goto unlock; }
@@ -670,12 +670,12 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,memset (mp->data,0 ,PSIZE ); } -unlock_page (page); +folio_unlock (folio);jfs_info ("__get_metapage: returning = 0x%p data = 0x%p" , mp, mp->data);return mp; unlock: -unlock_page (page); +folio_unlock (folio);return NULL ; }
Signature · 1 line
2.43.0
Matthew Wilcox (Oracle)
maintainerPATCH 4/13 jfs: Convert insert_metapage() to take a folio
In reply to Matthew Wilcox (Oracle)Both of its callers now have a folio, so convert this function. Use folio_attach_private() instead of manually setting folio->private. This also gets the expected refcount of the folio correct.
--- fs/jfs/jfs_metapage.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-)
fs/jfs/jfs_metapage.c +13 -18
@@ -87,25 +87,23 @@ static inline struct metapage *page_to_mp(struct page *page, int offset)return mp_anchor (page)->mp[offset >>L2PSIZE ]; } -static inline int insert_metapage (struct page *page,struct metapage *mp) +static inline int insert_metapage (struct folio *folio,struct metapage *mp) {struct meta_anchor *a;int index;int l2mp_blocks;/* log2 blocks per metapage */ -if (PagePrivate (page)) - a =mp_anchor (page); -else { + a = folio->private; +if (!a) { a =kzalloc (sizeof (struct meta_anchor ),GFP_NOFS );if (!a)return -ENOMEM ; -set_page_private (page, (unsigned long )a); -SetPagePrivate (page); -kmap (page); +folio_attach_private (folio, a); +kmap (&folio->page); }if (mp) { - l2mp_blocks =L2PSIZE - page->mapping->host->i_blkbits; + l2mp_blocks =L2PSIZE - folio->mapping->host->i_blkbits; index = (mp->index >> l2mp_blocks) & (MPS_PER_PAGE -1 ); a->mp_count++; a->mp[index] = mp;
@@ -127,8 +125,7 @@ static inline void remove_metapage(struct page *page, struct metapage *mp) a->mp[index] =NULL ;if (--a->mp_count ==0 ) {kfree (a); -set_page_private (page,0 ); -ClearPagePrivate (page); +detach_page_private (page);kunmap (page); } }
@@ -150,20 +147,18 @@ static inline struct metapage *page_to_mp(struct page *page, int offset)return PagePrivate (page) ? (struct metapage *)page_private (page) :NULL ; } -static inline int insert_metapage (struct page *page,struct metapage *mp) +static inline int insert_metapage (struct folio *folio,struct metapage *mp) {if (mp) { -set_page_private (page, (unsigned long )mp); -SetPagePrivate (page); -kmap (page); +folio_attach_private (folio, mp); +kmap (&folio->page); }return 0 ; }static inline void remove_metapage (struct page *page,struct metapage *mp) { -set_page_private (page,0 ); -ClearPagePrivate (page); +detach_page_private (page);kunmap (page); }
@@ -496,7 +491,7 @@ static int metapage_read_folio(struct file *fp, struct folio *folio) &xlen);if (pblock) {if (!folio->private) -insert_metapage (&folio->page,NULL ); +insert_metapage (folio,NULL );inc_io (&folio->page);if (bio)submit_bio (bio);
@@ -658,7 +653,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, mp->logical_size = size; mp->data =folio_address (folio) + page_offset; mp->index = lblock; -if (unlikely (insert_metapage (&folio->page, mp))) { +if (unlikely (insert_metapage (folio, mp))) {free_metapage (mp); goto unlock; }
Signature · 1 line
2.43.0
Matthew Wilcox (Oracle)
maintainerPATCH 5/13 jfs; Convert release_metapage to use a folio
In reply to Matthew Wilcox (Oracle)Convert mp->page to a folio and remove 7 hidden calls to compound_head().
--- fs/jfs/jfs_metapage.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
fs/jfs/jfs_metapage.c +10 -12
@@ -749,37 +749,35 @@ void put_metapage(struct metapage *mp)void release_metapage (struct metapage * mp) { -struct page *page = mp->page; +struct folio *folio =page_folio (mp->page);jfs_info ("release_metapage: mp = 0x%p, flag = 0x%lx" , mp, mp->flag); -BUG_ON (!page); - -lock_page (page); +folio_lock (folio);unlock_metapage (mp);assert (mp->count);if (--mp->count || mp->nohomeok) { -unlock_page (page); -put_page (page); +folio_unlock (folio); +folio_put (folio);return ; }if (test_bit (META_dirty, &mp->flag)) { -set_page_dirty (page); +folio_mark_dirty (folio);if (test_bit (META_sync, &mp->flag)) {clear_bit (META_sync, &mp->flag); -if (metapage_write_one (page)) +if (metapage_write_one (&folio->page))jfs_error (mp->sb,"metapage_write_one() failed\n" ); -lock_page (page); +folio_lock (folio); } }else if (mp->lsn)/* discard_metapage doesn't remove it */ remove_from_logsync (mp);/* Try to keep metapages from using up too much memory */ -drop_metapage (page, mp); +drop_metapage (&folio->page, mp); -unlock_page (page); -put_page (page); +folio_unlock (folio); +folio_put (folio); }void __invalidate_metapages (struct inode *ip,s64 addr,int len)
Signature · 1 line
2.43.0
Matthew Wilcox (Oracle)
maintainerPATCH 6/13 jfs: Convert drop_metapage and remove_metapage to take a folio
In reply to Matthew Wilcox (Oracle)All callers now have a folio, so pass it in instead of the page. Removes a couple of calls to compound_head().
--- fs/jfs/jfs_metapage.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
fs/jfs/jfs_metapage.c +12 -12
@@ -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);
Signature · 1 line
2.43.0
kernel test robot
build botRe: [PATCH 06/13] jfs: Convert drop_metapage and remove_metapage to take a folio
kernel test robot noticed the following build errors:
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/[email protected]/config) compiler: loongarch64-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240203/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH 06/13] jfs: Convert drop_metapage and remove_metapage to take a folio
In reply to Matthew Wilcox (Oracle)kernel test robot noticed the following build errors:
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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Matthew Wilcox (Oracle)
maintainerPATCH 7/13 jfs: Convert dec_io to take a folio
In reply to Matthew Wilcox (Oracle)This means also converting the two handlers to take a folio. Saves four calls to compound_head().
--- fs/jfs/jfs_metapage.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
fs/jfs/jfs_metapage.c +17 -15
@@ -135,10 +135,12 @@ static inline void inc_io(struct page *page) atomic_inc(&mp_anchor(page)->io_count); } -static inline void dec_io (struct page *page,void (*handler) (struct page *)) +static inline void dec_io (struct folio *folio,void (*handler) (struct folio *)) { -if (atomic_dec_and_test (&mp_anchor (page)->io_count)) -handler (page); +struct meta_anchor *anchor = folio->private; + +if (atomic_dec_and_test (&anchor->io_count)) +handler (folio); }#else
@@ -163,7 +165,7 @@ static inline void remove_metapage(struct folio *folio, struct metapage *mp) }#define inc_io (page) do {} while(0) -#define dec_io (page, handler) handler(page) +#define dec_io (folio, handler) handler(folio)#endif
@@ -253,11 +255,11 @@ static sector_t metapage_get_blocks(struct inode *inode, sector_t lblock,return lblock; } -static void last_read_complete (struct page *page) +static void last_read_complete (struct folio *folio) { -if (!PageError (page)) -SetPageUptodate (page); -unlock_page (page); +if (!folio_test_error (folio)) +folio_mark_uptodate (folio); +folio_unlock (folio); }static void metapage_read_end_io (struct bio *bio)
@@ -269,7 +271,7 @@ static void metapage_read_end_io(struct bio *bio)folio_set_error (folio); } -dec_io (&folio->page, last_read_complete); +dec_io (folio, last_read_complete);bio_put (bio); }
@@ -295,13 +297,13 @@ static void remove_from_logsync(struct metapage *mp)LOGSYNC_UNLOCK (log, flags); } -static void last_write_complete (struct page *page) +static void last_write_complete (struct folio *folio) {struct metapage *mp;unsigned int offset;for (offset =0 ; offset <PAGE_SIZE ; offset +=PSIZE ) { - mp =page_to_mp (page, offset); + mp =page_to_mp (&folio->page, offset);if (mp &&test_bit (META_io, &mp->flag)) {if (mp->lsn)remove_from_logsync (mp);
@@ -312,7 +314,7 @@ static void last_write_complete(struct page *page)* safe unless I have the page locked */ } -end_page_writeback (page); +folio_end_writeback (folio); }static void metapage_write_end_io (struct bio *bio)
@@ -326,7 +328,7 @@ static void metapage_write_end_io(struct bio *bio)printk (KERN_ERR "metapage_write_end_io: I/O error\n" );mapping_set_error (folio->mapping, err); } -dec_io (&folio->page, last_write_complete); +dec_io (folio, last_write_complete);bio_put (bio); }
@@ -449,10 +451,10 @@ static int metapage_write_folio(struct folio *folio, 4, bio, sizeof(*bio), 0);bio_put (bio);folio_unlock (folio); -dec_io (&folio->page, last_write_complete); +dec_io (folio, last_write_complete); err_out:while (bad_blocks--) -dec_io (&folio->page, last_write_complete); +dec_io (folio, last_write_complete);return -EIO ; }
Signature · 1 line
2.43.0
Matthew Wilcox (Oracle)
maintainerPATCH 8/13 jfs; Convert __invalidate_metapages to use a folio
In reply to Matthew Wilcox (Oracle)Retrieve a folio from the page cache instead of a page. Saves a couple of calls to compound_head().
--- fs/jfs/jfs_metapage.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/jfs/jfs_metapage.c +6 -6
@@ -791,7 +791,6 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len)struct address_space *mapping =JFS_SBI (ip->i_sb)->direct_inode->i_mapping;struct metapage *mp; -struct page *page;unsigned int offset;/*
@@ -800,11 +799,12 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len)*/ for (lblock = addr & ~(BlocksPerPage -1 ); lblock < addr + len; lblock += BlocksPerPage) { - page =find_lock_page (mapping, lblock >> l2BlocksPerPage); -if (!page) +struct folio *folio =filemap_lock_folio (mapping, + lblock >> l2BlocksPerPage); +if (IS_ERR (folio))continue ;for (offset =0 ; offset <PAGE_SIZE ; offset +=PSIZE ) { - mp =page_to_mp (page, offset); + mp =page_to_mp (&folio->page, offset);if (!mp)continue ;if (mp->index < addr)
@@ -817,8 +817,8 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len)if (mp->lsn)remove_from_logsync (mp); } -unlock_page (page); -put_page (page); +folio_unlock (folio); +folio_put (folio); } }
Signature · 1 line
2.43.0
Matthew Wilcox (Oracle)
maintainerPATCH 9/13 jfs: Convert page_to_mp to folio_to_mp
In reply to Matthew Wilcox (Oracle)Access folio->private directly instead of testing the page private flag.
--- fs/jfs/jfs_metapage.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
fs/jfs/jfs_metapage.c +12 -10
@@ -80,11 +80,13 @@ struct meta_anchor { };#define mp_anchor (page) ((struct meta_anchor *)page_private(page)) -static inline struct metapage *page_to_mp (struct page *page,int offset) +static inline struct metapage *folio_to_mp (struct folio *folio,int offset) { -if (!PagePrivate (page)) +struct meta_anchor *anchor = folio->private; + +if (!anchor)return NULL ; -return mp_anchor (page)->mp[offset >>L2PSIZE ]; +return anchor->mp[offset >>L2PSIZE ]; }static inline int insert_metapage (struct folio *folio,struct metapage *mp)
@@ -144,9 +146,9 @@ static inline void dec_io(struct folio *folio, void (*handler) (struct folio *)) }#else -static inline struct metapage *page_to_mp (struct page *page,int offset) +static inline struct metapage *folio_to_mp (struct folio *folio,int offset) { -return PagePrivate (page) ? (struct metapage *)page_private (page) :NULL ; +return folio->private; }static inline int insert_metapage (struct folio *folio,struct metapage *mp)
@@ -303,7 +305,7 @@ static void last_write_complete(struct folio *folio)unsigned int offset;for (offset =0 ; offset <PAGE_SIZE ; offset +=PSIZE ) { - mp =page_to_mp (&folio->page, offset); + mp =folio_to_mp (folio, offset);if (mp &&test_bit (META_io, &mp->flag)) {if (mp->lsn)remove_from_logsync (mp);
@@ -359,7 +361,7 @@ static int metapage_write_folio(struct folio *folio,folio_start_writeback (folio);for (offset =0 ; offset <PAGE_SIZE ; offset +=PSIZE ) { - mp =page_to_mp (&folio->page, offset); + mp =folio_to_mp (folio, offset);if (!mp || !test_bit (META_dirty, &mp->flag))continue ;
@@ -526,7 +528,7 @@ static bool metapage_release_folio(struct folio *folio, gfp_t gfp_mask)int offset;for (offset =0 ; offset <PAGE_SIZE ; offset +=PSIZE ) { - mp =page_to_mp (&folio->page, offset); + mp =folio_to_mp (folio, offset);if (!mp)continue ;
@@ -620,7 +622,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,folio_lock (folio); } - mp =page_to_mp (&folio->page, page_offset); + mp =folio_to_mp (folio, page_offset);if (mp) {if (mp->logical_size != size) { jfs_error(inode->i_sb,
@@ -804,7 +806,7 @@ void __invalidate_metapages(struct inode *ip, s64 addr, int len)if (IS_ERR (folio))continue ;for (offset =0 ; offset <PAGE_SIZE ; offset +=PSIZE ) { - mp =page_to_mp (&folio->page, offset); + mp =folio_to_mp (folio, offset);if (!mp)continue ;if (mp->index < addr)
Signature · 1 line
2.43.0
Matthew Wilcox (Oracle)
maintainerPATCH 10/13 jfs: Convert inc_io and mp_anchor to take a folio
In reply to Matthew Wilcox (Oracle)All their callers now have a folio, so pass it in. No savings here, just cleaning up some remnants.
--- fs/jfs/jfs_metapage.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/jfs/jfs_metapage.c +8 -8
@@ -78,7 +78,7 @@ struct meta_anchor {atomic_t io_count;struct metapage *mp[MPS_PER_PAGE ]; }; -#define mp_anchor (page) ((struct meta_anchor *)page_private(page)) +#define mp_anchor (folio) (folio->private)static inline struct metapage *folio_to_mp (struct folio *folio,int offset) {
@@ -116,7 +116,7 @@ static inline int insert_metapage(struct folio *folio, struct metapage *mp)static inline void remove_metapage (struct folio *folio,struct metapage *mp) { -struct meta_anchor *a =mp_anchor (&folio->page); +struct meta_anchor *a =mp_anchor (folio);int l2mp_blocks =L2PSIZE - folio->mapping->host->i_blkbits;int index;
@@ -132,9 +132,9 @@ static inline void remove_metapage(struct folio *folio, struct metapage *mp) } } -static inline void inc_io (struct page *page) +static inline void inc_io (struct folio *folio) { -atomic_inc (&mp_anchor (page)->io_count); +atomic_inc (&mp_anchor (folio)->io_count); }static inline void dec_io (struct folio *folio,void (*handler) (struct folio *))
@@ -166,7 +166,7 @@ static inline void remove_metapage(struct folio *folio, struct metapage *mp) kunmap(&folio->page); } -#define inc_io (page) do {} while(0) +#define inc_io (folio) do {} while(0)#define dec_io (folio, handler) handler(folio)#endif
@@ -395,14 +395,14 @@ static int metapage_write_folio(struct folio *folio,* Increment counter before submitting i/o to keep * count from hitting zero before we're through */ -inc_io (&folio->page); +inc_io (folio);if (!bio->bi_iter.bi_size) goto dump_bio;submit_bio (bio); nr_underway++; bio =NULL ; }else -inc_io (&folio->page); +inc_io (folio); xlen = (folio_size (folio) - offset) >> inode->i_blkbits; pblock =metapage_get_blocks (inode, lblock, &xlen);if (!pblock) {
@@ -496,7 +496,7 @@ static int metapage_read_folio(struct file *fp, struct folio *folio)if (pblock) {if (!folio->private)insert_metapage (folio,NULL ); -inc_io (&folio->page); +inc_io (folio);if (bio)submit_bio (bio);
Signature · 1 line
2.43.0
kernel test robot
build botRe: [PATCH 10/13] jfs: Convert inc_io and mp_anchor to take a folio
kernel test robot noticed the following build errors:
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-11-willy%40infradead.org patch subject: [PATCH 10/13] jfs: Convert inc_io and mp_anchor to take a folio config: loongarch-defconfig (https://download.01.org/0day-ci/archive/20240203/[email protected]/config) compiler: loongarch64-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240203/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All error/warnings (new ones prefixed by >>):
fs/jfs/jfs_metapage.c: In function 'remove_metapage':
fs/jfs/jfs_metapage.c:130:38: error: passing argument 1 of 'folio_detach_private' from incompatible pointer type [-Werror=incompatible-pointer-types]
130 | 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)
| ~~~~~~~~~~~~~~^~~~~
fs/jfs/jfs_metapage.c: In function 'inc_io':
>> fs/jfs/jfs_metapage.c:137:37: warning: dereferencing 'void *' pointer
137 | atomic_inc(&mp_anchor(folio)->io_count);
| ^~
>> fs/jfs/jfs_metapage.c:137:37: error: request for member 'io_count' in something not a structure or unioncc1: some warnings being treated as errors
vim +/io_count +137 fs/jfs/jfs_metapage.c
> 14 #include <linux/buffer_head.h>
15 #include <linux/mempool.h>
16 #include <linux/seq_file.h>
17 #include <linux/writeback.h>
18 #include "jfs_incore.h"
19 #include "jfs_superblock.h"
20 #include "jfs_filsys.h"
21 #include "jfs_metapage.h"
22 #include "jfs_txnmgr.h"
23 #include "jfs_debug.h"
24
25 #ifdef CONFIG_JFS_STATISTICS
26 static struct {
27 uint pagealloc; /* # of page allocations */
28 uint pagefree; /* # of page frees */
29 uint lockwait; /* # of sleeping lock_metapage() calls */
30 } mpStat;
31 #endif
32
33 #define metapage_locked(mp) test_bit(META_locked, &(mp)->flag)
34 #define trylock_metapage(mp) test_and_set_bit_lock(META_locked, &(mp)->flag)
35
36 static inline void unlock_metapage(struct metapage *mp)
37 {
38 clear_bit_unlock(META_locked, &mp->flag);
39 wake_up(&mp->wait);
40 }
41
42 static inline void __lock_metapage(struct metapage *mp)
43 {
44 DECLARE_WAITQUEUE(wait, current);
45 INCREMENT(mpStat.lockwait);
46 add_wait_queue_exclusive(&mp->wait, &wait);
47 do {
48 set_current_state(TASK_UNINTERRUPTIBLE);
49 if (metapage_locked(mp)) {
50 unlock_page(mp->page);
51 io_schedule();
52 lock_page(mp->page);
53 }
54 } while (trylock_metapage(mp));
55 __set_current_state(TASK_RUNNING);
56 remove_wait_queue(&mp->wait, &wait);
57 }
58
59 /*
60 * Must have mp->page locked
61 */
62 static inline void lock_metapage(struct metapage *mp)
63 {
64 if (trylock_metapage(mp))
65 __lock_metapage(mp);
66 }
67
68 #define METAPOOL_MIN_PAGES 32
69 static struct kmem_cache *metapage_cache;
70 static mempool_t *metapage_mempool;
71
72 #define MPS_PER_PAGE (PAGE_SIZE >> L2PSIZE)
73
74 #if MPS_PER_PAGE > 1
75
76 struct meta_anchor {
77 int mp_count;
78 atomic_t io_count;
79 struct metapage *mp[MPS_PER_PAGE];
80 };
81 #define mp_anchor(folio) (folio->private)
82
83 static inline struct metapage *folio_to_mp(struct folio *folio, int offset)
84 {
85 struct meta_anchor *anchor = folio->private;
86
87 if (!anchor)
88 return NULL;
89 return anchor->mp[offset >> L2PSIZE];
90 }
91
92 static inline int insert_metapage(struct folio *folio, struct metapage *mp)
93 {
94 struct meta_anchor *a;
95 int index;
96 int l2mp_blocks; /* log2 blocks per metapage */
97
98 a = folio->private;
99 if (!a) {
100 a = kzalloc(sizeof(struct meta_anchor), GFP_NOFS);
101 if (!a)
102 return -ENOMEM;
103 folio_attach_private(folio, a);
104 kmap(&folio->page);
105 }
106
107 if (mp) {
108 l2mp_blocks = L2PSIZE - folio->mapping->host->i_blkbits;
109 index = (mp->index >> l2mp_blocks) & (MPS_PER_PAGE - 1);
110 a->mp_count++;
111 a->mp[index] = mp;
112 }
113
114 return 0;
115 }
116
117 static inline void remove_metapage(struct folio *folio, struct metapage *mp)
118 {
119 struct meta_anchor *a = mp_anchor(folio);
120 int l2mp_blocks = L2PSIZE - folio->mapping->host->i_blkbits;
121 int index;
122
123 index = (mp->index >> l2mp_blocks) & (MPS_PER_PAGE - 1);
124
125 BUG_ON(a->mp[index] != mp);
126
127 a->mp[index] = NULL;
128 if (--a->mp_count == 0) {
129 kfree(a);
130 folio_detach_private(&folio->page);
131 kunmap(&folio->page);
132 }
133 }
134
135 static inline void inc_io(struct folio *folio)
136 {
> 137 atomic_inc(&mp_anchor(folio)->io_count); 138 }
139
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Matthew Wilcox (Oracle)
maintainerPATCH 11/13 jfs: Convert force_metapage to use a folio
In reply to Matthew Wilcox (Oracle)Convert the mp->page to a folio and operate on it. That lets us convert metapage_write_one() to take a folio. Replaces five calls to compound_head() with one.
--- fs/jfs/jfs_metapage.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
fs/jfs/jfs_metapage.c +8 -9
@@ -688,9 +688,8 @@ void grab_metapage(struct metapage * mp)unlock_page (mp->page); } -static int metapage_write_one (struct page *page) +static int metapage_write_one (struct folio *folio) { -struct folio *folio =page_folio (page);struct address_space *mapping = folio->mapping;struct writeback_control wbc = { .sync_mode =WB_SYNC_ALL ,
@@ -719,17 +718,17 @@ static int metapage_write_one(struct page *page)void force_metapage (struct metapage *mp) { -struct page *page = mp->page; +struct folio *folio =page_folio (mp->page);jfs_info ("force_metapage: mp = 0x%p" , mp);set_bit (META_forcewrite, &mp->flag);clear_bit (META_sync, &mp->flag); -get_page (page); -lock_page (page); -set_page_dirty (page); -if (metapage_write_one (page)) +folio_get (folio); +folio_lock (folio); +folio_mark_dirty (folio); +if (metapage_write_one (folio))jfs_error (mp->sb,"metapage_write_one() failed\n" );clear_bit (META_forcewrite, &mp->flag); -put_page (page); +folio_put (folio); }void hold_metapage (struct metapage *mp)
@@ -770,7 +769,7 @@ void release_metapage(struct metapage * mp)folio_mark_dirty (folio);if (test_bit (META_sync, &mp->flag)) {clear_bit (META_sync, &mp->flag); -if (metapage_write_one (&folio->page)) +if (metapage_write_one (folio))jfs_error (mp->sb,"metapage_write_one() failed\n" );folio_lock (folio); }
Signature · 1 line
2.43.0
Matthew Wilcox (Oracle)
maintainerPATCH 12/13 jfs: Change metapage->page to metapage->folio
In reply to Matthew Wilcox (Oracle)Convert all the users to operate on a folio. Saves sixteen calls to compound_head(). We still use sizeof(struct page) in print_hex_dump, otherwise it will go into the second and third pages of the folio which won't exist for jfs folios (since they are not large). This needs a better solution, but finding it can be postponed.
--- fs/jfs/jfs_logmgr.c | 2 +- fs/jfs/jfs_metapage.c | 26 +++++++++++++------------- fs/jfs/jfs_metapage.h | 16 ++++++++-------- 3 files changed, 22 insertions(+), 22 deletions(-)
fs/jfs/jfs_logmgr.c +1 -1
@@ -1600,7 +1600,7 @@ void jfs_flush_journal(struct jfs_log *log, int wait) mp, sizeof(struct metapage), 0);print_hex_dump (KERN_ERR ,"page: " ,DUMP_PREFIX_ADDRESS ,16 , -sizeof (long ), mp->page, +sizeof (long ), mp->folio,sizeof (struct page ),0 ); }else print_hex_dump(KERN_ERR, "tblock:",
fs/jfs/jfs_metapage.c +13 -13
@@ -47,9 +47,9 @@ static inline void __lock_metapage(struct metapage *mp)do {set_current_state (TASK_UNINTERRUPTIBLE );if (metapage_locked (mp)) { -unlock_page (mp->page); +folio_unlock (mp->folio);io_schedule (); -lock_page (mp->page); +folio_lock (mp->folio); } }while (trylock_metapage (mp));__set_current_state (TASK_RUNNING );
@@ -57,7 +57,7 @@ static inline void __lock_metapage(struct metapage *mp) }/* -* Must have mp->page locked +* Must have mp->folio locked */ static inline void lock_metapage (struct metapage *mp) {
@@ -648,7 +648,7 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock, mp =alloc_metapage (GFP_NOFS );if (!mp) goto unlock; - mp->page = &folio->page; + mp->folio = folio; mp->sb = inode->i_sb; mp->flag =0 ; mp->xflag =COMMIT_PAGE ;
@@ -681,11 +681,11 @@ struct metapage *__get_metapage(struct inode *inode, unsigned long lblock,void grab_metapage (struct metapage * mp) {jfs_info ("grab_metapage: mp = 0x%p" , mp); -get_page (mp->page); -lock_page (mp->page); +folio_get (mp->folio); +folio_lock (mp->folio); mp->count++;lock_metapage (mp); -unlock_page (mp->page); +folio_unlock (mp->folio); }static int metapage_write_one (struct folio *folio)
@@ -718,7 +718,7 @@ static int metapage_write_one(struct folio *folio)void force_metapage (struct metapage *mp) { -struct folio *folio =page_folio (mp->page); +struct folio *folio = mp->folio;jfs_info ("force_metapage: mp = 0x%p" , mp);set_bit (META_forcewrite, &mp->flag);clear_bit (META_sync, &mp->flag);
@@ -733,26 +733,26 @@ void force_metapage(struct metapage *mp)void hold_metapage (struct metapage *mp) { -lock_page (mp->page); +folio_lock (mp->folio); }void put_metapage (struct metapage *mp) {if (mp->count || mp->nohomeok) {/* Someone else will release this */ -unlock_page (mp->page); +folio_unlock (mp->folio);return ; } -get_page (mp->page); +folio_get (mp->folio); mp->count++;lock_metapage (mp); -unlock_page (mp->page); +folio_unlock (mp->folio);release_metapage (mp); }void release_metapage (struct metapage * mp) { -struct folio *folio =page_folio (mp->page); +struct folio *folio = mp->folio;jfs_info ("release_metapage: mp = 0x%p, flag = 0x%lx" , mp, mp->flag);folio_lock (folio);
fs/jfs/jfs_metapage.h +8 -8
@@ -24,7 +24,7 @@ struct metapage {wait_queue_head_t wait;/* implementation */ -struct page *page; +struct folio *folio;struct super_block *sb;unsigned int logical_size;
@@ -90,14 +90,14 @@ static inline void discard_metapage(struct metapage *mp)static inline void metapage_nohomeok (struct metapage *mp) { -struct page *page = mp->page; -lock_page (page); +struct folio *folio = mp->folio; +folio_lock (folio);if (!mp->nohomeok++) {mark_metapage_dirty (mp); -get_page (page); -wait_on_page_writeback (page); +folio_get (folio); +folio_wait_writeback (folio); } -unlock_page (page); +folio_unlock (folio); }/*
@@ -107,7 +107,7 @@ static inline void metapage_nohomeok(struct metapage *mp)static inline void metapage_wait_for_io (struct metapage *mp) {if (test_bit (META_io, &mp->flag)) -wait_on_page_writeback (mp->page); +folio_wait_writeback (mp->folio); }/*
@@ -116,7 +116,7 @@ static inline void metapage_wait_for_io(struct metapage *mp)static inline void _metapage_homeok (struct metapage *mp) {if (!--mp->nohomeok) -put_page (mp->page); +folio_put (mp->folio); }static inline void metapage_homeok (struct metapage *mp)
Signature · 1 line
2.43.0
Matthew Wilcox (Oracle)
maintainerPATCH 13/13 fs: Remove i_blocks_per_page
In reply to Matthew Wilcox (Oracle)The last caller has been converted to i_blocks_per_folio() so we can remove this wrapper.
--- include/linux/pagemap.h | 6 ------ 1 file changed, 6 deletions(-)
include/linux/pagemap.h +0 -6
@@ -1556,10 +1556,4 @@ unsigned int i_blocks_per_folio(struct inode *inode, struct folio *folio) {return folio_size (folio) >> inode->i_blkbits; } - -static inline -unsigned int i_blocks_per_page (struct inode *inode,struct page *page) -{ -return i_blocks_per_folio (inode,page_folio (page)); -}#endif /* _LINUX_PAGEMAP_H */
Signature · 1 line
2.43.0