+ fs-dont-opencode-lru_to_page.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: fs: don't open code lru_to_page()
has been added to the -mm tree.  Its filename is
     fs-dont-opencode-lru_to_page.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/fs-dont-opencode-lru_to_page.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/fs-dont-opencode-lru_to_page.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Nikolay Borisov <nborisov@xxxxxxxx>
Subject: fs: don't open code lru_to_page()

Multiple filesystems open code lru_to_page().  Rectify this by moving the
macro from mm_inline (which is specific to lru stuff) to the more generic
mm.h header and start using the macro where appropriate.

No functional changes.

Link: http://lkml.kernel.org/r/20181129104810.23361-1-nborisov@xxxxxxxx
Link: https://lkml.kernel.org/r/20181129075301.29087-1-nborisov@xxxxxxxx
Signed-off-by: Nikolay Borisov <nborisov@xxxxxxxx>
Acked-by: Michal Hocko <mhocko@xxxxxxxx>
Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/afs/file.c             |    5 +++--
 fs/btrfs/extent_io.c      |    2 +-
 fs/ceph/addr.c            |    5 ++---
 fs/cifs/file.c            |    3 ++-
 fs/ext4/readpage.c        |    2 +-
 fs/ocfs2/aops.c           |    3 ++-
 fs/orangefs/inode.c       |    2 +-
 include/linux/mm.h        |    2 ++
 include/linux/mm_inline.h |    3 ---
 mm/swap.c                 |    2 +-
 10 files changed, 15 insertions(+), 14 deletions(-)

--- a/fs/afs/file.c~fs-dont-opencode-lru_to_page
+++ a/fs/afs/file.c
@@ -17,6 +17,7 @@
 #include <linux/writeback.h>
 #include <linux/gfp.h>
 #include <linux/task_io_accounting_ops.h>
+#include <linux/mm.h>
 #include "internal.h"
 
 static int afs_file_mmap(struct file *file, struct vm_area_struct *vma);
@@ -441,7 +442,7 @@ static int afs_readpages_one(struct file
 	/* Count the number of contiguous pages at the front of the list.  Note
 	 * that the list goes prev-wards rather than next-wards.
 	 */
-	first = list_entry(pages->prev, struct page, lru);
+	first = lru_to_page(pages);
 	index = first->index + 1;
 	n = 1;
 	for (p = first->lru.prev; p != pages; p = p->prev) {
@@ -473,7 +474,7 @@ static int afs_readpages_one(struct file
 	 * page at the end of the file.
 	 */
 	do {
-		page = list_entry(pages->prev, struct page, lru);
+		page = lru_to_page(pages);
 		list_del(&page->lru);
 		index = page->index;
 		if (add_to_page_cache_lru(page, mapping, index,
--- a/fs/btrfs/extent_io.c~fs-dont-opencode-lru_to_page
+++ a/fs/btrfs/extent_io.c
@@ -4105,7 +4105,7 @@ int extent_readpages(struct address_spac
 	u64 prev_em_start = (u64)-1;
 
 	for (page_idx = 0; page_idx < nr_pages; page_idx++) {
-		page = list_entry(pages->prev, struct page, lru);
+		page = lru_to_page(pages);
 
 		prefetchw(&page->flags);
 		list_del(&page->lru);
--- a/fs/ceph/addr.c~fs-dont-opencode-lru_to_page
+++ a/fs/ceph/addr.c
@@ -306,7 +306,7 @@ static int start_read(struct inode *inod
 	struct ceph_osd_client *osdc =
 		&ceph_inode_to_client(inode)->client->osdc;
 	struct ceph_inode_info *ci = ceph_inode(inode);
-	struct page *page = list_entry(page_list->prev, struct page, lru);
+	struct page *page = lru_to_page(page_list);
 	struct ceph_vino vino;
 	struct ceph_osd_request *req;
 	u64 off;
@@ -333,8 +333,7 @@ static int start_read(struct inode *inod
 			if (got)
 				ceph_put_cap_refs(ci, got);
 			while (!list_empty(page_list)) {
-				page = list_entry(page_list->prev,
-						  struct page, lru);
+				page = lru_to_page(page_list);
 				list_del(&page->lru);
 				put_page(page);
 			}
--- a/fs/cifs/file.c~fs-dont-opencode-lru_to_page
+++ a/fs/cifs/file.c
@@ -33,6 +33,7 @@
 #include <linux/mount.h>
 #include <linux/slab.h>
 #include <linux/swap.h>
+#include <linux/mm.h>
 #include <asm/div64.h>
 #include "cifsfs.h"
 #include "cifspdu.h"
@@ -3975,7 +3976,7 @@ readpages_get_pages(struct address_space
 
 	INIT_LIST_HEAD(tmplist);
 
-	page = list_entry(page_list->prev, struct page, lru);
+	page = lru_to_page(page_list);
 
 	/*
 	 * Lock the page and put it in the cache. Since no one else
--- a/fs/ext4/readpage.c~fs-dont-opencode-lru_to_page
+++ a/fs/ext4/readpage.c
@@ -128,7 +128,7 @@ int ext4_mpage_readpages(struct address_
 
 		prefetchw(&page->flags);
 		if (pages) {
-			page = list_entry(pages->prev, struct page, lru);
+			page = lru_to_page(pages);
 			list_del(&page->lru);
 			if (add_to_page_cache_lru(page, mapping, page->index,
 				  readahead_gfp_mask(mapping)))
--- a/fs/ocfs2/aops.c~fs-dont-opencode-lru_to_page
+++ a/fs/ocfs2/aops.c
@@ -30,6 +30,7 @@
 #include <linux/quotaops.h>
 #include <linux/blkdev.h>
 #include <linux/uio.h>
+#include <linux/mm.h>
 
 #include <cluster/masklog.h>
 
@@ -397,7 +398,7 @@ static int ocfs2_readpages(struct file *
 	 * Check whether a remote node truncated this file - we just
 	 * drop out in that case as it's not worth handling here.
 	 */
-	last = list_entry(pages->prev, struct page, lru);
+	last = lru_to_page(pages);
 	start = (loff_t)last->index << PAGE_SHIFT;
 	if (start >= i_size_read(inode))
 		goto out_unlock;
--- a/fs/orangefs/inode.c~fs-dont-opencode-lru_to_page
+++ a/fs/orangefs/inode.c
@@ -77,7 +77,7 @@ static int orangefs_readpages(struct fil
 	for (page_idx = 0; page_idx < nr_pages; page_idx++) {
 		struct page *page;
 
-		page = list_entry(pages->prev, struct page, lru);
+		page = lru_to_page(pages);
 		list_del(&page->lru);
 		if (!add_to_page_cache(page,
 				       mapping,
--- a/include/linux/mm.h~fs-dont-opencode-lru_to_page
+++ a/include/linux/mm.h
@@ -206,6 +206,8 @@ extern int overcommit_kbytes_handler(str
 /* test whether an address (unsigned long or pointer) is aligned to PAGE_SIZE */
 #define PAGE_ALIGNED(addr)	IS_ALIGNED((unsigned long)(addr), PAGE_SIZE)
 
+#define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
+
 /*
  * Linux kernel virtual memory manager primitives.
  * The idea being to have a "virtual" mm in the same way
--- a/include/linux/mm_inline.h~fs-dont-opencode-lru_to_page
+++ a/include/linux/mm_inline.h
@@ -124,7 +124,4 @@ static __always_inline enum lru_list pag
 	}
 	return lru;
 }
-
-#define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
-
 #endif
--- a/mm/swap.c~fs-dont-opencode-lru_to_page
+++ a/mm/swap.c
@@ -126,7 +126,7 @@ void put_pages_list(struct list_head *pa
 	while (!list_empty(pages)) {
 		struct page *victim;
 
-		victim = list_entry(pages->prev, struct page, lru);
+		victim = lru_to_page(pages);
 		list_del(&victim->lru);
 		put_page(victim);
 	}
_

Patches currently in -mm which might be from nborisov@xxxxxxxx are

fs-dont-opencode-lru_to_page.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux