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 (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
30 * Use is subject to license terms.
32 * Copyright (c) 2011, Whamcloud, Inc.
35 * This file is part of Lustre, http://www.lustre.org/
36 * Lustre is a trademark of Sun Microsystems, Inc.
38 * Implementation of cl_io for LOV layer.
40 * Author: Nikita Danilov <nikita.danilov@sun.com>
43 #define DEBUG_SUBSYSTEM S_LOV
45 #include "lov_cl_internal.h"
51 static inline void lov_sub_enter(struct lov_io_sub *sub)
55 static inline void lov_sub_exit(struct lov_io_sub *sub)
60 static void lov_io_sub_fini(const struct lu_env *env, struct lov_io *lio,
61 struct lov_io_sub *sub)
64 if (sub->sub_io != NULL) {
65 if (sub->sub_io_initialized) {
67 cl_io_fini(sub->sub_env, sub->sub_io);
69 sub->sub_io_initialized = 0;
70 lio->lis_active_subios--;
72 if (sub->sub_stripe == lio->lis_single_subio_index)
73 lio->lis_single_subio_index = -1;
74 else if (!sub->sub_borrowed)
75 OBD_FREE_PTR(sub->sub_io);
78 if (sub->sub_env != NULL && !IS_ERR(sub->sub_env)) {
79 if (!sub->sub_borrowed)
80 cl_env_put(sub->sub_env, &sub->sub_refcheck);
86 static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio,
87 int stripe, loff_t start, loff_t end)
89 struct lov_stripe_md *lsm = lov_r0(lio->lis_object)->lo_lsm;
90 struct cl_io *parent = lio->lis_cl.cis_io;
94 io->u.ci_setattr.sa_attr = parent->u.ci_setattr.sa_attr;
95 io->u.ci_setattr.sa_valid = parent->u.ci_setattr.sa_valid;
96 io->u.ci_setattr.sa_capa = parent->u.ci_setattr.sa_capa;
97 if (cl_io_is_trunc(io)) {
98 loff_t new_size = parent->u.ci_setattr.sa_attr.lvb_size;
100 new_size = lov_size_to_stripe(lsm, new_size, stripe);
101 io->u.ci_setattr.sa_attr.lvb_size = new_size;
106 struct cl_object *obj = parent->ci_obj;
107 loff_t off = cl_offset(obj, parent->u.ci_fault.ft_index);
109 io->u.ci_fault = parent->u.ci_fault;
110 off = lov_size_to_stripe(lsm, off, stripe);
111 io->u.ci_fault.ft_index = cl_index(obj, off);
116 if (cl_io_is_append(parent)) {
117 io->u.ci_wr.wr_append = 1;
119 io->u.ci_rw.crw_pos = start;
120 io->u.ci_rw.crw_count = end - start;
129 static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio,
130 struct lov_io_sub *sub)
132 struct lov_object *lov = lio->lis_object;
133 struct lov_device *ld = lu2lov_dev(lov2cl(lov)->co_lu.lo_dev);
134 struct cl_io *sub_io;
135 struct cl_object *sub_obj;
136 struct cl_io *io = lio->lis_cl.cis_io;
138 int stripe = sub->sub_stripe;
141 LASSERT(sub->sub_io == NULL);
142 LASSERT(sub->sub_env == NULL);
143 LASSERT(sub->sub_stripe < lio->lis_stripe_count);
147 sub->sub_io_initialized = 0;
148 sub->sub_borrowed = 0;
150 if (lio->lis_mem_frozen) {
151 LASSERT(cfs_mutex_is_locked(&ld->ld_mutex));
152 sub->sub_io = &ld->ld_emrg[stripe]->emrg_subio;
153 sub->sub_env = ld->ld_emrg[stripe]->emrg_env;
154 sub->sub_borrowed = 1;
158 /* obtain new environment */
159 cookie = cl_env_reenter();
160 sub->sub_env = cl_env_get(&sub->sub_refcheck);
161 cl_env_reexit(cookie);
162 if (IS_ERR(sub->sub_env))
163 result = PTR_ERR(sub->sub_env);
167 * First sub-io. Use ->lis_single_subio to
168 * avoid dynamic allocation.
170 if (lio->lis_active_subios == 0) {
171 sub->sub_io = &lio->lis_single_subio;
172 lio->lis_single_subio_index = stripe;
174 OBD_ALLOC_PTR(sub->sub_io);
175 if (sub->sub_io == NULL)
182 sub_obj = lovsub2cl(lov_r0(lov)->lo_sub[stripe]);
183 sub_io = sub->sub_io;
185 sub_io->ci_obj = sub_obj;
186 sub_io->ci_result = 0;
188 sub_io->ci_parent = io;
189 sub_io->ci_lockreq = io->ci_lockreq;
190 sub_io->ci_type = io->ci_type;
191 sub_io->ci_no_srvlock = io->ci_no_srvlock;
194 result = cl_io_sub_init(sub->sub_env, sub_io,
195 io->ci_type, sub_obj);
198 lio->lis_active_subios++;
199 sub->sub_io_initialized = 1;
204 lov_io_sub_fini(env, lio, sub);
208 struct lov_io_sub *lov_sub_get(const struct lu_env *env,
209 struct lov_io *lio, int stripe)
212 struct lov_io_sub *sub = &lio->lis_subs[stripe];
214 LASSERT(stripe < lio->lis_stripe_count);
217 if (!sub->sub_io_initialized) {
218 sub->sub_stripe = stripe;
219 rc = lov_io_sub_init(env, lio, sub);
229 void lov_sub_put(struct lov_io_sub *sub)
234 /*****************************************************************************
240 static int lov_page_stripe(const struct cl_page *page)
242 struct lovsub_object *subobj;
246 lu_object_locate(page->cp_child->cp_obj->co_lu.lo_header,
247 &lovsub_device_type));
248 LASSERT(subobj != NULL);
249 RETURN(subobj->lso_index);
252 struct lov_io_sub *lov_page_subio(const struct lu_env *env, struct lov_io *lio,
253 const struct cl_page_slice *slice)
255 struct lov_stripe_md *lsm = lov_r0(lio->lis_object)->lo_lsm;
256 struct cl_page *page = slice->cpl_page;
259 LASSERT(lio->lis_cl.cis_io != NULL);
260 LASSERT(cl2lov(slice->cpl_obj) == lio->lis_object);
261 LASSERT(lsm != NULL);
262 LASSERT(lio->lis_nr_subios > 0);
265 stripe = lov_page_stripe(page);
266 RETURN(lov_sub_get(env, lio, stripe));
270 static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio,
273 struct lov_object *lov = lio->lis_object;
274 struct lov_stripe_md *lsm = lov_r0(lov)->lo_lsm;
277 LASSERT(lio->lis_object != NULL);
281 * Need to be optimized, we can't afford to allocate a piece of memory
282 * when writing a page. -jay
284 OBD_ALLOC_LARGE(lio->lis_subs,
285 lsm->lsm_stripe_count * sizeof lio->lis_subs[0]);
286 if (lio->lis_subs != NULL) {
287 lio->lis_nr_subios = lio->lis_stripe_count;
288 lio->lis_single_subio_index = -1;
289 lio->lis_active_subios = 0;
296 static void lov_io_slice_init(struct lov_io *lio,
297 struct lov_object *obj, struct cl_io *io)
299 struct lov_stripe_md *lsm = lov_r0(obj)->lo_lsm;
301 LASSERT(lsm != NULL);
305 lio->lis_object = obj;
306 lio->lis_stripe_count = lsm->lsm_stripe_count;
308 switch (io->ci_type) {
311 lio->lis_pos = io->u.ci_rw.crw_pos;
312 lio->lis_endpos = io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count;
313 lio->lis_io_endpos = lio->lis_endpos;
314 if (cl_io_is_append(io)) {
315 LASSERT(io->ci_type == CIT_WRITE);
317 lio->lis_endpos = OBD_OBJECT_EOF;
322 if (cl_io_is_trunc(io))
323 lio->lis_pos = io->u.ci_setattr.sa_attr.lvb_size;
326 lio->lis_endpos = OBD_OBJECT_EOF;
330 pgoff_t index = io->u.ci_fault.ft_index;
331 lio->lis_pos = cl_offset(io->ci_obj, index);
332 lio->lis_endpos = cl_offset(io->ci_obj, index + 1);
338 lio->lis_endpos = OBD_OBJECT_EOF;
348 static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)
350 struct lov_io *lio = cl2lov_io(env, ios);
354 if (lio->lis_subs != NULL) {
355 for (i = 0; i < lio->lis_nr_subios; i++)
356 lov_io_sub_fini(env, lio, &lio->lis_subs[i]);
357 OBD_FREE_LARGE(lio->lis_subs,
358 lio->lis_nr_subios * sizeof lio->lis_subs[0]);
359 lio->lis_nr_subios = 0;
364 static obd_off lov_offset_mod(obd_off val, int delta)
366 if (val != OBD_OBJECT_EOF)
371 static int lov_io_iter_init(const struct lu_env *env,
372 const struct cl_io_slice *ios)
374 struct lov_io *lio = cl2lov_io(env, ios);
375 struct lov_stripe_md *lsm = lov_r0(lio->lis_object)->lo_lsm;
376 struct lov_io_sub *sub;
384 endpos = lov_offset_mod(lio->lis_endpos, -1);
385 for (stripe = 0; stripe < lio->lis_stripe_count; stripe++) {
386 if (!lov_stripe_intersects(lsm, stripe, lio->lis_pos,
387 endpos, &start, &end))
390 end = lov_offset_mod(end, +1);
391 sub = lov_sub_get(env, lio, stripe);
393 lov_io_sub_inherit(sub->sub_io, lio, stripe,
395 rc = cl_io_iter_init(sub->sub_env, sub->sub_io);
397 CDEBUG(D_VFSTRACE, "shrink: %d ["LPU64", "LPU64")\n",
403 cfs_list_add_tail(&sub->sub_linkage, &lio->lis_active);
410 static int lov_io_rw_iter_init(const struct lu_env *env,
411 const struct cl_io_slice *ios)
413 struct lov_io *lio = cl2lov_io(env, ios);
414 struct cl_io *io = ios->cis_io;
415 struct lov_stripe_md *lsm = lov_r0(cl2lov(ios->cis_obj))->lo_lsm;
416 loff_t start = io->u.ci_rw.crw_pos;
418 unsigned long ssize = lsm->lsm_stripe_size;
420 LASSERT(io->ci_type == CIT_READ || io->ci_type == CIT_WRITE);
423 /* fast path for common case. */
424 if (lio->lis_nr_subios != 1 && !cl_io_is_append(io)) {
426 do_div(start, ssize);
427 next = (start + 1) * ssize;
428 if (next <= start * ssize)
431 io->ci_continue = next < lio->lis_io_endpos;
432 io->u.ci_rw.crw_count = min_t(loff_t, lio->lis_io_endpos,
433 next) - io->u.ci_rw.crw_pos;
434 lio->lis_pos = io->u.ci_rw.crw_pos;
435 lio->lis_endpos = io->u.ci_rw.crw_pos + io->u.ci_rw.crw_count;
436 CDEBUG(D_VFSTRACE, "stripe: "LPU64" chunk: ["LPU64", "LPU64") "LPU64"\n",
437 (__u64)start, lio->lis_pos, lio->lis_endpos,
438 (__u64)lio->lis_io_endpos);
441 * XXX The following call should be optimized: we know, that
442 * [lio->lis_pos, lio->lis_endpos) intersects with exactly one stripe.
444 RETURN(lov_io_iter_init(env, ios));
447 static int lov_io_call(const struct lu_env *env, struct lov_io *lio,
448 int (*iofunc)(const struct lu_env *, struct cl_io *))
450 struct lov_io_sub *sub;
454 cfs_list_for_each_entry(sub, &lio->lis_active, sub_linkage) {
456 rc = iofunc(sub->sub_env, sub->sub_io);
464 static int lov_io_lock(const struct lu_env *env, const struct cl_io_slice *ios)
467 RETURN(lov_io_call(env, cl2lov_io(env, ios), cl_io_lock));
470 static int lov_io_start(const struct lu_env *env, const struct cl_io_slice *ios)
473 RETURN(lov_io_call(env, cl2lov_io(env, ios), cl_io_start));
476 static int lov_io_end_wrapper(const struct lu_env *env, struct cl_io *io)
480 * It's possible that lov_io_start() wasn't called against this
481 * sub-io, either because previous sub-io failed, or upper layer
484 if (io->ci_state == CIS_IO_GOING)
487 io->ci_state = CIS_IO_FINISHED;
491 static int lov_io_iter_fini_wrapper(const struct lu_env *env, struct cl_io *io)
493 cl_io_iter_fini(env, io);
497 static int lov_io_unlock_wrapper(const struct lu_env *env, struct cl_io *io)
499 cl_io_unlock(env, io);
503 static void lov_io_end(const struct lu_env *env, const struct cl_io_slice *ios)
507 rc = lov_io_call(env, cl2lov_io(env, ios), lov_io_end_wrapper);
511 static void lov_io_iter_fini(const struct lu_env *env,
512 const struct cl_io_slice *ios)
514 struct lov_io *lio = cl2lov_io(env, ios);
518 rc = lov_io_call(env, lio, lov_io_iter_fini_wrapper);
520 while (!cfs_list_empty(&lio->lis_active))
521 cfs_list_del_init(lio->lis_active.next);
525 static void lov_io_unlock(const struct lu_env *env,
526 const struct cl_io_slice *ios)
531 rc = lov_io_call(env, cl2lov_io(env, ios), lov_io_unlock_wrapper);
537 static struct cl_page_list *lov_io_submit_qin(struct lov_device *ld,
538 struct cl_page_list *qin,
541 return alloc ? &qin[idx] : &ld->ld_emrg[idx]->emrg_page_list;
545 * lov implementation of cl_operations::cio_submit() method. It takes a list
546 * of pages in \a queue, splits it into per-stripe sub-lists, invokes
547 * cl_io_submit() on underlying devices to submit sub-lists, and then splices
550 * Major complication of this function is a need to handle memory cleansing:
551 * cl_io_submit() is called to write out pages as a part of VM memory
552 * reclamation, and hence it may not fail due to memory shortages (system
553 * dead-locks otherwise). To deal with this, some resources (sub-lists,
554 * sub-environment, etc.) are allocated per-device on "startup" (i.e., in a
555 * not-memory cleansing context), and in case of memory shortage, these
556 * pre-allocated resources are used by lov_io_submit() under
557 * lov_device::ld_mutex mutex.
559 static int lov_io_submit(const struct lu_env *env,
560 const struct cl_io_slice *ios,
561 enum cl_req_type crt, struct cl_2queue *queue,
562 enum cl_req_priority priority)
564 struct lov_io *lio = cl2lov_io(env, ios);
565 struct lov_object *obj = lio->lis_object;
566 struct lov_device *ld = lu2lov_dev(lov2cl(obj)->co_lu.lo_dev);
567 struct cl_page_list *qin = &queue->c2_qin;
568 struct cl_2queue *cl2q = &lov_env_info(env)->lti_cl2q;
569 struct cl_page_list *stripes_qin = NULL;
570 struct cl_page *page;
574 #define QIN(stripe) lov_io_submit_qin(ld, stripes_qin, stripe, alloc)
578 #if defined(__KERNEL__) && defined(__linux__)
579 !(current->flags & PF_MEMALLOC);
584 if (lio->lis_active_subios == 1) {
585 int idx = lio->lis_single_subio_index;
586 struct lov_io_sub *sub;
588 LASSERT(idx < lio->lis_nr_subios);
589 sub = lov_sub_get(env, lio, idx);
590 LASSERT(!IS_ERR(sub));
591 LASSERT(sub->sub_io == &lio->lis_single_subio);
592 rc = cl_io_submit_rw(sub->sub_env, sub->sub_io,
593 crt, queue, priority);
598 LASSERT(lio->lis_subs != NULL);
600 OBD_ALLOC_LARGE(stripes_qin,
601 sizeof(*stripes_qin) * lio->lis_nr_subios);
602 if (stripes_qin == NULL)
605 for (stripe = 0; stripe < lio->lis_nr_subios; stripe++)
606 cl_page_list_init(&stripes_qin[stripe]);
609 * If we get here, it means pageout & swap doesn't help.
610 * In order to not make things worse, even don't try to
611 * allocate the memory with __GFP_NOWARN. -jay
613 cfs_mutex_lock(&ld->ld_mutex);
614 lio->lis_mem_frozen = 1;
617 cl_2queue_init(cl2q);
618 cl_page_list_for_each_safe(page, tmp, qin) {
619 stripe = lov_page_stripe(page);
620 cl_page_list_move(QIN(stripe), qin, page);
623 for (stripe = 0; stripe < lio->lis_nr_subios; stripe++) {
624 struct lov_io_sub *sub;
625 struct cl_page_list *sub_qin = QIN(stripe);
627 if (cfs_list_empty(&sub_qin->pl_pages))
630 cl_page_list_splice(sub_qin, &cl2q->c2_qin);
631 sub = lov_sub_get(env, lio, stripe);
633 rc = cl_io_submit_rw(sub->sub_env, sub->sub_io,
634 crt, cl2q, priority);
638 cl_page_list_splice(&cl2q->c2_qin, &queue->c2_qin);
639 cl_page_list_splice(&cl2q->c2_qout, &queue->c2_qout);
644 for (stripe = 0; stripe < lio->lis_nr_subios; stripe++) {
645 struct cl_page_list *sub_qin = QIN(stripe);
647 if (cfs_list_empty(&sub_qin->pl_pages))
650 cl_page_list_splice(sub_qin, qin);
654 OBD_FREE_LARGE(stripes_qin,
655 sizeof(*stripes_qin) * lio->lis_nr_subios);
659 for (i = 0; i < lio->lis_nr_subios; i++) {
660 struct cl_io *cio = lio->lis_subs[i].sub_io;
662 if (cio && cio == &ld->ld_emrg[i]->emrg_subio)
663 lov_io_sub_fini(env, lio, &lio->lis_subs[i]);
665 lio->lis_mem_frozen = 0;
666 cfs_mutex_unlock(&ld->ld_mutex);
673 static int lov_io_prepare_write(const struct lu_env *env,
674 const struct cl_io_slice *ios,
675 const struct cl_page_slice *slice,
676 unsigned from, unsigned to)
678 struct lov_io *lio = cl2lov_io(env, ios);
679 struct cl_page *sub_page = lov_sub_page(slice);
680 struct lov_io_sub *sub;
684 sub = lov_page_subio(env, lio, slice);
686 result = cl_io_prepare_write(sub->sub_env, sub->sub_io,
690 result = PTR_ERR(sub);
694 static int lov_io_commit_write(const struct lu_env *env,
695 const struct cl_io_slice *ios,
696 const struct cl_page_slice *slice,
697 unsigned from, unsigned to)
699 struct lov_io *lio = cl2lov_io(env, ios);
700 struct cl_page *sub_page = lov_sub_page(slice);
701 struct lov_io_sub *sub;
705 sub = lov_page_subio(env, lio, slice);
707 result = cl_io_commit_write(sub->sub_env, sub->sub_io,
711 result = PTR_ERR(sub);
715 static int lov_io_fault_start(const struct lu_env *env,
716 const struct cl_io_slice *ios)
718 struct cl_fault_io *fio;
720 struct lov_io_sub *sub;
723 fio = &ios->cis_io->u.ci_fault;
724 lio = cl2lov_io(env, ios);
725 sub = lov_sub_get(env, lio, lov_page_stripe(fio->ft_page));
726 sub->sub_io->u.ci_fault.ft_nob = fio->ft_nob;
728 RETURN(lov_io_start(env, ios));
731 static const struct cl_io_operations lov_io_ops = {
734 .cio_fini = lov_io_fini,
735 .cio_iter_init = lov_io_rw_iter_init,
736 .cio_iter_fini = lov_io_iter_fini,
737 .cio_lock = lov_io_lock,
738 .cio_unlock = lov_io_unlock,
739 .cio_start = lov_io_start,
740 .cio_end = lov_io_end
743 .cio_fini = lov_io_fini,
744 .cio_iter_init = lov_io_rw_iter_init,
745 .cio_iter_fini = lov_io_iter_fini,
746 .cio_lock = lov_io_lock,
747 .cio_unlock = lov_io_unlock,
748 .cio_start = lov_io_start,
749 .cio_end = lov_io_end
752 .cio_fini = lov_io_fini,
753 .cio_iter_init = lov_io_iter_init,
754 .cio_iter_fini = lov_io_iter_fini,
755 .cio_lock = lov_io_lock,
756 .cio_unlock = lov_io_unlock,
757 .cio_start = lov_io_start,
758 .cio_end = lov_io_end
761 .cio_fini = lov_io_fini,
762 .cio_iter_init = lov_io_iter_init,
763 .cio_iter_fini = lov_io_iter_fini,
764 .cio_lock = lov_io_lock,
765 .cio_unlock = lov_io_unlock,
766 .cio_start = lov_io_fault_start,
767 .cio_end = lov_io_end
770 .cio_fini = lov_io_fini
775 .cio_submit = lov_io_submit
778 .cio_submit = lov_io_submit
781 .cio_prepare_write = lov_io_prepare_write,
782 .cio_commit_write = lov_io_commit_write
785 /*****************************************************************************
787 * Empty lov io operations.
791 static void lov_empty_io_fini(const struct lu_env *env,
792 const struct cl_io_slice *ios)
798 static void lov_empty_impossible(const struct lu_env *env,
799 struct cl_io_slice *ios)
804 #define LOV_EMPTY_IMPOSSIBLE ((void *)lov_empty_impossible)
807 * An io operation vector for files without stripes.
809 static const struct cl_io_operations lov_empty_io_ops = {
813 .cio_fini = lov_empty_io_fini,
814 .cio_iter_init = LOV_EMPTY_IMPOSSIBLE,
815 .cio_lock = LOV_EMPTY_IMPOSSIBLE,
816 .cio_start = LOV_EMPTY_IMPOSSIBLE,
817 .cio_end = LOV_EMPTY_IMPOSSIBLE
821 .cio_fini = lov_empty_io_fini,
822 .cio_iter_init = LOV_EMPTY_IMPOSSIBLE,
823 .cio_lock = LOV_EMPTY_IMPOSSIBLE,
824 .cio_start = LOV_EMPTY_IMPOSSIBLE,
825 .cio_end = LOV_EMPTY_IMPOSSIBLE
828 .cio_fini = lov_empty_io_fini,
829 .cio_iter_init = LOV_EMPTY_IMPOSSIBLE,
830 .cio_lock = LOV_EMPTY_IMPOSSIBLE,
831 .cio_start = LOV_EMPTY_IMPOSSIBLE,
832 .cio_end = LOV_EMPTY_IMPOSSIBLE
835 .cio_fini = lov_empty_io_fini,
836 .cio_iter_init = LOV_EMPTY_IMPOSSIBLE,
837 .cio_lock = LOV_EMPTY_IMPOSSIBLE,
838 .cio_start = LOV_EMPTY_IMPOSSIBLE,
839 .cio_end = LOV_EMPTY_IMPOSSIBLE
842 .cio_fini = lov_empty_io_fini
847 .cio_submit = LOV_EMPTY_IMPOSSIBLE
850 .cio_submit = LOV_EMPTY_IMPOSSIBLE
853 .cio_commit_write = LOV_EMPTY_IMPOSSIBLE
856 int lov_io_init_raid0(const struct lu_env *env, struct cl_object *obj,
859 struct lov_io *lio = lov_env_io(env);
860 struct lov_object *lov = cl2lov(obj);
863 CFS_INIT_LIST_HEAD(&lio->lis_active);
864 lov_io_slice_init(lio, lov, io);
865 if (io->ci_result == 0) {
866 LASSERT(lov_r0(lov)->lo_lsm != NULL);
867 io->ci_result = lov_io_subio_init(env, lio, io);
868 if (io->ci_result == 0)
869 cl_io_slice_add(io, &lio->lis_cl, obj, &lov_io_ops);
871 RETURN(io->ci_result);
874 int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj,
877 struct lov_io *lio = lov_env_io(env);
881 switch (io->ci_type) {
894 CERROR("Page fault on a file without stripes: "DFID"\n",
895 PFID(lu_object_fid(&obj->co_lu)));
899 cl_io_slice_add(io, &lio->lis_cl, obj, &lov_empty_io_ops);
900 io->ci_result = result;