Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp107774pxv; Wed, 14 Jul 2021 23:58:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIxUHb0qP1XpDcAJs+AtPuOd+fbG+WjtAQ7Jemrnz0iZC5ucG/YIA4rQsGF44lpvPtGt8S X-Received: by 2002:a17:906:d20b:: with SMTP id w11mr3703892ejz.242.1626332319515; Wed, 14 Jul 2021 23:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626332319; cv=none; d=google.com; s=arc-20160816; b=b3Fp7a9wCawRQk4sRcvNqflm4BO/P3WEX6H1w7kIpHQ2Tx3mcI7ltFdcDbmfYPr66k XnNEVFPaCfeN48pqxuLhueHgDqPnCRxyjpvVmPwSSnxqKwibPF/KQAAojEWZqzkI4QVk 9aGOWMbz8AhnZHo1fMiOo8SDwXSqilvLMTpZZ/DUEaf+LtByoNA9daaG2NrBH318JonE 8SvkI+FY4LdqGH5wKUWX92RVBj0GAEPKTEROU1PfwKKfNeCJLaFe+2iB0pvbOjIn0xAy xAE6qCa+mgnMn9WrQYG9rhZ9ZSKWVV6rHBtfq0/pluRAXlm3xVp99X+9LeTGk/B/n/vN ZjlQ== 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=vEW50pAiBefXZGZB4rMFPiTBwMLt7IwLVQwI0eyDnjw=; b=Dt7sl4le7Y309RXAWAlU5QvBGqIrfeA5twpRY0I3lWM6ZSMRY+pJnEX7JKZ5AT5BNS T1YtuGFw+PL9MGNcYS+89Skeah5/UXPsXeL/BFpTnT/DvRS5F8kcbqNhz4bbNAInESqN 1H2CvcJZ7Uqt9UoBVEF74cC42wMKYGOTbrOMbDB+Zorr9N2p/rVo1jSWMi9tKb+jaUoe rDMYXLEW7j0BMPrlj1GZYLO3Ghb67buekTHWMVYwbDABgTPyFdOUHKSEgvcWGW1SVqCC gDfSDu+HR6nMh0vJjYFKFyGbPNIMnJinpEWeeRk8BVj/ujxrj5fl7z8Uhc0Xjkuud8Vs o84w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Xtis+O5l; 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 lk10si6214023ejb.499.2021.07.14.23.58.17; Wed, 14 Jul 2021 23:58:39 -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=Xtis+O5l; 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 S238614AbhGOE6O (ORCPT + 99 others); Thu, 15 Jul 2021 00:58:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234980AbhGOE6N (ORCPT ); Thu, 15 Jul 2021 00:58:13 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DF75C06175F; Wed, 14 Jul 2021 21:55:20 -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=vEW50pAiBefXZGZB4rMFPiTBwMLt7IwLVQwI0eyDnjw=; b=Xtis+O5l25gFqKYqvSBk/4/90b Z4c+n5MI2dGkoPxlRte/QI1ctxxf8AavDBa6IuUBLFaBXht0V3iL71IUTkyspxmyt4akqJ03YY4ic IqJKxU2gaGLZTz6Iu10BcsxGegKUoqOWje8W9N6aApYV9Vnc3UjUx5LozFiIB2CawqfxtfMp9KOt1 U5d8g/1JI5GLOwr4hzIXC5uoA8JzlDcXd0qc8HeyFD6S0lUVswDXkQRQ5Z9TozMBd8RkbyabGTcC0 589Vk+cfipC8YVky+BStDP1d6w7SkHCaas0nlQ9LHeXbdtuc51dlY3gqYUP5fRR/j5rOdp6FkFeek N4rBL6OQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3tMz-002z2a-2W; Thu, 15 Jul 2021 04:53:46 +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 097/138] iomap: Pass the iomap_page into iomap_set_range_uptodate Date: Thu, 15 Jul 2021 04:36:23 +0100 Message-Id: <20210715033704.692967-98-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 All but one caller already has the iomap_page, and we can avoid getting it again. Signed-off-by: Matthew Wilcox (Oracle) --- fs/iomap/buffered-io.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 6b41019a51a3..fbe4ebc074ce 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -134,11 +134,9 @@ iomap_adjust_read_range(struct inode *inode, struct iomap_page *iop, *lenp = plen; } -static void -iomap_iop_set_range_uptodate(struct page *page, unsigned off, unsigned len) +static void iomap_iop_set_range_uptodate(struct page *page, + struct iomap_page *iop, unsigned off, unsigned len) { - struct folio *folio = page_folio(page); - struct iomap_page *iop = to_iomap_page(folio); struct inode *inode = page->mapping->host; unsigned first = off >> inode->i_blkbits; unsigned last = (off + len - 1) >> inode->i_blkbits; @@ -151,14 +149,14 @@ iomap_iop_set_range_uptodate(struct page *page, unsigned off, unsigned len) spin_unlock_irqrestore(&iop->uptodate_lock, flags); } -static void -iomap_set_range_uptodate(struct page *page, unsigned off, unsigned len) +static void iomap_set_range_uptodate(struct page *page, + struct iomap_page *iop, unsigned off, unsigned len) { if (PageError(page)) return; - if (page_has_private(page)) - iomap_iop_set_range_uptodate(page, off, len); + if (iop) + iomap_iop_set_range_uptodate(page, iop, off, len); else SetPageUptodate(page); } @@ -174,7 +172,8 @@ iomap_read_page_end_io(struct bio_vec *bvec, int error) ClearPageUptodate(page); SetPageError(page); } else { - iomap_set_range_uptodate(page, bvec->bv_offset, bvec->bv_len); + iomap_set_range_uptodate(page, iop, bvec->bv_offset, + bvec->bv_len); } if (!iop || atomic_sub_and_test(bvec->bv_len, &iop->read_bytes_pending)) @@ -254,7 +253,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data, if (iomap_block_needs_zeroing(inode, iomap, pos)) { zero_user(page, poff, plen); - iomap_set_range_uptodate(page, poff, plen); + iomap_set_range_uptodate(page, iop, poff, plen); goto done; } @@ -583,7 +582,7 @@ __iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, int flags, if (status) return status; } - iomap_set_range_uptodate(page, poff, plen); + iomap_set_range_uptodate(page, iop, poff, plen); } while ((block_start += plen) < block_end); return 0; @@ -645,6 +644,8 @@ iomap_write_begin(struct inode *inode, loff_t pos, unsigned len, unsigned flags, static size_t __iomap_write_end(struct inode *inode, loff_t pos, size_t len, size_t copied, struct page *page) { + struct folio *folio = page_folio(page); + struct iomap_page *iop = to_iomap_page(folio); flush_dcache_page(page); /* @@ -660,7 +661,7 @@ static size_t __iomap_write_end(struct inode *inode, loff_t pos, size_t len, */ if (unlikely(copied < len && !PageUptodate(page))) return 0; - iomap_set_range_uptodate(page, offset_in_page(pos), len); + iomap_set_range_uptodate(page, iop, offset_in_page(pos), len); __set_page_dirty_nobuffers(page); return copied; } -- 2.30.2