Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp116205pxv; Thu, 15 Jul 2021 00:08:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxryETMwJYgCUNQC8GDJALADTc8E2qdE1BQi1dzqR8A5q5KsTk5IPRapEXj7kJuuekiBd5q X-Received: by 2002:a02:c013:: with SMTP id y19mr2606947jai.36.1626332933469; Thu, 15 Jul 2021 00:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626332933; cv=none; d=google.com; s=arc-20160816; b=AjHzMchyQew2wOr3oXmbWwiohj6yrAktsyy8xqGAFOle7nYL7Jgdo4MGCUpfJgDlAt NXk4lK2N5cjxgdTlLqYWhSll+Drlo1ebty0yI8kcAfJO7oSKA5rpMY8nuVB9MupsJWdY q7LRcihbqlFqtlf5k4eOEvMEIPlQOfuMhuRt4K5LIh9rs6FzxRZ1z1ZM+T+iRkk2rs/v Q6xB6x5ToZALVRjDeGA9HMtww7zqFlHRBRxAxmEPmhBH9Db0QUEetDsQ0gq3104vTY07 51nN1UVnxWRbYdzpI1fX5xuQUov8pTaSKBNRrFABG2xIkd7Cvd3BpN2upeOYL04zh9fw Kl6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BzlU35lU3qSym1scpXVdTvYuYkJXSOHQJYSVBLZky0w=; b=CHZkArEba5pjNv4etw6e2ip8rLTbQ9gQ8vIoL9Q8KcnqM8+SdnevTF/H4UPBkbXolw x/tlkpTcEwVzgZK6y5PxGwTWmQMPj3vAAIAvcGxEk810vsVoWWLjq9hmNeVpFeupjIdU RuxbO3KNxoUZUvs7711Y4FQwONprBjjcAlglHlMmmfdXY6hQEJ19gqsYi7kKyMCPsDhf Gs1VXHW3UJ7jdUyjF0ii7YVAaR9Jh5KXsS2ZMWdggqdTGavjXYl/aGhgeHgAdlLw0ZsF X77riSxjWjBRxWkE55PGO8cdBZEyhW9Tx2Zb2/EzD1wKQMpItMzpn80c0qxEcoCbXXVG Pspg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="PLI9hB/9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x99si5668218jah.122.2021.07.15.00.08.41; Thu, 15 Jul 2021 00:08:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="PLI9hB/9"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239232AbhGOFP2 (ORCPT + 99 others); Thu, 15 Jul 2021 01:15:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233239AbhGOFP2 (ORCPT ); Thu, 15 Jul 2021 01:15:28 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AB6AC06175F; Wed, 14 Jul 2021 22:12:36 -0700 (PDT) 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=BzlU35lU3qSym1scpXVdTvYuYkJXSOHQJYSVBLZky0w=; b=PLI9hB/9pIA7VPcXi/xFVWEV67 x2V+RSGP4ZERq8bvKO1ZlPVgTfPgL4/BqiVqzOUzr0g771DkEm/JdrKwoNGrG3r++gEt7BFlcwbvB qO09ISougSNBNxkUPncXDvnzsM2HZjJ0JgsveRcXsEQ6bgjDgPWLl+wtv1/3qR0Yge35Zx5v7mQ8T IuEF984wxw7itozvaqo6ZNkT7L01WtKErO1zqY2dJOLtHnQnHkqksqEDaXULp9ypfFu2Nw6yRr9fZ HUOurRK0NMxJio+7+CRZQ1DijYwgx+s0ovE5ozkgvRt0z3RbbKp87C84XWAqHQNDzhFd3KjnW3crx Tf5sDHtg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3tef-0030Gi-7R; Thu, 15 Jul 2021 05:11:34 +0000 From: "Matthew Wilcox (Oracle)" To: linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH v14 116/138] mm/filemap: Convert filemap_range_uptodate to folios Date: Thu, 15 Jul 2021 04:36:42 +0100 Message-Id: <20210715033704.692967-117-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210715033704.692967-1-willy@infradead.org> References: <20210715033704.692967-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The only caller was already passing a head page, so this simply avoids a call to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) --- mm/filemap.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index 7eda9afb0600..078c318e2f16 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2328,29 +2328,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, @@ -2376,7 +2376,7 @@ static int filemap_update_page(struct kiocb *iocb, goto truncated; 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; -- 2.30.2