Commit 36319c0c authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Andrew Morton

nilfs2: convert to nilfs_folio_buffers_clean()

All callers of nilfs_page_buffers_clean() now have a folio, so convert it
to take a folio.  While I'm at it, make it return a bool.

Link: https://lkml.kernel.org/r/20231114084436.2755-6-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 797e25ad
...@@ -81,7 +81,7 @@ void nilfs_forget_buffer(struct buffer_head *bh) ...@@ -81,7 +81,7 @@ void nilfs_forget_buffer(struct buffer_head *bh)
lock_buffer(bh); lock_buffer(bh);
set_mask_bits(&bh->b_state, clear_bits, 0); set_mask_bits(&bh->b_state, clear_bits, 0);
if (nilfs_page_buffers_clean(&folio->page)) if (nilfs_folio_buffers_clean(folio))
__nilfs_clear_page_dirty(&folio->page); __nilfs_clear_page_dirty(&folio->page);
bh->b_blocknr = -1; bh->b_blocknr = -1;
...@@ -131,23 +131,23 @@ void nilfs_copy_buffer(struct buffer_head *dbh, struct buffer_head *sbh) ...@@ -131,23 +131,23 @@ void nilfs_copy_buffer(struct buffer_head *dbh, struct buffer_head *sbh)
} }
/** /**
* nilfs_page_buffers_clean - check if a page has dirty buffers or not. * nilfs_folio_buffers_clean - Check if a folio has dirty buffers or not.
* @page: page to be checked * @folio: Folio to be checked.
* *
* nilfs_page_buffers_clean() returns zero if the page has dirty buffers. * nilfs_folio_buffers_clean() returns false if the folio has dirty buffers.
* Otherwise, it returns non-zero value. * Otherwise, it returns true.
*/ */
int nilfs_page_buffers_clean(struct page *page) bool nilfs_folio_buffers_clean(struct folio *folio)
{ {
struct buffer_head *bh, *head; struct buffer_head *bh, *head;
bh = head = page_buffers(page); bh = head = folio_buffers(folio);
do { do {
if (buffer_dirty(bh)) if (buffer_dirty(bh))
return 0; return false;
bh = bh->b_this_page; bh = bh->b_this_page;
} while (bh != head); } while (bh != head);
return 1; return true;
} }
void nilfs_page_bug(struct page *page) void nilfs_page_bug(struct page *page)
......
...@@ -36,7 +36,7 @@ struct buffer_head *nilfs_grab_buffer(struct inode *, struct address_space *, ...@@ -36,7 +36,7 @@ struct buffer_head *nilfs_grab_buffer(struct inode *, struct address_space *,
unsigned long, unsigned long); unsigned long, unsigned long);
void nilfs_forget_buffer(struct buffer_head *); void nilfs_forget_buffer(struct buffer_head *);
void nilfs_copy_buffer(struct buffer_head *, struct buffer_head *); void nilfs_copy_buffer(struct buffer_head *, struct buffer_head *);
int nilfs_page_buffers_clean(struct page *); bool nilfs_folio_buffers_clean(struct folio *);
void nilfs_page_bug(struct page *); 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 *);
......
...@@ -1759,7 +1759,7 @@ static void nilfs_end_folio_io(struct folio *folio, int err) ...@@ -1759,7 +1759,7 @@ static void nilfs_end_folio_io(struct folio *folio, int err)
* all the buffers get cleaned later. * all the buffers get cleaned later.
*/ */
folio_lock(folio); folio_lock(folio);
if (nilfs_page_buffers_clean(&folio->page)) if (nilfs_folio_buffers_clean(folio))
__nilfs_clear_page_dirty(&folio->page); __nilfs_clear_page_dirty(&folio->page);
folio_unlock(folio); folio_unlock(folio);
} }
...@@ -1767,7 +1767,7 @@ static void nilfs_end_folio_io(struct folio *folio, int err) ...@@ -1767,7 +1767,7 @@ static void nilfs_end_folio_io(struct folio *folio, int err)
} }
if (!err) { if (!err) {
if (!nilfs_page_buffers_clean(&folio->page)) if (!nilfs_folio_buffers_clean(folio))
filemap_dirty_folio(folio->mapping, folio); filemap_dirty_folio(folio->mapping, folio);
folio_clear_error(folio); folio_clear_error(folio);
} else { } else {
......
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