NFSv4.2: Remove ifdef CONFIG_NFSD_V4 from nfsV4.2 client SSC code.
Subsystems (2)
Dai Ngo
reviewerPATCH 1/1 NFSv4.2: Remove ifdef CONFIG_NFSD_V4 from nfsV4.2 client SSC code.
The client SSC code should not depend on any of the CONFIG_NFSD config. Replaced CONFIG_NFSD_V4 with CONFIG_NFS_V4_2_SSC_HELPER in nfs4file.c and super.c. This patch also fixes the compiler warning of unused variables when NFS_V4_2 is configured and NFSD_V4 is not.
--- fs/nfs/nfs4file.c | 6 ++++-- fs/nfs/super.c | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-)
fs/nfs/nfs4file.c +4 -2
@@ -313,6 +313,7 @@ static loff_t nfs42_remap_file_range(struct file *src_file, loff_t src_off,return ret <0 ? ret : count; } +#ifdef CONFIG_NFS_V4_2_SSC_HELPER static int read_name_gen =1 ;#define SSC_READ_NAME_BODY "ssc_read_%d"
@@ -411,6 +412,7 @@ static const struct nfs4_ssc_client_ops nfs4_ssc_clnt_ops_tbl = { .sco_open = __nfs42_ssc_open, .sco_close = __nfs42_ssc_close, }; +#endif /* CONFIG_NFS_V4_2_SSC_HELPER */ /** * nfs42_ssc_register_ops - Wrapper to register NFS_V4 ops in nfs_common
@@ -420,7 +422,7 @@ static const struct nfs4_ssc_client_ops nfs4_ssc_clnt_ops_tbl = {*/ void nfs42_ssc_register_ops (void ) { -#ifdef CONFIG_NFSD_V4 +#ifdef CONFIG_NFS_V4_2_SSC_HELPER nfs42_ssc_register (&nfs4_ssc_clnt_ops_tbl);#endif }
@@ -433,7 +435,7 @@ void nfs42_ssc_register_ops(void)*/ void nfs42_ssc_unregister_ops (void ) { -#ifdef CONFIG_NFSD_V4 +#ifdef CONFIG_NFS_V4_2_SSC_HELPER nfs42_ssc_unregister (&nfs4_ssc_clnt_ops_tbl);#endif }
fs/nfs/super.c +3 -3
@@ -86,7 +86,7 @@ const struct super_operations nfs_sops = { };EXPORT_SYMBOL_GPL (nfs_sops); -#ifdef CONFIG_NFS_V4_2 +#ifdef CONFIG_NFS_V4_2_SSC_HELPER static const struct nfs_ssc_client_ops nfs_ssc_clnt_ops_tbl = { .sco_sb_deactive = nfs_sb_deactive, };
@@ -116,14 +116,14 @@ static void unregister_nfs4_fs(void)#ifdef CONFIG_NFS_V4_2 static void nfs_ssc_register_ops (void ) { -#ifdef CONFIG_NFSD_V4 +#ifdef CONFIG_NFS_V4_2_SSC_HELPER nfs_ssc_register (&nfs_ssc_clnt_ops_tbl);#endif }static void nfs_ssc_unregister_ops (void ) { -#ifdef CONFIG_NFSD_V4 +#ifdef CONFIG_NFS_V4_2_SSC_HELPER nfs_ssc_unregister (&nfs_ssc_clnt_ops_tbl);#endif }
Signature · 1 line
2.9.5
Quoted 80 lines · Dai Ngo
The client SSC code should not depend on any of the
CONFIG_NFSDconfig. ReplacedCONFIG_NFSD_V4withCONFIG_NFS_V4_2_SSC_HELPERinnfs4file.candsuper.c. This patch also fixes the compiler warning of unused variables whenNFS_V4_2is configured andNFSD_V4is not.Signed-off-by Dai Ngo <[email protected]>---
fs/nfs/nfs4file.c | 6 ++++--
fs/nfs/super.c | 6 +++---2 files changed, 7 insertions(+), 5 deletions(-)fs/nfs/nfs4file.c +0
-0@@ -313,6 +313,7 @@ static loff_t nfs42_remap_file_range(struct file *src_file, loff_t src_off, return ret < 0 ? ret : count; }
+#ifdefCONFIG_NFS_V4_2_SSC_HELPER
static intread_name_gen= 1;
#defineSSC_READ_NAME_BODY"ssc_read_%d"fs/nfs/nfs4file.c +1
-0@@ -411,6 +412,7 @@ static const struct nfs4_ssc_client_ops nfs4_ssc_clnt_ops_tbl = { .sco_open = __nfs42_ssc_open, .sco_close = __nfs42_ssc_close, }; +#endif /* CONFIG_NFS_V4_2_SSC_HELPER */
/**
*nfs42_ssc_register_ops- Wrapper to registerNFS_V4ops innfs_commonfs/nfs/nfs4file.c +1
-1@@ -420,7 +422,7 @@ static const struct nfs4_ssc_client_opsnfs4_ssc_clnt_ops_tbl = { */ void nfs42_ssc_register_ops(void) { -#ifdef CONFIG_NFSD_V4 +#ifdef CONFIG_NFS_V4_2_SSC_HELPER nfs42_ssc_register(&nfs4_ssc_clnt_ops_tbl); #endif}
fs/nfs/nfs4file.c +1
-1@@ -433,7 +435,7 @@ void nfs42_ssc_register_ops(void)*/ void nfs42_ssc_unregister_ops(void) { -#ifdef CONFIG_NFSD_V4 +#ifdef CONFIG_NFS_V4_2_SSC_HELPER nfs42_ssc_unregister(&nfs4_ssc_clnt_ops_tbl); #endif }fs/nfs/super.c +0
-0@@ -86,7 +86,7 @@ const struct super_operations nfs_sops = { }; EXPORT_SYMBOL_GPL(nfs_sops);fs/nfs/super.c +1
-1-#ifdef CONFIG_NFS_V4_2 +#ifdef CONFIG_NFS_V4_2_SSC_HELPER static const struct
nfs_ssc_client_opsnfs_ssc_clnt_ops_tbl= { .sco_sb_deactive =nfs_sb_deactive,
};fs/nfs/super.c +1
-1@@ -116,14 +116,14 @@ static void unregister_nfs4_fs(void) #ifdef CONFIG_NFS_V4_2 static void nfs_ssc_register_ops(void) { -#ifdef CONFIG_NFSD_V4 +#ifdef CONFIG_NFS_V4_2_SSC_HELPER nfs_ssc_register(&nfs_ssc_clnt_ops_tbl); #endif }
static voidnfs_ssc_unregister_ops(void)
{fs/nfs/super.c +1
-1-#ifdef CONFIG_NFSD_V4 +#ifdef CONFIG_NFS_V4_2_SSC_HELPER
Quoted 3 lines
nfs_ssc_unregister(&nfs_ssc_clnt_ops_tbl); #endif
}
OK. This looks better, and gives us a more direct dependency. However looking independently at fs/Kconfig, I'm seeing
config NFS_V4_2_SSC_HELPER
tristate
default y if NFS_V4=y || NFS_FS=yShouldn't that rather be:
config NFS_V4_2_SSC_HELPER
bool default y if NFS_V4_2 || NFSD_V4_2_INTER_SSC
...to allow us to get rid of these CONFIG_NFS_V4_2_SSC_HELPER #ifdefs in fs/nfs? I suspect the above would also allow us to simplify the dependencies in fs/nfsd/Kconfig for NFSD_V4_2_INTER_SSC too.
Signature · 3 lines
Trond Myklebust Linux NFS client maintainer, Hammerspace [email protected]