Jelajahi Sumber

NFS: Fix up split of fs/nfs/inode.c

Fix ups for the splitting of the superblock stuff out of fs/nfs/inode.c,
including:

 (*) Move the callback tcpport module param into callback.c.

 (*) Move the idmap cache timeout module param into idmap.c.

 (*) Changes to internal.h:

     (*) namespace-nfs4.c was renamed to nfs4namespace.c.

     (*) nfs_stat_to_errno() is in nfs2xdr.c, not nfs4xdr.c.

     (*) nfs4xdr.c is contingent on CONFIG_NFS_V4.

     (*) nfs4_path() is only uses if CONFIG_NFS_V4 is set.

Plus also:

 (*) The sec_flavours[] table should really be const.

Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
David Howells 19 tahun lalu
induk
melakukan
7d4e2747a0
4 mengubah file dengan 39 tambahan dan 42 penghapusan
  1. 15 0
      fs/nfs/callback.c
  2. 14 0
      fs/nfs/idmap.c
  3. 6 6
      fs/nfs/internal.h
  4. 4 36
      fs/nfs/super.c

+ 15 - 0
fs/nfs/callback.c

@@ -36,6 +36,21 @@ static struct svc_program nfs4_callback_program;
 
 
 unsigned int nfs_callback_set_tcpport;
 unsigned int nfs_callback_set_tcpport;
 unsigned short nfs_callback_tcpport;
 unsigned short nfs_callback_tcpport;
+static const int nfs_set_port_min = 0;
+static const int nfs_set_port_max = 65535;
+
+static int param_set_port(const char *val, struct kernel_param *kp)
+{
+	char *endp;
+	int num = simple_strtol(val, &endp, 0);
+	if (endp == val || *endp || num < nfs_set_port_min || num > nfs_set_port_max)
+		return -EINVAL;
+	*((int *)kp->arg) = num;
+	return 0;
+}
+
+module_param_call(callback_tcpport, param_set_port, param_get_int,
+		 &nfs_callback_set_tcpport, 0644);
 
 
 /*
 /*
  * This is the callback kernel thread.
  * This is the callback kernel thread.

+ 14 - 0
fs/nfs/idmap.c

@@ -57,6 +57,20 @@
 /* Default cache timeout is 10 minutes */
 /* Default cache timeout is 10 minutes */
 unsigned int nfs_idmap_cache_timeout = 600 * HZ;
 unsigned int nfs_idmap_cache_timeout = 600 * HZ;
 
 
+static int param_set_idmap_timeout(const char *val, struct kernel_param *kp)
+{
+	char *endp;
+	int num = simple_strtol(val, &endp, 0);
+	int jif = num * HZ;
+	if (endp == val || *endp || num < 0 || jif < num)
+		return -EINVAL;
+	*((int *)kp->arg) = jif;
+	return 0;
+}
+
+module_param_call(idmap_cache_timeout, param_set_idmap_timeout, param_get_int,
+		 &nfs_idmap_cache_timeout, 0644);
+
 struct idmap_hashent {
 struct idmap_hashent {
 	unsigned long ih_expires;
 	unsigned long ih_expires;
 	__u32 ih_id;
 	__u32 ih_id;

+ 6 - 6
fs/nfs/internal.h

@@ -15,7 +15,7 @@ struct nfs_clone_mount {
 	rpc_authflavor_t authflavor;
 	rpc_authflavor_t authflavor;
 };
 };
 
 
-/* namespace-nfs4.c */
+/* nfs4namespace.c */
 #ifdef CONFIG_NFS_V4
 #ifdef CONFIG_NFS_V4
 extern struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentry *dentry);
 extern struct vfsmount *nfs_do_refmount(const struct vfsmount *mnt_parent, struct dentry *dentry);
 #else
 #else
@@ -46,6 +46,7 @@ extern void nfs_destroy_directcache(void);
 #endif
 #endif
 
 
 /* nfs2xdr.c */
 /* nfs2xdr.c */
+extern int nfs_stat_to_errno(int);
 extern struct rpc_procinfo nfs_procedures[];
 extern struct rpc_procinfo nfs_procedures[];
 extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int);
 extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int);
 
 
@@ -54,8 +55,9 @@ extern struct rpc_procinfo nfs3_procedures[];
 extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int);
 extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int);
 
 
 /* nfs4xdr.c */
 /* nfs4xdr.c */
-extern int nfs_stat_to_errno(int);
+#ifdef CONFIG_NFS_V4
 extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus);
 extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus);
+#endif
 
 
 /* nfs4proc.c */
 /* nfs4proc.c */
 #ifdef CONFIG_NFS_V4
 #ifdef CONFIG_NFS_V4
@@ -97,15 +99,13 @@ extern char *nfs_path(const char *base, const struct dentry *dentry,
 /*
 /*
  * Determine the mount path as a string
  * Determine the mount path as a string
  */
  */
+#ifdef CONFIG_NFS_V4
 static inline char *
 static inline char *
 nfs4_path(const struct dentry *dentry, char *buffer, ssize_t buflen)
 nfs4_path(const struct dentry *dentry, char *buffer, ssize_t buflen)
 {
 {
-#ifdef CONFIG_NFS_V4
 	return nfs_path(NFS_SB(dentry->d_sb)->mnt_path, dentry, buffer, buflen);
 	return nfs_path(NFS_SB(dentry->d_sb)->mnt_path, dentry, buffer, buflen);
-#else
-	return NULL;
-#endif
 }
 }
+#endif
 
 
 /*
 /*
  * Determine the device name as a string
  * Determine the device name as a string

+ 4 - 36
fs/nfs/super.c

@@ -187,40 +187,6 @@ static struct super_operations nfs4_sops = {
 };
 };
 #endif
 #endif
 
 
-#ifdef CONFIG_NFS_V4
-static const int nfs_set_port_min = 0;
-static const int nfs_set_port_max = 65535;
-
-static int param_set_port(const char *val, struct kernel_param *kp)
-{
-	char *endp;
-	int num = simple_strtol(val, &endp, 0);
-	if (endp == val || *endp || num < nfs_set_port_min || num > nfs_set_port_max)
-		return -EINVAL;
-	*((int *)kp->arg) = num;
-	return 0;
-}
-
-module_param_call(callback_tcpport, param_set_port, param_get_int,
-		 &nfs_callback_set_tcpport, 0644);
-#endif
-
-#ifdef CONFIG_NFS_V4
-static int param_set_idmap_timeout(const char *val, struct kernel_param *kp)
-{
-	char *endp;
-	int num = simple_strtol(val, &endp, 0);
-	int jif = num * HZ;
-	if (endp == val || *endp || num < 0 || jif < num)
-		return -EINVAL;
-	*((int *)kp->arg) = jif;
-	return 0;
-}
-
-module_param_call(idmap_cache_timeout, param_set_idmap_timeout, param_get_int,
-		 &nfs_idmap_cache_timeout, 0644);
-#endif
-
 static struct shrinker *acl_shrinker;
 static struct shrinker *acl_shrinker;
 
 
 /*
 /*
@@ -328,9 +294,12 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf)
 
 
 }
 }
 
 
+/*
+ * Map the security flavour number to a name
+ */
 static const char *nfs_pseudoflavour_to_name(rpc_authflavor_t flavour)
 static const char *nfs_pseudoflavour_to_name(rpc_authflavor_t flavour)
 {
 {
-	static struct {
+	static const struct {
 		rpc_authflavor_t flavour;
 		rpc_authflavor_t flavour;
 		const char *str;
 		const char *str;
 	} sec_flavours[] = {
 	} sec_flavours[] = {
@@ -1368,7 +1337,6 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
 	}
 	}
 
 
 	s = sget(fs_type, nfs4_compare_super, nfs_set_super, server);
 	s = sget(fs_type, nfs4_compare_super, nfs_set_super, server);
-
 	if (IS_ERR(s)) {
 	if (IS_ERR(s)) {
 		error = PTR_ERR(s);
 		error = PTR_ERR(s);
 		goto out_free;
 		goto out_free;