Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp145756pxv; Thu, 15 Jul 2021 00:50:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx72Qr4Cmkrp2hx7iqzieWiDBn0S0XtV7dmLxhhZbT1HDvdY2/txIG9/l8MlEQR9tGBFUMa X-Received: by 2002:aa7:c9d8:: with SMTP id i24mr4992939edt.79.1626335406534; Thu, 15 Jul 2021 00:50:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626335406; cv=none; d=google.com; s=arc-20160816; b=Wzjiz7MJJe0kjCPHHhCxFDEijZQ6Mb4BWxGfmTng6LTAb8BFDC/UCpoFeTPbOGVugd eepn1UiDqpW4gjLpaUdnH7Bidoe4T0GAZxL1ygjIsI+JvWDasGTgNaPWJaDBOdqT89F5 MD9XRvfxstzleGjRLEoRGgupFe7AGhipNbE/6EZhMdi8SxMwit4sB+aBWLyFCpcD5APW Vyeys1hdgwADHH76UdvMfQifHl0bHiZAB3UYmTP4/yD7lFDVjJf52b0nwG7SoRT8IvlV naJ1uS0+DI2grdf+luSQAlpv/r5B9aRsiUdmIAME3gbkR1F7+jAIVYibXCFlmjggUgHd 3oJw== 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=VuqrnoOJwk1QQMLBYra8dBPuvmqfF7lT7RNddxEL2SQ=; b=aeDMM6apsklPhAsh5jCOj/MWIcO6RgTYBlzROVuoXLsNucWkzeOzbbnzROMgTHmhMi OjLtTiBZKw6SIE/a/WvrUYcYU8KIRmZ7N6G8tyKcbus4B6M57e3UuGsZeuFIdxR7vmTK acGco1oEgw5CkA/epLfMgcYtwtvnY+KIL/CWRlz+AZ+jJYXNdcWMMW0fDYafYZ4ZuI40 toULHhSJid9PNUcxvhhOsMONN/BiDmJdUCcrU8X30MM3WSbIEliv0ddNmJZhTmfnZwYa 58Z6/mWU5HwDVNCO6aPkleP6SIbcOmI8GyZLM+ygaKboa3+haO1gz6PTPLaRDZ0eKqhC 6CDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=tzV6SIFI; 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 eo9si8015986ejc.108.2021.07.15.00.49.44; Thu, 15 Jul 2021 00:50:06 -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=tzV6SIFI; 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 S236656AbhGOFEG (ORCPT + 99 others); Thu, 15 Jul 2021 01:04:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231549AbhGOFEC (ORCPT ); Thu, 15 Jul 2021 01:04:02 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D054C06175F; Wed, 14 Jul 2021 22:01:10 -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=VuqrnoOJwk1QQMLBYra8dBPuvmqfF7lT7RNddxEL2SQ=; b=tzV6SIFI8DPTW8BXavSKgzU1IM tSwhFhX8ZA4jGS++xv0+1EHf8+l+542sE21kQSkm8UcboVdS4jS+ZqYJHDftOYCzto1uvoKtGq/6a l2/RSc2CeDMJ02e1CWsh8ZsHUFM1xm149k/OTth+kolzcNOK2/3yUHTrnFeAhTpCxhvaagpxm0Arz ZnOqtwRTRtq2nJw3mWjEfFFNQoILM+NRPgNjxGRpLQzY9GP7mtd1H9l7Ksnqhcl2etctSC1itH7AD fUfcpC/iAbTC+Px0LrrJRzqgdoz+8lxHEq5vU3Pv7+DXOP5+00dsovlqPjHoRq4i3D8i/WjZoCyWK eF6qCr2A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3tTO-002zZK-9y; Thu, 15 Jul 2021 04:59:58 +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 103/138] iomap: Convert iomap_read_inline_data to take a folio Date: Thu, 15 Jul 2021 04:36:29 +0100 Message-Id: <20210715033704.692967-104-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 Inline data is restricted to being less than a page in size, so we don't need to handle multi-page folios. Signed-off-by: Matthew Wilcox (Oracle) --- fs/iomap/buffered-io.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 5e0aa23d4693..c616ef1feb21 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -194,24 +194,24 @@ struct iomap_readpage_ctx { struct readahead_control *rac; }; -static void -iomap_read_inline_data(struct inode *inode, struct page *page, +static void iomap_read_inline_data(struct inode *inode, struct folio *folio, struct iomap *iomap) { size_t size = i_size_read(inode); void *addr; - if (PageUptodate(page)) + if (folio_test_uptodate(folio)) return; - BUG_ON(page->index); + BUG_ON(folio->index); + BUG_ON(folio_multi(folio)); BUG_ON(size > PAGE_SIZE - offset_in_page(iomap->inline_data)); - addr = kmap_atomic(page); + addr = kmap_local_folio(folio, 0); memcpy(addr, iomap->inline_data, size); memset(addr + size, 0, PAGE_SIZE - size); - kunmap_atomic(addr); - SetPageUptodate(page); + kunmap_local(addr); + folio_mark_uptodate(folio); } static inline bool iomap_block_needs_zeroing(struct inode *inode, @@ -236,7 +236,7 @@ iomap_readpage_actor(struct inode *inode, loff_t pos, loff_t length, void *data, if (iomap->type == IOMAP_INLINE) { WARN_ON_ONCE(pos); - iomap_read_inline_data(inode, &folio->page, iomap); + iomap_read_inline_data(inode, folio, iomap); return PAGE_SIZE; } @@ -614,7 +614,7 @@ static int iomap_write_begin(struct inode *inode, loff_t pos, size_t len, page = folio_file_page(folio, pos >> PAGE_SHIFT); if (srcmap->type == IOMAP_INLINE) - iomap_read_inline_data(inode, page, srcmap); + iomap_read_inline_data(inode, folio, srcmap); else if (iomap->flags & IOMAP_F_BUFFER_HEAD) status = __block_write_begin_int(page, pos, len, NULL, srcmap); else -- 2.30.2