]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
pnfs-obj: define per-inode private structure
authorBenny Halevy <bhalevy@panasas.com>
Sun, 22 May 2011 16:51:48 +0000 (19:51 +0300)
committerBoaz Harrosh <bharrosh@panasas.com>
Sun, 29 May 2011 17:53:51 +0000 (20:53 +0300)
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>
fs/nfs/objlayout/objio_osd.c
fs/nfs/objlayout/objlayout.c
fs/nfs/objlayout/objlayout.h

index 2255e2d22d051d9ef493ef0c2a08ba4d1a4a0623..353821f7937b09ceeacc647dc0d1600009eb62fd 100644 (file)
@@ -364,6 +364,9 @@ static struct pnfs_layoutdriver_type objlayout_type = {
        .id = LAYOUT_OSD2_OBJECTS,
        .name = "LAYOUT_OSD2_OBJECTS",
 
+       .alloc_layout_hdr        = objlayout_alloc_layout_hdr,
+       .free_layout_hdr         = objlayout_free_layout_hdr,
+
        .alloc_lseg              = objlayout_alloc_lseg,
        .free_lseg               = objlayout_free_lseg,
 
index 10e5fca3b7fb8937870487dcaa4fc6fe8a07cd11..f14b4da34052ddee361546ebc05229ffc5638622 100644 (file)
 #include "objlayout.h"
 
 #define NFSDBG_FACILITY         NFSDBG_PNFS_LD
+/*
+ * Create a objlayout layout structure for the given inode and return it.
+ */
+struct pnfs_layout_hdr *
+objlayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
+{
+       struct objlayout *objlay;
+
+       objlay = kzalloc(sizeof(struct objlayout), gfp_flags);
+       dprintk("%s: Return %p\n", __func__, objlay);
+       return &objlay->pnfs_layout;
+}
+
+/*
+ * Free an objlayout layout structure
+ */
+void
+objlayout_free_layout_hdr(struct pnfs_layout_hdr *lo)
+{
+       struct objlayout *objlay = OBJLAYOUT(lo);
+
+       dprintk("%s: objlay %p\n", __func__, objlay);
+
+       kfree(objlay);
+}
+
 /*
  * Unmarshall layout and store it in pnfslay.
  */
index 0814271bb9ba5f32dd2db0a96230c749bdf67af4..fa0262149f59c1d2927703e0c9ab62a981f5bc98 100644 (file)
 #include <linux/pnfs_osd_xdr.h>
 #include "../pnfs.h"
 
+/*
+ * per-inode layout
+ */
+struct objlayout {
+       struct pnfs_layout_hdr pnfs_layout;
+};
+
+static inline struct objlayout *
+OBJLAYOUT(struct pnfs_layout_hdr *lo)
+{
+       return container_of(lo, struct objlayout, pnfs_layout);
+}
+
 /*
  * Raid engine I/O API
  */
@@ -66,6 +79,10 @@ extern void objlayout_put_deviceinfo(struct pnfs_osd_deviceaddr *deviceaddr);
 /*
  * exported generic objects function vectors
  */
+
+extern struct pnfs_layout_hdr *objlayout_alloc_layout_hdr(struct inode *, gfp_t gfp_flags);
+extern void objlayout_free_layout_hdr(struct pnfs_layout_hdr *);
+
 extern struct pnfs_layout_segment *objlayout_alloc_lseg(
        struct pnfs_layout_hdr *,
        struct nfs4_layoutget_res *,