Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nilfs2: convert nilfs_btnode_prepare_change_key to use a folio

Saves three calls to compound_head().

Link: https://lkml.kernel.org/r/20231114084436.2755-19-konishi.ryusuke@gmail.com
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Matthew Wilcox (Oracle) and committed by
Andrew Morton
7c5c654c cf62eb2c

+9 -9
+9 -9
fs/nilfs2/btnode.c
··· 185 185 ctxt->newbh = NULL; 186 186 187 187 if (inode->i_blkbits == PAGE_SHIFT) { 188 - struct page *opage = obh->b_page; 189 - lock_page(opage); 188 + struct folio *ofolio = obh->b_folio; 189 + folio_lock(ofolio); 190 190 retry: 191 191 /* BUG_ON(oldkey != obh->b_folio->index); */ 192 - if (unlikely(oldkey != opage->index)) 193 - NILFS_PAGE_BUG(opage, 192 + if (unlikely(oldkey != ofolio->index)) 193 + NILFS_PAGE_BUG(&ofolio->page, 194 194 "invalid oldkey %lld (newkey=%lld)", 195 195 (unsigned long long)oldkey, 196 196 (unsigned long long)newkey); 197 197 198 198 xa_lock_irq(&btnc->i_pages); 199 - err = __xa_insert(&btnc->i_pages, newkey, opage, GFP_NOFS); 199 + err = __xa_insert(&btnc->i_pages, newkey, ofolio, GFP_NOFS); 200 200 xa_unlock_irq(&btnc->i_pages); 201 201 /* 202 - * Note: page->index will not change to newkey until 202 + * Note: folio->index will not change to newkey until 203 203 * nilfs_btnode_commit_change_key() will be called. 204 - * To protect the page in intermediate state, the page lock 204 + * To protect the folio in intermediate state, the folio lock 205 205 * is held. 206 206 */ 207 207 if (!err) ··· 213 213 if (!err) 214 214 goto retry; 215 215 /* fallback to copy mode */ 216 - unlock_page(opage); 216 + folio_unlock(ofolio); 217 217 } 218 218 219 219 nbh = nilfs_btnode_create_block(btnc, newkey); ··· 225 225 return 0; 226 226 227 227 failed_unlock: 228 - unlock_page(obh->b_page); 228 + folio_unlock(obh->b_folio); 229 229 return err; 230 230 } 231 231