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 to nilfs_clear_folio_dirty()

All callers of nilfs_clear_dirty_page() now have a folio, so rename the
function and pass in the folio. Saves three hidden calls to
compound_head().

Link: https://lkml.kernel.org/r/20231114084436.2755-9-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
5d3b5903 021cff9d

+17 -16
+1 -1
fs/nilfs2/inode.c
··· 186 186 * have dirty pages that try to be flushed in background. 187 187 * So, here we simply discard this dirty page. 188 188 */ 189 - nilfs_clear_dirty_page(page, false); 189 + nilfs_clear_folio_dirty(folio, false); 190 190 folio_unlock(folio); 191 191 return -EROFS; 192 192 }
+1 -1
fs/nilfs2/mdt.c
··· 411 411 * have dirty folios that try to be flushed in background. 412 412 * So, here we simply discard this dirty folio. 413 413 */ 414 - nilfs_clear_dirty_page(page, false); 414 + nilfs_clear_folio_dirty(folio, false); 415 415 folio_unlock(folio); 416 416 return -EROFS; 417 417 }
+14 -13
fs/nilfs2/page.c
··· 379 379 * was acquired. Skip processing in that case. 380 380 */ 381 381 if (likely(folio->mapping == mapping)) 382 - nilfs_clear_dirty_page(&folio->page, silent); 382 + nilfs_clear_folio_dirty(folio, silent); 383 383 384 384 folio_unlock(folio); 385 385 } ··· 389 389 } 390 390 391 391 /** 392 - * nilfs_clear_dirty_page - discard dirty page 393 - * @page: dirty page that will be discarded 392 + * nilfs_clear_folio_dirty - discard dirty folio 393 + * @folio: dirty folio that will be discarded 394 394 * @silent: suppress [true] or print [false] warning messages 395 395 */ 396 - void nilfs_clear_dirty_page(struct page *page, bool silent) 396 + void nilfs_clear_folio_dirty(struct folio *folio, bool silent) 397 397 { 398 - struct inode *inode = page->mapping->host; 398 + struct inode *inode = folio->mapping->host; 399 399 struct super_block *sb = inode->i_sb; 400 + struct buffer_head *bh, *head; 400 401 401 - BUG_ON(!PageLocked(page)); 402 + BUG_ON(!folio_test_locked(folio)); 402 403 403 404 if (!silent) 404 405 nilfs_warn(sb, "discard dirty page: offset=%lld, ino=%lu", 405 - page_offset(page), inode->i_ino); 406 + folio_pos(folio), inode->i_ino); 406 407 407 - ClearPageUptodate(page); 408 - ClearPageMappedToDisk(page); 408 + folio_clear_uptodate(folio); 409 + folio_clear_mappedtodisk(folio); 409 410 410 - if (page_has_buffers(page)) { 411 - struct buffer_head *bh, *head; 411 + head = folio_buffers(folio); 412 + if (head) { 412 413 const unsigned long clear_bits = 413 414 (BIT(BH_Uptodate) | BIT(BH_Dirty) | BIT(BH_Mapped) | 414 415 BIT(BH_Async_Write) | BIT(BH_NILFS_Volatile) | 415 416 BIT(BH_NILFS_Checked) | BIT(BH_NILFS_Redirected)); 416 417 417 - bh = head = page_buffers(page); 418 + bh = head; 418 419 do { 419 420 lock_buffer(bh); 420 421 if (!silent) ··· 428 427 } while (bh = bh->b_this_page, bh != head); 429 428 } 430 429 431 - __nilfs_clear_page_dirty(page); 430 + __nilfs_clear_page_dirty(&folio->page); 432 431 } 433 432 434 433 unsigned int nilfs_page_count_clean_buffers(struct page *page,
+1 -1
fs/nilfs2/page.h
··· 41 41 42 42 int nilfs_copy_dirty_pages(struct address_space *, struct address_space *); 43 43 void nilfs_copy_back_pages(struct address_space *, struct address_space *); 44 - void nilfs_clear_dirty_page(struct page *, bool); 44 + void nilfs_clear_folio_dirty(struct folio *, bool); 45 45 void nilfs_clear_dirty_pages(struct address_space *, bool); 46 46 unsigned int nilfs_page_count_clean_buffers(struct page *, unsigned int, 47 47 unsigned int);