diff mbox series

[05/19] mm/filemap: Rename generic_file_buffered_read subfunctions

Message ID 20201029193405.29125-6-willy@infradead.org
State New
Headers show
Series Transparent Hugepages for non-tmpfs filesystems | expand

Commit Message

Matthew Wilcox (Oracle) Oct. 29, 2020, 7:33 p.m. UTC
The recent split of generic_file_buffered_read() created some very
long function names which are hard to distinguish from each other.
Rename as follows:

generic_file_buffered_read_readpage -> gfbr_read_page
generic_file_buffered_read_pagenotuptodate -> gfbr_update_page
generic_file_buffered_read_no_cached_page -> gfbr_create_page
generic_file_buffered_read_get_pages -> gfbr_get_pages

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/filemap.c | 43 ++++++++++++++-----------------------------
 1 file changed, 14 insertions(+), 29 deletions(-)

Comments

Kent Overstreet Oct. 30, 2020, 12:04 a.m. UTC | #1
On Thu, Oct 29, 2020 at 07:33:51PM +0000, Matthew Wilcox (Oracle) wrote:
> The recent split of generic_file_buffered_read() created some very
> long function names which are hard to distinguish from each other.
> Rename as follows:
> 
> generic_file_buffered_read_readpage -> gfbr_read_page
> generic_file_buffered_read_pagenotuptodate -> gfbr_update_page
> generic_file_buffered_read_no_cached_page -> gfbr_create_page
> generic_file_buffered_read_get_pages -> gfbr_get_pages
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Reviewed-by: Kent Overstreet <kent.overstreet@gmail.com>
Christoph Hellwig Oct. 30, 2020, 8:56 a.m. UTC | #2
I actually had a series to clean a lot of this up based on the previous
version of the generic_file_buffered_read.  Give me a chance to
resurrect that..
Kirill A. Shutemov Nov. 3, 2020, 2:16 p.m. UTC | #3
On Thu, Oct 29, 2020 at 07:33:51PM +0000, Matthew Wilcox (Oracle) wrote:
> generic_file_buffered_read_readpage -> gfbr_read_page
> generic_file_buffered_read_pagenotuptodate -> gfbr_update_page
> generic_file_buffered_read_no_cached_page -> gfbr_create_page
> generic_file_buffered_read_get_pages -> gfbr_get_pages

Oh.. I hate this. "gfbr" is something you see in a spoon of letter soup.

Maybe just drop few of these words? "buffered_read_" or "file_read_"?
Matthew Wilcox (Oracle) Nov. 3, 2020, 2:40 p.m. UTC | #4
On Tue, Nov 03, 2020 at 05:16:01PM +0300, Kirill A. Shutemov wrote:
> On Thu, Oct 29, 2020 at 07:33:51PM +0000, Matthew Wilcox (Oracle) wrote:
> > generic_file_buffered_read_readpage -> gfbr_read_page
> > generic_file_buffered_read_pagenotuptodate -> gfbr_update_page
> > generic_file_buffered_read_no_cached_page -> gfbr_create_page
> > generic_file_buffered_read_get_pages -> gfbr_get_pages
> 
> Oh.. I hate this. "gfbr" is something you see in a spoon of letter soup.
> 
> Maybe just drop few of these words? "buffered_read_" or "file_read_"?

gfbr became filemap.  See [PATCH 00/17] Refactor generic_file_buffered_read
Kirill A. Shutemov Nov. 3, 2020, 3:02 p.m. UTC | #5
On Tue, Nov 03, 2020 at 02:40:14PM +0000, Matthew Wilcox wrote:
> On Tue, Nov 03, 2020 at 05:16:01PM +0300, Kirill A. Shutemov wrote:
> > On Thu, Oct 29, 2020 at 07:33:51PM +0000, Matthew Wilcox (Oracle) wrote:
> > > generic_file_buffered_read_readpage -> gfbr_read_page
> > > generic_file_buffered_read_pagenotuptodate -> gfbr_update_page
> > > generic_file_buffered_read_no_cached_page -> gfbr_create_page
> > > generic_file_buffered_read_get_pages -> gfbr_get_pages
> > 
> > Oh.. I hate this. "gfbr" is something you see in a spoon of letter soup.
> > 
> > Maybe just drop few of these words? "buffered_read_" or "file_read_"?
> 
> gfbr became filemap.  See [PATCH 00/17] Refactor generic_file_buffered_read

Okay, works for me.
diff mbox series

Patch

diff --git a/mm/filemap.c b/mm/filemap.c
index a68516ddeddc..7bc791b47a68 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2176,11 +2176,8 @@  static int lock_page_for_iocb(struct kiocb *iocb, struct page *page)
 		return lock_page_killable(page);
 }
 
-static struct page *
-generic_file_buffered_read_readpage(struct kiocb *iocb,
-				    struct file *filp,
-				    struct address_space *mapping,
-				    struct page *page)
+static struct page *gfbr_read_page(struct kiocb *iocb, struct file *filp,
+		struct address_space *mapping, struct page *page)
 {
 	struct file_ra_state *ra = &filp->f_ra;
 	int error;
@@ -2231,12 +2228,9 @@  generic_file_buffered_read_readpage(struct kiocb *iocb,
 	return page;
 }
 
-static struct page *
-generic_file_buffered_read_pagenotuptodate(struct kiocb *iocb,
-					   struct file *filp,
-					   struct iov_iter *iter,
-					   struct page *page,
-					   loff_t pos, loff_t count)
+static struct page *gfbr_update_page(struct kiocb *iocb, struct file *filp,
+		struct iov_iter *iter, struct page *page, loff_t pos,
+		loff_t count)
 {
 	struct address_space *mapping = filp->f_mapping;
 	struct inode *inode = mapping->host;
@@ -2299,12 +2293,10 @@  generic_file_buffered_read_pagenotuptodate(struct kiocb *iocb,
 		return page;
 	}
 
-	return generic_file_buffered_read_readpage(iocb, filp, mapping, page);
+	return gfbr_read_page(iocb, filp, mapping, page);
 }
 
-static struct page *
-generic_file_buffered_read_no_cached_page(struct kiocb *iocb,
-					  struct iov_iter *iter)
+static struct page *gfbr_create_page(struct kiocb *iocb, struct iov_iter *iter)
 {
 	struct file *filp = iocb->ki_filp;
 	struct address_space *mapping = filp->f_mapping;
@@ -2315,10 +2307,6 @@  generic_file_buffered_read_no_cached_page(struct kiocb *iocb,
 	if (iocb->ki_flags & IOCB_NOIO)
 		return ERR_PTR(-EAGAIN);
 
-	/*
-	 * Ok, it wasn't cached, so we need to create a new
-	 * page..
-	 */
 	page = page_cache_alloc(mapping);
 	if (!page)
 		return ERR_PTR(-ENOMEM);
@@ -2330,13 +2318,11 @@  generic_file_buffered_read_no_cached_page(struct kiocb *iocb,
 		return error != -EEXIST ? ERR_PTR(error) : NULL;
 	}
 
-	return generic_file_buffered_read_readpage(iocb, filp, mapping, page);
+	return gfbr_read_page(iocb, filp, mapping, page);
 }
 
-static int generic_file_buffered_read_get_pages(struct kiocb *iocb,
-						struct iov_iter *iter,
-						struct page **pages,
-						unsigned int nr)
+static int gfbr_get_pages(struct kiocb *iocb, struct iov_iter *iter,
+		struct page **pages, unsigned int nr)
 {
 	struct file *filp = iocb->ki_filp;
 	struct address_space *mapping = filp->f_mapping;
@@ -2363,7 +2349,7 @@  static int generic_file_buffered_read_get_pages(struct kiocb *iocb,
 	if (nr_got)
 		goto got_pages;
 
-	pages[0] = generic_file_buffered_read_no_cached_page(iocb, iter);
+	pages[0] = gfbr_create_page(iocb, iter);
 	err = PTR_ERR_OR_ZERO(pages[0]);
 	if (!IS_ERR_OR_NULL(pages[0]))
 		nr_got = 1;
@@ -2397,8 +2383,8 @@  static int generic_file_buffered_read_get_pages(struct kiocb *iocb,
 				break;
 			}
 
-			page = generic_file_buffered_read_pagenotuptodate(iocb,
-					filp, iter, page, pg_pos, pg_count);
+			page = gfbr_update_page(iocb, filp, iter, page,
+					pg_pos, pg_count);
 			if (IS_ERR_OR_NULL(page)) {
 				for (j = i + 1; j < nr_got; j++)
 					put_page(pages[j]);
@@ -2474,8 +2460,7 @@  ssize_t generic_file_buffered_read(struct kiocb *iocb,
 			iocb->ki_flags |= IOCB_NOWAIT;
 
 		i = 0;
-		pg_nr = generic_file_buffered_read_get_pages(iocb, iter,
-							     pages, nr_pages);
+		pg_nr = gfbr_get_pages(iocb, iter, pages, nr_pages);
 		if (pg_nr < 0) {
 			error = pg_nr;
 			break;