Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2350506imu; Thu, 29 Nov 2018 03:41:39 -0800 (PST) X-Google-Smtp-Source: AFSGD/U6rQoFIy5FaqCjM7ia1JtwM0bbEEYe//FEpIP9zLkasmhudmmTVErdpvjTPXXPo1Geaz89 X-Received: by 2002:a17:902:850c:: with SMTP id bj12mr1125854plb.46.1543491699841; Thu, 29 Nov 2018 03:41:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543491699; cv=none; d=google.com; s=arc-20160816; b=d2fLfukUfAR8//Iya2UnCzs13tWrynUtMj+dxg4K3GIsf4Vpv+IaNpn475hINSU5qR dgXqZivRhuX8wQoHhhmsVIEksEycG++pkRwfmaKqngKapYuqpHutr24NptRxJ8FmwJVG +Da7GezKn7DL0lH/K9m9Dub1GfoYKuT6X3l6qxX+q4JqXozaTvi3io1jILV1uR/hlgWO uYQbhYecqL7uX+iYafDqmpW23b34+VW6eG9FP62Ae68W0cfINRe9YRFjOZUgCRd4ez/I RwAeZk/sKk/dkVdf7A1wgZ6dGPxu1atIc9OO4CpIz1HQbXwAayFFV5mcMgiUHs7lW8E0 7BKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date; bh=tCjZOXY70X/tdkB9aVpc/j8rtU+Iry1KloOCiCksHhU=; b=q0WjcuVx21xsRO+kqtTRztDi6vAED86BeLXpEIxzS3MCmD110HJwLI+szvoOACdQ9R TLHW35cuBhiv9PEFr1OxV2J0rQNnY2OeuFybbnUsE0splhOyIq227E/bODJh4cxwfSc2 4IVE0Nco1tpLUWZ8Wm5sHG3vFEA3s1GgQ05+ZhCA6GG+t/M9tkzZHiSHOgWrbqv0PVSD mbAUk6wJN7MiILBSplRZ00Wz8SU9Kg1eeIIYCVFVR1IHhBzGbQ74iVpgFvopVcXMdgTq W8i5BthwmR6QBcA8F1vmJoWbWDvY+BpB2Pomh7rev0HorUJXwlN+yrhOcXm2qajocOo5 yRQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si1147282pls.408.2018.11.29.03.41.24; Thu, 29 Nov 2018 03:41:39 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728108AbeK2Wnr (ORCPT + 99 others); Thu, 29 Nov 2018 17:43:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51616 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726869AbeK2Wnr (ORCPT ); Thu, 29 Nov 2018 17:43:47 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C75030001E8; Thu, 29 Nov 2018 11:38:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ADAD462997; Thu, 29 Nov 2018 11:38:41 +0000 (UTC) Received: from zmail21.collab.prod.int.phx2.redhat.com (zmail21.collab.prod.int.phx2.redhat.com [10.5.83.24]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3D9801809546; Thu, 29 Nov 2018 11:38:41 +0000 (UTC) Date: Thu, 29 Nov 2018 06:38:40 -0500 (EST) From: Pankaj Gupta To: Nikolay Borisov Cc: Michal Hocko , linux-kernel@vger.kernel.org, David Howells , Chris Mason , Josef Bacik , David Sterba , Zheng Yan , Sage Weil , Ilya Dryomov , Steve French , Theodore Ts'o , Andreas Dilger , Mark Fasheh , Joel Becker , Mike Marshall , Martin Brandenburg , Andrew Morton , Mike Rapoport , Matthew Wilcox , Randy Dunlap , YueHaibing , Shakeel Butt , Dan Williams , linux-afs@lists.infradead.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-ext4@vger.kernel.org, ocfs2-devel@oss.oracle.com, devel@lists.orangefs.org, linux-mm@kvack.org Message-ID: <1231450124.37408874.1543491520867.JavaMail.zimbra@redhat.com> In-Reply-To: <0921bc8f-b899-4925-51f2-a9f45d4c906a@suse.com> References: <20181129075301.29087-1-nborisov@suse.com> <20181129075301.29087-2-nborisov@suse.com> <20181129081826.GO6923@dhcp22.suse.cz> <0921bc8f-b899-4925-51f2-a9f45d4c906a@suse.com> Subject: Re: [PATCH 2/2] fs: Don't open-code lru_to_page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.116.136, 10.4.195.28] Thread-Topic: Don't open-code lru_to_page Thread-Index: f6plNFJ2u+TeYP0RguagIH0cNHPblQ== X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 29 Nov 2018 11:38:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > >> There are a bunch of filesystems which essentially open-code lru_to_page > >> helper. Change them to using the helper. No functional changes. > > > > I would just squash the two into a single patch. It makes the first one > > more obvious. Or is there any reason to have them separate? > > No reason, just didn't know how people would react so that's why I chose > to send as two separate. > > If I squash them who would be the best person to take them ? For squashed version: Acked-by: Pankaj gupta > > > > >> Signed-off-by: Nikolay Borisov > > > > Acked-by: Michal Hocko > > > >> --- > >> > >> Since this is a mostly mechanical change I've actually batched all of them > >> in > >> a single patch. > >> > >> 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 +- > >> mm/swap.c | 2 +- > >> 8 files changed, 13 insertions(+), 11 deletions(-) > >> > >> diff --git a/fs/afs/file.c b/fs/afs/file.c > >> index d6bc3f5d784b..323ae9912203 100644 > >> --- a/fs/afs/file.c > >> +++ b/fs/afs/file.c > >> @@ -17,6 +17,7 @@ > >> #include > >> #include > >> #include > >> +#include > >> #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 *file, struct > >> address_space *mapping, > >> /* 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 *file, struct > >> address_space *mapping, > >> * 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, > >> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c > >> index 19f4b8fd654f..8332c5f4b1c3 100644 > >> --- a/fs/btrfs/extent_io.c > >> +++ b/fs/btrfs/extent_io.c > >> @@ -4104,7 +4104,7 @@ int extent_readpages(struct address_space *mapping, > >> struct list_head *pages, > >> 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); > >> diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c > >> index 8eade7a993c1..5d0c05e288cc 100644 > >> --- a/fs/ceph/addr.c > >> +++ b/fs/ceph/addr.c > >> @@ -306,7 +306,7 @@ static int start_read(struct inode *inode, struct > >> ceph_rw_context *rw_ctx, > >> 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 *inode, struct > >> ceph_rw_context *rw_ctx, > >> 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); > >> } > >> diff --git a/fs/cifs/file.c b/fs/cifs/file.c > >> index 74c33d5fafc8..b16a4d887d17 100644 > >> --- a/fs/cifs/file.c > >> +++ b/fs/cifs/file.c > >> @@ -33,6 +33,7 @@ > >> #include > >> #include > >> #include > >> +#include > >> #include > >> #include "cifsfs.h" > >> #include "cifspdu.h" > >> @@ -3975,7 +3976,7 @@ readpages_get_pages(struct address_space *mapping, > >> struct list_head *page_list, > >> > >> 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 > >> diff --git a/fs/ext4/readpage.c b/fs/ext4/readpage.c > >> index f461d75ac049..6aa282ee455a 100644 > >> --- a/fs/ext4/readpage.c > >> +++ b/fs/ext4/readpage.c > >> @@ -128,7 +128,7 @@ int ext4_mpage_readpages(struct address_space > >> *mapping, > >> > >> 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))) > >> diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c > >> index eb1ce30412dc..832c1759a09a 100644 > >> --- a/fs/ocfs2/aops.c > >> +++ b/fs/ocfs2/aops.c > >> @@ -30,6 +30,7 @@ > >> #include > >> #include > >> #include > >> +#include > >> > >> #include > >> > >> @@ -397,7 +398,7 @@ static int ocfs2_readpages(struct file *filp, struct > >> address_space *mapping, > >> * 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; > >> diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c > >> index fe53381b26b1..f038235c64bd 100644 > >> --- a/fs/orangefs/inode.c > >> +++ b/fs/orangefs/inode.c > >> @@ -77,7 +77,7 @@ static int orangefs_readpages(struct file *file, > >> 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, > >> diff --git a/mm/swap.c b/mm/swap.c > >> index aa483719922e..20b9e9d99652 100644 > >> --- a/mm/swap.c > >> +++ b/mm/swap.c > >> @@ -126,7 +126,7 @@ void put_pages_list(struct list_head *pages) > >> 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); > >> } > >> -- > >> 2.17.1 > > > >