diff mbox series

[2/4] nilfs2: Convert nilfs_page_count_clean_buffers() to take a folio

Message ID 20241002150036.1339475-3-willy@infradead.org (mailing list archive)
State New
Headers show
Series nilfs2: Finish folio conversion | expand

Commit Message

Matthew Wilcox Oct. 2, 2024, 3 p.m. UTC
Both callers have a folio, so pass it in and use it directly.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 fs/nilfs2/dir.c   | 2 +-
 fs/nilfs2/inode.c | 2 +-
 fs/nilfs2/page.c  | 4 ++--
 fs/nilfs2/page.h  | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

Comments

Ryusuke Konishi Oct. 3, 2024, 11:51 a.m. UTC | #1
On Thu, Oct 3, 2024 at 12:00 AM Matthew Wilcox (Oracle) wrote:
>
> Both callers have a folio, so pass it in and use it directly.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> ---
>  fs/nilfs2/dir.c   | 2 +-
>  fs/nilfs2/inode.c | 2 +-
>  fs/nilfs2/page.c  | 4 ++--
>  fs/nilfs2/page.h  | 4 ++--
>  4 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
> index fe5b1a30c509..b1ad4062bbab 100644
> --- a/fs/nilfs2/dir.c
> +++ b/fs/nilfs2/dir.c
> @@ -95,7 +95,7 @@ static void nilfs_commit_chunk(struct folio *folio,
>         unsigned int nr_dirty;
>         int err;
>
> -       nr_dirty = nilfs_page_count_clean_buffers(&folio->page, from, to);
> +       nr_dirty = nilfs_page_count_clean_buffers(folio, from, to);
>         copied = block_write_end(NULL, mapping, pos, len, len, folio, NULL);
>         if (pos + copied > dir->i_size)
>                 i_size_write(dir, pos + copied);
> diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
> index f1b47b655672..005dfd1f8fec 100644
> --- a/fs/nilfs2/inode.c
> +++ b/fs/nilfs2/inode.c
> @@ -242,7 +242,7 @@ static int nilfs_write_end(struct file *file, struct address_space *mapping,
>         unsigned int nr_dirty;
>         int err;
>
> -       nr_dirty = nilfs_page_count_clean_buffers(&folio->page, start,
> +       nr_dirty = nilfs_page_count_clean_buffers(folio, start,
>                                                   start + copied);
>         copied = generic_write_end(file, mapping, pos, len, copied, folio,
>                                    fsdata);
> diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
> index 16bb82cdbc07..ebd395dd131b 100644
> --- a/fs/nilfs2/page.c
> +++ b/fs/nilfs2/page.c
> @@ -419,14 +419,14 @@ void nilfs_clear_folio_dirty(struct folio *folio)
>         __nilfs_clear_folio_dirty(folio);
>  }
>
> -unsigned int nilfs_page_count_clean_buffers(struct page *page,
> +unsigned int nilfs_page_count_clean_buffers(struct folio *folio,
>                                             unsigned int from, unsigned int to)
>  {
>         unsigned int block_start, block_end;
>         struct buffer_head *bh, *head;
>         unsigned int nc = 0;
>
> -       for (bh = head = page_buffers(page), block_start = 0;
> +       for (bh = head = folio_buffers(folio), block_start = 0;
>              bh != head || !block_start;
>              block_start = block_end, bh = bh->b_this_page) {
>                 block_end = block_start + bh->b_size;
> diff --git a/fs/nilfs2/page.h b/fs/nilfs2/page.h
> index 64521a03a19e..b6d9301f16ae 100644
> --- a/fs/nilfs2/page.h
> +++ b/fs/nilfs2/page.h
> @@ -43,8 +43,8 @@ int nilfs_copy_dirty_pages(struct address_space *, struct address_space *);
>  void nilfs_copy_back_pages(struct address_space *, struct address_space *);
>  void nilfs_clear_folio_dirty(struct folio *folio);
>  void nilfs_clear_dirty_pages(struct address_space *mapping);
> -unsigned int nilfs_page_count_clean_buffers(struct page *, unsigned int,
> -                                           unsigned int);
> +unsigned int nilfs_page_count_clean_buffers(struct folio *,
> +               unsigned int from, unsigned int to);

This gives the following checkpatch warning:

WARNING: function definition argument 'struct folio *' should also
have an identifier name
#75: FILE: fs/nilfs2/page.h:46:
+unsigned int nilfs_page_count_clean_buffers(struct folio *,

It would be appreciated if you could include the argument name in the
declaration of nilfs_page_count_clean_buffer after replacement.

Everything else seems fine.

Thanks,
Ryusuke Konishi

>  unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
>                                             sector_t start_blk,
>                                             sector_t *blkoff);
> --
> 2.43.0
>
diff mbox series

Patch

diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c
index fe5b1a30c509..b1ad4062bbab 100644
--- a/fs/nilfs2/dir.c
+++ b/fs/nilfs2/dir.c
@@ -95,7 +95,7 @@  static void nilfs_commit_chunk(struct folio *folio,
 	unsigned int nr_dirty;
 	int err;
 
-	nr_dirty = nilfs_page_count_clean_buffers(&folio->page, from, to);
+	nr_dirty = nilfs_page_count_clean_buffers(folio, from, to);
 	copied = block_write_end(NULL, mapping, pos, len, len, folio, NULL);
 	if (pos + copied > dir->i_size)
 		i_size_write(dir, pos + copied);
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index f1b47b655672..005dfd1f8fec 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -242,7 +242,7 @@  static int nilfs_write_end(struct file *file, struct address_space *mapping,
 	unsigned int nr_dirty;
 	int err;
 
-	nr_dirty = nilfs_page_count_clean_buffers(&folio->page, start,
+	nr_dirty = nilfs_page_count_clean_buffers(folio, start,
 						  start + copied);
 	copied = generic_write_end(file, mapping, pos, len, copied, folio,
 				   fsdata);
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c
index 16bb82cdbc07..ebd395dd131b 100644
--- a/fs/nilfs2/page.c
+++ b/fs/nilfs2/page.c
@@ -419,14 +419,14 @@  void nilfs_clear_folio_dirty(struct folio *folio)
 	__nilfs_clear_folio_dirty(folio);
 }
 
-unsigned int nilfs_page_count_clean_buffers(struct page *page,
+unsigned int nilfs_page_count_clean_buffers(struct folio *folio,
 					    unsigned int from, unsigned int to)
 {
 	unsigned int block_start, block_end;
 	struct buffer_head *bh, *head;
 	unsigned int nc = 0;
 
-	for (bh = head = page_buffers(page), block_start = 0;
+	for (bh = head = folio_buffers(folio), block_start = 0;
 	     bh != head || !block_start;
 	     block_start = block_end, bh = bh->b_this_page) {
 		block_end = block_start + bh->b_size;
diff --git a/fs/nilfs2/page.h b/fs/nilfs2/page.h
index 64521a03a19e..b6d9301f16ae 100644
--- a/fs/nilfs2/page.h
+++ b/fs/nilfs2/page.h
@@ -43,8 +43,8 @@  int nilfs_copy_dirty_pages(struct address_space *, struct address_space *);
 void nilfs_copy_back_pages(struct address_space *, struct address_space *);
 void nilfs_clear_folio_dirty(struct folio *folio);
 void nilfs_clear_dirty_pages(struct address_space *mapping);
-unsigned int nilfs_page_count_clean_buffers(struct page *, unsigned int,
-					    unsigned int);
+unsigned int nilfs_page_count_clean_buffers(struct folio *,
+		unsigned int from, unsigned int to);
 unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
 					    sector_t start_blk,
 					    sector_t *blkoff);