From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6EA6C433DB for ; Mon, 18 Jan 2021 17:03:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8037C22C9D for ; Mon, 18 Jan 2021 17:03:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8037C22C9D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0DE6B6B024C; Mon, 18 Jan 2021 12:03:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id F09186B024F; Mon, 18 Jan 2021 12:03:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF9A98D0018; Mon, 18 Jan 2021 12:03:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0028.hostedemail.com [216.40.44.28]) by kanga.kvack.org (Postfix) with ESMTP id C79AB6B024C for ; Mon, 18 Jan 2021 12:03:44 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5A8502494 for ; Mon, 18 Jan 2021 17:03:44 +0000 (UTC) X-FDA: 77719517568.30.toad37_3c17f712754a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 71C061800864E for ; Mon, 18 Jan 2021 17:03:41 +0000 (UTC) X-HE-Tag: toad37_3c17f712754a X-Filterd-Recvd-Size: 3665 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Mon, 18 Jan 2021 17:03:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=cTOpJKpaWG1T2olInxdo/JtYe/CGbbNz/gPOn4Fxrq8=; b=p6E17oGJgO7ca7drhZoZJR4lZT xxu34oeTRCxsNIquO7WC0+nBCAGmKRFwXddlh+q2zv01RvxrrW4CC/f6uUbmhF3HATUxP0cYfzKRS taOO2mli0NWSv6g+pOCkIPEoiQMflnX7AuC228Q7kdtsRFcVJwg5VpVPO3U4z+CQ2k4c0Q185AJZH rQhcdJskwqxUD5W39N55foJV651CllKXZ3au9IOPYeDsKyLC12Ns5GjJ6TfTELRVIW6r2gyY+7IY2 iJr+frT09M94ofbwC0ljOja5UBnwEVJlj2WAEBGuUsgpB/g9b/9A5voGXBaGtjvC44PKO4pPNyNa8 Sd6y0lZw==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1l1XwF-00D7XQ-3l; Mon, 18 Jan 2021 17:03:35 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org Subject: [PATCH v2 27/27] cachefiles: Switch to wait_page_key Date: Mon, 18 Jan 2021 17:01:48 +0000 Message-Id: <20210118170148.3126186-28-willy@infradead.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210118170148.3126186-1-willy@infradead.org> References: <20210118170148.3126186-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: Cachefiles was relying on wait_page_key and wait_bit_key being the same layout, which is fragile. Now that wait_page_key is exposed in the pagemap.h header, we can remove that fragility. Also switch it to use the folio directly instead of the page. Signed-off-by: Matthew Wilcox (Oracle) --- fs/cachefiles/rdwr.c | 13 ++++++------- include/linux/pagemap.h | 1 - 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index 8bda092e60c5..f64b2d01578b 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c @@ -24,22 +24,21 @@ static int cachefiles_read_waiter(wait_queue_entry_t = *wait, unsigned mode, container_of(wait, struct cachefiles_one_read, monitor); struct cachefiles_object *object; struct fscache_retrieval *op =3D monitor->op; - struct wait_bit_key *key =3D _key; - struct page *page =3D wait->private; + struct wait_page_key *key =3D _key; + struct folio *folio =3D wait->private; =20 ASSERT(key); =20 _enter("{%lu},%u,%d,{%p,%u}", monitor->netfs_page->index, mode, sync, - key->flags, key->bit_nr); + key->folio, key->bit_nr); =20 - if (key->flags !=3D &page->flags || - key->bit_nr !=3D PG_locked) + if (key->folio !=3D folio || key->bit_nr !=3D PG_locked) return 0; =20 - _debug("--- monitor %p %lx ---", page, page->flags); + _debug("--- monitor %p %lx ---", folio, folio->page.flags); =20 - if (!PageUptodate(page) && !PageError(page)) { + if (!FolioUptodate(folio) && !FolioError(folio)) { /* unlocked, not uptodate and not erronous? */ _debug("page probably truncated"); } diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index cf235fd60478..a0c5345041be 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -592,7 +592,6 @@ static inline pgoff_t linear_page_index(struct vm_are= a_struct *vma, return pgoff; } =20 -/* This has the same layout as wait_bit_key - see fs/cachefiles/rdwr.c *= / struct wait_page_key { struct folio *folio; int bit_nr; --=20 2.29.2