Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3439079pxb; Mon, 1 Nov 2021 13:52:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywWVMABfYWq7VqyIilMpNgWMD1xHEwyfZfvDUPxy/2CFzdWS3kLVtLuQG1XckoqzRBkzIK X-Received: by 2002:a17:907:d9f:: with SMTP id go31mr14186172ejc.412.1635799931823; Mon, 01 Nov 2021 13:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635799931; cv=none; d=google.com; s=arc-20160816; b=Uggleq4sxPo8tS+KK3LzeYhneoWQJDTEblFc+YOCx+SPjiB4U+dP5g2n6xjXBjVc5x 70T4WQ5vG2n2AEfBy8Fd+K/b0pShDXcVcwZ5Yb+M1lNF4NRh19OLGwp0NcqwV7/2DrCm GN3Zf7i5FuzvFcQOf/Mj7LKqugRAVefOAgniaDDx1sPaY5XNebUkuJ2+XohChto3Nnl/ n8GZwH8Xv/hCIbMU0HPehCGYUzmMjPQdt+JISzQsLLLcLZv3+1WXm1JQmiLKRbea8m0q SgF/pJV13v7kWSPFznoa/5HJzx9qlfBEkc7XReIFU/PYkdkp2roHbjwztwvLDz4c2T5L usVw== 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=JowmokzmLBePGKHizYHUmJEnsmoAJKdK0XLGuVKangc=; b=O0AygLeG60zkx/PHmcu/LDkPSPCFJzDgbV8IXycBUSC3JPZDhOraCsiP06nb2Vnb8I IvCRiD9FCKTmCuCsoR52BY/z/dyohapy3Rf976XvualWKUQtzP+chYfRLW6OHKW01+YF 5U+AXrCglmDtx7zEl5yyAkV8YRWT4Uyz/cYUEeW/7NWUOFXire+bl/DLYtBRpD7X3Nc7 4BhBoHiyFvOccVwbuZsGpc9T/QbYRQTKVLNjO5oOAA8DYgI5sz+YXr5RPjQvigMUknab o7/9A4dlhdIsmNLsX87zDabnvZBkZ1znyWE8MUDED1/t0nawVolyEHHvr2rFzZIX1v+c UIIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=OPDnbPO+; 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 sc33si459662ejc.409.2021.11.01.13.51.47; Mon, 01 Nov 2021 13:52:11 -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=OPDnbPO+; 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 S230505AbhKAUwA (ORCPT + 99 others); Mon, 1 Nov 2021 16:52:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbhKAUv7 (ORCPT ); Mon, 1 Nov 2021 16:51:59 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B600C061714; Mon, 1 Nov 2021 13:49:26 -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=JowmokzmLBePGKHizYHUmJEnsmoAJKdK0XLGuVKangc=; b=OPDnbPO+2WPGuCPNQivcEhvQM3 4VMQeGpkiQKj0e9JPD9Vsq+M9grGQ5Jo3T8628qbhYoMmsG7ni6fTnwry27leIAdefeClLvTKupeT iPo/6iKJwYnvm66lu/svcPQrgcukoVZHVSceV5LgNBCIXkjqbJ7xXbAZyJ5C7amF8rCl3QloCn/vO VpJGCDZCm3ZUdgxbcsP3UlSRzNlu5lk+zQAVbiN/g6Dil0N8Tjg9Erl2rZDeJZw7gAjQZVnE3fZIM ndF+dRuRN3nyR1y0a/cOZGO+Aq2Z2a52ML+6/O4BXjQUsmEzKR0pfUojyFMmajCRjirO5D9EZSOO2 3j5Rb2Gw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mheBy-0040aY-MB; Mon, 01 Nov 2021 20:46:37 +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 04/21] iomap: Convert to_iomap_page to take a folio Date: Mon, 1 Nov 2021 20:39:12 +0000 Message-Id: <20211101203929.954622-5-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 The big comment about only using a head page can go away now that it takes a folio argument. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Darrick J. Wong --- fs/iomap/buffered-io.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 9cc5798423d1..24a2aa69c467 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -22,8 +22,8 @@ #include "../internal.h" /* - * Structure allocated for each page or THP when block size < page size - * to track sub-page uptodate status and I/O completions. + * Structure allocated for each folio when block size < folio size + * to track sub-folio uptodate status and I/O completions. */ struct iomap_page { atomic_t read_bytes_pending; @@ -32,17 +32,10 @@ struct iomap_page { unsigned long uptodate[]; }; -static inline struct iomap_page *to_iomap_page(struct page *page) +static inline struct iomap_page *to_iomap_page(struct folio *folio) { - /* - * per-block data is stored in the head page. Callers should - * not be dealing with tail pages, and if they are, they can - * call thp_head() first. - */ - VM_BUG_ON_PGFLAGS(PageTail(page), page); - - if (page_has_private(page)) - return (struct iomap_page *)page_private(page); + if (folio_test_private(folio)) + return folio_get_private(folio); return NULL; } @@ -51,7 +44,8 @@ static struct bio_set iomap_ioend_bioset; static struct iomap_page * iomap_page_create(struct inode *inode, struct page *page) { - struct iomap_page *iop = to_iomap_page(page); + struct folio *folio = page_folio(page); + struct iomap_page *iop = to_iomap_page(folio); unsigned int nr_blocks = i_blocks_per_page(inode, page); if (iop || nr_blocks <= 1) @@ -144,7 +138,8 @@ iomap_adjust_read_range(struct inode *inode, struct iomap_page *iop, static void iomap_iop_set_range_uptodate(struct page *page, unsigned off, unsigned len) { - struct iomap_page *iop = to_iomap_page(page); + 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; @@ -173,7 +168,8 @@ static void iomap_read_page_end_io(struct bio_vec *bvec, int error) { struct page *page = bvec->bv_page; - struct iomap_page *iop = to_iomap_page(page); + struct folio *folio = page_folio(page); + struct iomap_page *iop = to_iomap_page(folio); if (unlikely(error)) { ClearPageUptodate(page); @@ -427,7 +423,8 @@ int iomap_is_partially_uptodate(struct page *page, unsigned long from, unsigned long count) { - struct iomap_page *iop = to_iomap_page(page); + struct folio *folio = page_folio(page); + struct iomap_page *iop = to_iomap_page(folio); struct inode *inode = page->mapping->host; unsigned len, first, last; unsigned i; @@ -1003,7 +1000,8 @@ static void iomap_finish_page_writeback(struct inode *inode, struct page *page, int error, unsigned int len) { - struct iomap_page *iop = to_iomap_page(page); + struct folio *folio = page_folio(page); + struct iomap_page *iop = to_iomap_page(folio); if (error) { SetPageError(page); -- 2.33.0