Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3450970pxb; Mon, 1 Nov 2021 14:06:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJpWG6DDLWZpqb9T23Rq9Y48OF6TX2N/dnfKpAqoAAql8AyaMNhD95KR8pcuo59n3zIOAz X-Received: by 2002:a92:d706:: with SMTP id m6mr21295381iln.155.1635800769425; Mon, 01 Nov 2021 14:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635800769; cv=none; d=google.com; s=arc-20160816; b=edmb6OlTt1yz8YgnXJeMjKK6icmCb4cvw0HzxvTIOv0hNYok6EbIyZvSd4Bq+i44Ud dsDVBLHK7lqSTupkORuvwanKzD1zKzD27HMmWJbFpci635GW/StTBE821rVmDMb+71g1 W85AiemtgYR2d3rmFPpNCmyLcD6Vt8Pi5XtpB3jS+kTHL245Nw2o1nDJ7oUeilueyWSO WbYqbM2BduQdlY7jQP+cLP65kAQymwwcauKwQWS9Y7KPj3yb4vcnWLoCCtsqZww266pI x3yG6nVLTiZ3OD1t7vzotn9pt3fKmhfT3DWHIjDdWTTsOXuJrex0XPWYnAwZl2eVn5kC BQ2Q== 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=11slo8JST7WFtjePDn5GzJOvUSqFCENMy5XC+yDdEpc=; b=U/VbDhFdtqquybfEPEhHKLU0BJPPBmx9/HcdL2WsvC1ZcEeWZvfuxH/FUf586ruz8U lBvU0ZCKcAPeIz2e79uD1h+wLckNVL9vkc6WJ5M18ZSGhdsDYk56UmSB97E1YV+6BoM3 NaDRfeauoeq5ZSvMEkDR+nD7lVm9nOKqE5pQr5zulqMsI+PAVK4M03K1EdH3ukK4fHrz fLzd616A5qV8BBlWcDsrUHdmp8FQoVbKYXV9mZQyx+MuTloYTKGlZJbDUZcIVlwAL4dG Us61YnXVq/4vV8pcfPkK/8yX49x4zdPE1li+x3S5m7TTzXjKDXlgjvn+9Cp0TcPk3eFR KBEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=JphgnPqz; 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 a6si17585325ioa.60.2021.11.01.14.05.54; Mon, 01 Nov 2021 14:06:09 -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=JphgnPqz; 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 S230519AbhKAVFf (ORCPT + 99 others); Mon, 1 Nov 2021 17:05:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbhKAVFe (ORCPT ); Mon, 1 Nov 2021 17:05:34 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A368FC061714; Mon, 1 Nov 2021 14:03:00 -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=11slo8JST7WFtjePDn5GzJOvUSqFCENMy5XC+yDdEpc=; b=JphgnPqzegpOcRhljjVvTa6Mc0 r9euR1qCnQ6HzuVRAMg3OXhUwJ0FzCjIwQHzvMQioWk/ppRwuj5Eg5U+ScgQf751Djhk3RURLboH1 PiLxBqo7N35OnhQeStJgdFWms9E19C1NusQKbFLyqeud3kt6d2krMlrs6qHBNL+GynGlL8ODHMPZr slXb3Yt15ykZ9wdplQZbRsJSwLeSasEJrUA4IgqjJkn5bq5fJM/j9/Upom4BFPZQ37K7YU+JWtR/w EAxClpkkk3RY++Hbo/+u8dMniRoDCoXwytu6GRTdDmFkUa1Mm5sVLniSTfArXlca3EZDvFZXJfq5q 3k/+VM2w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhePB-00411g-5B; Mon, 01 Nov 2021 21:00:22 +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 12/21] iomap: Convert iomap_read_inline_data to take a folio Date: Mon, 1 Nov 2021 20:39:20 +0000 Message-Id: <20211101203929.954622-13-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 We still only support up to a single page of inline data (at least, per call to iomap_read_inline_data()), but it can now be written into the middle of a folio in case we decide to allocate a 16KiB page for a file that's 8.1KiB in size. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Darrick J. Wong --- fs/iomap/buffered-io.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index dea577380215..b5e77d9de4a7 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -195,9 +195,8 @@ struct iomap_readpage_ctx { }; static loff_t iomap_read_inline_data(const struct iomap_iter *iter, - struct page *page) + struct folio *folio) { - 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; @@ -205,7 +204,7 @@ static loff_t iomap_read_inline_data(const struct iomap_iter *iter, size_t offset = offset_in_folio(folio, iomap->offset); void *addr; - if (PageUptodate(page)) + if (folio_test_uptodate(folio)) return PAGE_SIZE - poff; if (WARN_ON_ONCE(size > PAGE_SIZE - poff)) @@ -220,7 +219,7 @@ static loff_t iomap_read_inline_data(const struct iomap_iter *iter, else iop = to_iomap_page(folio); - addr = kmap_local_page(page) + poff; + addr = kmap_local_folio(folio, offset); memcpy(addr, iomap->inline_data, size); memset(addr + size, 0, PAGE_SIZE - poff - size); kunmap_local(addr); @@ -252,7 +251,7 @@ static loff_t iomap_readpage_iter(const struct iomap_iter *iter, sector_t sector; if (iomap->type == IOMAP_INLINE) - return min(iomap_read_inline_data(iter, page), length); + return min(iomap_read_inline_data(iter, folio), length); /* zero post-eof blocks as the page may be mapped */ iop = iomap_page_create(iter->inode, folio); @@ -587,12 +586,13 @@ static int __iomap_write_begin(const struct iomap_iter *iter, loff_t pos, static int iomap_write_begin_inline(const struct iomap_iter *iter, struct page *page) { + struct folio *folio = page_folio(page); int ret; /* needs more work for the tailpacking case; disable for now */ if (WARN_ON_ONCE(iomap_iter_srcmap(iter)->offset != 0)) return -EIO; - ret = iomap_read_inline_data(iter, page); + ret = iomap_read_inline_data(iter, folio); if (ret < 0) return ret; return 0; -- 2.33.0