1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
30 * Use is subject to license terms.
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 LOV layer.
38 * Author: Nikita Danilov <nikita.danilov@sun.com>
41 #define DEBUG_SUBSYSTEM S_LOV
43 #include "lov_cl_internal.h"
49 static void lov_sub_enter(struct lov_io_sub *sub)
52 if (sub->sub_reenter++ == 0) {
53 sub->sub_cookie = cl_env_reenter();
54 cl_env_implant(sub->sub_env, &sub->sub_refcheck2);
59 static void lov_sub_exit(struct lov_io_sub *sub)
62 if (--sub->sub_reenter == 0) {
63 cl_env_unplant(sub->sub_env, &sub->sub_refcheck2);
64 cl_env_reexit(sub->sub_cookie);
69 static void lov_io_sub_fini(const struct lu_env *env, struct lov_io *lio,
70 struct lov_io_sub *sub)
73 if (sub->sub_io != NULL) {
74 if (sub->sub_io_initialized) {
76 cl_io_fini(sub->sub_env, sub->sub_io);
78 sub->sub_io_initialized = 0;
79 lio->lis_active_subios--;
81 if (sub->sub_stripe == lio->lis_single_subio_index)
82 lio->lis_single_subio_index = -1;
83 else if (!sub->sub_borrowed)
84 OBD_FREE_PTR(sub->sub_io);
87 if (sub->sub_env != NULL && !IS_ERR(sub->sub_env)) {
88 if (!sub->sub_borrowed)
89 cl_env_put(sub->sub_env, &sub->sub_refcheck);
95 static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio,
96 int stripe, loff_t start, loff_t end)
98 struct lov_stripe_md *lsm = lov_r0(lio->lis_object)->lo_lsm;
99 struct cl_io *parent = lio->lis_cl.cis_io;
101 switch(io->ci_type) {
103 size_t new_size = parent->u.ci_truncate.tr_size;
105 new_size = lov_size_to_stripe(lsm, new_size, stripe);
106 io->u.ci_truncate.tr_capa = parent->u.ci_truncate.tr_capa;
107 io->u.ci_truncate.tr_size = new_size;
111 struct cl_object *obj = parent->ci_obj;
112 loff_t off = cl_offset(obj, parent->u.ci_fault.ft_index);
114 io->u.ci_fault = parent->u.ci_fault;
115 off = lov_size_to_stripe(lsm, off, stripe);
116 io->u.ci_fault.ft_index = cl_index(obj, off);
121 io->u.ci_rw.crw_pos = start;
122 io->u.ci_rw.crw_count = end - start;
130 static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio,
131 struct lov_io_sub *sub)
133 struct lov_object *lov = lio->lis_object;
134 struct lov_device *ld = lu2lov_dev(lov2cl(lov)->co_lu.lo_dev);
135 struct cl_io *sub_io;
136 struct cl_object *sub_obj;
137 struct cl_io *io = lio->lis_cl.cis_io;
139 int stripe = sub->sub_stripe;
142 LASSERT(sub->sub_io == NULL);
143 LASSERT(sub->sub_env == NULL);
144 LASSERT(sub->sub_stripe < lio->lis_stripe_count);
148 sub->sub_io_initialized = 0;
149 sub->sub_borrowed = 0;
151 if (lio->lis_mem_frozen) {
152 LASSERT(mutex_is_locked(&ld->ld_mutex));
153 sub->sub_io = &ld->ld_emrg[stripe]->emrg_subio;
154 sub->sub_env = ld->ld_emrg[stripe]->emrg_env;
155 sub->sub_borrowed = 1;
159 /* obtain new environment */
160 cookie = cl_env_reenter();
161 sub->sub_env = cl_env_get(&sub->sub_refcheck);
162 cl_env_reexit(cookie);
163 if (IS_ERR(sub->sub_env))
164 result = PTR_ERR(sub->sub_env);
168 * First sub-io. Use ->lis_single_subio to
169 * avoid dynamic allocation.
171 if (lio->lis_active_subios == 0) {
172 sub->sub_io = &lio->lis_single_subio;
173 lio->lis_single_subio_index = stripe;
175 OBD_ALLOC_PTR(sub->sub_io);
176 if (sub->sub_io == NULL)
183 sub_obj = lovsub2cl(lov_r0(lov)->lo_sub[stripe]);
184 sub_io = sub->sub_io;
186 sub_io->ci_obj = sub_obj;
187 sub_io->ci_result = 0;
189 sub_io->ci_parent = io;
190 sub_io->ci_lockreq = io->ci_lockreq;
191 sub_io->ci_type = io->ci_type;
192 sub_io->ci_no_srvlock = io->ci_no_srvlock;
195 result = cl_io_sub_init(sub->sub_env, sub_io,
196 io->ci_type, sub_obj);
199 lio->lis_active_subios++;
200 sub->sub_io_initialized = 1;
205 lov_io_sub_fini(env, lio, sub);
209 struct lov_io_sub *lov_sub_get(const struct lu_env *env,
210 struct lov_io *lio, int stripe)
213 struct lov_io_sub *sub = &lio->lis_subs[stripe];
215 LASSERT(stripe < lio->lis_stripe_count);
218 if (!sub->sub_io_initialized) {
219 sub->sub_stripe = stripe;
220 rc = lov_io_sub_init(env, lio, sub);
230 void lov_sub_put(struct lov_io_sub *sub)
235 /*****************************************************************************
241 static int lov_page_stripe(const struct cl_page *page)
243 struct lovsub_object *subobj;
247 lu_object_locate(page->cp_child->cp_obj->co_lu.lo_header,
248 &lovsub_device_type));
249 LASSERT(subobj != NULL);
250 RETURN(subobj->lso_index);
253 struct lov_io_sub *lov_page_subio(const struct lu_env *env, struct lov_io *lio,
254 const struct cl_page_slice *slice)
256 struct lov_stripe_md *lsm = lov_r0(lio->lis_object)->lo_lsm;
257 struct cl_page *page = slice->cpl_page;
260 LASSERT(lio->lis_cl.cis_io != NULL);
261 LASSERT(cl2lov(slice->cpl_obj) == lio->lis_object);
262 LASSERT(lsm != NULL);
263 LASSERT(lio->lis_nr_subios > 0);
266 stripe = lov_page_stripe(page);
267 RETURN(lov_sub_get(env, lio, stripe));
271 static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio,
274 struct lov_object *lov = lio->lis_object;
275 struct lov_stripe_md *lsm = lov_r0(lov)->lo_lsm;
278 LASSERT(lio->lis_object != NULL);
282 * Need to be optimized, we can't afford to allocate a piece of memory
283 * when writing a page. -jay
285 OBD_ALLOC(lio->lis_subs,
286 lsm->lsm_stripe_count * sizeof lio->lis_subs[0]);
287 if (lio->lis_subs != NULL) {
288 lio->lis_nr_subios = lio->lis_stripe_count;
289 lio->lis_single_subio_index = -1;
290 lio->lis_active_subios = 0;
297 static void lov_io_slice_init(struct lov_io *lio,
298 struct lov_object *obj, struct cl_io *io)
300 struct lov_stripe_md *lsm = lov_r0(obj)->lo_lsm;
302 LASSERT(lsm != NULL);
306 lio->lis_object = obj;
307 lio->lis_stripe_count = lsm->lsm_stripe_count;
309 switch (io->ci_type) {
312 lio->lis_pos = io->u.ci_rw.crw_pos;
313 lio->lis_endpos = io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count;
314 lio->lis_io_endpos = lio->lis_endpos;
315 if (cl_io_is_append(io)) {
316 LASSERT(io->ci_type == CIT_WRITE);
318 lio->lis_endpos = OBD_OBJECT_EOF;
323 lio->lis_pos = io->u.ci_truncate.tr_size;
324 lio->lis_endpos = OBD_OBJECT_EOF;
328 pgoff_t index = io->u.ci_fault.ft_index;
329 lio->lis_pos = cl_offset(io->ci_obj, index);
330 lio->lis_endpos = cl_offset(io->ci_obj, index + 1);
336 lio->lis_endpos = OBD_OBJECT_EOF;
346 static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)
348 struct lov_io *lio = cl2lov_io(env, ios);
352 if (lio->lis_subs != NULL) {
353 for (i = 0; i < lio->lis_nr_subios; i++)
354 lov_io_sub_fini(env, lio, &lio->lis_subs[i]);
355 OBD_FREE(lio->lis_subs,
356 lio->lis_nr_subios * sizeof lio->lis_subs[0]);
357 lio->lis_nr_subios = 0;
362 static obd_off lov_offset_mod(obd_off val, int delta)
364 if (val != OBD_OBJECT_EOF)
369 static int lov_io_iter_init(const struct lu_env *env,
370 const struct cl_io_slice *ios)
372 struct lov_io *lio = cl2lov_io(env, ios);
373 struct lov_stripe_md *lsm = lov_r0(lio->lis_object)->lo_lsm;
374 struct lov_io_sub *sub;
382 endpos = lov_offset_mod(lio->lis_endpos, -1);
383 for (stripe = 0; stripe < lio->lis_stripe_count; stripe++) {
384 if (!lov_stripe_intersects(lsm, stripe, lio->lis_pos,
385 endpos, &start, &end))
388 end = lov_offset_mod(end, +1);
389 sub = lov_sub_get(env, lio, stripe);
391 lov_io_sub_inherit(sub->sub_io, lio, stripe,
393 rc = cl_io_iter_init(sub->sub_env, sub->sub_io);
395 CDEBUG(D_VFSTRACE, "shrink: %i [%llu, %llu)\n",
401 list_add_tail(&sub->sub_linkage, &lio->lis_active);
408 static int lov_io_rw_iter_init(const struct lu_env *env,
409 const struct cl_io_slice *ios)
411 struct lov_io *lio = cl2lov_io(env, ios);
412 struct cl_io *io = ios->cis_io;
413 struct lov_stripe_md *lsm = lov_r0(cl2lov(ios->cis_obj))->lo_lsm;
414 loff_t start = io->u.ci_rw.crw_pos;
416 unsigned long ssize = lsm->lsm_stripe_size;
418 LASSERT(io->ci_type == CIT_READ || io->ci_type == CIT_WRITE);
421 /* fast path for common case. */
422 if (lio->lis_nr_subios != 1 && !cl_io_is_append(io)) {
424 do_div(start, ssize);
425 next = (start + 1) * ssize;
426 if (next <= start * ssize)
429 io->ci_continue = next < lio->lis_io_endpos;
430 io->u.ci_rw.crw_count = min_t(loff_t, lio->lis_io_endpos,
431 next) - io->u.ci_rw.crw_pos;
432 lio->lis_pos = io->u.ci_rw.crw_pos;
433 lio->lis_endpos = io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count;
434 CDEBUG(D_VFSTRACE, "stripe: %llu chunk: [%llu, %llu) %llu\n",
435 (__u64)start, lio->lis_pos, lio->lis_endpos,
436 (__u64)lio->lis_io_endpos);
439 * XXX The following call should be optimized: we know, that
440 * [lio->lis_pos, lio->lis_endpos) intersects with exactly one stripe.
442 RETURN(lov_io_iter_init(env, ios));
445 static int lov_io_call(const struct lu_env *env, struct lov_io *lio,
446 int (*iofunc)(const struct lu_env *, struct cl_io *))
448 struct lov_io_sub *sub;
452 list_for_each_entry(sub, &lio->lis_active, sub_linkage) {
454 rc = iofunc(sub->sub_env, sub->sub_io);
462 static int lov_io_lock(const struct lu_env *env, const struct cl_io_slice *ios)
465 RETURN(lov_io_call(env, cl2lov_io(env, ios), cl_io_lock));
468 static int lov_io_start(const struct lu_env *env, const struct cl_io_slice *ios)
471 RETURN(lov_io_call(env, cl2lov_io(env, ios), cl_io_start));
474 static int lov_io_end_wrapper(const struct lu_env *env, struct cl_io *io)
478 * It's possible that lov_io_start() wasn't called against this
479 * sub-io, either because previous sub-io failed, or upper layer
482 if (io->ci_state == CIS_IO_GOING)
485 io->ci_state = CIS_IO_FINISHED;
489 static int lov_io_iter_fini_wrapper(const struct lu_env *env, struct cl_io *io)
491 cl_io_iter_fini(env, io);
495 static int lov_io_unlock_wrapper(const struct lu_env *env, struct cl_io *io)
497 cl_io_unlock(env, io);
501 static void lov_io_end(const struct lu_env *env, const struct cl_io_slice *ios)
505 rc = lov_io_call(env, cl2lov_io(env, ios), lov_io_end_wrapper);
509 static void lov_io_iter_fini(const struct lu_env *env,
510 const struct cl_io_slice *ios)
512 struct lov_io *lio = cl2lov_io(env, ios);
516 rc = lov_io_call(env, lio, lov_io_iter_fini_wrapper);
518 while (!list_empty(&lio->lis_active))
519 list_del_init(lio->lis_active.next);
523 static void lov_io_unlock(const struct lu_env *env,
524 const struct cl_io_slice *ios)
529 rc = lov_io_call(env, cl2lov_io(env, ios), lov_io_unlock_wrapper);
535 static struct cl_page_list *lov_io_submit_qin(struct lov_device *ld,
536 struct cl_page_list *qin,
539 return alloc ? &qin[idx] : &ld->ld_emrg[idx]->emrg_page_list;
543 * lov implementation of cl_operations::cio_submit() method. It takes a list
544 * of pages in \a queue, splits it into per-stripe sub-lists, invokes
545 * cl_io_submit() on underlying devices to submit sub-lists, and then splices
548 * Major complication of this function is a need to handle memory cleansing:
549 * cl_io_submit() is called to write out pages as a part of VM memory
550 * reclamation, and hence it may not fail due to memory shortages (system
551 * dead-locks otherwise). To deal with this, some resources (sub-lists,
552 * sub-environment, etc.) are allocated per-device on "startup" (i.e., in a
553 * not-memory cleansing context), and in case of memory shortage, these
554 * pre-allocated resources are used by lov_io_submit() under
555 * lov_device::ld_mutex mutex.
557 static int lov_io_submit(const struct lu_env *env,
558 const struct cl_io_slice *ios,
559 enum cl_req_type crt, struct cl_2queue *queue,
560 enum cl_req_priority priority)
562 struct lov_io *lio = cl2lov_io(env, ios);
563 struct lov_object *obj = lio->lis_object;
564 struct lov_device *ld = lu2lov_dev(lov2cl(obj)->co_lu.lo_dev);
565 struct cl_page_list *qin = &queue->c2_qin;
566 struct cl_2queue *cl2q = &lov_env_info(env)->lti_cl2q;
567 struct cl_page_list *stripes_qin = NULL;
568 struct cl_page *page;
572 #define QIN(stripe) lov_io_submit_qin(ld, stripes_qin, stripe, alloc)
576 #if defined(__KERNEL__) && defined(__linux__)
577 !(current->flags & PF_MEMALLOC);
582 if (lio->lis_active_subios == 1) {
583 int idx = lio->lis_single_subio_index;
584 struct lov_io_sub *sub;
586 LASSERT(idx < lio->lis_nr_subios);
587 sub = lov_sub_get(env, lio, idx);
588 LASSERT(!IS_ERR(sub));
589 LASSERT(sub->sub_io == &lio->lis_single_subio);
590 rc = cl_io_submit_rw(sub->sub_env, sub->sub_io,
591 crt, queue, priority);
596 LASSERT(lio->lis_subs != NULL);
598 OBD_ALLOC(stripes_qin,
599 sizeof(*stripes_qin) * lio->lis_nr_subios);
600 if (stripes_qin == NULL)
603 for (stripe = 0; stripe < lio->lis_nr_subios; stripe++)
604 cl_page_list_init(&stripes_qin[stripe]);
607 * If we get here, it means pageout & swap doesn't help.
608 * In order to not make things worse, even don't try to
609 * allocate the memory with __GFP_NOWARN. -jay
611 mutex_lock(&ld->ld_mutex);
612 lio->lis_mem_frozen = 1;
615 cl_2queue_init(cl2q);
616 cl_page_list_for_each_safe(page, tmp, qin) {
617 stripe = lov_page_stripe(page);
618 cl_page_list_move(QIN(stripe), qin, page);
621 for (stripe = 0; stripe < lio->lis_nr_subios; stripe++) {
622 struct lov_io_sub *sub;
623 struct cl_page_list *sub_qin = QIN(stripe);
625 if (list_empty(&sub_qin->pl_pages))
628 cl_page_list_splice(sub_qin, &cl2q->c2_qin);
629 sub = lov_sub_get(env, lio, stripe);
631 rc = cl_io_submit_rw(sub->sub_env, sub->sub_io,
632 crt, cl2q, priority);
636 cl_page_list_splice(&cl2q->c2_qin, &queue->c2_qin);
637 cl_page_list_splice(&cl2q->c2_qout, &queue->c2_qout);
642 for (stripe = 0; stripe < lio->lis_nr_subios; stripe++) {
643 struct cl_page_list *sub_qin = QIN(stripe);
645 if (list_empty(&sub_qin->pl_pages))
648 cl_page_list_splice(sub_qin, qin);
652 OBD_FREE(stripes_qin,
653 sizeof(*stripes_qin) * lio->lis_nr_subios);
657 for (i = 0; i < lio->lis_nr_subios; i++) {
658 struct cl_io *cio = lio->lis_subs[i].sub_io;
660 if (cio && cio == &ld->ld_emrg[i]->emrg_subio)
661 lov_io_sub_fini(env, lio, &lio->lis_subs[i]);
663 lio->lis_mem_frozen = 0;
664 mutex_unlock(&ld->ld_mutex);
671 static int lov_io_prepare_write(const struct lu_env *env,
672 const struct cl_io_slice *ios,
673 const struct cl_page_slice *slice,
674 unsigned from, unsigned to)
676 struct lov_io *lio = cl2lov_io(env, ios);
677 struct cl_page *sub_page = lov_sub_page(slice);
678 struct lov_io_sub *sub;
682 sub = lov_page_subio(env, lio, slice);
684 result = cl_io_prepare_write(sub->sub_env, sub->sub_io,
688 result = PTR_ERR(sub);
692 static int lov_io_commit_write(const struct lu_env *env,
693 const struct cl_io_slice *ios,
694 const struct cl_page_slice *slice,
695 unsigned from, unsigned to)
697 struct lov_io *lio = cl2lov_io(env, ios);
698 struct cl_page *sub_page = lov_sub_page(slice);
699 struct lov_io_sub *sub;
703 sub = lov_page_subio(env, lio, slice);
705 result = cl_io_commit_write(sub->sub_env, sub->sub_io,
709 result = PTR_ERR(sub);
713 static int lov_io_fault_start(const struct lu_env *env,
714 const struct cl_io_slice *ios)
716 struct cl_fault_io *fio;
718 struct lov_io_sub *sub;
721 fio = &ios->cis_io->u.ci_fault;
722 lio = cl2lov_io(env, ios);
723 sub = lov_sub_get(env, lio, lov_page_stripe(fio->ft_page));
724 sub->sub_io->u.ci_fault.ft_nob = fio->ft_nob;
726 RETURN(lov_io_start(env, ios));
729 static const struct cl_io_operations lov_io_ops = {
732 .cio_fini = lov_io_fini,
733 .cio_iter_init = lov_io_rw_iter_init,
734 .cio_iter_fini = lov_io_iter_fini,
735 .cio_lock = lov_io_lock,
736 .cio_unlock = lov_io_unlock,
737 .cio_start = lov_io_start,
738 .cio_end = lov_io_end
741 .cio_fini = lov_io_fini,
742 .cio_iter_init = lov_io_rw_iter_init,
743 .cio_iter_fini = lov_io_iter_fini,
744 .cio_lock = lov_io_lock,
745 .cio_unlock = lov_io_unlock,
746 .cio_start = lov_io_start,
747 .cio_end = lov_io_end
750 .cio_fini = lov_io_fini,
751 .cio_iter_init = lov_io_iter_init,
752 .cio_iter_fini = lov_io_iter_fini,
753 .cio_lock = lov_io_lock,
754 .cio_unlock = lov_io_unlock,
755 .cio_start = lov_io_start,
756 .cio_end = lov_io_end
759 .cio_fini = lov_io_fini,
760 .cio_iter_init = lov_io_iter_init,
761 .cio_iter_fini = lov_io_iter_fini,
762 .cio_lock = lov_io_lock,
763 .cio_unlock = lov_io_unlock,
764 .cio_start = lov_io_fault_start,
765 .cio_end = lov_io_end
768 .cio_fini = lov_io_fini
773 .cio_submit = lov_io_submit
776 .cio_submit = lov_io_submit
779 .cio_prepare_write = lov_io_prepare_write,
780 .cio_commit_write = lov_io_commit_write
783 /*****************************************************************************
785 * Empty lov io operations.
789 static void lov_empty_io_fini(const struct lu_env *env,
790 const struct cl_io_slice *ios)
796 static void lov_empty_impossible(const struct lu_env *env,
797 struct cl_io_slice *ios)
802 #define LOV_EMPTY_IMPOSSIBLE ((void *)lov_empty_impossible)
805 * An io operation vector for files without stripes.
807 static const struct cl_io_operations lov_empty_io_ops = {
811 .cio_fini = lov_empty_io_fini,
812 .cio_iter_init = LOV_EMPTY_IMPOSSIBLE,
813 .cio_lock = LOV_EMPTY_IMPOSSIBLE,
814 .cio_start = LOV_EMPTY_IMPOSSIBLE,
815 .cio_end = LOV_EMPTY_IMPOSSIBLE
819 .cio_fini = lov_empty_io_fini,
820 .cio_iter_init = LOV_EMPTY_IMPOSSIBLE,
821 .cio_lock = LOV_EMPTY_IMPOSSIBLE,
822 .cio_start = LOV_EMPTY_IMPOSSIBLE,
823 .cio_end = LOV_EMPTY_IMPOSSIBLE
826 .cio_fini = lov_empty_io_fini,
827 .cio_iter_init = LOV_EMPTY_IMPOSSIBLE,
828 .cio_lock = LOV_EMPTY_IMPOSSIBLE,
829 .cio_start = LOV_EMPTY_IMPOSSIBLE,
830 .cio_end = LOV_EMPTY_IMPOSSIBLE
833 .cio_fini = lov_empty_io_fini,
834 .cio_iter_init = LOV_EMPTY_IMPOSSIBLE,
835 .cio_lock = LOV_EMPTY_IMPOSSIBLE,
836 .cio_start = LOV_EMPTY_IMPOSSIBLE,
837 .cio_end = LOV_EMPTY_IMPOSSIBLE
840 .cio_fini = lov_empty_io_fini
845 .cio_submit = LOV_EMPTY_IMPOSSIBLE
848 .cio_submit = LOV_EMPTY_IMPOSSIBLE
851 .cio_commit_write = LOV_EMPTY_IMPOSSIBLE
854 int lov_io_init_raid0(const struct lu_env *env, struct cl_object *obj,
857 struct lov_io *lio = lov_env_io(env);
858 struct lov_object *lov = cl2lov(obj);
861 CFS_INIT_LIST_HEAD(&lio->lis_active);
862 lov_io_slice_init(lio, lov, io);
863 if (io->ci_result == 0) {
864 LASSERT(lov_r0(lov)->lo_lsm != NULL);
865 io->ci_result = lov_io_subio_init(env, lio, io);
866 if (io->ci_result == 0)
867 cl_io_slice_add(io, &lio->lis_cl, obj, &lov_io_ops);
869 RETURN(io->ci_result);
872 int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj,
875 struct lov_io *lio = lov_env_io(env);
879 switch (io->ci_type) {
892 CERROR("Page fault on a file without stripes: "DFID"\n",
893 PFID(lu_object_fid(&obj->co_lu)));
897 cl_io_slice_add(io, &lio->lis_cl, obj, &lov_empty_io_ops);
898 io->ci_result = result;