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;
152 * First sub-io. Use ->lis_single_subio and current environment, to
153 * avoid dynamic allocation.
155 if (lio->lis_active_subios == 0) {
156 sub->sub_io = &lio->lis_single_subio;
157 lio->lis_single_subio_index = stripe;
158 sub->sub_env = cl_env_get(&sub->sub_refcheck);
159 LASSERT(sub->sub_env == env);
160 } else if (lio->lis_mem_frozen) {
161 LASSERT(mutex_is_locked(&ld->ld_mutex));
162 sub->sub_io = &ld->ld_emrg[stripe]->emrg_subio;
163 sub->sub_env = ld->ld_emrg[stripe]->emrg_env;
164 sub->sub_borrowed = 1;
168 /* obtain new environment */
169 cookie = cl_env_reenter();
170 sub->sub_env = cl_env_get(&sub->sub_refcheck);
171 cl_env_reexit(cookie);
173 OBD_ALLOC_PTR(sub->sub_io);
174 if (IS_ERR(sub->sub_env))
175 result = PTR_ERR(sub->sub_env);
176 else if (sub->sub_io == NULL)
181 sub_obj = lovsub2cl(lov_r0(lov)->lo_sub[stripe]);
182 sub_io = sub->sub_io;
184 sub_io->ci_obj = sub_obj;
185 sub_io->ci_result = 0;
187 sub_io->ci_parent = io;
188 sub_io->ci_lockreq = io->ci_lockreq;
189 sub_io->ci_type = io->ci_type;
190 sub_io->ci_no_srvlock = io->ci_no_srvlock;
193 result = cl_io_sub_init(sub->sub_env, sub_io,
194 io->ci_type, sub_obj);
197 lio->lis_active_subios++;
198 sub->sub_io_initialized = 1;
203 lov_io_sub_fini(env, lio, sub);
207 struct lov_io_sub *lov_sub_get(const struct lu_env *env,
208 struct lov_io *lio, int stripe)
211 struct lov_io_sub *sub = &lio->lis_subs[stripe];
213 LASSERT(stripe < lio->lis_stripe_count);
216 if (!sub->sub_io_initialized) {
217 sub->sub_stripe = stripe;
218 rc = lov_io_sub_init(env, lio, sub);
228 void lov_sub_put(struct lov_io_sub *sub)
233 /*****************************************************************************
239 static int lov_page_stripe(const struct cl_page *page)
241 struct lovsub_object *subobj;
245 lu_object_locate(page->cp_child->cp_obj->co_lu.lo_header,
246 &lovsub_device_type));
247 LASSERT(subobj != NULL);
248 RETURN(subobj->lso_index);
251 struct lov_io_sub *lov_page_subio(const struct lu_env *env, struct lov_io *lio,
252 const struct cl_page_slice *slice)
254 struct lov_stripe_md *lsm = lov_r0(lio->lis_object)->lo_lsm;
255 struct cl_page *page = slice->cpl_page;
258 LASSERT(lio->lis_cl.cis_io != NULL);
259 LASSERT(cl2lov(slice->cpl_obj) == lio->lis_object);
260 LASSERT(lsm != NULL);
261 LASSERT(lio->lis_nr_subios > 0);
264 stripe = lov_page_stripe(page);
265 RETURN(lov_sub_get(env, lio, stripe));
269 static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio,
272 struct lov_object *lov = lio->lis_object;
273 struct lov_stripe_md *lsm = lov_r0(lov)->lo_lsm;
276 LASSERT(lio->lis_object != NULL);
280 * Need to be optimized, we can't afford to allocate a piece of memory
281 * when writing a page. -jay
283 OBD_ALLOC(lio->lis_subs,
284 lsm->lsm_stripe_count * sizeof lio->lis_subs[0]);
285 if (lio->lis_subs != NULL) {
286 lio->lis_nr_subios = lio->lis_stripe_count;
287 lio->lis_single_subio_index = -1;
288 lio->lis_active_subios = 0;
295 static void lov_io_slice_init(struct lov_io *lio,
296 struct lov_object *obj, struct cl_io *io)
298 struct lov_stripe_md *lsm = lov_r0(obj)->lo_lsm;
300 LASSERT(lsm != NULL);
304 lio->lis_object = obj;
305 lio->lis_stripe_count = lsm->lsm_stripe_count;
307 switch (io->ci_type) {
310 lio->lis_pos = io->u.ci_rw.crw_pos;
311 lio->lis_endpos = io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count;
312 lio->lis_io_endpos = lio->lis_endpos;
313 if (cl_io_is_append(io)) {
314 LASSERT(io->ci_type == CIT_WRITE);
316 lio->lis_endpos = OBD_OBJECT_EOF;
321 lio->lis_pos = io->u.ci_truncate.tr_size;
322 lio->lis_endpos = OBD_OBJECT_EOF;
326 pgoff_t index = io->u.ci_fault.ft_index;
327 lio->lis_pos = cl_offset(io->ci_obj, index);
328 lio->lis_endpos = cl_offset(io->ci_obj, index + 1);
334 lio->lis_endpos = OBD_OBJECT_EOF;
344 static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)
346 struct lov_io *lio = cl2lov_io(env, ios);
350 if (lio->lis_subs != NULL) {
351 for (i = 0; i < lio->lis_nr_subios; i++)
352 lov_io_sub_fini(env, lio, &lio->lis_subs[i]);
353 OBD_FREE(lio->lis_subs,
354 lio->lis_nr_subios * sizeof lio->lis_subs[0]);
355 lio->lis_nr_subios = 0;
360 static obd_off lov_offset_mod(obd_off val, int delta)
362 if (val != OBD_OBJECT_EOF)
367 static int lov_io_iter_init(const struct lu_env *env,
368 const struct cl_io_slice *ios)
370 struct lov_io *lio = cl2lov_io(env, ios);
371 struct lov_stripe_md *lsm = lov_r0(lio->lis_object)->lo_lsm;
372 struct lov_io_sub *sub;
380 endpos = lov_offset_mod(lio->lis_endpos, -1);
381 for (stripe = 0; stripe < lio->lis_stripe_count; stripe++) {
382 if (!lov_stripe_intersects(lsm, stripe, lio->lis_pos,
383 endpos, &start, &end))
386 end = lov_offset_mod(end, +1);
387 sub = lov_sub_get(env, lio, stripe);
389 lov_io_sub_inherit(sub->sub_io, lio, stripe,
391 rc = cl_io_iter_init(sub->sub_env, sub->sub_io);
393 CDEBUG(D_VFSTRACE, "shrink: %i [%llu, %llu)\n",
399 list_add_tail(&sub->sub_linkage, &lio->lis_active);
406 static int lov_io_rw_iter_init(const struct lu_env *env,
407 const struct cl_io_slice *ios)
409 struct lov_io *lio = cl2lov_io(env, ios);
410 struct cl_io *io = ios->cis_io;
411 struct lov_stripe_md *lsm = lov_r0(cl2lov(ios->cis_obj))->lo_lsm;
412 loff_t start = io->u.ci_rw.crw_pos;
414 unsigned long ssize = lsm->lsm_stripe_size;
416 LASSERT(io->ci_type == CIT_READ || io->ci_type == CIT_WRITE);
419 /* fast path for common case. */
420 if (lio->lis_nr_subios != 1 && !cl_io_is_append(io)) {
422 do_div(start, ssize);
423 next = (start + 1) * ssize;
424 if (next <= start * ssize)
427 io->ci_continue = next < lio->lis_io_endpos;
428 io->u.ci_rw.crw_count = min_t(loff_t, lio->lis_io_endpos,
429 next) - io->u.ci_rw.crw_pos;
430 lio->lis_pos = io->u.ci_rw.crw_pos;
431 lio->lis_endpos = io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count;
432 CDEBUG(D_VFSTRACE, "stripe: %llu chunk: [%llu, %llu) %llu\n",
433 (__u64)start, lio->lis_pos, lio->lis_endpos,
434 (__u64)lio->lis_io_endpos);
437 * XXX The following call should be optimized: we know, that
438 * [lio->lis_pos, lio->lis_endpos) intersects with exactly one stripe.
440 RETURN(lov_io_iter_init(env, ios));
443 static int lov_io_call(const struct lu_env *env, struct lov_io *lio,
444 int (*iofunc)(const struct lu_env *, struct cl_io *))
446 struct lov_io_sub *sub;
450 list_for_each_entry(sub, &lio->lis_active, sub_linkage) {
452 rc = iofunc(sub->sub_env, sub->sub_io);
460 static int lov_io_lock(const struct lu_env *env, const struct cl_io_slice *ios)
463 RETURN(lov_io_call(env, cl2lov_io(env, ios), cl_io_lock));
466 static int lov_io_start(const struct lu_env *env, const struct cl_io_slice *ios)
469 RETURN(lov_io_call(env, cl2lov_io(env, ios), cl_io_start));
472 static int lov_io_end_wrapper(const struct lu_env *env, struct cl_io *io)
476 * It's possible that lov_io_start() wasn't called against this
477 * sub-io, either because previous sub-io failed, or upper layer
480 if (io->ci_state == CIS_IO_GOING)
483 io->ci_state = CIS_IO_FINISHED;
487 static int lov_io_iter_fini_wrapper(const struct lu_env *env, struct cl_io *io)
489 cl_io_iter_fini(env, io);
493 static int lov_io_unlock_wrapper(const struct lu_env *env, struct cl_io *io)
495 cl_io_unlock(env, io);
499 static void lov_io_end(const struct lu_env *env, const struct cl_io_slice *ios)
503 rc = lov_io_call(env, cl2lov_io(env, ios), lov_io_end_wrapper);
507 static void lov_io_iter_fini(const struct lu_env *env,
508 const struct cl_io_slice *ios)
510 struct lov_io *lio = cl2lov_io(env, ios);
514 rc = lov_io_call(env, lio, lov_io_iter_fini_wrapper);
516 while (!list_empty(&lio->lis_active))
517 list_del_init(lio->lis_active.next);
521 static void lov_io_unlock(const struct lu_env *env,
522 const struct cl_io_slice *ios)
527 rc = lov_io_call(env, cl2lov_io(env, ios), lov_io_unlock_wrapper);
533 static struct cl_page_list *lov_io_submit_qin(struct lov_device *ld,
534 struct cl_page_list *qin,
537 return alloc ? &qin[idx] : &ld->ld_emrg[idx]->emrg_page_list;
541 * lov implementation of cl_operations::cio_submit() method. It takes a list
542 * of pages in \a queue, splits it into per-stripe sub-lists, invokes
543 * cl_io_submit() on underlying devices to submit sub-lists, and then splices
546 * Major complication of this function is a need to handle memory cleansing:
547 * cl_io_submit() is called to write out pages as a part of VM memory
548 * reclamation, and hence it may not fail due to memory shortages (system
549 * dead-locks otherwise). To deal with this, some resources (sub-lists,
550 * sub-environment, etc.) are allocated per-device on "startup" (i.e., in a
551 * not-memory cleansing context), and in case of memory shortage, these
552 * pre-allocated resources are used by lov_io_submit() under
553 * lov_device::ld_mutex mutex.
555 static int lov_io_submit(const struct lu_env *env,
556 const struct cl_io_slice *ios,
557 enum cl_req_type crt, struct cl_2queue *queue,
558 enum cl_req_priority priority)
560 struct lov_io *lio = cl2lov_io(env, ios);
561 struct lov_object *obj = lio->lis_object;
562 struct lov_device *ld = lu2lov_dev(lov2cl(obj)->co_lu.lo_dev);
563 struct cl_page_list *qin = &queue->c2_qin;
564 struct cl_2queue *cl2q = &lov_env_info(env)->lti_cl2q;
565 struct cl_page_list *stripes_qin = NULL;
566 struct cl_page *page;
570 #define QIN(stripe) lov_io_submit_qin(ld, stripes_qin, stripe, alloc)
574 #if defined(__KERNEL__) && defined(__linux__)
575 !(current->flags & PF_MEMALLOC);
580 if (lio->lis_active_subios == 1) {
581 int idx = lio->lis_single_subio_index;
582 struct lov_io_sub *sub;
584 LASSERT(idx < lio->lis_nr_subios);
585 sub = lov_sub_get(env, lio, idx);
586 LASSERT(!IS_ERR(sub));
587 LASSERT(sub->sub_io == &lio->lis_single_subio);
588 rc = cl_io_submit_rw(sub->sub_env, sub->sub_io,
589 crt, queue, priority);
594 LASSERT(lio->lis_subs != NULL);
596 OBD_ALLOC(stripes_qin,
597 sizeof(*stripes_qin) * lio->lis_nr_subios);
598 if (stripes_qin == NULL)
601 for (stripe = 0; stripe < lio->lis_nr_subios; stripe++)
602 cl_page_list_init(&stripes_qin[stripe]);
605 * If we get here, it means pageout & swap doesn't help.
606 * In order to not make things worse, even don't try to
607 * allocate the memory with __GFP_NOWARN. -jay
609 mutex_lock(&ld->ld_mutex);
610 lio->lis_mem_frozen = 1;
613 cl_2queue_init(cl2q);
614 cl_page_list_for_each_safe(page, tmp, qin) {
615 stripe = lov_page_stripe(page);
616 cl_page_list_move(QIN(stripe), qin, page);
619 for (stripe = 0; stripe < lio->lis_nr_subios; stripe++) {
620 struct lov_io_sub *sub;
621 struct cl_page_list *sub_qin = QIN(stripe);
623 if (list_empty(&sub_qin->pl_pages))
626 cl_page_list_splice(sub_qin, &cl2q->c2_qin);
627 sub = lov_sub_get(env, lio, stripe);
629 rc = cl_io_submit_rw(sub->sub_env, sub->sub_io,
630 crt, cl2q, priority);
634 cl_page_list_splice(&cl2q->c2_qin, &queue->c2_qin);
635 cl_page_list_splice(&cl2q->c2_qout, &queue->c2_qout);
640 for (stripe = 0; stripe < lio->lis_nr_subios; stripe++) {
641 struct cl_page_list *sub_qin = QIN(stripe);
643 if (list_empty(&sub_qin->pl_pages))
646 cl_page_list_splice(sub_qin, qin);
650 OBD_FREE(stripes_qin,
651 sizeof(*stripes_qin) * lio->lis_nr_subios);
655 for (i = 0; i < lio->lis_nr_subios; i++) {
656 struct cl_io *cio = lio->lis_subs[i].sub_io;
658 if (cio && cio == &ld->ld_emrg[i]->emrg_subio)
659 lov_io_sub_fini(env, lio, &lio->lis_subs[i]);
661 lio->lis_mem_frozen = 0;
662 mutex_unlock(&ld->ld_mutex);
669 static int lov_io_prepare_write(const struct lu_env *env,
670 const struct cl_io_slice *ios,
671 const struct cl_page_slice *slice,
672 unsigned from, unsigned to)
674 struct lov_io *lio = cl2lov_io(env, ios);
675 struct cl_page *sub_page = lov_sub_page(slice);
676 struct lov_io_sub *sub;
680 sub = lov_page_subio(env, lio, slice);
682 result = cl_io_prepare_write(sub->sub_env, sub->sub_io,
686 result = PTR_ERR(sub);
690 static int lov_io_commit_write(const struct lu_env *env,
691 const struct cl_io_slice *ios,
692 const struct cl_page_slice *slice,
693 unsigned from, unsigned to)
695 struct lov_io *lio = cl2lov_io(env, ios);
696 struct cl_page *sub_page = lov_sub_page(slice);
697 struct lov_io_sub *sub;
701 sub = lov_page_subio(env, lio, slice);
703 result = cl_io_commit_write(sub->sub_env, sub->sub_io,
707 result = PTR_ERR(sub);
711 static int lov_io_fault_start(const struct lu_env *env,
712 const struct cl_io_slice *ios)
714 struct cl_fault_io *fio;
716 struct lov_io_sub *sub;
719 fio = &ios->cis_io->u.ci_fault;
720 lio = cl2lov_io(env, ios);
721 sub = lov_sub_get(env, lio, lov_page_stripe(fio->ft_page));
722 sub->sub_io->u.ci_fault.ft_nob = fio->ft_nob;
724 RETURN(lov_io_start(env, ios));
727 static const struct cl_io_operations lov_io_ops = {
730 .cio_fini = lov_io_fini,
731 .cio_iter_init = lov_io_rw_iter_init,
732 .cio_iter_fini = lov_io_iter_fini,
733 .cio_lock = lov_io_lock,
734 .cio_unlock = lov_io_unlock,
735 .cio_start = lov_io_start,
736 .cio_end = lov_io_end
739 .cio_fini = lov_io_fini,
740 .cio_iter_init = lov_io_rw_iter_init,
741 .cio_iter_fini = lov_io_iter_fini,
742 .cio_lock = lov_io_lock,
743 .cio_unlock = lov_io_unlock,
744 .cio_start = lov_io_start,
745 .cio_end = lov_io_end
748 .cio_fini = lov_io_fini,
749 .cio_iter_init = lov_io_iter_init,
750 .cio_iter_fini = lov_io_iter_fini,
751 .cio_lock = lov_io_lock,
752 .cio_unlock = lov_io_unlock,
753 .cio_start = lov_io_start,
754 .cio_end = lov_io_end
757 .cio_fini = lov_io_fini,
758 .cio_iter_init = lov_io_iter_init,
759 .cio_iter_fini = lov_io_iter_fini,
760 .cio_lock = lov_io_lock,
761 .cio_unlock = lov_io_unlock,
762 .cio_start = lov_io_fault_start,
763 .cio_end = lov_io_end
766 .cio_fini = lov_io_fini
771 .cio_submit = lov_io_submit
774 .cio_submit = lov_io_submit
777 .cio_prepare_write = lov_io_prepare_write,
778 .cio_commit_write = lov_io_commit_write
781 /*****************************************************************************
783 * Empty lov io operations.
787 static void lov_empty_io_fini(const struct lu_env *env,
788 const struct cl_io_slice *ios)
794 static void lov_empty_impossible(const struct lu_env *env,
795 struct cl_io_slice *ios)
800 #define LOV_EMPTY_IMPOSSIBLE ((void *)lov_empty_impossible)
803 * An io operation vector for files without stripes.
805 static const struct cl_io_operations lov_empty_io_ops = {
809 .cio_fini = lov_empty_io_fini,
810 .cio_iter_init = LOV_EMPTY_IMPOSSIBLE,
811 .cio_lock = LOV_EMPTY_IMPOSSIBLE,
812 .cio_start = LOV_EMPTY_IMPOSSIBLE,
813 .cio_end = LOV_EMPTY_IMPOSSIBLE
817 .cio_fini = lov_empty_io_fini,
818 .cio_iter_init = LOV_EMPTY_IMPOSSIBLE,
819 .cio_lock = LOV_EMPTY_IMPOSSIBLE,
820 .cio_start = LOV_EMPTY_IMPOSSIBLE,
821 .cio_end = LOV_EMPTY_IMPOSSIBLE
824 .cio_fini = lov_empty_io_fini,
825 .cio_iter_init = LOV_EMPTY_IMPOSSIBLE,
826 .cio_lock = LOV_EMPTY_IMPOSSIBLE,
827 .cio_start = LOV_EMPTY_IMPOSSIBLE,
828 .cio_end = LOV_EMPTY_IMPOSSIBLE
831 .cio_fini = lov_empty_io_fini,
832 .cio_iter_init = LOV_EMPTY_IMPOSSIBLE,
833 .cio_lock = LOV_EMPTY_IMPOSSIBLE,
834 .cio_start = LOV_EMPTY_IMPOSSIBLE,
835 .cio_end = LOV_EMPTY_IMPOSSIBLE
838 .cio_fini = lov_empty_io_fini
843 .cio_submit = LOV_EMPTY_IMPOSSIBLE
846 .cio_submit = LOV_EMPTY_IMPOSSIBLE
849 .cio_commit_write = LOV_EMPTY_IMPOSSIBLE
852 int lov_io_init_raid0(const struct lu_env *env, struct cl_object *obj,
855 struct lov_io *lio = lov_env_io(env);
856 struct lov_object *lov = cl2lov(obj);
859 CFS_INIT_LIST_HEAD(&lio->lis_active);
860 lov_io_slice_init(lio, lov, io);
861 if (io->ci_result == 0) {
862 LASSERT(lov_r0(lov)->lo_lsm != NULL);
863 io->ci_result = lov_io_subio_init(env, lio, io);
864 if (io->ci_result == 0)
865 cl_io_slice_add(io, &lio->lis_cl, obj, &lov_io_ops);
867 RETURN(io->ci_result);
870 int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj,
873 struct lov_io *lio = lov_env_io(env);
877 switch (io->ci_type) {
890 CERROR("Page fault on a file without stripes: "DFID"\n",
891 PFID(lu_object_fid(&obj->co_lu)));
895 cl_io_slice_add(io, &lio->lis_cl, obj, &lov_empty_io_ops);
896 io->ci_result = result;