From patchwork Wed Dec 8 04:22:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 12663803 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 0748AC433EF for ; Wed, 8 Dec 2021 07:00:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 96BD76B0075; Wed, 8 Dec 2021 01:58:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 91BBB6B0078; Wed, 8 Dec 2021 01:58:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80A526B007B; Wed, 8 Dec 2021 01:58:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay035.a.hostedemail.com [64.99.140.35]) by kanga.kvack.org (Postfix) with ESMTP id 70A6E6B0075 for ; Wed, 8 Dec 2021 01:58:45 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 2FEEA801B5 for ; Wed, 8 Dec 2021 04:29:10 +0000 (UTC) X-FDA: 78893347218.11.FD900FF Received: from relay.hostedemail.com (relay034.a.hostedemail.com [64.99.140.34]) by imf14.hostedemail.com (Postfix) with ESMTP id C8F416001983 for ; Wed, 8 Dec 2021 04:29:09 +0000 (UTC) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id C053621396 for ; Wed, 8 Dec 2021 04:23:13 +0000 (UTC) X-FDA: 78893332266.28.38CF984 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf29.hostedemail.com (Postfix) with ESMTP id 4BF91900024B for ; Wed, 8 Dec 2021 04:23: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=zEgXkSFSyMhCDJOHlKNghSVrMcqn165U8NTQAl+dWqc=; b=bz12BuBcZTfHqa5dTwh8rOHjDm vc7TDqj5res0EDmYcwsR9xgH2Ney/EsiNS2mJY3zrc/MIkPBWDWvOZaFd0Rz8ra2P2GEEX6WcoJBb c0qtkWiokhfGoVJWW35NXYaUOD/OXEThVuW/fWJQSwHiYJ2K309g89G7iWK6n0fz6CoV5gCLOy4mR aC3faxLeAfmbx3ckFxm06CBguVnkFlg7C8xCmUqq5dj94ohonL9SrLOfExGnF2d4DTqW5NJA+GFu1 Dxnuo71keuwoJsYfZa/54mxTnVykZI6En91fvb5Jt/Il2WQ46O11qs4KZ0+sETe8Bptnf0f/DUetz f9yr+Cdw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1muoU3-0084YR-S5; Wed, 08 Dec 2021 04:23:11 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 20/48] filemap: Convert filemap_range_uptodate to folios Date: Wed, 8 Dec 2021 04:22:28 +0000 Message-Id: <20211208042256.1923824-21-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211208042256.1923824-1-willy@infradead.org> References: <20211208042256.1923824-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: C8F416001983 X-HE-Tag-Orig: 1638937393-414941 Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=bz12BuBc; spf=none (imf14.hostedemail.com: domain of FILTER%willy@infradead.org has no SPF policy when checking 64.99.140.34) smtp.mailfrom=FILTER%willy@infradead.org; dmarc=none X-Rspamd-Server: rspam04 X-Stat-Signature: 91t41jnu18pzuhzo3jnhk6x85qycc9s1 X-HE-Tag: 1638937749-940347 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 only caller was already passing a head page, so this simply avoids a call to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- mm/filemap.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index b044afef78ef..c4f887c277d0 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2395,29 +2395,29 @@ static int filemap_read_folio(struct file *file, struct address_space *mapping, } static bool filemap_range_uptodate(struct address_space *mapping, - loff_t pos, struct iov_iter *iter, struct page *page) + loff_t pos, struct iov_iter *iter, struct folio *folio) { int count; - if (PageUptodate(page)) + if (folio_test_uptodate(folio)) return true; /* pipes can't handle partially uptodate pages */ if (iov_iter_is_pipe(iter)) return false; if (!mapping->a_ops->is_partially_uptodate) return false; - if (mapping->host->i_blkbits >= (PAGE_SHIFT + thp_order(page))) + if (mapping->host->i_blkbits >= folio_shift(folio)) return false; count = iter->count; - if (page_offset(page) > pos) { - count -= page_offset(page) - pos; + if (folio_pos(folio) > pos) { + count -= folio_pos(folio) - pos; pos = 0; } else { - pos -= page_offset(page); + pos -= folio_pos(folio); } - return mapping->a_ops->is_partially_uptodate(page, pos, count); + return mapping->a_ops->is_partially_uptodate(&folio->page, pos, count); } static int filemap_update_page(struct kiocb *iocb, @@ -2457,7 +2457,7 @@ static int filemap_update_page(struct kiocb *iocb, goto unlock; error = 0; - if (filemap_range_uptodate(mapping, iocb->ki_pos, iter, &folio->page)) + if (filemap_range_uptodate(mapping, iocb->ki_pos, iter, folio)) goto unlock; error = -EAGAIN;