Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3444603pxb; Mon, 1 Nov 2021 13:59:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzg4tsYPTECydNrW1RKXHe14iZcUwbODY/nR1TTtspfHK0EXcdPk+QyKGDF/BsoHFvYBdpf X-Received: by 2002:a05:6602:2089:: with SMTP id a9mr17410051ioa.20.1635800393885; Mon, 01 Nov 2021 13:59:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635800393; cv=none; d=google.com; s=arc-20160816; b=Wal1xiQyJ4ct97ZaWk+KtsKLNBNTHfPmT+AIrvfxwS9icxy9WyMgqFz1vf2AnTn/L1 2nCeIeT02msbUegXupCqiXgscpCj/EsK7dCrFAqAj/+SvwDGOeQvcggkH/s730nYDzEL Mfwr8Z+5wmbAKcaGnDWmihBb/UYmb2HSPLpbHzisXysL1GdTG5kTKjQSUv6DVHmMclk3 VAbX/XhaZDCJqgz7RCF8W01ltQKmjiL3zxXLBn6WGNcAvEPP0MVMFAuMgLnn3vFzOr2L 8UaYFJ+ubHg+dTb8DP6iZPqMEEN4oAMZRV5/IFmN2ZgXeqvQdSVSWucDtJ+/Rm7x+neH Jf4w== 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=SY0k+0X/MIdMh+Ee2kdkHjsdASr522NeEF8FMPYe7hE=; b=Y+n6/Hz3Lrw9JkmLZTEiXE/mZqFZ9g8SPC5g6HKwETVFxeejvPkr8ca4CbekKrKaAA ew2lunF6cj+ZDd/tVT4gzy2C4+W8yru6Gnoq4DcdE+Hb44F0SYiDbK137seyB9Xr85jd h6XqUu9gjAsG2pSdE9FoEC5dD/j6QQR0CgRY0BdOVs+qMFq+TXZBEXVlNyrQi2bJEJoC vNoZtrwUcmgZfLmLdhImJ/CqpYSPIfj/uQ9JyHEv5j+QS8fioTvVJaT1da88Xn+ajfkZ 4PCLEtLntjnKT4qEbXUxmrRNRXneZfFlPrtlkyvJeh6kM0C9W+SX0agygNktjnu1hsNW 0GPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=A4QG249W; 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 p40si16235215jal.133.2021.11.01.13.59.42; Mon, 01 Nov 2021 13:59: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=A4QG249W; 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 S229692AbhKAVBK (ORCPT + 99 others); Mon, 1 Nov 2021 17:01:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbhKAVBE (ORCPT ); Mon, 1 Nov 2021 17:01:04 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D300C061714; Mon, 1 Nov 2021 13:58:30 -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=SY0k+0X/MIdMh+Ee2kdkHjsdASr522NeEF8FMPYe7hE=; b=A4QG249WK6jocKj7ZpYPjeQz5a RmhGRGwD/O7rhP5yH68r9Qya8FIdGmCktTsCPptIhOqms84T7tlOcakSKlASafVGbgczYVSPmmyeD s2ctWlJxQuo3xVTSRvCX7C4QTZsvasMAbY+ad5ADoetUhSRXUV6yOza2e2NI9oks4nyaZ9hfN0bGb vJBH7m5gjEcMMAcnfIXEDqXYzHGPzR8InIz8EFDzNmSfMRa4V3Z+wQDNDMk3jafLIgllGU/ZpvlZs cv/b/Br/gjSqh13n8UWw1hAfhNJFZugizWePCGO5+6kx74K//pUJokxIyZodKDwPqOVmWBY0lEmFh YYd7M34w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mheK0-0040tQ-K9; Mon, 01 Nov 2021 20:55:06 +0000 From: "Matthew Wilcox (Oracle)" To: "Darrick J. Wong" Cc: "Matthew Wilcox (Oracle)" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe , Christoph Hellwig Subject: [PATCH 09/21] iomap: Pass the iomap_page into iomap_set_range_uptodate Date: Mon, 1 Nov 2021 20:39:17 +0000 Message-Id: <20211101203929.954622-10-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211101203929.954622-1-willy@infradead.org> References: <20211101203929.954622-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, so we can avoid getting it again. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Darrick J. Wong --- fs/iomap/buffered-io.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index e9a60520e769..e171eb2ebc5d 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)) @@ -204,6 +203,7 @@ static loff_t iomap_read_inline_data(const struct iomap_iter *iter, struct page *page) { struct folio *folio = page_folio(page); + struct iomap_page *iop; const struct iomap *iomap = iomap_iter_srcmap(iter); size_t size = i_size_read(iter->inode) - iomap->offset; size_t poff = offset_in_page(iomap->offset); @@ -220,13 +220,15 @@ static loff_t iomap_read_inline_data(const struct iomap_iter *iter, if (WARN_ON_ONCE(size > iomap->length)) return -EIO; if (poff > 0) - iomap_page_create(iter->inode, folio); + iop = iomap_page_create(iter->inode, folio); + else + iop = to_iomap_page(folio); addr = kmap_local_page(page) + poff; memcpy(addr, iomap->inline_data, size); memset(addr + size, 0, PAGE_SIZE - poff - size); kunmap_local(addr); - iomap_set_range_uptodate(page, poff, PAGE_SIZE - poff); + iomap_set_range_uptodate(page, iop, poff, PAGE_SIZE - poff); return PAGE_SIZE - poff; } @@ -264,7 +266,7 @@ static loff_t iomap_readpage_iter(const struct iomap_iter *iter, if (iomap_block_needs_zeroing(iter, pos)) { zero_user(page, poff, plen); - iomap_set_range_uptodate(page, poff, plen); + iomap_set_range_uptodate(page, iop, poff, plen); goto done; } @@ -578,7 +580,7 @@ static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos, 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; @@ -653,6 +655,8 @@ static int iomap_write_begin(const struct iomap_iter *iter, loff_t pos, 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); /* @@ -668,7 +672,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.33.0