Commit 5d3b5903 authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

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.comSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 021cff9d
...@@ -186,7 +186,7 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc) ...@@ -186,7 +186,7 @@ static int nilfs_writepage(struct page *page, struct writeback_control *wbc)
* have dirty pages that try to be flushed in background. * have dirty pages that try to be flushed in background.
* So, here we simply discard this dirty page. * So, here we simply discard this dirty page.
*/ */
nilfs_clear_dirty_page(page, false); nilfs_clear_folio_dirty(folio, false);
folio_unlock(folio); folio_unlock(folio);
return -EROFS; return -EROFS;
} }
......
...@@ -411,7 +411,7 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc) ...@@ -411,7 +411,7 @@ nilfs_mdt_write_page(struct page *page, struct writeback_control *wbc)
* have dirty folios that try to be flushed in background. * have dirty folios that try to be flushed in background.
* So, here we simply discard this dirty folio. * So, here we simply discard this dirty folio.
*/ */
nilfs_clear_dirty_page(page, false); nilfs_clear_folio_dirty(folio, false);
folio_unlock(folio); folio_unlock(folio);
return -EROFS; return -EROFS;
} }
......
...@@ -379,7 +379,7 @@ void nilfs_clear_dirty_pages(struct address_space *mapping, bool silent) ...@@ -379,7 +379,7 @@ void nilfs_clear_dirty_pages(struct address_space *mapping, bool silent)
* was acquired. Skip processing in that case. * was acquired. Skip processing in that case.
*/ */
if (likely(folio->mapping == mapping)) if (likely(folio->mapping == mapping))
nilfs_clear_dirty_page(&folio->page, silent); nilfs_clear_folio_dirty(folio, silent);
folio_unlock(folio); folio_unlock(folio);
} }
...@@ -389,32 +389,33 @@ void nilfs_clear_dirty_pages(struct address_space *mapping, bool silent) ...@@ -389,32 +389,33 @@ void nilfs_clear_dirty_pages(struct address_space *mapping, bool silent)
} }
/** /**
* nilfs_clear_dirty_page - discard dirty page * nilfs_clear_folio_dirty - discard dirty folio
* @page: dirty page that will be discarded * @folio: dirty folio that will be discarded
* @silent: suppress [true] or print [false] warning messages * @silent: suppress [true] or print [false] warning messages
*/ */
void nilfs_clear_dirty_page(struct page *page, bool silent) void nilfs_clear_folio_dirty(struct folio *folio, bool silent)
{ {
struct inode *inode = page->mapping->host; struct inode *inode = folio->mapping->host;
struct super_block *sb = inode->i_sb; struct super_block *sb = inode->i_sb;
struct buffer_head *bh, *head;
BUG_ON(!PageLocked(page)); BUG_ON(!folio_test_locked(folio));
if (!silent) if (!silent)
nilfs_warn(sb, "discard dirty page: offset=%lld, ino=%lu", nilfs_warn(sb, "discard dirty page: offset=%lld, ino=%lu",
page_offset(page), inode->i_ino); folio_pos(folio), inode->i_ino);
ClearPageUptodate(page); folio_clear_uptodate(folio);
ClearPageMappedToDisk(page); folio_clear_mappedtodisk(folio);
if (page_has_buffers(page)) { head = folio_buffers(folio);
struct buffer_head *bh, *head; if (head) {
const unsigned long clear_bits = const unsigned long clear_bits =
(BIT(BH_Uptodate) | BIT(BH_Dirty) | BIT(BH_Mapped) | (BIT(BH_Uptodate) | BIT(BH_Dirty) | BIT(BH_Mapped) |
BIT(BH_Async_Write) | BIT(BH_NILFS_Volatile) | BIT(BH_Async_Write) | BIT(BH_NILFS_Volatile) |
BIT(BH_NILFS_Checked) | BIT(BH_NILFS_Redirected)); BIT(BH_NILFS_Checked) | BIT(BH_NILFS_Redirected));
bh = head = page_buffers(page); bh = head;
do { do {
lock_buffer(bh); lock_buffer(bh);
if (!silent) if (!silent)
...@@ -427,7 +428,7 @@ void nilfs_clear_dirty_page(struct page *page, bool silent) ...@@ -427,7 +428,7 @@ void nilfs_clear_dirty_page(struct page *page, bool silent)
} while (bh = bh->b_this_page, bh != head); } while (bh = bh->b_this_page, bh != head);
} }
__nilfs_clear_page_dirty(page); __nilfs_clear_page_dirty(&folio->page);
} }
unsigned int nilfs_page_count_clean_buffers(struct page *page, unsigned int nilfs_page_count_clean_buffers(struct page *page,
......
...@@ -41,7 +41,7 @@ void nilfs_page_bug(struct page *); ...@@ -41,7 +41,7 @@ void nilfs_page_bug(struct page *);
int nilfs_copy_dirty_pages(struct address_space *, struct address_space *); int nilfs_copy_dirty_pages(struct address_space *, struct address_space *);
void nilfs_copy_back_pages(struct address_space *, struct address_space *); void nilfs_copy_back_pages(struct address_space *, struct address_space *);
void nilfs_clear_dirty_page(struct page *, bool); void nilfs_clear_folio_dirty(struct folio *, bool);
void nilfs_clear_dirty_pages(struct address_space *, bool); void nilfs_clear_dirty_pages(struct address_space *, bool);
unsigned int nilfs_page_count_clean_buffers(struct page *, unsigned int, unsigned int nilfs_page_count_clean_buffers(struct page *, unsigned int,
unsigned int); unsigned int);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment