4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2011, Whamcloud, Inc.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * Implementation of cl_io for OSC layer.
38 * Author: Nikita Danilov <nikita.danilov@sun.com>
39 * Author: Jinshan Xiong <jinshan.xiong@whamcloud.com>
42 #define DEBUG_SUBSYSTEM S_OSC
44 #include "osc_cl_internal.h"
50 /*****************************************************************************
56 static struct osc_req *cl2osc_req(const struct cl_req_slice *slice)
58 LINVRNT(slice->crs_dev->cd_lu_dev.ld_type == &osc_device_type);
59 return container_of0(slice, struct osc_req, or_cl);
62 static struct osc_io *cl2osc_io(const struct lu_env *env,
63 const struct cl_io_slice *slice)
65 struct osc_io *oio = container_of0(slice, struct osc_io, oi_cl);
66 LINVRNT(oio == osc_env_io(env));
70 static struct osc_page *osc_cl_page_osc(struct cl_page *page)
72 const struct cl_page_slice *slice;
74 slice = cl_page_at(page, &osc_device_type);
75 LASSERT(slice != NULL);
77 return cl2osc_page(slice);
81 /*****************************************************************************
87 static void osc_io_fini(const struct lu_env *env, const struct cl_io_slice *io)
92 * An implementation of cl_io_operations::cio_io_submit() method for osc
93 * layer. Iterates over pages in the in-queue, prepares each for io by calling
94 * cl_page_prep() and then either submits them through osc_io_submit_page()
95 * or, if page is already submitted, changes osc flags through
96 * osc_set_async_flags().
98 static int osc_io_submit(const struct lu_env *env,
99 const struct cl_io_slice *ios,
100 enum cl_req_type crt, struct cl_2queue *queue)
102 struct obd_export *exp;
103 struct cl_page *page;
105 struct client_obd *cli = NULL;
106 struct osc_object *osc = NULL; /* to keep gcc happy */
107 struct osc_page *opg;
109 CFS_LIST_HEAD (list);
111 struct cl_page_list *qin = &queue->c2_qin;
112 struct cl_page_list *qout = &queue->c2_qout;
119 LASSERT(qin->pl_nr > 0);
121 CDEBUG(D_CACHE, "%d %d\n", qin->pl_nr, crt);
123 osc = cl2osc(ios->cis_obj);
124 exp = osc_export(osc);
126 max_pages = cli->cl_max_pages_per_rpc;
128 cmd = crt == CRT_WRITE ? OBD_BRW_WRITE : OBD_BRW_READ;
129 brw_flags = osc_io_srvlock(cl2osc_io(env, ios)) ? OBD_BRW_SRVLOCK : 0;
132 * NOTE: here @page is a top-level page. This is done to avoid
133 * creation of sub-page-list.
135 cl_page_list_for_each_safe(page, tmp, qin) {
136 struct osc_async_page *oap;
142 opg = osc_cl_page_osc(page);
144 LASSERT(osc == oap->oap_obj);
146 if (!cfs_list_empty(&oap->oap_pending_item) ||
147 !cfs_list_empty(&oap->oap_rpc_item)) {
148 CDEBUG(D_CACHE, "Busy oap %p page %p for submit.\n",
154 result = cl_page_prep(env, io, page, crt);
157 if (result != -EALREADY)
160 * Handle -EALREADY error: for read case, the page is
161 * already in UPTODATE state; for write, the page
168 cl_page_list_move(qout, qin, page);
169 oap->oap_async_flags = ASYNC_URGENT|ASYNC_READY;
170 oap->oap_async_flags |= ASYNC_COUNT_STABLE;
172 osc_page_submit(env, opg, crt, brw_flags);
173 cfs_list_add_tail(&oap->oap_pending_item, &list);
174 if (++queued == max_pages) {
176 result = osc_queue_sync_pages(env, osc, &list, cmd,
184 result = osc_queue_sync_pages(env, osc, &list, cmd, brw_flags);
186 CDEBUG(D_INFO, "%d/%d %d\n", qin->pl_nr, qout->pl_nr, result);
187 return qout->pl_nr > 0 ? 0 : result;
190 static void osc_page_touch_at(const struct lu_env *env,
191 struct cl_object *obj, pgoff_t idx, unsigned to)
193 struct lov_oinfo *loi = cl2osc(obj)->oo_oinfo;
194 struct cl_attr *attr = &osc_env_info(env)->oti_attr;
198 /* offset within stripe */
199 kms = cl_offset(obj, idx) + to;
201 cl_object_attr_lock(obj);
205 * ll_inode_size_lock(inode, 0); lov_stripe_lock(lsm);
209 CDEBUG(D_INODE, "stripe KMS %sincreasing "LPU64"->"LPU64" "LPU64"\n",
210 kms > loi->loi_kms ? "" : "not ", loi->loi_kms, kms,
211 loi->loi_lvb.lvb_size);
214 if (kms > loi->loi_kms) {
218 if (kms > loi->loi_lvb.lvb_size) {
219 attr->cat_size = kms;
222 cl_object_attr_set(env, obj, attr, valid);
223 cl_object_attr_unlock(obj);
227 * This is called when a page is accessed within file in a way that creates
228 * new page, if one were missing (i.e., if there were a hole at that place in
229 * the file, or accessed page is beyond the current file size). Examples:
230 * ->commit_write() and ->nopage() methods.
232 * Expand stripe KMS if necessary.
234 static void osc_page_touch(const struct lu_env *env,
235 struct osc_page *opage, unsigned to)
237 struct cl_page *page = opage->ops_cl.cpl_page;
238 struct cl_object *obj = opage->ops_cl.cpl_obj;
240 osc_page_touch_at(env, obj, page->cp_index, to);
244 * Implements cl_io_operations::cio_prepare_write() method for osc layer.
246 * \retval -EIO transfer initiated against this osc will most likely fail
247 * \retval 0 transfer initiated against this osc will most likely succeed.
249 * The reason for this check is to immediately return an error to the caller
250 * in the case of a deactivated import. Note, that import can be deactivated
251 * later, while pages, dirtied by this IO, are still in the cache, but this is
252 * irrelevant, because that would still return an error to the application (if
253 * it does fsync), but many applications don't do fsync because of performance
254 * issues, and we wanted to return an -EIO at write time to notify the
257 static int osc_io_prepare_write(const struct lu_env *env,
258 const struct cl_io_slice *ios,
259 const struct cl_page_slice *slice,
260 unsigned from, unsigned to)
262 struct osc_device *dev = lu2osc_dev(slice->cpl_obj->co_lu.lo_dev);
263 struct obd_import *imp = class_exp2cliimp(dev->od_exp);
264 struct osc_io *oio = cl2osc_io(env, ios);
269 * This implements OBD_BRW_CHECK logic from old client.
272 if (imp == NULL || imp->imp_invalid)
274 if (result == 0 && oio->oi_lockless)
275 /* this page contains `invalid' data, but who cares?
276 * nobody can access the invalid data.
277 * in osc_io_commit_write(), we're going to write exact
278 * [from, to) bytes of this page to OST. -jay */
279 cl_page_export(env, slice->cpl_page, 1);
284 static int osc_io_commit_write(const struct lu_env *env,
285 const struct cl_io_slice *ios,
286 const struct cl_page_slice *slice,
287 unsigned from, unsigned to)
289 struct osc_io *oio = cl2osc_io(env, ios);
290 struct osc_page *opg = cl2osc_page(slice);
291 struct osc_object *obj = cl2osc(opg->ops_cl.cpl_obj);
292 struct osc_async_page *oap = &opg->ops_oap;
297 * XXX instead of calling osc_page_touch() here and in
298 * osc_io_fault_start() it might be more logical to introduce
299 * cl_page_touch() method, that generic cl_io_commit_write() and page
302 osc_page_touch(env, cl2osc_page(slice), to);
303 if (!client_is_remote(osc_export(obj)) &&
304 cfs_capable(CFS_CAP_SYS_RESOURCE))
305 oap->oap_brw_flags |= OBD_BRW_NOQUOTA;
307 if (oio->oi_lockless)
308 /* see osc_io_prepare_write() for lockless io handling. */
309 cl_page_clip(env, slice->cpl_page, from, to);
314 static int osc_io_fault_start(const struct lu_env *env,
315 const struct cl_io_slice *ios)
318 struct cl_fault_io *fio;
323 fio = &io->u.ci_fault;
324 CDEBUG(D_INFO, "%lu %d %d\n",
325 fio->ft_index, fio->ft_writable, fio->ft_nob);
327 * If mapping is writeable, adjust kms to cover this page,
328 * but do not extend kms beyond actual file size.
331 if (fio->ft_writable)
332 osc_page_touch_at(env, ios->cis_obj,
333 fio->ft_index, fio->ft_nob);
337 static int osc_async_upcall(void *a, int rc)
339 struct osc_async_cbargs *args = a;
342 cfs_complete(&args->opc_sync);
346 #if defined(__KERNEL__)
348 * Checks that there are no pages being written in the extent being truncated.
350 static int trunc_check_cb(const struct lu_env *env, struct cl_io *io,
351 struct cl_page *page, void *cbdata)
353 const struct cl_page_slice *slice;
354 struct osc_page *ops;
355 struct osc_async_page *oap;
356 __u64 start = *(__u64 *)cbdata;
358 slice = cl_page_at(page, &osc_device_type);
359 LASSERT(slice != NULL);
360 ops = cl2osc_page(slice);
363 if (oap->oap_cmd & OBD_BRW_WRITE &&
364 !cfs_list_empty(&oap->oap_pending_item))
365 CL_PAGE_DEBUG(D_ERROR, env, page, "exists " LPU64 "/%s.\n",
366 start, current->comm);
370 cfs_page_t *vmpage = cl_page_vmpage(env, page);
371 if (PageLocked(vmpage))
372 CDEBUG(D_CACHE, "page %p index %lu locked for %d.\n",
374 (oap->oap_cmd & OBD_BRW_RWMASK));
378 return CLP_GANG_OKAY;
381 static void osc_trunc_check(const struct lu_env *env, struct cl_io *io,
382 struct osc_io *oio, __u64 size)
384 struct cl_object *clob;
388 clob = oio->oi_cl.cis_obj;
389 start = cl_index(clob, size);
390 partial = cl_offset(clob, start) < size;
393 * Complain if there are pages in the truncated region.
395 cl_page_gang_lookup(env, clob, io, start + partial, CL_PAGE_EOF,
396 trunc_check_cb, (void *)&size);
398 #else /* __KERNEL__ */
399 static void osc_trunc_check(const struct lu_env *env, struct cl_io *io,
400 struct osc_io *oio, __u64 size)
406 static int osc_io_setattr_start(const struct lu_env *env,
407 const struct cl_io_slice *slice)
409 struct cl_io *io = slice->cis_io;
410 struct osc_io *oio = cl2osc_io(env, slice);
411 struct cl_object *obj = slice->cis_obj;
412 struct lov_oinfo *loi = cl2osc(obj)->oo_oinfo;
413 struct cl_attr *attr = &osc_env_info(env)->oti_attr;
414 struct obdo *oa = &oio->oi_oa;
415 struct osc_async_cbargs *cbargs = &oio->oi_cbarg;
416 __u64 size = io->u.ci_setattr.sa_attr.lvb_size;
417 unsigned int ia_valid = io->u.ci_setattr.sa_valid;
419 struct obd_info oinfo = { { { 0 } } };
421 /* truncate cache dirty pages first */
422 if (cl_io_is_trunc(io))
423 result = osc_cache_truncate_start(env, oio, cl2osc(obj), size);
425 if (result == 0 && oio->oi_lockless == 0) {
426 cl_object_attr_lock(obj);
427 result = cl_object_attr_get(env, obj, attr);
429 struct ost_lvb *lvb = &io->u.ci_setattr.sa_attr;
430 unsigned int cl_valid = 0;
432 if (ia_valid & ATTR_SIZE) {
433 attr->cat_size = attr->cat_kms = size;
434 cl_valid = (CAT_SIZE | CAT_KMS);
436 if (ia_valid & ATTR_MTIME_SET) {
437 attr->cat_mtime = lvb->lvb_mtime;
438 cl_valid |= CAT_MTIME;
440 if (ia_valid & ATTR_ATIME_SET) {
441 attr->cat_atime = lvb->lvb_atime;
442 cl_valid |= CAT_ATIME;
444 if (ia_valid & ATTR_CTIME_SET) {
445 attr->cat_ctime = lvb->lvb_ctime;
446 cl_valid |= CAT_CTIME;
448 result = cl_object_attr_set(env, obj, attr, cl_valid);
450 cl_object_attr_unlock(obj);
452 memset(oa, 0, sizeof(*oa));
454 oa->o_id = loi->loi_id;
455 oa->o_seq = loi->loi_seq;
456 oa->o_mtime = attr->cat_mtime;
457 oa->o_atime = attr->cat_atime;
458 oa->o_ctime = attr->cat_ctime;
459 oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLATIME |
460 OBD_MD_FLCTIME | OBD_MD_FLMTIME;
461 if (ia_valid & ATTR_SIZE) {
463 oa->o_blocks = OBD_OBJECT_EOF;
464 oa->o_valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
466 if (oio->oi_lockless) {
467 oa->o_flags = OBD_FL_SRVLOCK;
468 oa->o_valid |= OBD_MD_FLFLAGS;
471 LASSERT(oio->oi_lockless == 0);
475 oinfo.oi_capa = io->u.ci_setattr.sa_capa;
476 cfs_init_completion(&cbargs->opc_sync);
478 if (ia_valid & ATTR_SIZE)
479 result = osc_punch_base(osc_export(cl2osc(obj)),
480 &oinfo, osc_async_upcall,
481 cbargs, PTLRPCD_SET);
483 result = osc_setattr_async_base(osc_export(cl2osc(obj)),
486 cbargs, PTLRPCD_SET);
491 static void osc_io_setattr_end(const struct lu_env *env,
492 const struct cl_io_slice *slice)
494 struct cl_io *io = slice->cis_io;
495 struct osc_io *oio = cl2osc_io(env, slice);
496 struct cl_object *obj = slice->cis_obj;
497 struct osc_async_cbargs *cbargs = &oio->oi_cbarg;
500 cfs_wait_for_completion(&cbargs->opc_sync);
502 result = io->ci_result = cbargs->opc_rc;
504 if (oio->oi_lockless) {
505 /* lockless truncate */
506 struct osc_device *osd = lu2osc_dev(obj->co_lu.lo_dev);
508 LASSERT(cl_io_is_trunc(io));
509 /* XXX: Need a lock. */
510 osd->od_stats.os_lockless_truncates++;
514 if (cl_io_is_trunc(io)) {
515 __u64 size = io->u.ci_setattr.sa_attr.lvb_size;
516 osc_trunc_check(env, io, oio, size);
517 if (oio->oi_trunc != NULL) {
518 osc_cache_truncate_end(env, oio, cl2osc(obj));
519 oio->oi_trunc = NULL;
524 static int osc_io_read_start(const struct lu_env *env,
525 const struct cl_io_slice *slice)
527 struct osc_io *oio = cl2osc_io(env, slice);
528 struct cl_object *obj = slice->cis_obj;
529 struct cl_attr *attr = &osc_env_info(env)->oti_attr;
533 if (oio->oi_lockless == 0) {
534 cl_object_attr_lock(obj);
535 result = cl_object_attr_get(env, obj, attr);
537 attr->cat_atime = LTIME_S(CFS_CURRENT_TIME);
538 result = cl_object_attr_set(env, obj, attr,
541 cl_object_attr_unlock(obj);
546 static int osc_io_write_start(const struct lu_env *env,
547 const struct cl_io_slice *slice)
549 struct osc_io *oio = cl2osc_io(env, slice);
550 struct cl_object *obj = slice->cis_obj;
551 struct cl_attr *attr = &osc_env_info(env)->oti_attr;
555 if (oio->oi_lockless == 0) {
556 cl_object_attr_lock(obj);
557 result = cl_object_attr_get(env, obj, attr);
559 attr->cat_mtime = attr->cat_ctime =
560 LTIME_S(CFS_CURRENT_TIME);
561 result = cl_object_attr_set(env, obj, attr,
562 CAT_MTIME | CAT_CTIME);
564 cl_object_attr_unlock(obj);
569 static int osc_fsync_ost(const struct lu_env *env, struct osc_object *obj,
570 struct cl_fsync_io *fio)
572 struct osc_io *oio = osc_env_io(env);
573 struct obdo *oa = &oio->oi_oa;
574 struct obd_info *oinfo = &oio->oi_info;
575 struct lov_oinfo *loi = obj->oo_oinfo;
576 struct osc_async_cbargs *cbargs = &oio->oi_cbarg;
580 memset(oa, 0, sizeof(*oa));
581 oa->o_id = loi->loi_id;
582 oa->o_seq = loi->loi_seq;
583 oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP;
585 /* reload size abd blocks for start and end of sync range */
586 oa->o_size = fio->fi_start;
587 oa->o_blocks = fio->fi_end;
588 oa->o_valid |= OBD_MD_FLSIZE | OBD_MD_FLBLOCKS;
590 obdo_set_parent_fid(oa, fio->fi_fid);
592 memset(oinfo, 0, sizeof(*oinfo));
594 oinfo->oi_capa = fio->fi_capa;
595 cfs_init_completion(&cbargs->opc_sync);
597 rc = osc_sync_base(osc_export(obj), oinfo, osc_async_upcall, cbargs,
602 static int osc_io_fsync_start(const struct lu_env *env,
603 const struct cl_io_slice *slice)
605 struct cl_io *io = slice->cis_io;
606 struct cl_fsync_io *fio = &io->u.ci_fsync;
607 struct cl_object *obj = slice->cis_obj;
608 struct osc_object *osc = cl2osc(obj);
609 pgoff_t start = cl_index(obj, fio->fi_start);
610 pgoff_t end = cl_index(obj, fio->fi_end);
614 if (fio->fi_end == OBD_OBJECT_EOF)
617 result = osc_cache_writeback_range(env, osc, start, end, 0,
618 fio->fi_mode == CL_FSYNC_DISCARD);
620 fio->fi_nr_written += result;
623 if (fio->fi_mode == CL_FSYNC_ALL) {
626 /* we have to wait for writeback to finish before we can
627 * send OST_SYNC RPC. This is bad because it causes extents
628 * to be written osc by osc. However, we usually start
629 * writeback before CL_FSYNC_ALL so this won't have any real
631 rc = osc_cache_wait_range(env, osc, start, end);
634 rc = osc_fsync_ost(env, osc, fio);
642 static void osc_io_fsync_end(const struct lu_env *env,
643 const struct cl_io_slice *slice)
645 struct cl_fsync_io *fio = &slice->cis_io->u.ci_fsync;
646 struct cl_object *obj = slice->cis_obj;
647 pgoff_t start = cl_index(obj, fio->fi_start);
648 pgoff_t end = cl_index(obj, fio->fi_end);
651 if (fio->fi_mode == CL_FSYNC_LOCAL) {
652 result = osc_cache_wait_range(env, cl2osc(obj), start, end);
653 } else if (fio->fi_mode == CL_FSYNC_ALL) {
654 struct osc_io *oio = cl2osc_io(env, slice);
655 struct osc_async_cbargs *cbargs = &oio->oi_cbarg;
657 cfs_wait_for_completion(&cbargs->opc_sync);
659 result = cbargs->opc_rc;
661 slice->cis_io->ci_result = result;
664 static void osc_io_end(const struct lu_env *env,
665 const struct cl_io_slice *slice)
667 struct osc_io *oio = cl2osc_io(env, slice);
669 if (oio->oi_active) {
670 osc_extent_release(env, oio->oi_active);
671 oio->oi_active = NULL;
675 static const struct cl_io_operations osc_io_ops = {
678 .cio_start = osc_io_read_start,
679 .cio_fini = osc_io_fini
682 .cio_start = osc_io_write_start,
683 .cio_end = osc_io_end,
684 .cio_fini = osc_io_fini
687 .cio_start = osc_io_setattr_start,
688 .cio_end = osc_io_setattr_end
691 .cio_start = osc_io_fault_start,
692 .cio_end = osc_io_end,
693 .cio_fini = osc_io_fini
696 .cio_start = osc_io_fsync_start,
697 .cio_end = osc_io_fsync_end,
698 .cio_fini = osc_io_fini
701 .cio_fini = osc_io_fini
706 .cio_submit = osc_io_submit
709 .cio_submit = osc_io_submit
712 .cio_prepare_write = osc_io_prepare_write,
713 .cio_commit_write = osc_io_commit_write
716 /*****************************************************************************
718 * Transfer operations.
722 static int osc_req_prep(const struct lu_env *env,
723 const struct cl_req_slice *slice)
728 static void osc_req_completion(const struct lu_env *env,
729 const struct cl_req_slice *slice, int ioret)
733 or = cl2osc_req(slice);
734 OBD_SLAB_FREE_PTR(or, osc_req_kmem);
738 * Implementation of struct cl_req_operations::cro_attr_set() for osc
739 * layer. osc is responsible for struct obdo::o_id and struct obdo::o_seq
742 static void osc_req_attr_set(const struct lu_env *env,
743 const struct cl_req_slice *slice,
744 const struct cl_object *obj,
745 struct cl_req_attr *attr, obd_valid flags)
747 struct lov_oinfo *oinfo;
748 struct cl_req *clerq;
749 struct cl_page *apage; /* _some_ page in @clerq */
750 struct cl_lock *lock; /* _some_ lock protecting @apage */
751 struct osc_lock *olck;
752 struct osc_page *opg;
756 oinfo = cl2osc(obj)->oo_oinfo;
757 if (flags & OBD_MD_FLID) {
758 oa->o_id = oinfo->loi_id;
759 oa->o_valid |= OBD_MD_FLID;
761 if (flags & OBD_MD_FLGROUP) {
762 oa->o_seq = oinfo->loi_seq;
763 oa->o_valid |= OBD_MD_FLGROUP;
765 if (flags & OBD_MD_FLHANDLE) {
766 clerq = slice->crs_req;
767 LASSERT(!cfs_list_empty(&clerq->crq_pages));
768 apage = container_of(clerq->crq_pages.next,
769 struct cl_page, cp_flight);
770 opg = osc_cl_page_osc(apage);
771 apage = opg->ops_cl.cpl_page; /* now apage is a sub-page */
772 lock = cl_lock_at_page(env, apage->cp_obj, apage, NULL, 1, 1);
774 struct cl_object_header *head;
775 struct cl_lock *scan;
777 head = cl_object_header(apage->cp_obj);
778 cfs_list_for_each_entry(scan, &head->coh_locks,
780 CL_LOCK_DEBUG(D_ERROR, env, scan,
782 CL_PAGE_DEBUG(D_ERROR, env, apage,
783 "dump uncover page!\n");
784 libcfs_debug_dumpstack(NULL);
788 olck = osc_lock_at(lock);
789 LASSERT(olck != NULL);
790 LASSERT(ergo(opg->ops_srvlock, olck->ols_lock == NULL));
791 /* check for lockless io. */
792 if (olck->ols_lock != NULL) {
793 oa->o_handle = olck->ols_lock->l_remote_handle;
794 oa->o_valid |= OBD_MD_FLHANDLE;
796 cl_lock_put(env, lock);
800 static const struct cl_req_operations osc_req_ops = {
801 .cro_prep = osc_req_prep,
802 .cro_attr_set = osc_req_attr_set,
803 .cro_completion = osc_req_completion
807 int osc_io_init(const struct lu_env *env,
808 struct cl_object *obj, struct cl_io *io)
810 struct osc_io *oio = osc_env_io(env);
812 CL_IO_SLICE_CLEAN(oio, oi_cl);
813 cl_io_slice_add(io, &oio->oi_cl, obj, &osc_io_ops);
817 int osc_req_init(const struct lu_env *env, struct cl_device *dev,
823 OBD_SLAB_ALLOC_PTR_GFP(or, osc_req_kmem, CFS_ALLOC_IO);
825 cl_req_slice_add(req, &or->or_cl, dev, &osc_req_ops);