浏览代码

SUNRPC: sunrpc should not explicitly depend on NFS config options

Change explicit references to CONFIG_NFS_V4_1 to implicit ones
Get rid of the unnecessary defines in backchannel_rqst.c and
bc_svc.c: the Makefile takes care of those dependency.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Trond Myklebust 14 年之前
父节点
当前提交
9e00abc3c2

+ 1 - 0
fs/nfs/Kconfig

@@ -77,6 +77,7 @@ config NFS_V4
 config NFS_V4_1
 config NFS_V4_1
 	bool "NFS client support for NFSv4.1 (EXPERIMENTAL)"
 	bool "NFS client support for NFSv4.1 (EXPERIMENTAL)"
 	depends on NFS_FS && NFS_V4 && EXPERIMENTAL
 	depends on NFS_FS && NFS_V4 && EXPERIMENTAL
+	select SUNRPC_BACKCHANNEL
 	select PNFS_FILE_LAYOUT
 	select PNFS_FILE_LAYOUT
 	help
 	help
 	  This option enables support for minor version 1 of the NFSv4 protocol
 	  This option enables support for minor version 1 of the NFSv4 protocol

+ 3 - 3
include/linux/sunrpc/bc_xprt.h

@@ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #include <linux/sunrpc/xprt.h>
 #include <linux/sunrpc/xprt.h>
 #include <linux/sunrpc/sched.h>
 #include <linux/sunrpc/sched.h>
 
 
-#ifdef CONFIG_NFS_V4_1
+#ifdef CONFIG_SUNRPC_BACKCHANNEL
 struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt);
 struct rpc_rqst *xprt_alloc_bc_request(struct rpc_xprt *xprt);
 void xprt_free_bc_request(struct rpc_rqst *req);
 void xprt_free_bc_request(struct rpc_rqst *req);
 int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
 int xprt_setup_backchannel(struct rpc_xprt *, unsigned int min_reqs);
@@ -47,7 +47,7 @@ static inline int svc_is_backchannel(const struct svc_rqst *rqstp)
 		return 1;
 		return 1;
 	return 0;
 	return 0;
 }
 }
-#else /* CONFIG_NFS_V4_1 */
+#else /* CONFIG_SUNRPC_BACKCHANNEL */
 static inline int xprt_setup_backchannel(struct rpc_xprt *xprt,
 static inline int xprt_setup_backchannel(struct rpc_xprt *xprt,
 					 unsigned int min_reqs)
 					 unsigned int min_reqs)
 {
 {
@@ -62,6 +62,6 @@ static inline int svc_is_backchannel(const struct svc_rqst *rqstp)
 static inline void xprt_free_bc_request(struct rpc_rqst *req)
 static inline void xprt_free_bc_request(struct rpc_rqst *req)
 {
 {
 }
 }
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */
 #endif /* _LINUX_SUNRPC_BC_XPRT_H */
 #endif /* _LINUX_SUNRPC_BC_XPRT_H */
 
 

+ 2 - 2
include/linux/sunrpc/svc.h

@@ -92,7 +92,7 @@ struct svc_serv {
 	struct module *		sv_module;	/* optional module to count when
 	struct module *		sv_module;	/* optional module to count when
 						 * adding threads */
 						 * adding threads */
 	svc_thread_fn		sv_function;	/* main function for threads */
 	svc_thread_fn		sv_function;	/* main function for threads */
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 	struct list_head	sv_cb_list;	/* queue for callback requests
 	struct list_head	sv_cb_list;	/* queue for callback requests
 						 * that arrive over the same
 						 * that arrive over the same
 						 * connection */
 						 * connection */
@@ -100,7 +100,7 @@ struct svc_serv {
 	wait_queue_head_t	sv_cb_waitq;	/* sleep here if there are no
 	wait_queue_head_t	sv_cb_waitq;	/* sleep here if there are no
 						 * entries in the svc_cb_list */
 						 * entries in the svc_cb_list */
 	struct svc_xprt		*sv_bc_xprt;	/* callback on fore channel */
 	struct svc_xprt		*sv_bc_xprt;	/* callback on fore channel */
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */
 };
 };
 
 
 /*
 /*

+ 8 - 8
include/linux/sunrpc/xprt.h

@@ -100,11 +100,11 @@ struct rpc_rqst {
 	ktime_t			rq_xtime;	/* transmit time stamp */
 	ktime_t			rq_xtime;	/* transmit time stamp */
 	int			rq_ntrans;
 	int			rq_ntrans;
 
 
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 	struct list_head	rq_bc_list;	/* Callback service list */
 	struct list_head	rq_bc_list;	/* Callback service list */
 	unsigned long		rq_bc_pa_state;	/* Backchannel prealloc state */
 	unsigned long		rq_bc_pa_state;	/* Backchannel prealloc state */
 	struct list_head	rq_bc_pa_list;	/* Backchannel prealloc list */
 	struct list_head	rq_bc_pa_list;	/* Backchannel prealloc list */
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANEL */
 };
 };
 #define rq_svec			rq_snd_buf.head
 #define rq_svec			rq_snd_buf.head
 #define rq_slen			rq_snd_buf.len
 #define rq_slen			rq_snd_buf.len
@@ -200,7 +200,7 @@ struct rpc_xprt {
 	u32			xid;		/* Next XID value to use */
 	u32			xid;		/* Next XID value to use */
 	struct rpc_task *	snd_task;	/* Task blocked in send */
 	struct rpc_task *	snd_task;	/* Task blocked in send */
 	struct svc_xprt		*bc_xprt;	/* NFSv4.1 backchannel */
 	struct svc_xprt		*bc_xprt;	/* NFSv4.1 backchannel */
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 	struct svc_serv		*bc_serv;       /* The RPC service which will */
 	struct svc_serv		*bc_serv;       /* The RPC service which will */
 						/* process the callback */
 						/* process the callback */
 	unsigned int		bc_alloc_count;	/* Total number of preallocs */
 	unsigned int		bc_alloc_count;	/* Total number of preallocs */
@@ -208,7 +208,7 @@ struct rpc_xprt {
 						 * items */
 						 * items */
 	struct list_head	bc_pa_list;	/* List of preallocated
 	struct list_head	bc_pa_list;	/* List of preallocated
 						 * backchannel rpc_rqst's */
 						 * backchannel rpc_rqst's */
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */
 	struct list_head	recv;
 	struct list_head	recv;
 
 
 	struct {
 	struct {
@@ -228,15 +228,15 @@ struct rpc_xprt {
 	const char		*address_strings[RPC_DISPLAY_MAX];
 	const char		*address_strings[RPC_DISPLAY_MAX];
 };
 };
 
 
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 /*
 /*
  * Backchannel flags
  * Backchannel flags
  */
  */
 #define	RPC_BC_PA_IN_USE	0x0001		/* Preallocated backchannel */
 #define	RPC_BC_PA_IN_USE	0x0001		/* Preallocated backchannel */
 						/* buffer in use */
 						/* buffer in use */
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */
 
 
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 static inline int bc_prealloc(struct rpc_rqst *req)
 static inline int bc_prealloc(struct rpc_rqst *req)
 {
 {
 	return test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state);
 	return test_bit(RPC_BC_PA_IN_USE, &req->rq_bc_pa_state);
@@ -246,7 +246,7 @@ static inline int bc_prealloc(struct rpc_rqst *req)
 {
 {
 	return 0;
 	return 0;
 }
 }
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */
 
 
 struct xprt_create {
 struct xprt_create {
 	int			ident;		/* XPRT_TRANSPORT identifier */
 	int			ident;		/* XPRT_TRANSPORT identifier */

+ 4 - 0
net/sunrpc/Kconfig

@@ -4,6 +4,10 @@ config SUNRPC
 config SUNRPC_GSS
 config SUNRPC_GSS
 	tristate
 	tristate
 
 
+config SUNRPC_BACKCHANNEL
+	bool
+	depends on SUNRPC
+
 config SUNRPC_XPRT_RDMA
 config SUNRPC_XPRT_RDMA
 	tristate
 	tristate
 	depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS && EXPERIMENTAL
 	depends on SUNRPC && INFINIBAND && INFINIBAND_ADDR_TRANS && EXPERIMENTAL

+ 1 - 1
net/sunrpc/Makefile

@@ -13,6 +13,6 @@ sunrpc-y := clnt.o xprt.o socklib.o xprtsock.o sched.o \
 	    addr.o rpcb_clnt.o timer.o xdr.o \
 	    addr.o rpcb_clnt.o timer.o xdr.o \
 	    sunrpc_syms.o cache.o rpc_pipe.o \
 	    sunrpc_syms.o cache.o rpc_pipe.o \
 	    svc_xprt.o
 	    svc_xprt.o
-sunrpc-$(CONFIG_NFS_V4_1) += backchannel_rqst.o bc_svc.o
+sunrpc-$(CONFIG_SUNRPC_BACKCHANNEL) += backchannel_rqst.o bc_svc.o
 sunrpc-$(CONFIG_PROC_FS) += stats.o
 sunrpc-$(CONFIG_PROC_FS) += stats.o
 sunrpc-$(CONFIG_SYSCTL) += sysctl.o
 sunrpc-$(CONFIG_SYSCTL) += sysctl.o

+ 0 - 3
net/sunrpc/backchannel_rqst.c

@@ -29,8 +29,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #define RPCDBG_FACILITY	RPCDBG_TRANS
 #define RPCDBG_FACILITY	RPCDBG_TRANS
 #endif
 #endif
 
 
-#if defined(CONFIG_NFS_V4_1)
-
 /*
 /*
  * Helper routines that track the number of preallocation elements
  * Helper routines that track the number of preallocation elements
  * on the transport.
  * on the transport.
@@ -279,4 +277,3 @@ void xprt_free_bc_request(struct rpc_rqst *req)
 	spin_unlock_bh(&xprt->bc_pa_lock);
 	spin_unlock_bh(&xprt->bc_pa_lock);
 }
 }
 
 
-#endif /* CONFIG_NFS_V4_1 */

+ 0 - 3
net/sunrpc/bc_svc.c

@@ -27,8 +27,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * reply over an existing open connection previously established by the client.
  * reply over an existing open connection previously established by the client.
  */
  */
 
 
-#if defined(CONFIG_NFS_V4_1)
-
 #include <linux/module.h>
 #include <linux/module.h>
 
 
 #include <linux/sunrpc/xprt.h>
 #include <linux/sunrpc/xprt.h>
@@ -63,4 +61,3 @@ int bc_send(struct rpc_rqst *req)
 	return ret;
 	return ret;
 }
 }
 
 
-#endif /* CONFIG_NFS_V4_1 */

+ 6 - 6
net/sunrpc/clnt.c

@@ -64,9 +64,9 @@ static void	call_decode(struct rpc_task *task);
 static void	call_bind(struct rpc_task *task);
 static void	call_bind(struct rpc_task *task);
 static void	call_bind_status(struct rpc_task *task);
 static void	call_bind_status(struct rpc_task *task);
 static void	call_transmit(struct rpc_task *task);
 static void	call_transmit(struct rpc_task *task);
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 static void	call_bc_transmit(struct rpc_task *task);
 static void	call_bc_transmit(struct rpc_task *task);
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */
 static void	call_status(struct rpc_task *task);
 static void	call_status(struct rpc_task *task);
 static void	call_transmit_status(struct rpc_task *task);
 static void	call_transmit_status(struct rpc_task *task);
 static void	call_refresh(struct rpc_task *task);
 static void	call_refresh(struct rpc_task *task);
@@ -716,7 +716,7 @@ rpc_call_async(struct rpc_clnt *clnt, const struct rpc_message *msg, int flags,
 }
 }
 EXPORT_SYMBOL_GPL(rpc_call_async);
 EXPORT_SYMBOL_GPL(rpc_call_async);
 
 
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 /**
 /**
  * rpc_run_bc_task - Allocate a new RPC task for backchannel use, then run
  * rpc_run_bc_task - Allocate a new RPC task for backchannel use, then run
  * rpc_execute against it
  * rpc_execute against it
@@ -759,7 +759,7 @@ out:
 	dprintk("RPC: rpc_run_bc_task: task= %p\n", task);
 	dprintk("RPC: rpc_run_bc_task: task= %p\n", task);
 	return task;
 	return task;
 }
 }
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */
 
 
 void
 void
 rpc_call_start(struct rpc_task *task)
 rpc_call_start(struct rpc_task *task)
@@ -1362,7 +1362,7 @@ call_transmit_status(struct rpc_task *task)
 	}
 	}
 }
 }
 
 
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 /*
 /*
  * 5b.	Send the backchannel RPC reply.  On error, drop the reply.  In
  * 5b.	Send the backchannel RPC reply.  On error, drop the reply.  In
  * addition, disconnect on connectivity errors.
  * addition, disconnect on connectivity errors.
@@ -1426,7 +1426,7 @@ call_bc_transmit(struct rpc_task *task)
 	}
 	}
 	rpc_wake_up_queued_task(&req->rq_xprt->pending, task);
 	rpc_wake_up_queued_task(&req->rq_xprt->pending, task);
 }
 }
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */
 
 
 /*
 /*
  * 6.	Sort out the RPC call status
  * 6.	Sort out the RPC call status

+ 2 - 2
net/sunrpc/svc.c

@@ -1252,7 +1252,7 @@ svc_process(struct svc_rqst *rqstp)
 	}
 	}
 }
 }
 
 
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 /*
 /*
  * Process a backchannel RPC request that arrived over an existing
  * Process a backchannel RPC request that arrived over an existing
  * outbound connection
  * outbound connection
@@ -1301,7 +1301,7 @@ bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req,
 	}
 	}
 }
 }
 EXPORT_SYMBOL(bc_svc_process);
 EXPORT_SYMBOL(bc_svc_process);
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */
 
 
 /*
 /*
  * Return (transport-specific) limit on the rpc payload.
  * Return (transport-specific) limit on the rpc payload.

+ 7 - 7
net/sunrpc/svcsock.c

@@ -66,12 +66,12 @@ static void		svc_sock_free(struct svc_xprt *);
 static struct svc_xprt *svc_create_socket(struct svc_serv *, int,
 static struct svc_xprt *svc_create_socket(struct svc_serv *, int,
 					  struct net *, struct sockaddr *,
 					  struct net *, struct sockaddr *,
 					  int, int);
 					  int, int);
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 static struct svc_xprt *svc_bc_create_socket(struct svc_serv *, int,
 static struct svc_xprt *svc_bc_create_socket(struct svc_serv *, int,
 					     struct net *, struct sockaddr *,
 					     struct net *, struct sockaddr *,
 					     int, int);
 					     int, int);
 static void svc_bc_sock_free(struct svc_xprt *xprt);
 static void svc_bc_sock_free(struct svc_xprt *xprt);
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */
 
 
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 static struct lock_class_key svc_key[2];
 static struct lock_class_key svc_key[2];
@@ -1241,7 +1241,7 @@ static struct svc_xprt *svc_tcp_create(struct svc_serv *serv,
 	return svc_create_socket(serv, IPPROTO_TCP, net, sa, salen, flags);
 	return svc_create_socket(serv, IPPROTO_TCP, net, sa, salen, flags);
 }
 }
 
 
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 static struct svc_xprt *svc_bc_create_socket(struct svc_serv *, int,
 static struct svc_xprt *svc_bc_create_socket(struct svc_serv *, int,
 					     struct net *, struct sockaddr *,
 					     struct net *, struct sockaddr *,
 					     int, int);
 					     int, int);
@@ -1282,7 +1282,7 @@ static void svc_cleanup_bc_xprt_sock(void)
 {
 {
 	svc_unreg_xprt_class(&svc_tcp_bc_class);
 	svc_unreg_xprt_class(&svc_tcp_bc_class);
 }
 }
-#else /* CONFIG_NFS_V4_1 */
+#else /* CONFIG_SUNRPC_BACKCHANNEL */
 static void svc_init_bc_xprt_sock(void)
 static void svc_init_bc_xprt_sock(void)
 {
 {
 }
 }
@@ -1290,7 +1290,7 @@ static void svc_init_bc_xprt_sock(void)
 static void svc_cleanup_bc_xprt_sock(void)
 static void svc_cleanup_bc_xprt_sock(void)
 {
 {
 }
 }
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */
 
 
 static struct svc_xprt_ops svc_tcp_ops = {
 static struct svc_xprt_ops svc_tcp_ops = {
 	.xpo_create = svc_tcp_create,
 	.xpo_create = svc_tcp_create,
@@ -1621,7 +1621,7 @@ static void svc_sock_free(struct svc_xprt *xprt)
 	kfree(svsk);
 	kfree(svsk);
 }
 }
 
 
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 /*
 /*
  * Create a back channel svc_xprt which shares the fore channel socket.
  * Create a back channel svc_xprt which shares the fore channel socket.
  */
  */
@@ -1660,4 +1660,4 @@ static void svc_bc_sock_free(struct svc_xprt *xprt)
 	if (xprt)
 	if (xprt)
 		kfree(container_of(xprt, struct svc_sock, sk_xprt));
 		kfree(container_of(xprt, struct svc_sock, sk_xprt));
 }
 }
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */

+ 2 - 2
net/sunrpc/xprt.c

@@ -1111,10 +1111,10 @@ found:
 
 
 	INIT_LIST_HEAD(&xprt->free);
 	INIT_LIST_HEAD(&xprt->free);
 	INIT_LIST_HEAD(&xprt->recv);
 	INIT_LIST_HEAD(&xprt->recv);
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 	spin_lock_init(&xprt->bc_pa_lock);
 	spin_lock_init(&xprt->bc_pa_lock);
 	INIT_LIST_HEAD(&xprt->bc_pa_list);
 	INIT_LIST_HEAD(&xprt->bc_pa_list);
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */
 
 
 	INIT_WORK(&xprt->task_cleanup, xprt_autoclose);
 	INIT_WORK(&xprt->task_cleanup, xprt_autoclose);
 	if (xprt_has_timer(xprt))
 	if (xprt_has_timer(xprt))

+ 3 - 3
net/sunrpc/xprtsock.c

@@ -37,7 +37,7 @@
 #include <linux/sunrpc/svcsock.h>
 #include <linux/sunrpc/svcsock.h>
 #include <linux/sunrpc/xprtsock.h>
 #include <linux/sunrpc/xprtsock.h>
 #include <linux/file.h>
 #include <linux/file.h>
-#ifdef CONFIG_NFS_V4_1
+#ifdef CONFIG_SUNRPC_BACKCHANNEL
 #include <linux/sunrpc/bc_xprt.h>
 #include <linux/sunrpc/bc_xprt.h>
 #endif
 #endif
 
 
@@ -1236,7 +1236,7 @@ static inline int xs_tcp_read_reply(struct rpc_xprt *xprt,
 	return 0;
 	return 0;
 }
 }
 
 
-#if defined(CONFIG_NFS_V4_1)
+#if defined(CONFIG_SUNRPC_BACKCHANNEL)
 /*
 /*
  * Obtains an rpc_rqst previously allocated and invokes the common
  * Obtains an rpc_rqst previously allocated and invokes the common
  * tcp read code to read the data.  The result is placed in the callback
  * tcp read code to read the data.  The result is placed in the callback
@@ -1299,7 +1299,7 @@ static inline int _xs_tcp_read_data(struct rpc_xprt *xprt,
 {
 {
 	return xs_tcp_read_reply(xprt, desc);
 	return xs_tcp_read_reply(xprt, desc);
 }
 }
-#endif /* CONFIG_NFS_V4_1 */
+#endif /* CONFIG_SUNRPC_BACKCHANNEL */
 
 
 /*
 /*
  * Read data off the transport.  This can be either an RPC_CALL or an
  * Read data off the transport.  This can be either an RPC_CALL or an