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 E6823C433E0 for ; Fri, 22 Jan 2021 16:08:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 98525233FC for ; Fri, 22 Jan 2021 16:08:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 98525233FC 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 2D3476B000E; Fri, 22 Jan 2021 11:08:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 25D3B6B0010; Fri, 22 Jan 2021 11:08:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 125936B0012; Fri, 22 Jan 2021 11:08:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0038.hostedemail.com [216.40.44.38]) by kanga.kvack.org (Postfix) with ESMTP id ED5B86B000E for ; Fri, 22 Jan 2021 11:08:14 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id AFC5F1DFC for ; Fri, 22 Jan 2021 16:08:14 +0000 (UTC) X-FDA: 77733892908.12.feast12_0106ae72756d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 6A8751802B9D0 for ; Fri, 22 Jan 2021 16:08:14 +0000 (UTC) X-HE-Tag: feast12_0106ae72756d X-Filterd-Recvd-Size: 4168 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Fri, 22 Jan 2021 16:08:13 +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=2l7KhQmeVEgzNv6gIsz+bp1NSbblHe5jWS/lA7k9oQo=; b=e2kb8wiG1N46lGY957HUHmq5pv g19AKKENfHTGsmbGFoLuVQem/Ih/91LxZDDPYd5lrPYSLMImVj83zZAJOu8uxoU/do0tj+4xrftFr E17ne5wQgOr2gBMqgkM5bLHjfUDJ38DwdwzPf5sGYQPsIKrbLgwvMoubHMP4kayuE/bPK81MT6Hi2 fQ33Uuw7C7qOVBRLqeUKzzc1ApsWufEvfbzmP+EfC3ODeEbMteQp3OSXwBCzKaNraqiuSd5cpMKMb WqhNNQSCZrLgKCOsO7+J3ssw0VyYaD/ZxbBRBHyiambwyxH/BMztffIH18CdoCrTorLjbRbuHqG8s yhTl3CZQ==; Received: from willy by casper.infradead.org with local (Exim 4.94 #2 (Red Hat Linux)) id 1l2ywo-000wNk-Ks; Fri, 22 Jan 2021 16:06:29 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Kent Overstreet , Christoph Hellwig Subject: [PATCH v5 07/18] mm/filemap: Inline __wait_on_page_locked_async into caller Date: Fri, 22 Jan 2021 16:01:29 +0000 Message-Id: <20210122160140.223228-8-willy@infradead.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210122160140.223228-1-willy@infradead.org> References: <20210122160140.223228-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: The previous patch removed wait_on_page_locked_async(), so inline __wait_on_page_locked_async into __lock_page_async(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Kent Overstreet Reviewed-by: Christoph Hellwig --- mm/filemap.c | 53 ++++++++++++++++++++++------------------------------ 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 88201506ad3ef..abd596931f699 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1338,36 +1338,6 @@ int wait_on_page_bit_killable(struct page *page, i= nt bit_nr) } EXPORT_SYMBOL(wait_on_page_bit_killable); =20 -static int __wait_on_page_locked_async(struct page *page, - struct wait_page_queue *wait, bool set) -{ - struct wait_queue_head *q =3D page_waitqueue(page); - int ret =3D 0; - - wait->page =3D page; - wait->bit_nr =3D PG_locked; - - spin_lock_irq(&q->lock); - __add_wait_queue_entry_tail(q, &wait->wait); - SetPageWaiters(page); - if (set) - ret =3D !trylock_page(page); - else - ret =3D PageLocked(page); - /* - * If we were successful now, we know we're still on the - * waitqueue as we're still under the lock. This means it's - * safe to remove and return success, we know the callback - * isn't going to trigger. - */ - if (!ret) - __remove_wait_queue(q, &wait->wait); - else - ret =3D -EIOCBQUEUED; - spin_unlock_irq(&q->lock); - return ret; -} - /** * put_and_wait_on_page_locked - Drop a reference and wait for it to be = unlocked * @page: The page to wait for. @@ -1543,7 +1513,28 @@ EXPORT_SYMBOL_GPL(__lock_page_killable); =20 int __lock_page_async(struct page *page, struct wait_page_queue *wait) { - return __wait_on_page_locked_async(page, wait, true); + struct wait_queue_head *q =3D page_waitqueue(page); + int ret =3D 0; + + wait->page =3D page; + wait->bit_nr =3D PG_locked; + + spin_lock_irq(&q->lock); + __add_wait_queue_entry_tail(q, &wait->wait); + SetPageWaiters(page); + ret =3D !trylock_page(page); + /* + * If we were successful now, we know we're still on the + * waitqueue as we're still under the lock. This means it's + * safe to remove and return success, we know the callback + * isn't going to trigger. + */ + if (!ret) + __remove_wait_queue(q, &wait->wait); + else + ret =3D -EIOCBQUEUED; + spin_unlock_irq(&q->lock); + return ret; } =20 /* --=20 2.29.2