All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Rees <rees@umich.edu>
To: Benny Halevy <bhalevy@panasas.com>
Cc: linux-nfs@vger.kernel.org, peter honeyman <honey@citi.umich.edu>
Subject: [PATCH 11/33] pnfsblock: add block device discovery pipe
Date: Mon, 13 Jun 2011 22:32:27 -0400	[thread overview]
Message-ID: <a9a8d6f2cfe27f1be595d6b9e0372d70f595d2a0.1308017749.git.rees@umich.edu> (raw)
In-Reply-To: <cover.1308017749.git.rees@umich.edu>

Signed-off-by: Eric Anderle <eanderle@umich.edu>
Signed-off-by: Jim Rees <rees@umich.edu>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
 fs/nfs/blocklayout/Makefile                      |    2 +-
 fs/nfs/blocklayout/block-device-discovery-pipe.c |   66 ++++++++++++++++++++++
 fs/nfs/blocklayout/blocklayout.c                 |    3 +
 fs/nfs/blocklayout/blocklayout.h                 |   14 +++++
 4 files changed, 84 insertions(+), 1 deletions(-)
 create mode 100644 fs/nfs/blocklayout/block-device-discovery-pipe.c

diff --git a/fs/nfs/blocklayout/Makefile b/fs/nfs/blocklayout/Makefile
index 6bf49cd..d2bcd81 100644
--- a/fs/nfs/blocklayout/Makefile
+++ b/fs/nfs/blocklayout/Makefile
@@ -2,4 +2,4 @@
 # Makefile for the pNFS block layout driver kernel module
 #
 obj-$(CONFIG_PNFS_BLOCK) += blocklayoutdriver.o
-blocklayoutdriver-objs := blocklayout.o
+blocklayoutdriver-objs := blocklayout.o block-device-discovery-pipe.o
diff --git a/fs/nfs/blocklayout/block-device-discovery-pipe.c b/fs/nfs/blocklayout/block-device-discovery-pipe.c
new file mode 100644
index 0000000..e4c199f
--- /dev/null
+++ b/fs/nfs/blocklayout/block-device-discovery-pipe.c
@@ -0,0 +1,66 @@
+#include <linux/module.h>
+#include <linux/uaccess.h>
+#include <linux/proc_fs.h>
+#include <linux/string.h>
+#include <linux/slab.h>
+#include <linux/ctype.h>
+#include <linux/sched.h>
+#include "blocklayout.h"
+
+#define NFSDBG_FACILITY NFSDBG_PNFS_LD
+
+struct pipefs_list bl_device_list;
+struct dentry *bl_device_pipe;
+
+ssize_t bl_pipe_downcall(struct file *filp, const char __user *src, size_t len)
+{
+	int err;
+	struct pipefs_hdr *msg;
+
+	dprintk("Entering %s...\n", __func__);
+
+	msg = pipefs_readmsg(filp, src, len);
+	if (IS_ERR(msg)) {
+		dprintk("ERROR: unable to read pipefs message.\n");
+		return PTR_ERR(msg);
+	}
+
+	/* now assign the result, which wakes the blocked thread */
+	err = pipefs_assign_upcall_reply(msg, &bl_device_list);
+	if (err) {
+		dprintk("ERROR: failed to assign upcall with id %u\n",
+			msg->msgid);
+		kfree(msg);
+	}
+	return len;
+}
+
+static const struct rpc_pipe_ops bl_pipe_ops = {
+	.upcall         = pipefs_generic_upcall,
+	.downcall       = bl_pipe_downcall,
+	.destroy_msg    = pipefs_generic_destroy_msg,
+};
+
+int bl_pipe_init(void)
+{
+	dprintk("%s: block_device pipefs registering...\n", __func__);
+	bl_device_pipe = pipefs_mkpipe("bl_device_pipe", &bl_pipe_ops, 1);
+	if (IS_ERR(bl_device_pipe))
+		dprintk("ERROR, unable to make block_device pipe\n");
+
+	if (!bl_device_pipe)
+		dprintk("bl_device_pipe is NULL!\n");
+	else
+	dprintk("bl_device_pipe created!\n");
+	pipefs_init_list(&bl_device_list);
+	return 0;
+}
+
+void bl_pipe_exit(void)
+{
+	dprintk("%s: block_device pipefs unregistering...\n", __func__);
+	if (IS_ERR(bl_device_pipe))
+		return ;
+	pipefs_closepipe(bl_device_pipe);
+	return;
+}
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index 08458c6..bc6a0b2 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -185,6 +185,8 @@ static int __init nfs4blocklayout_init(void)
 	dprintk("%s: NFSv4 Block Layout Driver Registering...\n", __func__);
 
 	ret = pnfs_register_layoutdriver(&blocklayout_type);
+	if (!ret)
+		bl_pipe_init();
 	return ret;
 }
 
@@ -194,6 +196,7 @@ static void __exit nfs4blocklayout_exit(void)
 	       __func__);
 
 	pnfs_unregister_layoutdriver(&blocklayout_type);
+	bl_pipe_exit();
 }
 
 module_init(nfs4blocklayout_init);
diff --git a/fs/nfs/blocklayout/blocklayout.h b/fs/nfs/blocklayout/blocklayout.h
index 49d69c7..4b8608c 100644
--- a/fs/nfs/blocklayout/blocklayout.h
+++ b/fs/nfs/blocklayout/blocklayout.h
@@ -87,4 +87,18 @@ static inline struct pnfs_block_layout *BLK_LO2EXT(struct pnfs_layout_hdr *lo)
 	return container_of(lo, struct pnfs_block_layout, bl_layout);
 }
 
+#include <linux/sunrpc/simple_rpc_pipefs.h>
+
+extern struct pipefs_list 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 */
-- 
1.7.4.1


  parent reply	other threads:[~2011-06-14  2:32 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-14  2:31 [PATCH 00/33] v2 block layout patches Jim Rees
2011-06-14  2:32 ` [PATCH 01/33] pnfs: GETDEVICELIST Jim Rees
2011-06-14  2:32 ` [PATCH 02/33] pnfs: add set-clear layoutdriver interface Jim Rees
2011-06-14  2:32 ` [PATCH 03/33] pnfs: let layoutcommit code handle multiple segments Jim Rees
2011-06-14  2:32 ` [PATCH 04/33] pnfs: hook nfs_write_begin/end to allow layout driver manipulation Jim Rees
2011-06-14  2:32 ` [PATCH 05/33] pnfs: ask for layout_blksize and save it in nfs_server Jim Rees
2011-06-14  2:32 ` [PATCH 06/33] pnfs: cleanup_layoutcommit Jim Rees
2011-06-14  2:32 ` [PATCH 07/33] pnfsblock: define PNFS_BLOCK Kconfig option Jim Rees
2011-06-14  2:32 ` [PATCH 08/33] pnfsblock: blocklayout stub Jim Rees
2011-06-14  2:32 ` [PATCH 09/33] pnfsblock: layout alloc and free Jim Rees
2011-06-14  2:32 ` [PATCH 10/33] pnfsblock: add support for simple rpc pipefs Jim Rees
2011-06-14 15:52   ` Benny Halevy
2011-06-14  2:32 ` Jim Rees [this message]
2011-06-14  2:32 ` [PATCH 12/33] pnfsblock: basic extent code Jim Rees
2011-06-14  2:32 ` [PATCH 13/33] pnfsblock: add device operations Jim Rees
2011-06-14  2:32 ` [PATCH 14/33] pnfsblock: remove " Jim Rees
2011-06-14  2:32 ` [PATCH 15/33] pnfsblock: lseg alloc and free Jim Rees
2011-06-14  2:32 ` [PATCH 16/33] pnfsblock: merge extents Jim Rees
2011-06-14  2:32 ` [PATCH 17/33] pnfsblock: call and parse getdevicelist Jim Rees
2011-06-14  2:32 ` [PATCH 18/33] pnfsblock: allow use of PG_owner_priv_1 flag Jim Rees
2011-06-14  2:32 ` [PATCH 19/33] pnfsblock: xdr decode pnfs_block_layout4 Jim Rees
2011-06-14  2:32 ` [PATCH 20/33] pnfsblock: find_get_extent Jim Rees
2011-06-14  2:32 ` [PATCH 21/33] pnfsblock: SPLITME: add extent manipulation functions Jim Rees
2011-06-14  2:32 ` [PATCH 22/33] pnfsblock: merge rw extents Jim Rees
2011-06-14  2:32 ` [PATCH 23/33] pnfsblock: encode_layoutcommit Jim Rees
2011-06-14  2:33 ` [PATCH 24/33] pnfsblock: cleanup_layoutcommit Jim Rees
2011-06-14  2:33 ` [PATCH 25/33] pnfsblock: bl_read_pagelist Jim Rees
2011-06-14  2:33 ` [PATCH 26/33] pnfsblock: write_begin Jim Rees
2011-06-14  2:33 ` [PATCH 27/33] pnfsblock: write_end Jim Rees
2011-06-14  2:33 ` [PATCH 28/33] pnfsblock: write_end_cleanup Jim Rees
2011-06-14  2:33 ` [PATCH 29/33] pnfsblock: bl_write_pagelist support functions Jim Rees
2011-06-14  2:33 ` [PATCH 30/33] pnfsblock: bl_write_pagelist Jim Rees
2011-06-14  2:33 ` [PATCH 31/33] pnfsblock: note written INVAL areas for layoutcommit Jim Rees
2011-06-14  2:33 ` [PATCH 32/33] pnfsblock: Implement release_inval_marks Jim Rees
2011-06-14  2:33 ` [PATCH 33/33] pnfsblock DEVONLY: Add configurable prefetch size for layoutget Jim Rees

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a9a8d6f2cfe27f1be595d6b9e0372d70f595d2a0.1308017749.git.rees@umich.edu \
    --to=rees@umich.edu \
    --cc=bhalevy@panasas.com \
    --cc=honey@citi.umich.edu \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.