f7caecff6b4dc659da002475d57e8305f9468dce
[pandora-kernel.git] / fs / nfs / objlayout / objlayout.c
1 /*
2  *  pNFS Objects layout driver high level definitions
3  *
4  *  Copyright (C) 2007 Panasas Inc. [year of first publication]
5  *  All rights reserved.
6  *
7  *  Benny Halevy <bhalevy@panasas.com>
8  *  Boaz Harrosh <bharrosh@panasas.com>
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License version 2
12  *  See the file COPYING included with this distribution for more details.
13  *
14  *  Redistribution and use in source and binary forms, with or without
15  *  modification, are permitted provided that the following conditions
16  *  are met:
17  *
18  *  1. Redistributions of source code must retain the above copyright
19  *     notice, this list of conditions and the following disclaimer.
20  *  2. Redistributions in binary form must reproduce the above copyright
21  *     notice, this list of conditions and the following disclaimer in the
22  *     documentation and/or other materials provided with the distribution.
23  *  3. Neither the name of the Panasas company nor the names of its
24  *     contributors may be used to endorse or promote products derived
25  *     from this software without specific prior written permission.
26  *
27  *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
28  *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
29  *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30  *  DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31  *  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
34  *  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
35  *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
36  *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37  *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  */
39
40 #include <scsi/osd_initiator.h>
41 #include "objlayout.h"
42
43 #define NFSDBG_FACILITY         NFSDBG_PNFS_LD
44 /*
45  * Create a objlayout layout structure for the given inode and return it.
46  */
47 struct pnfs_layout_hdr *
48 objlayout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags)
49 {
50         struct objlayout *objlay;
51
52         objlay = kzalloc(sizeof(struct objlayout), gfp_flags);
53         if (objlay) {
54                 spin_lock_init(&objlay->lock);
55                 INIT_LIST_HEAD(&objlay->err_list);
56         }
57         dprintk("%s: Return %p\n", __func__, objlay);
58         return &objlay->pnfs_layout;
59 }
60
61 /*
62  * Free an objlayout layout structure
63  */
64 void
65 objlayout_free_layout_hdr(struct pnfs_layout_hdr *lo)
66 {
67         struct objlayout *objlay = OBJLAYOUT(lo);
68
69         dprintk("%s: objlay %p\n", __func__, objlay);
70
71         WARN_ON(!list_empty(&objlay->err_list));
72         kfree(objlay);
73 }
74
75 /*
76  * Unmarshall layout and store it in pnfslay.
77  */
78 struct pnfs_layout_segment *
79 objlayout_alloc_lseg(struct pnfs_layout_hdr *pnfslay,
80                      struct nfs4_layoutget_res *lgr,
81                      gfp_t gfp_flags)
82 {
83         int status = -ENOMEM;
84         struct xdr_stream stream;
85         struct xdr_buf buf = {
86                 .pages =  lgr->layoutp->pages,
87                 .page_len =  lgr->layoutp->len,
88                 .buflen =  lgr->layoutp->len,
89                 .len = lgr->layoutp->len,
90         };
91         struct page *scratch;
92         struct pnfs_layout_segment *lseg;
93
94         dprintk("%s: Begin pnfslay %p\n", __func__, pnfslay);
95
96         scratch = alloc_page(gfp_flags);
97         if (!scratch)
98                 goto err_nofree;
99
100         xdr_init_decode(&stream, &buf, NULL);
101         xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE);
102
103         status = objio_alloc_lseg(&lseg, pnfslay, &lgr->range, &stream, gfp_flags);
104         if (unlikely(status)) {
105                 dprintk("%s: objio_alloc_lseg Return err %d\n", __func__,
106                         status);
107                 goto err;
108         }
109
110         __free_page(scratch);
111
112         dprintk("%s: Return %p\n", __func__, lseg);
113         return lseg;
114
115 err:
116         __free_page(scratch);
117 err_nofree:
118         dprintk("%s: Err Return=>%d\n", __func__, status);
119         return ERR_PTR(status);
120 }
121
122 /*
123  * Free a layout segement
124  */
125 void
126 objlayout_free_lseg(struct pnfs_layout_segment *lseg)
127 {
128         dprintk("%s: freeing layout segment %p\n", __func__, lseg);
129
130         if (unlikely(!lseg))
131                 return;
132
133         objio_free_lseg(lseg);
134 }
135
136 /*
137  * I/O Operations
138  */
139 static inline u64
140 end_offset(u64 start, u64 len)
141 {
142         u64 end;
143
144         end = start + len;
145         return end >= start ? end : NFS4_MAX_UINT64;
146 }
147
148 /* last octet in a range */
149 static inline u64
150 last_byte_offset(u64 start, u64 len)
151 {
152         u64 end;
153
154         BUG_ON(!len);
155         end = start + len;
156         return end > start ? end - 1 : NFS4_MAX_UINT64;
157 }
158
159 static struct objlayout_io_state *
160 objlayout_alloc_io_state(struct pnfs_layout_hdr *pnfs_layout_type,
161                         struct page **pages,
162                         unsigned pgbase,
163                         loff_t offset,
164                         size_t count,
165                         struct pnfs_layout_segment *lseg,
166                         void *rpcdata,
167                         gfp_t gfp_flags)
168 {
169         struct objlayout_io_state *state;
170         u64 lseg_end_offset;
171
172         dprintk("%s: allocating io_state\n", __func__);
173         if (objio_alloc_io_state(lseg, &state, gfp_flags))
174                 return NULL;
175
176         BUG_ON(offset < lseg->pls_range.offset);
177         lseg_end_offset = end_offset(lseg->pls_range.offset,
178                                      lseg->pls_range.length);
179         BUG_ON(offset >= lseg_end_offset);
180         if (offset + count > lseg_end_offset) {
181                 count = lseg->pls_range.length -
182                                 (offset - lseg->pls_range.offset);
183                 dprintk("%s: truncated count %Zd\n", __func__, count);
184         }
185
186         if (pgbase > PAGE_SIZE) {
187                 pages += pgbase >> PAGE_SHIFT;
188                 pgbase &= ~PAGE_MASK;
189         }
190
191         INIT_LIST_HEAD(&state->err_list);
192         state->lseg = lseg;
193         state->rpcdata = rpcdata;
194         state->pages = pages;
195         state->pgbase = pgbase;
196         state->nr_pages = (pgbase + count + PAGE_SIZE - 1) >> PAGE_SHIFT;
197         state->offset = offset;
198         state->count = count;
199         state->sync = 0;
200
201         return state;
202 }
203
204 static void
205 objlayout_free_io_state(struct objlayout_io_state *state)
206 {
207         dprintk("%s: freeing io_state\n", __func__);
208         if (unlikely(!state))
209                 return;
210
211         objio_free_io_state(state);
212 }
213
214 /*
215  * I/O done common code
216  */
217 static void
218 objlayout_iodone(struct objlayout_io_state *state)
219 {
220         dprintk("%s: state %p status\n", __func__, state);
221
222         if (likely(state->status >= 0)) {
223                 objlayout_free_io_state(state);
224         } else {
225                 struct objlayout *objlay = OBJLAYOUT(state->lseg->pls_layout);
226
227                 spin_lock(&objlay->lock);
228                 list_add(&objlay->err_list, &state->err_list);
229                 spin_unlock(&objlay->lock);
230         }
231 }
232
233 /*
234  * objlayout_io_set_result - Set an osd_error code on a specific osd comp.
235  *
236  * The @index component IO failed (error returned from target). Register
237  * the error for later reporting at layout-return.
238  */
239 void
240 objlayout_io_set_result(struct objlayout_io_state *state, unsigned index,
241                         struct pnfs_osd_objid *pooid, int osd_error,
242                         u64 offset, u64 length, bool is_write)
243 {
244         struct pnfs_osd_ioerr *ioerr = &state->ioerrs[index];
245
246         BUG_ON(index >= state->num_comps);
247         if (osd_error) {
248                 ioerr->oer_component = *pooid;
249                 ioerr->oer_comp_offset = offset;
250                 ioerr->oer_comp_length = length;
251                 ioerr->oer_iswrite = is_write;
252                 ioerr->oer_errno = osd_error;
253
254                 dprintk("%s: err[%d]: errno=%d is_write=%d dev(%llx:%llx) "
255                         "par=0x%llx obj=0x%llx offset=0x%llx length=0x%llx\n",
256                         __func__, index, ioerr->oer_errno,
257                         ioerr->oer_iswrite,
258                         _DEVID_LO(&ioerr->oer_component.oid_device_id),
259                         _DEVID_HI(&ioerr->oer_component.oid_device_id),
260                         ioerr->oer_component.oid_partition_id,
261                         ioerr->oer_component.oid_object_id,
262                         ioerr->oer_comp_offset,
263                         ioerr->oer_comp_length);
264         } else {
265                 /* User need not call if no error is reported */
266                 ioerr->oer_errno = 0;
267         }
268 }
269
270 /* Function scheduled on rpc workqueue to call ->nfs_readlist_complete().
271  * This is because the osd completion is called with ints-off from
272  * the block layer
273  */
274 static void _rpc_read_complete(struct work_struct *work)
275 {
276         struct rpc_task *task;
277         struct nfs_read_data *rdata;
278
279         dprintk("%s enter\n", __func__);
280         task = container_of(work, struct rpc_task, u.tk_work);
281         rdata = container_of(task, struct nfs_read_data, task);
282
283         pnfs_ld_read_done(rdata);
284 }
285
286 void
287 objlayout_read_done(struct objlayout_io_state *state, ssize_t status, bool sync)
288 {
289         int eof = state->eof;
290         struct nfs_read_data *rdata;
291
292         state->status = status;
293         dprintk("%s: Begin status=%ld eof=%d\n", __func__, status, eof);
294         rdata = state->rpcdata;
295         rdata->task.tk_status = status;
296         if (status >= 0) {
297                 rdata->res.count = status;
298                 rdata->res.eof = eof;
299         }
300         objlayout_iodone(state);
301         /* must not use state after this point */
302
303         if (sync)
304                 pnfs_ld_read_done(rdata);
305         else {
306                 INIT_WORK(&rdata->task.u.tk_work, _rpc_read_complete);
307                 schedule_work(&rdata->task.u.tk_work);
308         }
309 }
310
311 /*
312  * Perform sync or async reads.
313  */
314 enum pnfs_try_status
315 objlayout_read_pagelist(struct nfs_read_data *rdata)
316 {
317         loff_t offset = rdata->args.offset;
318         size_t count = rdata->args.count;
319         struct objlayout_io_state *state;
320         ssize_t status = 0;
321         loff_t eof;
322
323         dprintk("%s: Begin inode %p offset %llu count %d\n",
324                 __func__, rdata->inode, offset, (int)count);
325
326         eof = i_size_read(rdata->inode);
327         if (unlikely(offset + count > eof)) {
328                 if (offset >= eof) {
329                         status = 0;
330                         rdata->res.count = 0;
331                         rdata->res.eof = 1;
332                         goto out;
333                 }
334                 count = eof - offset;
335         }
336
337         state = objlayout_alloc_io_state(NFS_I(rdata->inode)->layout,
338                                          rdata->args.pages, rdata->args.pgbase,
339                                          offset, count,
340                                          rdata->lseg, rdata,
341                                          GFP_KERNEL);
342         if (unlikely(!state)) {
343                 status = -ENOMEM;
344                 goto out;
345         }
346
347         state->eof = state->offset + state->count >= eof;
348
349         status = objio_read_pagelist(state);
350  out:
351         dprintk("%s: Return status %Zd\n", __func__, status);
352         rdata->pnfs_error = status;
353         return PNFS_ATTEMPTED;
354 }
355
356 /* Function scheduled on rpc workqueue to call ->nfs_writelist_complete().
357  * This is because the osd completion is called with ints-off from
358  * the block layer
359  */
360 static void _rpc_write_complete(struct work_struct *work)
361 {
362         struct rpc_task *task;
363         struct nfs_write_data *wdata;
364
365         dprintk("%s enter\n", __func__);
366         task = container_of(work, struct rpc_task, u.tk_work);
367         wdata = container_of(task, struct nfs_write_data, task);
368
369         pnfs_ld_write_done(wdata);
370 }
371
372 void
373 objlayout_write_done(struct objlayout_io_state *state, ssize_t status,
374                      bool sync)
375 {
376         struct nfs_write_data *wdata;
377
378         dprintk("%s: Begin\n", __func__);
379         wdata = state->rpcdata;
380         state->status = status;
381         wdata->task.tk_status = status;
382         if (status >= 0) {
383                 wdata->res.count = status;
384                 wdata->verf.committed = state->committed;
385                 dprintk("%s: Return status %d committed %d\n",
386                         __func__, wdata->task.tk_status,
387                         wdata->verf.committed);
388         } else
389                 dprintk("%s: Return status %d\n",
390                         __func__, wdata->task.tk_status);
391         objlayout_iodone(state);
392         /* must not use state after this point */
393
394         if (sync)
395                 pnfs_ld_write_done(wdata);
396         else {
397                 INIT_WORK(&wdata->task.u.tk_work, _rpc_write_complete);
398                 schedule_work(&wdata->task.u.tk_work);
399         }
400 }
401
402 /*
403  * Perform sync or async writes.
404  */
405 enum pnfs_try_status
406 objlayout_write_pagelist(struct nfs_write_data *wdata,
407                          int how)
408 {
409         struct objlayout_io_state *state;
410         ssize_t status;
411
412         dprintk("%s: Begin inode %p offset %llu count %u\n",
413                 __func__, wdata->inode, wdata->args.offset, wdata->args.count);
414
415         state = objlayout_alloc_io_state(NFS_I(wdata->inode)->layout,
416                                          wdata->args.pages,
417                                          wdata->args.pgbase,
418                                          wdata->args.offset,
419                                          wdata->args.count,
420                                          wdata->lseg, wdata,
421                                          GFP_NOFS);
422         if (unlikely(!state)) {
423                 status = -ENOMEM;
424                 goto out;
425         }
426
427         state->sync = how & FLUSH_SYNC;
428
429         status = objio_write_pagelist(state, how & FLUSH_STABLE);
430  out:
431         dprintk("%s: Return status %Zd\n", __func__, status);
432         wdata->pnfs_error = status;
433         return PNFS_ATTEMPTED;
434 }
435
436 static int
437 err_prio(u32 oer_errno)
438 {
439         switch (oer_errno) {
440         case 0:
441                 return 0;
442
443         case PNFS_OSD_ERR_RESOURCE:
444                 return OSD_ERR_PRI_RESOURCE;
445         case PNFS_OSD_ERR_BAD_CRED:
446                 return OSD_ERR_PRI_BAD_CRED;
447         case PNFS_OSD_ERR_NO_ACCESS:
448                 return OSD_ERR_PRI_NO_ACCESS;
449         case PNFS_OSD_ERR_UNREACHABLE:
450                 return OSD_ERR_PRI_UNREACHABLE;
451         case PNFS_OSD_ERR_NOT_FOUND:
452                 return OSD_ERR_PRI_NOT_FOUND;
453         case PNFS_OSD_ERR_NO_SPACE:
454                 return OSD_ERR_PRI_NO_SPACE;
455         default:
456                 WARN_ON(1);
457                 /* fallthrough */
458         case PNFS_OSD_ERR_EIO:
459                 return OSD_ERR_PRI_EIO;
460         }
461 }
462
463 static void
464 merge_ioerr(struct pnfs_osd_ioerr *dest_err,
465             const struct pnfs_osd_ioerr *src_err)
466 {
467         u64 dest_end, src_end;
468
469         if (!dest_err->oer_errno) {
470                 *dest_err = *src_err;
471                 /* accumulated device must be blank */
472                 memset(&dest_err->oer_component.oid_device_id, 0,
473                         sizeof(dest_err->oer_component.oid_device_id));
474
475                 return;
476         }
477
478         if (dest_err->oer_component.oid_partition_id !=
479                                 src_err->oer_component.oid_partition_id)
480                 dest_err->oer_component.oid_partition_id = 0;
481
482         if (dest_err->oer_component.oid_object_id !=
483                                 src_err->oer_component.oid_object_id)
484                 dest_err->oer_component.oid_object_id = 0;
485
486         if (dest_err->oer_comp_offset > src_err->oer_comp_offset)
487                 dest_err->oer_comp_offset = src_err->oer_comp_offset;
488
489         dest_end = end_offset(dest_err->oer_comp_offset,
490                               dest_err->oer_comp_length);
491         src_end =  end_offset(src_err->oer_comp_offset,
492                               src_err->oer_comp_length);
493         if (dest_end < src_end)
494                 dest_end = src_end;
495
496         dest_err->oer_comp_length = dest_end - dest_err->oer_comp_offset;
497
498         if ((src_err->oer_iswrite == dest_err->oer_iswrite) &&
499             (err_prio(src_err->oer_errno) > err_prio(dest_err->oer_errno))) {
500                         dest_err->oer_errno = src_err->oer_errno;
501         } else if (src_err->oer_iswrite) {
502                 dest_err->oer_iswrite = true;
503                 dest_err->oer_errno = src_err->oer_errno;
504         }
505 }
506
507 static void
508 encode_accumulated_error(struct objlayout *objlay, __be32 *p)
509 {
510         struct objlayout_io_state *state, *tmp;
511         struct pnfs_osd_ioerr accumulated_err = {.oer_errno = 0};
512
513         list_for_each_entry_safe(state, tmp, &objlay->err_list, err_list) {
514                 unsigned i;
515
516                 for (i = 0; i < state->num_comps; i++) {
517                         struct pnfs_osd_ioerr *ioerr = &state->ioerrs[i];
518
519                         if (!ioerr->oer_errno)
520                                 continue;
521
522                         printk(KERN_ERR "%s: err[%d]: errno=%d is_write=%d "
523                                 "dev(%llx:%llx) par=0x%llx obj=0x%llx "
524                                 "offset=0x%llx length=0x%llx\n",
525                                 __func__, i, ioerr->oer_errno,
526                                 ioerr->oer_iswrite,
527                                 _DEVID_LO(&ioerr->oer_component.oid_device_id),
528                                 _DEVID_HI(&ioerr->oer_component.oid_device_id),
529                                 ioerr->oer_component.oid_partition_id,
530                                 ioerr->oer_component.oid_object_id,
531                                 ioerr->oer_comp_offset,
532                                 ioerr->oer_comp_length);
533
534                         merge_ioerr(&accumulated_err, ioerr);
535                 }
536                 list_del(&state->err_list);
537                 objlayout_free_io_state(state);
538         }
539
540         pnfs_osd_xdr_encode_ioerr(p, &accumulated_err);
541 }
542
543 void
544 objlayout_encode_layoutreturn(struct pnfs_layout_hdr *pnfslay,
545                               struct xdr_stream *xdr,
546                               const struct nfs4_layoutreturn_args *args)
547 {
548         struct objlayout *objlay = OBJLAYOUT(pnfslay);
549         struct objlayout_io_state *state, *tmp;
550         __be32 *start;
551
552         dprintk("%s: Begin\n", __func__);
553         start = xdr_reserve_space(xdr, 4);
554         BUG_ON(!start);
555
556         spin_lock(&objlay->lock);
557
558         list_for_each_entry_safe(state, tmp, &objlay->err_list, err_list) {
559                 __be32 *last_xdr = NULL, *p;
560                 unsigned i;
561                 int res = 0;
562
563                 for (i = 0; i < state->num_comps; i++) {
564                         struct pnfs_osd_ioerr *ioerr = &state->ioerrs[i];
565
566                         if (!ioerr->oer_errno)
567                                 continue;
568
569                         dprintk("%s: err[%d]: errno=%d is_write=%d "
570                                 "dev(%llx:%llx) par=0x%llx obj=0x%llx "
571                                 "offset=0x%llx length=0x%llx\n",
572                                 __func__, i, ioerr->oer_errno,
573                                 ioerr->oer_iswrite,
574                                 _DEVID_LO(&ioerr->oer_component.oid_device_id),
575                                 _DEVID_HI(&ioerr->oer_component.oid_device_id),
576                                 ioerr->oer_component.oid_partition_id,
577                                 ioerr->oer_component.oid_object_id,
578                                 ioerr->oer_comp_offset,
579                                 ioerr->oer_comp_length);
580
581                         p = pnfs_osd_xdr_ioerr_reserve_space(xdr);
582                         if (unlikely(!p)) {
583                                 res = -E2BIG;
584                                 break; /* accumulated_error */
585                         }
586
587                         last_xdr = p;
588                         pnfs_osd_xdr_encode_ioerr(p, &state->ioerrs[i]);
589                 }
590
591                 /* TODO: use xdr_write_pages */
592                 if (unlikely(res)) {
593                         /* no space for even one error descriptor */
594                         BUG_ON(!last_xdr);
595
596                         /* we've encountered a situation with lots and lots of
597                          * errors and no space to encode them all. Use the last
598                          * available slot to report the union of all the
599                          * remaining errors.
600                          */
601                         encode_accumulated_error(objlay, last_xdr);
602                         goto loop_done;
603                 }
604                 list_del(&state->err_list);
605                 objlayout_free_io_state(state);
606         }
607 loop_done:
608         spin_unlock(&objlay->lock);
609
610         *start = cpu_to_be32((xdr->p - start - 1) * 4);
611         dprintk("%s: Return\n", __func__);
612 }
613
614
615 /*
616  * Get Device Info API for io engines
617  */
618 struct objlayout_deviceinfo {
619         struct page *page;
620         struct pnfs_osd_deviceaddr da; /* This must be last */
621 };
622
623 /* Initialize and call nfs_getdeviceinfo, then decode and return a
624  * "struct pnfs_osd_deviceaddr *" Eventually objlayout_put_deviceinfo()
625  * should be called.
626  */
627 int objlayout_get_deviceinfo(struct pnfs_layout_hdr *pnfslay,
628         struct nfs4_deviceid *d_id, struct pnfs_osd_deviceaddr **deviceaddr,
629         gfp_t gfp_flags)
630 {
631         struct objlayout_deviceinfo *odi;
632         struct pnfs_device pd;
633         struct super_block *sb;
634         struct page *page, **pages;
635         u32 *p;
636         int err;
637
638         page = alloc_page(gfp_flags);
639         if (!page)
640                 return -ENOMEM;
641
642         pages = &page;
643         pd.pages = pages;
644
645         memcpy(&pd.dev_id, d_id, sizeof(*d_id));
646         pd.layout_type = LAYOUT_OSD2_OBJECTS;
647         pd.pages = &page;
648         pd.pgbase = 0;
649         pd.pglen = PAGE_SIZE;
650         pd.mincount = 0;
651
652         sb = pnfslay->plh_inode->i_sb;
653         err = nfs4_proc_getdeviceinfo(NFS_SERVER(pnfslay->plh_inode), &pd);
654         dprintk("%s nfs_getdeviceinfo returned %d\n", __func__, err);
655         if (err)
656                 goto err_out;
657
658         p = page_address(page);
659         odi = kzalloc(sizeof(*odi), gfp_flags);
660         if (!odi) {
661                 err = -ENOMEM;
662                 goto err_out;
663         }
664         pnfs_osd_xdr_decode_deviceaddr(&odi->da, p);
665         odi->page = page;
666         *deviceaddr = &odi->da;
667         return 0;
668
669 err_out:
670         __free_page(page);
671         return err;
672 }
673
674 void objlayout_put_deviceinfo(struct pnfs_osd_deviceaddr *deviceaddr)
675 {
676         struct objlayout_deviceinfo *odi = container_of(deviceaddr,
677                                                 struct objlayout_deviceinfo,
678                                                 da);
679
680         __free_page(odi->page);
681         kfree(odi);
682 }