Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3465734pxb; Mon, 1 Nov 2021 14:23:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGGZawEx8ATv67MI+mvoFXno81PWrOqp7C7qO4BX+pn0Lf78GbtH3llW2PB8pN41Qphqaf X-Received: by 2002:a05:6638:441:: with SMTP id r1mr11893811jap.37.1635801823038; Mon, 01 Nov 2021 14:23:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635801823; cv=none; d=google.com; s=arc-20160816; b=yr8IdxwKH8WRrMoMditEEgHWi3JeqFYpFhE9O3KyFrgGQPJk3N/967xJsAVRp/jr6L Ig2n38+m1LaP4J4aM0F50vOVi2rmyzoJsbpp12vwqieB0+0q+BFm9bt2Y1quf5NYOfCr C0TemuOTo0qlrDWl7jiBjBx/RUxLFFMDlSu/tCPx3VVtjYZCPdlHbqJ0eCAnfDAL9gMe 5c+a+zlfE3PwsBnSwKWdK9hSKtwza3VrGYscgmr9qDfdtuGq5ZezDVCnUWLihSoZwM4d yCOYjPep6s9TDWRp+qaT1FK2KGGUFeCOQ3vhlcVfmpMbpy3t7OgG+zz441mjGVWIGAui rgFw== 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=nwAzZRMDr+7Cg6zEH4I8k5Ji0CIMLbAy3jNfQy75VRs=; b=CHeHXnncQ6PeW56S3zPGpsEURioW/R0ce1GpyfTc1/aplYUXKs6ljVtI5/bzgcRnPc 5EDjOVgyTqdD2y3sy9Nb+8gJNQPujOoKxMnMxBnB3e+Kmm7+289+MYhFFjcN/NqmHLlA hp5dMaidVYbvEqA1g+nIxRcguiUbJElRhQiY3EHTRzpPpEIR9/dNXjTW/Dhf4ftMHggy FoJnb8iWnadAijdxb2Cdr5J+YfWlWh4p+ha+Rmvy6wXMrQuNwT9FeI6ZIixOIa6smmse GSWRRnTxZ+t+ldWQsccG0vUNGhmTt3+IKZyvexVEO4corsmk6bQS9/kKycmnCYV46QVx 1BQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=TehrpSOa; 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 z6si20261137ilb.156.2021.11.01.14.23.31; Mon, 01 Nov 2021 14:23:43 -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=TehrpSOa; 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 S231511AbhKAVZK (ORCPT + 99 others); Mon, 1 Nov 2021 17:25:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231694AbhKAVZG (ORCPT ); Mon, 1 Nov 2021 17:25:06 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2AAD2C061714; Mon, 1 Nov 2021 14:22:32 -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=nwAzZRMDr+7Cg6zEH4I8k5Ji0CIMLbAy3jNfQy75VRs=; b=TehrpSOaZGQNFD1bjbAS/Ydl1Z d2N30JBydUePwBLC0B7lEIDdzYeZ+17J+7yyEk3uyRrX8GWx+TlFHVboZTvhCNMymjGpy6XlJ5Azs CIUyPjQhfhZkKq3vbRTTGUUOO07CttObB71NWJZ1sf/WBQCT1YmJDOlriFIqhV92KFV7hlFmbPrjh NuV2ciejrWeQJvXh9QNA4tF3aPae1NiorfJ8Xc6GclFL5jE2m8BqUTCh3I3g40dT+EGP6Iv0T8BMT 33LQmfg7S33ex6GTy6SmINtAJCRONAl4e9PAj3iWN4Ayir+DJQIi26uuN1S2a9ALwXu06gjeL/Uyo WCaD4nYg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mheXE-0041v3-NG; Mon, 01 Nov 2021 21:08:27 +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 17/21] iomap,xfs: Convert ->discard_page to ->discard_folio Date: Mon, 1 Nov 2021 20:39:25 +0000 Message-Id: <20211101203929.954622-18-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 XFS has the only implementation of ->discard_page today, so convert it to use folios in the same patch as converting the API. Signed-off-by: Matthew Wilcox (Oracle) --- fs/iomap/buffered-io.c | 4 ++-- fs/xfs/xfs_aops.c | 24 ++++++++++++------------ include/linux/iomap.h | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 6862487f4067..c50ae76835ca 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1349,8 +1349,8 @@ iomap_writepage_map(struct iomap_writepage_ctx *wpc, * won't be affected by I/O completion and we must unlock it * now. */ - if (wpc->ops->discard_page) - wpc->ops->discard_page(page, file_offset); + if (wpc->ops->discard_folio) + wpc->ops->discard_folio(page_folio(page), file_offset); if (!count) { ClearPageUptodate(page); unlock_page(page); diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 34fc6148032a..c6c4d07d0d26 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -428,37 +428,37 @@ xfs_prepare_ioend( * see a ENOSPC in writeback). */ static void -xfs_discard_page( - struct page *page, - loff_t fileoff) +xfs_discard_folio( + struct folio *folio, + loff_t pos) { - struct inode *inode = page->mapping->host; + struct inode *inode = folio->mapping->host; struct xfs_inode *ip = XFS_I(inode); struct xfs_mount *mp = ip->i_mount; - unsigned int pageoff = offset_in_page(fileoff); - xfs_fileoff_t start_fsb = XFS_B_TO_FSBT(mp, fileoff); - xfs_fileoff_t pageoff_fsb = XFS_B_TO_FSBT(mp, pageoff); + size_t offset = offset_in_folio(folio, pos); + xfs_fileoff_t start_fsb = XFS_B_TO_FSBT(mp, pos); + xfs_fileoff_t pageoff_fsb = XFS_B_TO_FSBT(mp, offset); int error; if (xfs_is_shutdown(mp)) goto out_invalidate; xfs_alert_ratelimited(mp, - "page discard on page "PTR_FMT", inode 0x%llx, offset %llu.", - page, ip->i_ino, fileoff); + "page discard on page "PTR_FMT", inode 0x%llx, pos %llu.", + folio, ip->i_ino, pos); error = xfs_bmap_punch_delalloc_range(ip, start_fsb, - i_blocks_per_page(inode, page) - pageoff_fsb); + i_blocks_per_folio(inode, folio) - pageoff_fsb); if (error && !xfs_is_shutdown(mp)) xfs_alert(mp, "page discard unable to remove delalloc mapping."); out_invalidate: - iomap_invalidatepage(page, pageoff, PAGE_SIZE - pageoff); + iomap_invalidate_folio(folio, offset, folio_size(folio) - offset); } static const struct iomap_writeback_ops xfs_writeback_ops = { .map_blocks = xfs_map_blocks, .prepare_ioend = xfs_prepare_ioend, - .discard_page = xfs_discard_page, + .discard_folio = xfs_discard_folio, }; STATIC int diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 91de58ca09fc..1a161314d7e4 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -285,7 +285,7 @@ struct iomap_writeback_ops { * Optional, allows the file system to discard state on a page where * we failed to submit any I/O. */ - void (*discard_page)(struct page *page, loff_t fileoff); + void (*discard_folio)(struct folio *folio, loff_t pos); }; struct iomap_writepage_ctx { -- 2.33.0