Skip to content

Commit

Permalink
pnfsblock: lseg alloc and free
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Isaman <iisaman@citi.umich.edu>
[pnfsblock: fix bug getting pnfs_layout_type in translate_devid().]
Signed-off-by: Tao Guo <guotao@nrchpc.ac.cn>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Zhang Jingwang <Jingwang.Zhang@emc.com>
Signed-off-by: Benny Halevy <bhalevy@tonian.com>
Signed-off-by: Jim Rees <rees@umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Fred Isaman authored and Trond Myklebust committed Jul 31, 2011
1 parent 025a70e commit a60d2eb
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
31 changes: 25 additions & 6 deletions fs/nfs/blocklayout/blocklayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,35 @@ static struct pnfs_layout_hdr *bl_alloc_layout_hdr(struct inode *inode,
return &bl->bl_layout;
}

static void
bl_free_lseg(struct pnfs_layout_segment *lseg)
static void bl_free_lseg(struct pnfs_layout_segment *lseg)
{
dprintk("%s enter\n", __func__);
kfree(lseg);
}

static struct pnfs_layout_segment *
bl_alloc_lseg(struct pnfs_layout_hdr *lo,
struct nfs4_layoutget_res *lgr, gfp_t gfp_flags)
/* We pretty much ignore lseg, and store all data layout wide, so we
* can correctly merge.
*/
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
Expand Down
6 changes: 6 additions & 0 deletions fs/nfs/blocklayout/blocklayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

static inline struct pnfs_block_layout *
BLK_LSEG2EXT(struct pnfs_layout_segment *lseg)
{
return BLK_LO2EXT(lseg->pls_layout);
}

struct bl_dev_msg {
int status;
uint32_t major, minor;
Expand Down
8 changes: 8 additions & 0 deletions fs/nfs/blocklayout/blocklayoutdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,11 @@ nfs4_blk_decode_device(struct nfs_server *server,
kfree(msg.data);
return rv;
}

int
nfs4_blk_process_layoutget(struct pnfs_layout_hdr *lo,
struct nfs4_layoutget_res *lgr, gfp_t gfp_flags)
{
/* STUB */
return -EIO;
}

0 comments on commit a60d2eb

Please sign in to comment.