Commit e51b841d authored by Benny Halevy's avatar Benny Halevy Committed by Boaz Harrosh

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: default avatarBoaz Harrosh <bharrosh@panasas.com>
Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
parent 636fb9c8
...@@ -364,6 +364,9 @@ static struct pnfs_layoutdriver_type objlayout_type = { ...@@ -364,6 +364,9 @@ static struct pnfs_layoutdriver_type objlayout_type = {
.id = LAYOUT_OSD2_OBJECTS, .id = LAYOUT_OSD2_OBJECTS,
.name = "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, .alloc_lseg = objlayout_alloc_lseg,
.free_lseg = objlayout_free_lseg, .free_lseg = objlayout_free_lseg,
......
...@@ -41,6 +41,32 @@ ...@@ -41,6 +41,32 @@
#include "objlayout.h" #include "objlayout.h"
#define NFSDBG_FACILITY NFSDBG_PNFS_LD #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. * Unmarshall layout and store it in pnfslay.
*/ */
......
...@@ -45,6 +45,19 @@ ...@@ -45,6 +45,19 @@
#include <linux/pnfs_osd_xdr.h> #include <linux/pnfs_osd_xdr.h>
#include "../pnfs.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 * Raid engine I/O API
*/ */
...@@ -66,6 +79,10 @@ extern void objlayout_put_deviceinfo(struct pnfs_osd_deviceaddr *deviceaddr); ...@@ -66,6 +79,10 @@ extern void objlayout_put_deviceinfo(struct pnfs_osd_deviceaddr *deviceaddr);
/* /*
* exported generic objects function vectors * 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( extern struct pnfs_layout_segment *objlayout_alloc_lseg(
struct pnfs_layout_hdr *, struct pnfs_layout_hdr *,
struct nfs4_layoutget_res *, struct nfs4_layoutget_res *,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment