Whamcloud - gitweb
LU-2558 test: recovery-small 19a FAIL no eviction
[fs/lustre-release.git] / lustre / lov / lov_io.c
index 12f620b..440f357 100644 (file)
@@ -27,7 +27,7 @@
  * 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/
@@ -156,7 +156,7 @@ static int lov_io_sub_init(const struct lu_env *env, struct lov_io *lio,
         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;
@@ -303,15 +303,14 @@ static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio,
 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:
@@ -629,7 +628,7 @@ static int lov_io_submit(const struct lu_env *env,
                  * 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;
         }
 
@@ -682,7 +681,7 @@ static int lov_io_submit(const struct lu_env *env,
                                 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);
@@ -934,13 +933,15 @@ int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj,
        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:
@@ -951,8 +952,8 @@ int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj,
         }
         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 */