aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorFred Isaman <iisaman@citi.umich.edu>2011-07-30 20:52:44 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-07-31 12:18:16 -0400
commita60d2ebd93d3c5db5b6913c4844b8e6bd3b5538e (patch)
tree34ef84344eb3cf3418c5ffe0058e65b3a3ec3dff /fs/nfs
parent025a70ed6518f635f66f314d6959718be79638db (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')
-rw-r--r--fs/nfs/blocklayout/blocklayout.c31
-rw-r--r--fs/nfs/blocklayout/blocklayout.h6
-rw-r--r--fs/nfs/blocklayout/blocklayoutdev.c8
3 files changed, 39 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
118static void 118static void bl_free_lseg(struct pnfs_layout_segment *lseg)
119bl_free_lseg(struct pnfs_layout_segment *lseg)
120{ 119{
120 dprintk("%s enter\n", __func__);
121 kfree(lseg);
121} 122}
122 123
123static struct pnfs_layout_segment * 124/* We pretty much ignore lseg, and store all data layout wide, so we
124bl_alloc_lseg(struct pnfs_layout_hdr *lo, 125 * can correctly merge.
125 struct nfs4_layoutget_res *lgr, gfp_t gfp_flags) 126 */
127static 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
130static void 149static void
diff --git a/fs/nfs/blocklayout/blocklayout.h b/fs/nfs/blocklayout/blocklayout.h
index 1527f88e00dd..3e05b08d5347 100644
--- a/fs/nfs/blocklayout/blocklayout.h
+++ b/fs/nfs/blocklayout/blocklayout.h
@@ -96,6 +96,12 @@ static inline struct pnfs_block_layout *BLK_LO2EXT(struct pnfs_layout_hdr *lo)
96 return container_of(lo, struct pnfs_block_layout, bl_layout); 96 return container_of(lo, struct pnfs_block_layout, bl_layout);
97} 97}
98 98
99static inline struct pnfs_block_layout *
100BLK_LSEG2EXT(struct pnfs_layout_segment *lseg)
101{
102 return BLK_LO2EXT(lseg->pls_layout);
103}
104
99struct bl_dev_msg { 105struct bl_dev_msg {
100 int status; 106 int status;
101 uint32_t major, minor; 107 uint32_t major, minor;
diff --git a/fs/nfs/blocklayout/blocklayoutdev.c b/fs/nfs/blocklayout/blocklayoutdev.c
index 7e1377fcfdce..64da33a40eaf 100644
--- a/fs/nfs/blocklayout/blocklayoutdev.c
+++ b/fs/nfs/blocklayout/blocklayoutdev.c
@@ -189,3 +189,11 @@ out:
189 kfree(msg.data); 189 kfree(msg.data);
190 return rv; 190 return rv;
191} 191}
192
193int
194nfs4_blk_process_layoutget(struct pnfs_layout_hdr *lo,
195 struct nfs4_layoutget_res *lgr, gfp_t gfp_flags)
196{
197 /* STUB */
198 return -EIO;
199}