Whamcloud - gitweb
LU-16367 misc: remove deprecated code
[fs/lustre-release.git] / lustre / mdc / mdc_dev.c
index d7719e1..956ff9d 100644 (file)
@@ -66,6 +66,7 @@ static void mdc_lock_build_einfo(const struct lu_env *env,
        einfo->ei_cb_cp = ldlm_completion_ast;
        einfo->ei_cb_gl = mdc_ldlm_glimpse_ast;
        einfo->ei_cbdata = osc; /* value to be put into ->l_ast_data */
+       einfo->ei_req_slot = 1;
 }
 
 static void mdc_lock_lvb_update(const struct lu_env *env,
@@ -682,7 +683,7 @@ int mdc_enqueue_interpret(const struct lu_env *env, struct ptlrpc_request *req,
        /* Complete obtaining the lock procedure. */
        rc = ldlm_cli_enqueue_fini(aa->oa_exp, req, &einfo, 1, aa->oa_flags,
                                   aa->oa_lvb, aa->oa_lvb ?
-                                  sizeof(*aa->oa_lvb) : 0, lockh, rc);
+                                  sizeof(*aa->oa_lvb) : 0, lockh, rc, true);
        /* Complete mdc stuff. */
        rc = mdc_enqueue_fini(aa->oa_exp, req, aa->oa_upcall, aa->oa_cookie,
                              lockh, mode, aa->oa_flags, rc);
@@ -713,7 +714,8 @@ int mdc_enqueue_send(const struct lu_env *env, struct obd_export *exp,
        struct ldlm_intent *lit;
        enum ldlm_mode mode;
        bool glimpse = *flags & LDLM_FL_HAS_INTENT;
-       __u64 match_flags = *flags;
+       __u64 search_flags = *flags;
+       __u64 match_flags = 0;
        LIST_HEAD(cancels);
        int rc, count;
        int lvb_size;
@@ -725,11 +727,14 @@ int mdc_enqueue_send(const struct lu_env *env, struct obd_export *exp,
        if (einfo->ei_mode == LCK_PR)
                mode |= LCK_PW;
 
-       match_flags |= LDLM_FL_LVB_READY;
+       search_flags |= LDLM_FL_LVB_READY;
        if (glimpse)
-               match_flags |= LDLM_FL_BLOCK_GRANTED;
-       mode = ldlm_lock_match(obd->obd_namespace, match_flags, res_id,
-                              einfo->ei_type, policy, mode, &lockh);
+               search_flags |= LDLM_FL_BLOCK_GRANTED;
+       if (mode == LCK_GROUP)
+               match_flags = LDLM_MATCH_GROUP;
+       mode = ldlm_lock_match_with_skip(obd->obd_namespace, search_flags, 0,
+                                        res_id, einfo->ei_type, policy, mode,
+                                        &lockh, match_flags);
        if (mode) {
                struct ldlm_lock *matched;
 
@@ -972,8 +977,6 @@ int mdc_lock_init(const struct lu_env *env, struct cl_object *obj,
 
        ols->ols_flags = flags;
        ols->ols_speculative = !!(enqflags & CEF_SPECULATIVE);
-       if (lock->cll_descr.cld_mode == CLM_GROUP)
-               ols->ols_flags |= LDLM_FL_ATOMIC_CB;
 
        if (ols->ols_flags & LDLM_FL_HAS_INTENT) {
                ols->ols_flags |= LDLM_FL_BLOCK_GRANTED;
@@ -988,6 +991,9 @@ int mdc_lock_init(const struct lu_env *env, struct cl_object *obj,
 
        if (io->ci_type == CIT_WRITE || cl_io_is_mkwrite(io))
                osc_lock_set_writer(env, io, obj, ols);
+       else if (io->ci_type == CIT_READ ||
+                (io->ci_type == CIT_FAULT && !io->u.ci_fault.ft_mkwrite))
+               osc_lock_set_reader(env, io, obj, ols);
 
        LDLM_DEBUG_NOLOCK("lock %p, mdc lock %p, flags %llx\n",
                          lock, ols, ols->ols_flags);
@@ -1024,8 +1030,9 @@ static int mdc_get_lock_handle(const struct lu_env *env, struct osc_object *osc,
 
                resname = &osc_env_info(env)->oti_resname;
                fid_build_reg_res_name(lu_object_fid(osc2lu(osc)), resname);
-               res = ldlm_resource_get(osc_export(osc)->exp_obd->obd_namespace,
-                                       NULL, resname, LDLM_IBITS, 0);
+               res = ldlm_resource_get(osc_export(osc)->
+                                                       exp_obd->obd_namespace,
+                                       resname, LDLM_IBITS, 0);
                if (IS_ERR(res))
                        CERROR("No lock resource for "DFID"\n",
                                PFID(lu_object_fid(osc2lu(osc))));
@@ -1289,6 +1296,7 @@ static int mdc_io_data_version_start(const struct lu_env *env,
 
        req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER, 0);
        req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER, 0);
+       req_capsule_set_size(&req->rq_pill, &RMF_FILE_ENCCTX, RCL_SERVER, 0);
        ptlrpc_request_set_replen(req);
 
        req->rq_interpret_reply = mdc_data_version_interpret;
@@ -1581,16 +1589,16 @@ static struct lu_device *mdc_device_alloc(const struct lu_env *env,
                                          struct lustre_cfg *cfg)
 {
        struct lu_device *d;
-       struct osc_device *od;
+       struct osc_device *oc;
        struct obd_device *obd;
        int rc;
 
-       OBD_ALLOC_PTR(od);
-       if (od == NULL)
+       OBD_ALLOC_PTR(oc);
+       if (oc == NULL)
                RETURN(ERR_PTR(-ENOMEM));
 
-       cl_device_init(&od->od_cl, t);
-       d = osc2lu_dev(od);
+       cl_device_init(&oc->osc_cl, t);
+       d = osc2lu_dev(oc);
        d->ld_ops = &mdc_lu_ops;
 
        /* Setup MDC OBD */
@@ -1603,7 +1611,8 @@ static struct lu_device *mdc_device_alloc(const struct lu_env *env,
                osc_device_free(env, d);
                RETURN(ERR_PTR(rc));
        }
-       od->od_exp = obd->obd_self_export;
+       oc->osc_exp = obd->obd_self_export;
+       oc->osc_stats.os_init = ktime_get_real();
        RETURN(d);
 }