* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, Whamcloud, Inc.
+ * Copyright (c) 2011, 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
sub->sub_borrowed = 0;
if (lio->lis_mem_frozen) {
- LASSERT(cfs_mutex_is_locked(&ld->ld_mutex));
+ LASSERT(mutex_is_locked(&ld->ld_mutex));
sub->sub_io = &ld->ld_emrg[stripe]->emrg_subio;
sub->sub_env = ld->ld_emrg[stripe]->emrg_env;
sub->sub_borrowed = 1;
static void lov_io_slice_init(struct lov_io *lio,
struct lov_object *obj, struct cl_io *io)
{
- struct lov_stripe_md *lsm = lov_lsm_addref(obj);
ENTRY;
io->ci_result = 0;
lio->lis_object = obj;
- LASSERT(lsm != NULL);
- lio->lis_lsm = lsm; /* called inside lo_type_guard. */
- lio->lis_stripe_count = lsm->lsm_stripe_count;
+ LASSERT(obj->lo_lsm != NULL);
+ lio->lis_lsm = lsm_addref(obj->lo_lsm);
+ lio->lis_stripe_count = lio->lis_lsm->lsm_stripe_count;
switch (io->ci_type) {
case CIT_READ:
* In order to not make things worse, even don't try to
* allocate the memory with __GFP_NOWARN. -jay
*/
- cfs_mutex_lock(&ld->ld_mutex);
+ mutex_lock(&ld->ld_mutex);
lio->lis_mem_frozen = 1;
}
lov_io_sub_fini(env, lio, &lio->lis_subs[i]);
}
lio->lis_mem_frozen = 0;
- cfs_mutex_unlock(&ld->ld_mutex);
+ mutex_unlock(&ld->ld_mutex);
}
RETURN(rc);
switch (io->ci_type) {
default:
LBUG();
+ case CIT_MISC:
+ case CIT_READ:
+ result = 0;
+ break;
case CIT_FSYNC:
- case CIT_MISC:
- case CIT_READ:
- result = 0;
- break;
+ case CIT_SETATTR:
+ result = +1;
+ break;
case CIT_WRITE:
- case CIT_SETATTR:
result = -EBADF;
break;
case CIT_FAULT:
}
if (result == 0)
cl_io_slice_add(io, &lio->lis_cl, obj, &lov_empty_io_ops);
- io->ci_result = result;
- RETURN(result != 0);
+ io->ci_result = result < 0 ? result : 0;
+ RETURN(result != 0);
}
/** @} lov */