Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1682250rwb; Thu, 19 Jan 2023 14:04:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXsPx24y6gc7hwjzaVkqZqfTNG2lkC23GCIJoGtWJ0OZk7zPihmN+wzTYOB1edk8ylzkQat+ X-Received: by 2002:a05:6a21:339a:b0:a7:345a:100f with SMTP id yy26-20020a056a21339a00b000a7345a100fmr15686286pzb.10.1674165875711; Thu, 19 Jan 2023 14:04:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674165875; cv=none; d=google.com; s=arc-20160816; b=aWEbyOgOCrtKRgXCt9VlXp/sXs9gylwXcd12jipC4/in/xERWDwpMutu5s2lz1HEqn D1SgZrtL4QRFJi7DChuzwgfcvuc306iXSDXwATE93Dm25FEK9kDCvFtRl8YyE2J7V4nQ +vSu691unjoFP+pGTqTWMyJXPUiUbxZwb3A458AmS9EcEvGq1z5ozKItMfvAu7TXReJQ HXXpOWMeyq4S2aNUfCACAqT7X8kGKwI6dY7av2hgSCAfmFN8BDmb3lvCydqOsyJ4N/MN vuTqAWUjbCRVYbvusYtWubn8u5nsIyiCuIiSMD4DXd+rwNTmxFxBycyck+IGUANuMby3 ZwTA== 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=q6/0A5kEaSqfUAmeHH3wuAMyxHFs+0TxqGY6JDvNkMk=; b=yr93PUuxYm7k+m3XlJIUhmu9FaEoITrEYAjngw4mdB6WM5whaDEFiYyB1PC3PkMNuz vCV55EacARcNjS/AA7BE7f4MKi2hZ9f4NgT2hI+SvakeY+zN95mJNPjDAi0ONawcKsRN OdBr/tMyOc+JXnhdeC2EbRtkE5uBkO8oPr1zAnwb7xdoYzWUepPNa0C4fsjSUinPIL2t Gs6CC01vz1cd+LTYpDwh3KE+88sVeMMo1S+KoSOfv3knCXAn8wi2+T2iiuqehK0PdhrE Wm9l7NzDhHyingoNzicps8R1EYMqmC9kpcbr9sGV0Jesb1nimKrGW79OwtCv5xPwsz+R SEBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TNwapJg0; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a639244000000b004770fe95989si40085472pgn.496.2023.01.19.14.04.23; Thu, 19 Jan 2023 14:04:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TNwapJg0; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229964AbjASWDW (ORCPT + 99 others); Thu, 19 Jan 2023 17:03:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230079AbjASWCk (ORCPT ); Thu, 19 Jan 2023 17:02:40 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2C2CC41F5 for ; Thu, 19 Jan 2023 13:40:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4426A61D84 for ; Thu, 19 Jan 2023 21:40:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74347C433F1; Thu, 19 Jan 2023 21:40:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674164422; bh=4/4I6sCY4E/uPcUZWLR+fcZEcbmWOVB26502wIU2hZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TNwapJg0hcc1e2OPxxq9K4gTN5wOXk5sRT5xz2G6XtHCQbxhCQEc8o/Dev79EnAVR fDTiRnia4LPDMc1gt472HMroXwoN7RwzNHma8hCGkeWMsIPHV498xH11z8svXuyIA1 Bbcv04EGrpCC6KLKb0PfaLDiuBbJ6fg3ZWyVvvXJHQt9WP4SpVZiKd9JBVQzGsSqiH 4etA+ffzkUhaWOlFc4L3n1H88ikdVRaWko9ICPes8YSl/J7i1Xp6X+a2MqaP9AOAQK y97ykppxSGUYQTFKjlDxhV56aRonyd7MprTEPmsqOJ976SGR+eN+sLE5LIFuDlEmQH 8vDSKJlEcFXJQ== From: trondmy@kernel.org To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2 09/18] NFS: Convert the function nfs_wb_page() to use folios Date: Thu, 19 Jan 2023 16:33:42 -0500 Message-Id: <20230119213351.443388-10-trondmy@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119213351.443388-9-trondmy@kernel.org> References: <20230119213351.443388-1-trondmy@kernel.org> <20230119213351.443388-2-trondmy@kernel.org> <20230119213351.443388-3-trondmy@kernel.org> <20230119213351.443388-4-trondmy@kernel.org> <20230119213351.443388-5-trondmy@kernel.org> <20230119213351.443388-6-trondmy@kernel.org> <20230119213351.443388-7-trondmy@kernel.org> <20230119213351.443388-8-trondmy@kernel.org> <20230119213351.443388-9-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust Convert to use the folio functions, but pass the struct page to nfs_writepage_locked() for now. Signed-off-by: Trond Myklebust --- fs/nfs/write.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index c80a57801b2e..0d63f03436d3 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -2069,13 +2069,18 @@ int nfs_wb_folio_cancel(struct inode *inode, struct folio *folio) return ret; } -/* - * Write back all requests on one page - we do this before reading it. +/** + * nfs_wb_folio - Write back all requests on one page + * @inode: pointer to page + * @folio: pointer to folio + * + * Assumes that the folio has been locked by the caller, and will + * not unlock it. */ -int nfs_wb_page(struct inode *inode, struct page *page) +int nfs_wb_folio(struct inode *inode, struct folio *folio) { - loff_t range_start = page_file_offset(page); - loff_t range_end = range_start + (loff_t)(PAGE_SIZE - 1); + loff_t range_start = folio_file_pos(folio); + loff_t range_end = range_start + (loff_t)folio_size(folio) - 1; struct writeback_control wbc = { .sync_mode = WB_SYNC_ALL, .nr_to_write = 0, @@ -2087,15 +2092,15 @@ int nfs_wb_page(struct inode *inode, struct page *page) trace_nfs_writeback_page_enter(inode); for (;;) { - wait_on_page_writeback(page); - if (clear_page_dirty_for_io(page)) { - ret = nfs_writepage_locked(page, &wbc); + folio_wait_writeback(folio); + if (folio_clear_dirty_for_io(folio)) { + ret = nfs_writepage_locked(&folio->page, &wbc); if (ret < 0) goto out_error; continue; } ret = 0; - if (!PagePrivate(page)) + if (!folio_test_private(folio)) break; ret = nfs_commit_inode(inode, FLUSH_SYNC); if (ret < 0) @@ -2106,17 +2111,9 @@ int nfs_wb_page(struct inode *inode, struct page *page) return ret; } -/** - * nfs_wb_folio - Write back all requests on one page - * @inode: pointer to page - * @folio: pointer to folio - * - * Assumes that the folio has been locked by the caller, and will - * not unlock it. - */ -int nfs_wb_folio(struct inode *inode, struct folio *folio) +int nfs_wb_page(struct inode *inode, struct page *page) { - return nfs_wb_page(inode, &folio->page); + return nfs_wb_folio(inode, page_folio(page)); } #ifdef CONFIG_MIGRATION -- 2.39.0