aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenny Halevy <bhalevy@panasas.com>2011-05-22 12:51:48 -0400
committerBoaz Harrosh <bharrosh@panasas.com>2011-05-29 13:53:51 -0400
commite51b841dd0be9ff53f740c44c32c32679edcb7c8 (patch)
tree03e46d6013fa2a45ad22b3f510267d11e5f8d25a
parent636fb9c89d7e216aac3d406e458864420057e981 (diff)
pnfs-obj: define per-inode private structure
allocate and deallocate per-inode private pnfs_layout_hdr in preparation for I/O implementation. Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
-rw-r--r--fs/nfs/objlayout/objio_osd.c3
-rw-r--r--fs/nfs/objlayout/objlayout.c26
-rw-r--r--fs/nfs/objlayout/objlayout.h17
3 files changed, 46 insertions, 0 deletions
diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
index 2255e2d22d05..353821f7937b 100644
--- a/fs/nfs/objlayout/objio_osd.c
+++ b/fs/nfs/objlayout/objio_osd.c
@@ -364,6 +364,9 @@ static struct pnfs_layoutdriver_type objlayout_type = {
364 .id = LAYOUT_OSD2_OBJECTS, 364 .id = LAYOUT_OSD2_OBJECTS,
365 .name = "LAYOUT_OSD2_OBJECTS", 365 .name = "LAYOUT_OSD2_OBJECTS",
366 366
367 .alloc_layout_hdr = objlayout_alloc_layout_hdr,
368 .free_layout_hdr = objlayout_free_layout_hdr,
369
367 .alloc_lseg = objlayout_alloc_lseg, 370 .alloc_lseg = objlayout_alloc_lseg,
368 .free_lseg = objlayout_free_lseg, 371 .free_lseg = objlayout_free_lseg,
369 372
diff --git a/fs/nfs/objlayout/objlayout.c b/fs/nfs/objlayout/objlayout.c
index 10e5fca3b7fb..f14b4da34052 100644
--- a/fs/nfs/objlayout/objlayout.c
+++ b/fs/nfs/objlayout/objlayout.c
@@ -42,6 +42,32 @@
42 42
43#define NFSDBG_FACILITY NFSDBG_PNFS_LD 43#define NFSDBG_FACILITY NFSDBG_PNFS_LD
44/* 44/*
45 * Create a objlayout layout structure for the given inode and return it.
46 */
47struct pnfs_layout_hdr *
48objlayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
49{
50 struct objlayout *objlay;
51
52 objlay = kzalloc(sizeof(struct objlayout), gfp_flags);
53 dprintk("%s: Return %p\n", __func__, objlay);
54 return &objlay->pnfs_layout;
55}
56
57/*
58 * Free an objlayout layout structure
59 */
60void
61objlayout_free_layout_hdr(struct pnfs_layout_hdr *lo)
62{
63 struct objlayout *objlay = OBJLAYOUT(lo);
64
65 dprintk("%s: objlay %p\n", __func__, objlay);
66
67 kfree(objlay);
68}
69
70/*
45 * Unmarshall layout and store it in pnfslay. 71 * Unmarshall layout and store it in pnfslay.
46 */ 72 */
47struct pnfs_layout_segment * 73struct pnfs_layout_segment *
diff --git a/fs/nfs/objlayout/objlayout.h b/fs/nfs/objlayout/objlayout.h
index 0814271bb9ba..fa0262149f59 100644
--- a/fs/nfs/objlayout/objlayout.h
+++ b/fs/nfs/objlayout/objlayout.h
@@ -46,6 +46,19 @@
46#include "../pnfs.h" 46#include "../pnfs.h"
47 47
48/* 48/*
49 * per-inode layout
50 */
51struct objlayout {
52 struct pnfs_layout_hdr pnfs_layout;
53};
54
55static inline struct objlayout *
56OBJLAYOUT(struct pnfs_layout_hdr *lo)
57{
58 return container_of(lo, struct objlayout, pnfs_layout);
59}
60
61/*
49 * Raid engine I/O API 62 * Raid engine I/O API
50 */ 63 */
51extern int objio_alloc_lseg(struct pnfs_layout_segment **outp, 64extern int objio_alloc_lseg(struct pnfs_layout_segment **outp,
@@ -66,6 +79,10 @@ extern void objlayout_put_deviceinfo(struct pnfs_osd_deviceaddr *deviceaddr);
66/* 79/*
67 * exported generic objects function vectors 80 * exported generic objects function vectors
68 */ 81 */
82
83extern struct pnfs_layout_hdr *objlayout_alloc_layout_hdr(struct inode *, gfp_t gfp_flags);
84extern void objlayout_free_layout_hdr(struct pnfs_layout_hdr *);
85
69extern struct pnfs_layout_segment *objlayout_alloc_lseg( 86extern struct pnfs_layout_segment *objlayout_alloc_lseg(
70 struct pnfs_layout_hdr *, 87 struct pnfs_layout_hdr *,
71 struct nfs4_layoutget_res *, 88 struct nfs4_layoutget_res *,