Whamcloud - gitweb
LU-17744 ldiskfs: mballoc stats fixes
[fs/lustre-release.git] / lustre / osc / osc_object.c
index 5c06f6e..d9b2290 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * Implementation of cl_object for OSC layer.
  *
@@ -334,32 +333,6 @@ drop_lock:
        RETURN(rc);
 }
 
-int osc_object_is_contended(struct osc_object *obj)
-{
-       struct osc_device *dev = lu2osc_dev(obj->oo_cl.co_lu.lo_dev);
-       time64_t osc_contention_time = dev->od_contention_time;
-       ktime_t retry_time;
-
-        if (OBD_FAIL_CHECK(OBD_FAIL_OSC_OBJECT_CONTENTION))
-                return 1;
-
-        if (!obj->oo_contended)
-                return 0;
-
-       /*
-        * I like copy-paste. the code is copied from
-        * ll_file_is_contended.
-        */
-       retry_time = ktime_add_ns(obj->oo_contention_time,
-                                 osc_contention_time * NSEC_PER_SEC);
-       if (ktime_after(ktime_get(), retry_time)) {
-               osc_object_clear_contended(obj);
-               return 0;
-       }
-       return 1;
-}
-EXPORT_SYMBOL(osc_object_is_contended);
-
 /**
  * Implementation of struct cl_object_operations::coo_req_attr_set() for osc
  * layer. osc is responsible for struct obdo::o_id and struct obdo::o_seq
@@ -372,10 +345,12 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj,
        struct obdo      *oa;
        struct ost_lvb   *lvb;
        u64               flags = attr->cra_flags;
+       struct osc_page *opg;
 
-       oinfo   = cl2osc(obj)->oo_oinfo;
-       lvb     = &oinfo->loi_lvb;
-       oa      = attr->cra_oa;
+       oinfo = cl2osc(obj)->oo_oinfo;
+       lvb = &oinfo->loi_lvb;
+       oa = attr->cra_oa;
+       opg = osc_cl_page_osc(attr->cra_page, cl2osc(obj));
 
        if ((flags & OBD_MD_FLMTIME) != 0) {
                oa->o_mtime = lvb->lvb_mtime;
@@ -409,14 +384,15 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj,
                }
                oa->o_valid |= OBD_MD_FLID;
        }
-       if (flags & OBD_MD_FLHANDLE) {
+       /* if srvlock is set, don't look for a local lock, since we won't use
+        * it and shouldn't note it in the RPC
+        */
+       if (flags & OBD_MD_FLHANDLE && !opg->ops_srvlock) {
                struct ldlm_lock *lock;
-               struct osc_page *opg;
 
-               opg = osc_cl_page_osc(attr->cra_page, cl2osc(obj));
                lock = osc_dlmlock_at_pgoff(env, cl2osc(obj), osc_index(opg),
                                OSC_DAP_FL_TEST_LOCK | OSC_DAP_FL_CANCELING);
-               if (lock == NULL && !opg->ops_srvlock) {
+               if (lock == NULL) {
                        struct ldlm_resource *res;
                        struct ldlm_res_id *resname;
 
@@ -425,21 +401,20 @@ static void osc_req_attr_set(const struct lu_env *env, struct cl_object *obj,
 
                        resname = &osc_env_info(env)->oti_resname;
                        ostid_build_res_name(&oinfo->loi_oi, resname);
-                       res = ldlm_resource_get(
-                               osc_export(cl2osc(obj))->exp_obd->obd_namespace,
-                               NULL, resname, LDLM_EXTENT, 0);
-                       ldlm_resource_dump(D_ERROR, res);
+                       res = ldlm_resource_get(osc_export(cl2osc(obj))->
+                                                       exp_obd->obd_namespace,
+                                               resname, LDLM_EXTENT, 0);
+                       if (IS_ERR(res))
+                               CERROR("No lock resource\n");
+                       else
+                               ldlm_resource_dump(D_ERROR, res);
 
-                       libcfs_debug_dumpstack(NULL);
                        LBUG();
                }
 
-               /* check for lockless io. */
-               if (lock != NULL) {
-                       oa->o_handle = lock->l_remote_handle;
-                       oa->o_valid |= OBD_MD_FLHANDLE;
-                       LDLM_LOCK_PUT(lock);
-               }
+               oa->o_handle = lock->l_remote_handle;
+               oa->o_valid |= OBD_MD_FLHANDLE;
+               LDLM_LOCK_PUT(lock);
        }
 }