Commit a60d2ebd authored by Fred Isaman's avatar Fred Isaman Committed by Trond Myklebust

pnfsblock: lseg alloc and free

Signed-off-by: default avatarFred Isaman <iisaman@citi.umich.edu>
[pnfsblock: fix bug getting pnfs_layout_type in translate_devid().]
Signed-off-by: default avatarTao Guo <guotao@nrchpc.ac.cn>
Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
Signed-off-by: default avatarZhang Jingwang <Jingwang.Zhang@emc.com>
Signed-off-by: default avatarBenny Halevy <bhalevy@tonian.com>
Signed-off-by: default avatarJim Rees <rees@umich.edu>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 025a70ed
...@@ -115,16 +115,35 @@ static struct pnfs_layout_hdr *bl_alloc_layout_hdr(struct inode *inode, ...@@ -115,16 +115,35 @@ static struct pnfs_layout_hdr *bl_alloc_layout_hdr(struct inode *inode,
return &bl->bl_layout; return &bl->bl_layout;
} }
static void static void bl_free_lseg(struct pnfs_layout_segment *lseg)
bl_free_lseg(struct pnfs_layout_segment *lseg)
{ {
dprintk("%s enter\n", __func__);
kfree(lseg);
} }
static struct pnfs_layout_segment * /* We pretty much ignore lseg, and store all data layout wide, so we
bl_alloc_lseg(struct pnfs_layout_hdr *lo, * can correctly merge.
struct nfs4_layoutget_res *lgr, gfp_t gfp_flags) */
static struct pnfs_layout_segment *bl_alloc_lseg(struct pnfs_layout_hdr *lo,
struct nfs4_layoutget_res *lgr,
gfp_t gfp_flags)
{ {
return NULL; struct pnfs_layout_segment *lseg;
int status;
dprintk("%s enter\n", __func__);
lseg = kzalloc(sizeof(*lseg), gfp_flags);
if (!lseg)
return ERR_PTR(-ENOMEM);
status = nfs4_blk_process_layoutget(lo, lgr, gfp_flags);
if (status) {
/* We don't want to call the full-blown bl_free_lseg,
* since on error extents were not touched.
*/
kfree(lseg);
return ERR_PTR(status);
}
return lseg;
} }
static void static void
......
...@@ -96,6 +96,12 @@ static inline struct pnfs_block_layout *BLK_LO2EXT(struct pnfs_layout_hdr *lo) ...@@ -96,6 +96,12 @@ static inline struct pnfs_block_layout *BLK_LO2EXT(struct pnfs_layout_hdr *lo)
return container_of(lo, struct pnfs_block_layout, bl_layout); return container_of(lo, struct pnfs_block_layout, bl_layout);
} }
static inline struct pnfs_block_layout *
BLK_LSEG2EXT(struct pnfs_layout_segment *lseg)
{
return BLK_LO2EXT(lseg->pls_layout);
}
struct bl_dev_msg { struct bl_dev_msg {
int status; int status;
uint32_t major, minor; uint32_t major, minor;
......
...@@ -189,3 +189,11 @@ nfs4_blk_decode_device(struct nfs_server *server, ...@@ -189,3 +189,11 @@ nfs4_blk_decode_device(struct nfs_server *server,
kfree(msg.data); kfree(msg.data);
return rv; return rv;
} }
int
nfs4_blk_process_layoutget(struct pnfs_layout_hdr *lo,
struct nfs4_layoutget_res *lgr, gfp_t gfp_flags)
{
/* STUB */
return -EIO;
}
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