Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2859969rwi; Fri, 28 Oct 2022 12:14:36 -0700 (PDT) X-Google-Smtp-Source: AMsMyM53lDApPV82tjXljzQpfLQ0wlMXR/DZawdgPiiETMlbFyEBKDaGgntOurxRXRdgphQ77rMM X-Received: by 2002:a17:907:78d:b0:740:33e1:998 with SMTP id xd13-20020a170907078d00b0074033e10998mr810217ejb.162.1666984476068; Fri, 28 Oct 2022 12:14:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666984476; cv=none; d=google.com; s=arc-20160816; b=upPSsTqL3iCdefOmE8queXtk5lR11n20ffBMPLMGrDwohinLpbrO5GYwpfS2R8T6mK bDN453wSNOeGlMAx24LV09VY9WErrYBskDLl2oXO/2Ae0piqpmJpmlxdi+0TEWC2Ku6u LWCIoTgV1JGNJaeBvlfjJwULT6rVOvfvNJPXL1FRtcmGR52VlNaLDhKzM7j+V772K1ho DkwwL9H87lKGbfu9pyoBqI3cmixSN1vt0i0A37cZfIgBRhots6iZnZ8xQGgffLK3KcNi nD54bdGubN5tNtenIpawP0z9P4SNoth+XEmhBnBcO+ebf8+nFLRW2eZ1mzQrExXeJaxB L01g== 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=65/sIxsSUqc+/hqKqzLrREgoMyNdqZnVUobsjbWrioU=; b=w0HiaWJiE+8iHEMr7iDPRJSWtRn1PFx+UyelC1gAZxG1yxRi9j7YK2MBvT1mfM4vgt x7on7elmCtmPB9voWtp/PZGSHi2DnJMinSmRf+1SEbVaWaSYC0pJjomY8yo2P6Ee0ebj 65XBkEeoxWhREaeXzJdggfKJ6msk9cMMAFr0xSUowQdaPKQtMOSAQyMbCSCFcoRh+1cj 0CXk69xKbH1Q1yB0jrakkOIV4HeueUpd9Hokd2Vw7/1sFK9uCGQoG190gh1u5i6A3V3c N68IGhzN98Z2I83WOMzUWpTTxVuBpapevH0T/8bSd/H7gsB4ytjds6ehWeLpMIxusFoD JKtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="PeYOB/G1"; 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 q6-20020a056402518600b0045d050f0fa3si6330235edd.565.2022.10.28.12.14.03; Fri, 28 Oct 2022 12:14:36 -0700 (PDT) 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="PeYOB/G1"; 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 S229917AbiJ1S5V (ORCPT + 99 others); Fri, 28 Oct 2022 14:57:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230115AbiJ1S5U (ORCPT ); Fri, 28 Oct 2022 14:57:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D312A1D2B58 for ; Fri, 28 Oct 2022 11:57:18 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 8F767B82C88 for ; Fri, 28 Oct 2022 18:57:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7B3DC433D6; Fri, 28 Oct 2022 18:57:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666983437; bh=Fh57O2isAT251Px6qkrQwR+hkIPHdB8ywH4ZqCZZ5ig=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PeYOB/G1p1bIUN6+jk4jdlTRMBMOVgRD0in7Ml4R53g7R9b/ZzYGfDifU/fAwRJmn +UNBbVjLajeCMKBckQCAP0KeGU4Ss3FjMxLop1WXhR/XtkiKx+hRZl+9S5//yDME47 m5mMpu9vcqvea1NWkuV1ifUG4+izfhE87MBJ937Uf6gmf/QjQOAPZ7vnugYf+p36tK +PMO+ismYjIaq90MxBkNylDbcYgBIWfHAHWymq1fNH/DB72C0YtQzE6YICUy7cetMU QnfW6dyfbtWXxbyczn189XT4OPv2TzKRL6DVXc+bOwe4zlMIbvoWAZRBVEOSgzKv7r dMgdTN0PTLcCg== From: Jeff Layton To: chuck.lever@oracle.com Cc: linux-nfs@vger.kernel.org, neilb@suse.de Subject: [PATCH v3 4/4] nfsd: start non-blocking writeback after adding nfsd_file to the LRU Date: Fri, 28 Oct 2022 14:57:12 -0400 Message-Id: <20221028185712.79863-5-jlayton@kernel.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221028185712.79863-1-jlayton@kernel.org> References: <20221028185712.79863-1-jlayton@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 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 When a GC entry gets added to the LRU, kick off SYNC_NONE writeback so that we can be ready to close it when the time comes. This should help minimize delays when freeing objects reaped from the LRU. Signed-off-by: Jeff Layton --- fs/nfsd/filecache.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index 47cdc6129a7b..c43b6cff03e2 100644 --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -325,6 +325,20 @@ nfsd_file_fsync(struct nfsd_file *nf) nfsd_reset_write_verifier(net_generic(nf->nf_net, nfsd_net_id)); } +static void +nfsd_file_flush(struct nfsd_file *nf) +{ + struct file *file = nf->nf_file; + struct address_space *mapping; + + if (!file || !(file->f_mode & FMODE_WRITE)) + return; + + mapping = file->f_mapping; + if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) + filemap_flush(mapping); +} + static int nfsd_file_check_write_error(struct nfsd_file *nf) { @@ -484,9 +498,14 @@ nfsd_file_put(struct nfsd_file *nf) /* Try to add it to the LRU. If that fails, decrement. */ if (nfsd_file_lru_add(nf)) { - /* If it's still hashed, we're done */ - if (test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) + /* + * If it's still hashed, we can just return now, + * after kicking off SYNC_NONE writeback. + */ + if (test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) { + nfsd_file_flush(nf); return; + } /* * We're racing with unhashing, so try to remove it from -- 2.37.3