Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3269232pxb; Fri, 12 Feb 2021 13:52:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfLj/SiOC8pa0jWGFsAO5ZnRZLM1oVMrLk6Qd0ZcyDn9mSb9CkialV5oxe86jedUSa4Hdq X-Received: by 2002:a17:906:4f16:: with SMTP id t22mr4909448eju.307.1613166771723; Fri, 12 Feb 2021 13:52:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613166771; cv=none; d=google.com; s=arc-20160816; b=lnXutoI1zFxN0S+flBFeyqVcG/8NicCcyxmYQVm7y4u3NkQZwvtufnGV6f9OCQ3yu3 rCG4UdTtb8rP2fnCtnD3tZyL6H/wtKVb8a7vC6vdhBZwdPoIMO5LODPZlwpmMSG458mU CmuQtg0fDbe3tTXp5gTIxAKPLskx8agyC6xravPeXbmggRheVnTM2OP+7pZfb/vbmrKW W/B/bVCidxlQ/xyM5FNKGl7TjgvJQAaXiqHkkp30V9+wnBZYvk2lVR1iTUtzOEByF/sc JEXy/ZbR3BDfzbRG+eSWSpXBaxWGmYKtzWPXc01WMORoFG98KcogUjrt9HMjaP5nisJZ AhgQ== 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=TSkL/v3pk09cID2+j/rDRRjOcFIo5wnpJ5Y+obO0WD0=; b=U0ugM1zYWoxegnkZH8RmejmBP3RTZGkln36mN5coCswDMKprD5ZJ/PTvmovz1VnT76 qZUWLZii/feSiZMuRZLIWNbcIndzpZNi8WlPweeP/aFeexqyWXSMvQEwwoNbMdUDujue LpysgfJuT2k9hdZ9/fFIwoQSf9pRW+HCQkVWLY6jHujKcButIsc1Ms0EaICQqpVty97n x8RKDuTDMW1sSAaA53dHjUK2l5QjTlFOKyPFgnKhrvoh3HIwEjPSAZfokptK5DlvMLLM HDXCinyfjXxVf7PLyUAIClTH3S1jQA8rDTy3D4S2QkK/eSsu9PEKCRwbFVSWFSgOcoId TPPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Lz7ow4ND; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si7959597eje.690.2021.02.12.13.52.24; Fri, 12 Feb 2021 13:52:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-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=@kernel.org header.s=k20201202 header.b=Lz7ow4ND; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 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 S229798AbhBLVui (ORCPT + 99 others); Fri, 12 Feb 2021 16:50:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:36322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbhBLVug (ORCPT ); Fri, 12 Feb 2021 16:50:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 736E964E8D; Fri, 12 Feb 2021 21:49:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613166595; bh=qJuFeeAcnlXPKGSJA0Yl43HBriEos2VfMxdKc4eyybY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lz7ow4NDHJCwrhN1yTa6i/nCXlumTENIyMFYHv+WINhV4XRxdviC9kIbhqcWt/8ec UPs0UAIL343EfOwUDlACnGzrdNKIn5u7O9EWrPqcwtmMpjO9BrJvM6CYkbU2GfDdHa H6/8LRNuNX4r8oRcL8polYQufjAsCkRpNitsxW7Jc5BA1TJsuemO28LnKEG5z3pEoy icFZpai5ToqM9dH9amxa43UIA4fq4YE1uEP8qJl7Hpg7B18I9lswIa7LTWj5UNaQ8c bDqoq5QWWTKh/8KQnnkIKYWl0YXsvP7obuGGX2obiimodhvTu6ZoD1TGhAGk7g21wY M9/92v5oUpriQ== From: trondmy@kernel.org To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 3/3] NFS: Add mount options supporting eager writes Date: Fri, 12 Feb 2021 16:49:49 -0500 Message-Id: <20210212214949.4408-4-trondmy@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210212214949.4408-3-trondmy@kernel.org> References: <20210212214949.4408-1-trondmy@kernel.org> <20210212214949.4408-2-trondmy@kernel.org> <20210212214949.4408-3-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust Signed-off-by: Trond Myklebust --- fs/nfs/fs_context.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c index 06894bcdea2d..b6be02aa79f0 100644 --- a/fs/nfs/fs_context.c +++ b/fs/nfs/fs_context.c @@ -82,6 +82,7 @@ enum nfs_param { Opt_v, Opt_vers, Opt_wsize, + Opt_write, }; enum { @@ -113,6 +114,19 @@ static const struct constant_table nfs_param_enums_lookupcache[] = { {} }; +enum { + Opt_write_lazy, + Opt_write_eager, + Opt_write_wait, +}; + +static const struct constant_table nfs_param_enums_write[] = { + { "lazy", Opt_write_lazy }, + { "eager", Opt_write_eager }, + { "wait", Opt_write_wait }, + {} +}; + static const struct fs_parameter_spec nfs_fs_parameters[] = { fsparam_flag_no("ac", Opt_ac), fsparam_u32 ("acdirmax", Opt_acdirmax), @@ -171,6 +185,7 @@ static const struct fs_parameter_spec nfs_fs_parameters[] = { fsparam_flag ("v4.1", Opt_v), fsparam_flag ("v4.2", Opt_v), fsparam_string("vers", Opt_vers), + fsparam_enum ("write", Opt_write, nfs_param_enums_write), fsparam_u32 ("wsize", Opt_wsize), {} }; @@ -770,6 +785,24 @@ static int nfs_fs_context_parse_param(struct fs_context *fc, goto out_invalid_value; } break; + case Opt_write: + switch (result.uint_32) { + case Opt_write_lazy: + ctx->flags &= + ~(NFS_MOUNT_WRITE_EAGER | NFS_MOUNT_WRITE_WAIT); + break; + case Opt_write_eager: + ctx->flags |= NFS_MOUNT_WRITE_EAGER; + ctx->flags &= ~NFS_MOUNT_WRITE_WAIT; + break; + case Opt_write_wait: + ctx->flags |= + NFS_MOUNT_WRITE_EAGER | NFS_MOUNT_WRITE_WAIT; + break; + default: + goto out_invalid_value; + } + break; /* * Special options -- 2.29.2