From patchwork Wed Oct 4 16:53:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13409078 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1484E7C4E5 for ; Wed, 4 Oct 2023 16:53:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 480BB6B028E; Wed, 4 Oct 2023 12:53:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4308B6B0290; Wed, 4 Oct 2023 12:53:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A94A6B0291; Wed, 4 Oct 2023 12:53:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 193A36B028E for ; Wed, 4 Oct 2023 12:53:41 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id EDACCC03B9 for ; Wed, 4 Oct 2023 16:53:40 +0000 (UTC) X-FDA: 81308375400.18.59EE0E6 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id 3994E140013 for ; Wed, 4 Oct 2023 16:53:38 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="RYa3D/dV"; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696438419; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5DKdxAyadRWDMiaslNEJr4yDpo8DKXMNV0hB6QcBBkM=; b=Jx9ZDLCXDvR67NABBO+24h7Yr767ZCM3AAKGbR2xejp9i4nKzDVj8DbQPnDplNoi/jBZYZ I4tW5hBV5MaiumUI3R4C1hlfrYLWmf7PONyZrCcNZ6wSErv+R9TrwBvrkxNZ6aXKajsdFo vheMwVgOoaVQGyxrcHtQGlu/xc6CdV8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696438419; a=rsa-sha256; cv=none; b=eN/jzovANlQCd7xlAvaxSTSggQFQHbNQ5LB195+0Z4mh9rNu0JnqmDjdmSQsd1lt8X2/1j MMG5L3aqeDh/cJRJ/d+jS9E3QlOhlq6nXJ38UPAVkbmfc3Zat50KXYgiZX6iPm8+wQUfgf mt1mTyyJ/w3Q7trew5GwFxPM2/IXWbk= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="RYa3D/dV"; spf=none (imf26.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=5DKdxAyadRWDMiaslNEJr4yDpo8DKXMNV0hB6QcBBkM=; b=RYa3D/dVz/0wGHfevaGhpqecso oT/Olzw7bs2m/lGKXPnZgBQatCf8z7bbcJjMtVfb0rXmyId6jA7S52FGGUqnby6PARrrczH/tB+vq We8hxsnFlycmu3R+t9Hg+VA4GM8ODiAUa7NU9DLjpuEbw/0AZ/iezCzuzB9+HkzTs3GrLbqbefqdz FjnB4rMgOWGRfIMh3v+2asasqkmqjO6UKVDTIjqqQ0D5VUKk1n+87VHmoGUUb67cVpiXOCZdSiMUp mQAZqJAfG8Mo6maQNsXErIyaMjGeLDbbjBrqxR0eyXp59QLdFngcX8oNVmFosewRlKa6F7HDj/h9a DAi5gaWw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qo57f-004SF3-GH; Wed, 04 Oct 2023 16:53:19 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, torvalds@linux-foundation.org, npiggin@gmail.com Subject: [PATCH v2 05/17] buffer: Use folio_end_read() Date: Wed, 4 Oct 2023 17:53:05 +0100 Message-Id: <20231004165317.1061855-6-willy@infradead.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20231004165317.1061855-1-willy@infradead.org> References: <20231004165317.1061855-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 3994E140013 X-Rspam-User: X-Stat-Signature: 1zs13dqw5fg43jzzzq4ir9tirseprq75 X-Rspamd-Server: rspam03 X-HE-Tag: 1696438418-837261 X-HE-Meta: U2FsdGVkX1/Cwh3ICutPmUbK8az+dAhnb+oRzD6i4sSgqNe6DTIPvEtEvEFqIB27Xt+3lhoDDU4XMo6cDMWvvUeLoDR5R0dpTtuGOKp7JWgsFoobGI3WoDXuKkABPGr3GOCAipEV5vph7birBkr9T4XqPGueIAbMNhTaTq+3R2vfByFmGBsanO0+AthaACHvJX2P7OFJIl46krdOcduE+tWLHfKSzojgjTHx47aH893bzQoPumJGy90ruEZncXal1i+RKOo1gYemBaSzzrhBnvzFjVMfJEtCbeHJCx5D8jBkFTA1rO2IShxtqbC/aGeFK/N9Pr6casIzeTvD7dCRL2c8n3TpW1FNmNFWm/mvkOiDBpQtG/YSAKB3M/tTNryP6QvwQ9ROWwl9V4l5t5l0jJ7BO88kd+WCs4FC8QnQfyorIB1nvi+tcCsgAByNuoSHX+KWjRnQ8uOR7G+BDZp8/FogHdhNLOhdWG22nbfa/rQmCJTXU+V/C6XJBJN4zfHZYNJoy72bukS3uHou84wIcEBrzS3/Phxy+QiqGEg1a66FWkh0guOOfSsSZKcAMbCdW4Eu0A1tNy9RUXrhqeRLOQY87IpGvNC7k+8UKpm98VWaAjlS6YNaptRGrFOur1j0ecAz91f1dXqOMHu5VyYHtK8fY8lm8tLQBkE2yQHyUuIz7BKxa6YPzPpM296A1iZKXlf673LyyHdHAOLfSrR++z+sf+OocE+gUUh69KOFss/q5+h6k1XV8PDO+qxJWrtVqN2yPl+mWqZoXuwOq5xhfXoDtfx+HSl+l0evlKaPkC99hkNSl9xmyyr0QAV9KpLG/xpyMMUDvtJ7zmrckPPfap71ReVHuOzlehjiBQPzdDgeoi/YwQRkpzYSYOxdnW9v3qSlK2/P27FQ03svlphB7T73CZbA2l4TBeLTdfm5DNAU/0cjkzti/q09j+ws8CbMNS31aZqMXWpkd4n8UgR KOJMVWbo Q1Ieiw29o918xUd8O8uuY5GiZL6mHWIsIKCxZl2D5q5azF0HAdnLlyPOSY5w/MrnY3mIoaouDq4QksTm5XvxautQ05wemgwAZHgcP1YGmPvWtKaIe+1TPQy/524ZLG67biipZVr335XhTqMD9quMOex7dw9hot9D6oQLD+wrMpeJegkJBFChE3h1xbWCeLiRIAR5kWrvUlu7Q9zMeajpatVckQoRrRX/h17yP 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: There are two places that we can use this new helper. Signed-off-by: Matthew Wilcox (Oracle) --- fs/buffer.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 12e9a71c693d..b7bafba87273 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -282,13 +282,7 @@ static void end_buffer_async_read(struct buffer_head *bh, int uptodate) } while (tmp != bh); spin_unlock_irqrestore(&first->b_uptodate_lock, flags); - /* - * If all of the buffers are uptodate then we can set the page - * uptodate. - */ - if (folio_uptodate) - folio_mark_uptodate(folio); - folio_unlock(folio); + folio_end_read(folio, folio_uptodate); return; still_busy: @@ -2425,12 +2419,10 @@ int block_read_full_folio(struct folio *folio, get_block_t *get_block) if (!nr) { /* - * All buffers are uptodate - we can set the folio uptodate - * as well. But not if get_block() returned an error. + * All buffers are uptodate or get_block() returned an + * error when trying to map them - we can finish the read. */ - if (!page_error) - folio_mark_uptodate(folio); - folio_unlock(folio); + folio_end_read(folio, !page_error); return 0; }