diff options
author | Fred Isaman <iisaman@citi.umich.edu> | 2011-07-30 20:52:44 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-07-31 12:18:16 -0400 |
commit | a60d2ebd93d3c5db5b6913c4844b8e6bd3b5538e (patch) | |
tree | 34ef84344eb3cf3418c5ffe0058e65b3a3ec3dff /fs/nfs/blocklayout/blocklayout.c | |
parent | 025a70ed6518f635f66f314d6959718be79638db (diff) |
pnfsblock: lseg alloc and free
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>
Diffstat (limited to 'fs/nfs/blocklayout/blocklayout.c')
-rw-r--r-- | fs/nfs/blocklayout/blocklayout.c | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c index c83878441047..e7bc7a57b3bb 100644 --- a/fs/nfs/blocklayout/blocklayout.c +++ b/fs/nfs/blocklayout/blocklayout.c | |||
@@ -115,16 +115,35 @@ static struct pnfs_layout_hdr *bl_alloc_layout_hdr(struct inode *inode, | |||
115 | return &bl->bl_layout; | 115 | return &bl->bl_layout; |
116 | } | 116 | } |
117 | 117 | ||
118 | static void | 118 | static void bl_free_lseg(struct pnfs_layout_segment *lseg) |
119 | bl_free_lseg(struct pnfs_layout_segment *lseg) | ||
120 | { | 119 | { |
120 | dprintk("%s enter\n", __func__); | ||
121 | kfree(lseg); | ||
121 | } | 122 | } |
122 | 123 | ||
123 | static struct pnfs_layout_segment * | 124 | /* We pretty much ignore lseg, and store all data layout wide, so we |
124 | bl_alloc_lseg(struct pnfs_layout_hdr *lo, | 125 | * can correctly merge. |
125 | struct nfs4_layoutget_res *lgr, gfp_t gfp_flags) | 126 | */ |
127 | static struct pnfs_layout_segment *bl_alloc_lseg(struct pnfs_layout_hdr *lo, | ||
128 | struct nfs4_layoutget_res *lgr, | ||
129 | gfp_t gfp_flags) | ||
126 | { | 130 | { |
127 | return NULL; | 131 | struct pnfs_layout_segment *lseg; |
132 | int status; | ||
133 | |||
134 | dprintk("%s enter\n", __func__); | ||
135 | lseg = kzalloc(sizeof(*lseg), gfp_flags); | ||
136 | if (!lseg) | ||
137 | return ERR_PTR(-ENOMEM); | ||
138 | status = nfs4_blk_process_layoutget(lo, lgr, gfp_flags); | ||
139 | if (status) { | ||
140 | /* We don't want to call the full-blown bl_free_lseg, | ||
141 | * since on error extents were not touched. | ||
142 | */ | ||
143 | kfree(lseg); | ||
144 | return ERR_PTR(status); | ||
145 | } | ||
146 | return lseg; | ||
128 | } | 147 | } |
129 | 148 | ||
130 | static void | 149 | static void |