pnfs-block: move device mapping from kernel to user daemon
Subsystems (3)
cover pnfs-block: move device mapping from kernel to user daemon
These two patches move the complex block layout device mapping from the kernel to a user space daemon. The first patch adds a simple upcall mechanism via pipefs for the kernel piece to communicate with the daemon. The second patch removes the kernel device mapping and replaces it with calls to the daemon.
Passes Connectathon tests to both EMC and spnfs servers.
The user daemon will be sent separately as a patch to nfs-utils.
Haiying Tang (2):
pnfs-block: Add support for simple rpc pipefs
pnfs-block: Remove device creation from kernel
fs/nfs/blocklayout/Makefile | 2 +- fs/nfs/blocklayout/block-device-discovery-pipe.c | 66 +++ fs/nfs/blocklayout/blocklayout.c | 15 +- fs/nfs/blocklayout/blocklayout.h | 18 +- fs/nfs/blocklayout/blocklayoutdev.c | 494 +++------------------- fs/nfs/blocklayout/blocklayoutdm.c | 297 ++----------- include/linux/sunrpc/rpc_pipe_fs.h | 4 + include/linux/sunrpc/simple_rpc_pipefs.h | 112 +++++ net/sunrpc/Makefile | 2 +- net/sunrpc/simple_rpc_pipefs.c | 422 ++++++++++++++++++ 10 files changed, 720 insertions(+), 712 deletions(-) create mode 100644 fs/nfs/blocklayout/block-device-discovery-pipe.c create mode 100644 include/linux/sunrpc/simple_rpc_pipefs.h create mode 100644 net/sunrpc/simple_rpc_pipefs.c
PATCH 1/2 pnfs-block: Add support for simple rpc pipefs
From: Haiying Tang <[email protected]>
pnfs-block: Add support for simple rpc pipefs
--- include/linux/sunrpc/rpc_pipe_fs.h | 4 + include/linux/sunrpc/simple_rpc_pipefs.h | 112 ++++++++ net/sunrpc/Makefile | 2 +- net/sunrpc/simple_rpc_pipefs.c | 422 ++++++++++++++++++++++++++++++ 4 files changed, 539 insertions(+), 1 deletions(-) create mode 100644 include/linux/sunrpc/simple_rpc_pipefs.h create mode 100644 net/sunrpc/simple_rpc_pipefs.c
include/linux/sunrpc/rpc_pipe_fs.h +4 -0
@@ -12,6 +12,10 @@ struct rpc_pipe_msg {size_t len;size_t copied;int errno; +#define PIPEFS_AUTOFREE_RPCMSG 0x01/* frees rpc_pipe_msg */ +#define PIPEFS_AUTOFREE_RPCMSG_DATA 0x02/* frees rpc_pipe_msg->data */ +#define PIPEFS_AUTOFREE_UPCALL_MSG PIPEFS_AUTOFREE_RPCMSG_DATA +u8 flags; };struct rpc_pipe_ops {
include/linux/sunrpc/simple_rpc_pipefs.h new file +112 -0
112 lines not on this page · raw message
net/sunrpc/Makefile +1 -1
@@ -12,7 +12,7 @@ sunrpc-y := clnt.o xprt.o socklib.o xprtsock.o sched.o \ svc.o svcsock.o svcauth.o svcauth_unix.o \ addr.o rpcb_clnt.o timer.o xdr.o \ sunrpc_syms.o cache.o rpc_pipe.o \ - svc_xprt.o + svc_xprt.o simple_rpc_pipefs.o sunrpc-$(CONFIG_NFS_V4_1) += backchannel_rqst.o bc_svc.o sunrpc-$(CONFIG_PROC_FS) += stats.o sunrpc-$(CONFIG_SYSCTL) += sysctl.o
net/sunrpc/simple_rpc_pipefs.c new file +422 -0
422 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Re: [PATCH 1/2] pnfs-block: Add support for simple rpc pipefs
include/linux/sunrpc/simple_rpc_pipefs.h line 2
Quoted 5 lines
include/linux/sunrpc/simple_rpc_pipefs.h new file +2
-0@@ -0,0 +1,112 @@ +/* +* linux/fs/gfs2/simple_rpc_pipefs.h
There's a reason why these kind of filename comments are useless, and you have just proven it.
include/linux/sunrpc/simple_rpc_pipefs.h line 49
Quoted 6 lines
include/linux/sunrpc/simple_rpc_pipefs.h new file +6
-0+#include <linux/fs.h> +#include <linux/list.h> +#include <linux/mount.h> +#include <linux/sched.h> +#include <linux/sunrpc/clnt.h> +#include <linux/sunrpc/rpc_pipe_fs.h>
Do you actually need all these in a header? I suspect many could go away in favour of forward declarations.
include/linux/sunrpc/simple_rpc_pipefs.h line 83
Quoted 12 lines
include/linux/sunrpc/simple_rpc_pipefs.h new file +11
-0+typedef struct pipefs_hdr { +u32 msgid; +u8 type; +u8 flags; +u16 totallen;/* length of entire message, including hdr itself */ +u32 status; +}pipefs_hdr_t ; +typedef struct pipefs_list { +struct list_head list; +spinlock_t list_lock; +}pipefs_list_t ;
Please do not add typedefs for your structures.
PATCH 2/2 pnfs-block: Remove device creation from kernel
In reply to Jim ReesFrom: Haiying Tang <[email protected]>
pnfs-block: Remove device creation from kernel
--- fs/nfs/blocklayout/Makefile | 2 +- fs/nfs/blocklayout/block-device-discovery-pipe.c | 66 +++ fs/nfs/blocklayout/blocklayout.c | 15 +- fs/nfs/blocklayout/blocklayout.h | 18 +- fs/nfs/blocklayout/blocklayoutdev.c | 494 +++------------------- fs/nfs/blocklayout/blocklayoutdm.c | 297 ++----------- 6 files changed, 181 insertions(+), 711 deletions(-) create mode 100644 fs/nfs/blocklayout/block-device-discovery-pipe.c
fs/nfs/blocklayout/Makefile +1 -1
@@ -3,4 +3,4 @@ # obj-$(CONFIG_PNFS_BLOCK) += blocklayoutdriver.o blocklayoutdriver-objs := blocklayout.o blocklayoutdev.o blocklayoutdm.o \ - extents.o + extents.o block-device-discovery-pipe.o
fs/nfs/blocklayout/block-device-discovery-pipe.c new file +66 -0
66 lines not on this page · raw message
fs/nfs/blocklayout/blocklayout.c +5 -10
@@ -737,6 +737,7 @@ nfs4_blk_get_deviceinfo(struct nfs_server *server, const struct nfs_fh *fh, dev->pglen =PAGE_SIZE * max_pages; dev->mincount =0 ; +dprintk ("%s: dev_id: %s\n" , __func__, dev->dev_id.data); rc = pnfs_block_callback_ops->nfs_getdeviceinfo (server, dev);dprintk ("%s getdevice info returns %d\n" , __func__, rc);if (rc)
@@ -765,7 +766,7 @@ bl_initialize_mountpoint(struct nfs_server *server, const struct nfs_fh *fh)struct pnfs_devicelist *dlist =NULL ;struct pnfs_block_dev *bdev;LIST_HEAD (block_disklist); -int status, i; +int status =0 , i;dprintk ("%s enter\n" , __func__);
@@ -782,13 +783,6 @@ bl_initialize_mountpoint(struct nfs_server *server, const struct nfs_fh *fh)spin_lock_init (&b_mt_id->bm_lock);INIT_LIST_HEAD (&b_mt_id->bm_devlist); -/* Construct a list of all visible block disks that have not been -* claimed. -*/ - status =nfs4_blk_create_block_disk_list (&block_disklist); -if (status <0 ) - goto out_error; - dlist =kmalloc (sizeof (struct pnfs_devicelist ),GFP_KERNEL );if (!dlist) goto out_error;
@@ -819,10 +813,9 @@ bl_initialize_mountpoint(struct nfs_server *server, const struct nfs_fh *fh) }dprintk ("%s SUCCESS\n" , __func__); server->pnfs_ld_data = b_mt_id; - status =0 ; + out_return:kfree (dlist); -nfs4_blk_destroy_disk_list (&block_disklist);return status; out_error:
@@ -1155,6 +1148,7 @@ static int __init nfs4blocklayout_init(void)dprintk ("%s: NFSv4 Block Layout Driver Registering...\n" , __func__); pnfs_block_callback_ops =pnfs_register_layoutdriver (&blocklayout_type); +bl_pipe_init ();return 0 ; }
@@ -1164,6 +1158,7 @@ static void __exit nfs4blocklayout_exit(void) __func__);pnfs_unregister_layoutdriver (&blocklayout_type); +bl_pipe_exit (); }module_init (nfs4blocklayout_init);
fs/nfs/blocklayout/blocklayout.h +15 -3
@@ -56,7 +56,6 @@ struct block_mount_id {struct pnfs_block_dev {struct list_head bm_node; -char *bm_mdevname;/* meta device name */ struct pnfs_deviceid bm_mdevid;/* associated devid */ struct block_device *bm_mdev;/* meta device itself */ };
@@ -263,8 +262,6 @@ int nfs4_blk_process_layoutget(struct pnfs_layout_type *lo,int nfs4_blk_create_block_disk_list (struct list_head *);void nfs4_blk_destroy_disk_list (struct list_head *);/* blocklayoutdm.c */ -struct pnfs_block_dev *nfs4_blk_init_metadev (struct nfs_server *server, -struct pnfs_device *dev);int nfs4_blk_flatten (struct pnfs_blk_volume *,int ,struct pnfs_block_dev *);void free_block_dev (struct pnfs_block_dev *bdev);/* extents.c */
@@ -288,4 +285,19 @@ int add_and_merge_extent(struct pnfs_block_layout *bl, struct pnfs_block_extent *new);int mark_for_commit (struct pnfs_block_extent *be,sector_t offset,sector_t length); + +#include <linux/sunrpc/simple_rpc_pipefs.h> + +extern pipefs_list_t bl_device_list; +extern struct dentry *bl_device_pipe; + +int bl_pipe_init (void ); +void bl_pipe_exit (void ); + +#define BL_DEVICE_UMOUNT 0x0/* Umount--delete devices */ +#define BL_DEVICE_MOUNT 0x1/* Mount--create devices*/ +#define BL_DEVICE_REQUEST_INIT 0x0/* Start request */ +#define BL_DEVICE_REQUEST_PROC 0x1/* User level process succeeds */ +#define BL_DEVICE_REQUEST_ERR 0x2/* User level process fails */ +#endif /* FS_NFS_NFS4BLOCKLAYOUT_H */
fs/nfs/blocklayout/blocklayoutdev.c +54 -440
529 lines not on this page · raw message
fs/nfs/blocklayout/blocklayoutdm.c +40 -257
332 lines not on this page · raw message
Signature · 1 line
1.7.0.4
Quoted 1 line
10 files changed, 720 insertions(+), 712 deletions(-)
While it's good that this cruft goes away from the kernel the diffstat is a bit disappointing.
Also you can now remove the block_class export that was added for pNFS.