From patchwork Thu Nov 29 07:52:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 10704133 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 81A63109C for ; Thu, 29 Nov 2018 07:53:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78A8F295D6 for ; Thu, 29 Nov 2018 07:53:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CC9929856; Thu, 29 Nov 2018 07:53:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 045FC295D6 for ; Thu, 29 Nov 2018 07:53:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2ABE06B5179; Thu, 29 Nov 2018 02:53:35 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 232136B517A; Thu, 29 Nov 2018 02:53:35 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0FB9F6B517B; Thu, 29 Nov 2018 02:53:35 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by kanga.kvack.org (Postfix) with ESMTP id CA6B36B5179 for ; Thu, 29 Nov 2018 02:53:34 -0500 (EST) Received: by mail-pf1-f200.google.com with SMTP id t72so875557pfi.21 for ; Wed, 28 Nov 2018 23:53:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=Vod9vCgp/hIsfnMxiYI/fehh33dItJbH/BNHsLTUt2E=; b=KxmyY/LaqFSJGvgOzf5H5oaKfvVX4ZMhcY+8JQPsROJ6ZEkFUkszAmz2YNfqspEwVn cDy7AJI/QsVAicC3hC2XumP63pHW69nfQJHcimXpWW1mS8Od7agphmO7m2P0KNaMz8Bm IGn8VxzOWHJaDdyvkFBMRIjjXZ47m9zMhkylZPFyxcUuDAmr+/byF4obWLv6540+8kSs JnT1Vi+4c6ZdaI+4ZmzCfnIEnW1uiaaWO9FYIERtH5NQ1h/gWH5S/FymX8cvH1cjfbee ESfBwfHbQEsII2qfhWHLYUXj6tCGgMT18dr8L/nXACU9YszX5nNKEAg8lRaOc4nqCrpP vv/w== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of nborisov@suse.com designates 195.135.220.15 as permitted sender) smtp.mailfrom=nborisov@suse.com X-Gm-Message-State: AA+aEWYtsK6h5e4YmwwwESVt+hsQOTZT+x9pjIL9HZTMawFNOSW1x9Os Do9T0HhB+p+H+f4QP5qwg2xK/Sy/uMxpTAiSgKzXUFojHtTzZqvPrWEts2zmHOdpqdcruJkD/hz 5i9LPJV8gWn92x/jo059BPti23h8cAGJXp1p618AXKCuEhNYYqj6RnOrpFipCXKXdsw== X-Received: by 2002:a63:1d1d:: with SMTP id d29mr377356pgd.49.1543478014390; Wed, 28 Nov 2018 23:53:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/WexvyiFdyXoglL7uqwZnEXY7eiHdIqdaiVl48QyivM5Quu+cY4Szy437jz/wyQSeNd5c8l X-Received: by 2002:a63:1d1d:: with SMTP id d29mr377329pgd.49.1543478013310; Wed, 28 Nov 2018 23:53:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543478013; cv=none; d=google.com; s=arc-20160816; b=NOSfS2SY0h7xfpT1fGO0g95yG1gxX6SMoQDqSxpxYOFUxQhIHZ1gvxJadlReWrx8bQ Zjvh9jQNCLkk8FXM7ExLlaJFMewNC7hgO7mnIMxjSIGGKT4mDrZJ+D7HuxZUByo3y/28 X6xXvKQNW4ebQXlSGunFUtJHUu0OWO/VHt4Jr92bfvz4595/7KUDYUiVvi3YsIbxXLuN 7gY2lszOxCuK2YvTSeZ9jYwqyaDqGV/KMn1XdoWxOW0yWD6hHN1JSjJ7Dul3Qly+AFuD VccjPptArnkdXE2pG0GAXDTD+zjHRAGKBsJygIwB4fXrXp5nBd3DatjumWk1JQJzHmBn P15Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=Vod9vCgp/hIsfnMxiYI/fehh33dItJbH/BNHsLTUt2E=; b=E+1XCtLrfh1Z1szhqUTx2OHbAePXEZHtikrbyYJrxcZR5eLm0u6g4CFJ4XmcdfCIKK s15tnkUHjqvnjRt5/GPsOiiaYzw7sHPgRYa/P1K4oohikUWY9UzfN9JxET0//hTVAy7f g75MGciylX335ePomVGoBJIyKMnjf6A7jweM1LRv/S+MSEvtmjPIQ7AwIEHWT2tCsMwk QLE31FZfPkr3meUbZlfYVkg5qvaSCfwHD/e6uS67XsmTNzdz4k2Fopr++S5xUp8ztPjd 85HPbd+3XAeGCkFqCOue5PMwudpqFajDJMJoih9voximk3v/gQb31MX3kXqD3BoBqnhp AjjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of nborisov@suse.com designates 195.135.220.15 as permitted sender) smtp.mailfrom=nborisov@suse.com Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id c191si1428121pfg.72.2018.11.28.23.53.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Nov 2018 23:53:33 -0800 (PST) Received-SPF: pass (google.com: domain of nborisov@suse.com designates 195.135.220.15 as permitted sender) client-ip=195.135.220.15; Authentication-Results: mx.google.com; spf=pass (google.com: domain of nborisov@suse.com designates 195.135.220.15 as permitted sender) smtp.mailfrom=nborisov@suse.com X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 858A5ADE0; Thu, 29 Nov 2018 07:53:31 +0000 (UTC) From: Nikolay Borisov To: linux-kernel@vger.kernel.org Cc: Nikolay Borisov , Andrew Morton , Matthew Wilcox , Michal Hocko , Dan Williams , "Kirill A. Shutemov" , Pavel Tatashin , Souptick Joarder , Logan Gunthorpe , Keith Busch , Tony Luck , Ingo Molnar , linux-mm@kvack.org Subject: [PATCH 1/2] mm: Move lru_to_page to mm.h Date: Thu, 29 Nov 2018 09:52:56 +0200 Message-Id: <20181129075301.29087-1-nborisov@suse.com> X-Mailer: git-send-email 2.17.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP There are multiple places in the kernel which opencode this helper, this patch moves it to the more generic mm.h header in preparation for using it. No functional changes. Signed-off-by: Nikolay Borisov --- include/linux/mm.h | 2 ++ include/linux/mm_inline.h | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 5411de93a363..47b4aa5bba93 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -146,6 +146,8 @@ extern int overcommit_kbytes_handler(struct ctl_table *, int, void __user *, /* 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 diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 10191c28fc04..04ec454d44ce 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -124,7 +124,4 @@ static __always_inline enum lru_list page_lru(struct page *page) } return lru; } - -#define lru_to_page(head) (list_entry((head)->prev, struct page, lru)) - #endif From patchwork Thu Nov 29 07:52:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 10704135 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D2D813BB for ; Thu, 29 Nov 2018 07:53:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4343128D77 for ; Thu, 29 Nov 2018 07:53:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37439294AC; Thu, 29 Nov 2018 07:53:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D35029856 for ; Thu, 29 Nov 2018 07:53:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE8A76B517B; Thu, 29 Nov 2018 02:53:46 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A6F916B517C; Thu, 29 Nov 2018 02:53:46 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 912EA6B517D; Thu, 29 Nov 2018 02:53:46 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by kanga.kvack.org (Postfix) with ESMTP id 4B4086B517B for ; Thu, 29 Nov 2018 02:53:46 -0500 (EST) Received: by mail-pg1-f197.google.com with SMTP id s27so698540pgm.4 for ; Wed, 28 Nov 2018 23:53:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=Ljs2ArZQwqAKJoNCRQ+0Y25noEAYnf20l6xMOChLSvw=; b=c9/6GXGHhVkAJZQClJCtCXTs65rJip7PBxhK1ZF0aaXI/+ZIbMCGMfkyd7OWMQ/ls5 v3oLnbgUo6RXrZb5eXxhz43KaI0XVPtJK3CcIKkCZFWvLJ1lnM8RFd9veFM8kt/53gzi b3x01X4bsrbK1ICAyApZ0c/0cM5Aeu1Vnv+pCbPuA1TMNSBA2hxHD/rsddoS3XsU6yvn 5NEazLe2QotBf6EignilHnNlNX1cBBmkAUCaee1EpMIMpmxd1l3sy9yarMfjifblb96J bU0v+3M+zf1QHeW1MZIP+40iHItk/lqKZROK8JBVv035+SXC37+0UpQ3ez2DGdGRmCe2 xpYg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of nborisov@suse.com designates 195.135.220.15 as permitted sender) smtp.mailfrom=nborisov@suse.com X-Gm-Message-State: AA+aEWaePoEVLjp2FBCHGn5g3bhvBzFFNv7W6ya6wxKOYAPZ0wrQtVZd 0GsSjexU7VTZ/HjI8IiqrN1WAx1gtgoZ1JJUZCoX7tdSQJ33KvsGVuBVx9mL4UAMiQATRbdygfY ibM8bcrzqqT1kU9Z7GnjaN2/qTSVmm7Bl7mEiBhn/nNFKgosBTkocRSY3OvM7+KFVag== X-Received: by 2002:a17:902:8687:: with SMTP id g7mr468810plo.96.1543478024458; Wed, 28 Nov 2018 23:53:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/U30AE4Oetd/jFg1lecPBtfOTv5Ti3IHraWuReAxCVTZRTZmDpAbzF3WeXBen3JqqJp4uL0 X-Received: by 2002:a17:902:8687:: with SMTP id g7mr468765plo.96.1543478023110; Wed, 28 Nov 2018 23:53:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543478023; cv=none; d=google.com; s=arc-20160816; b=BOSVaLWosKpOFqII/AGkkddof9PmIuwun2SMMpdSc20dcbGMUecT9PCJfiEpv1K6I4 umipG751yUqNBDEZcMxpN2gHzjqGuOBzkjfiOBQTLSmCQ6wgkllBdHO7Rdx78p8ZWPnm d2lkFtgqcYKimqJK4knNlJXN781rkwsH/QHH/A5JUXd08Y9JF4KFSzJ/vD3tj/vBwD7Q CWHCuglWZR+01BHKbt2wjC5AuQ5+7HmKWXEZOPAuh5T8UGLhNvN025j0mulQflPt0nwu 3IB1SGCvQl3CFAnr9asInkHVBv3M/j84d0Wmj/UW/+PxJZuVdwFuav/6aLMlH1/laRtY ueNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ljs2ArZQwqAKJoNCRQ+0Y25noEAYnf20l6xMOChLSvw=; b=GjORIdZwUNVZzuOel+4kR512jgcutNS9H4s2HiiD4FDeRUxRO88GVHaFZFZk6sbgT9 HzzGkKaBXoxOcc+oOYhLITPSS5K+K8wEM9OZN+Jx6TOHej3y98Nn6coMkGz0shXOf54i E81UeyIvw6DpivKsr4MVjNv4TQ30CBIU1J92PN2IEp16kdktN9/xwnrITQqiK2dk6ztp 9az2CgLsjg7M5Dwzcpt4jshReaIURyVB1uZbWrvLRRygVrHIlwKFcJkGgo1+0S0Ht8zZ DHzkMsFVPGOZdwH8ad6z562it81A7vYcuy/TakrrU34pbjFXfVG5W8JwkF1SYtTHRvHm RKjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of nborisov@suse.com designates 195.135.220.15 as permitted sender) smtp.mailfrom=nborisov@suse.com Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id 4si1453662pff.161.2018.11.28.23.53.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Nov 2018 23:53:43 -0800 (PST) Received-SPF: pass (google.com: domain of nborisov@suse.com designates 195.135.220.15 as permitted sender) client-ip=195.135.220.15; Authentication-Results: mx.google.com; spf=pass (google.com: domain of nborisov@suse.com designates 195.135.220.15 as permitted sender) smtp.mailfrom=nborisov@suse.com X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 03A41AEA3; Thu, 29 Nov 2018 07:53:40 +0000 (UTC) From: Nikolay Borisov To: linux-kernel@vger.kernel.org Cc: Nikolay Borisov , David Howells , Chris Mason , Josef Bacik , David Sterba , "Yan, Zheng" , 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 , Michal Hocko , 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 Subject: [PATCH 2/2] fs: Don't open-code lru_to_page Date: Thu, 29 Nov 2018 09:52:57 +0200 Message-Id: <20181129075301.29087-2-nborisov@suse.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181129075301.29087-1-nborisov@suse.com> References: <20181129075301.29087-1-nborisov@suse.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP There are a bunch of filesystems which essentially open-code lru_to_page helper. Change them to using the helper. No functional changes. Signed-off-by: Nikolay Borisov Acked-by: Michal Hocko Reviewed-by: David Hildenbrand Reviewed-by: Mike Rapoport Acked-by: Pankaj gupta Acked-by:: "Yan, Zheng" #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); }