Whamcloud - gitweb
LU-911 obdapi: add env to few methods
[fs/lustre-release.git] / lustre / lov / lov_obd.c
index a7696d3..211e04a 100644 (file)
@@ -1057,7 +1057,7 @@ static int lov_clear_orphans(struct obd_export *export, struct obdo *src_oa,
 
                 LASSERT(lov->lov_tgts[i]->ltd_exp);
                 /* XXX: LOV STACKING: use real "obj_mdp" sub-data */
-                err = obd_create(lov->lov_tgts[i]->ltd_exp,
+                err = obd_create(NULL, lov->lov_tgts[i]->ltd_exp,
                                  tmp_oa, &obj_mdp, oti);
                 if (err) {
                         /* This export will be disabled until it is recovered,
@@ -1110,15 +1110,17 @@ static int lov_recreate(struct obd_export *exp, struct obdo *src_oa,
         if (i == lsm->lsm_stripe_count)
                 GOTO(out, rc = -EINVAL);
 
-        rc = obd_create(lov->lov_tgts[ost_idx]->ltd_exp, src_oa, &obj_mdp, oti);
+        rc = obd_create(NULL, lov->lov_tgts[ost_idx]->ltd_exp,
+                        src_oa, &obj_mdp, oti);
 out:
         OBD_FREE(obj_mdp, sizeof(*obj_mdp));
         RETURN(rc);
 }
 
 /* the LOV expects oa->o_id to be set to the LOV object id */
-static int lov_create(struct obd_export *exp, struct obdo *src_oa,
-                      struct lov_stripe_md **ea, struct obd_trans_info *oti)
+static int lov_create(const struct lu_env *env, struct obd_export *exp,
+                      struct obdo *src_oa, struct lov_stripe_md **ea,
+                      struct obd_trans_info *oti)
 {
         struct lov_obd *lov;
         struct obd_info oinfo;
@@ -1190,9 +1192,10 @@ do {
                  "%p->lsm_magic=%x\n", (lsmp), (lsmp)->lsm_magic);              \
 } while (0)
 
-static int lov_destroy(struct obd_export *exp, struct obdo *oa,
-                       struct lov_stripe_md *lsm, struct obd_trans_info *oti,
-                       struct obd_export *md_exp, void *capa)
+static int lov_destroy(const struct lu_env *env, struct obd_export *exp,
+                       struct obdo *oa, struct lov_stripe_md *lsm,
+                       struct obd_trans_info *oti, struct obd_export *md_exp,
+                       void *capa)
 {
         struct lov_request_set *set;
         struct obd_info oinfo;
@@ -1224,7 +1227,7 @@ static int lov_destroy(struct obd_export *exp, struct obdo *oa,
                 if (oa->o_valid & OBD_MD_FLCOOKIE)
                         oti->oti_logcookies = set->set_cookies + req->rq_stripe;
 
-                err = obd_destroy(lov->lov_tgts[req->rq_idx]->ltd_exp,
+                err = obd_destroy(env, lov->lov_tgts[req->rq_idx]->ltd_exp,
                                   req->rq_oi.oi_oa, NULL, oti, NULL, capa);
                 err = lov_update_common_set(set, req, err);
                 if (err) {
@@ -1247,7 +1250,8 @@ out:
         RETURN(rc ? rc : err);
 }
 
-static int lov_getattr(struct obd_export *exp, struct obd_info *oinfo)
+static int lov_getattr(const struct lu_env *env, struct obd_export *exp,
+                       struct obd_info *oinfo)
 {
         struct lov_request_set *set;
         struct lov_request *req;
@@ -1275,7 +1279,7 @@ static int lov_getattr(struct obd_export *exp, struct obd_info *oinfo)
                        "%u\n", oinfo->oi_oa->o_id, req->rq_stripe,
                        req->rq_oi.oi_oa->o_id, req->rq_idx);
 
-                rc = obd_getattr(lov->lov_tgts[req->rq_idx]->ltd_exp,
+                rc = obd_getattr(env, lov->lov_tgts[req->rq_idx]->ltd_exp,
                                  &req->rq_oi);
                 err = lov_update_common_set(set, req, rc);
                 if (err) {
@@ -1364,8 +1368,8 @@ out:
         RETURN(rc ? rc : err);
 }
 
-static int lov_setattr(struct obd_export *exp, struct obd_info *oinfo,
-                       struct obd_trans_info *oti)
+static int lov_setattr(const struct lu_env *env, struct obd_export *exp,
+                       struct obd_info *oinfo, struct obd_trans_info *oti)
 {
         struct lov_request_set *set;
         struct lov_obd *lov;
@@ -1396,7 +1400,7 @@ static int lov_setattr(struct obd_export *exp, struct obd_info *oinfo,
         cfs_list_for_each (pos, &set->set_list) {
                 req = cfs_list_entry(pos, struct lov_request, rq_link);
 
-                rc = obd_setattr(lov->lov_tgts[req->rq_idx]->ltd_exp,
+                rc = obd_setattr(env, lov->lov_tgts[req->rq_idx]->ltd_exp,
                                  &req->rq_oi, NULL);
                 err = lov_update_setattr_set(set, req, rc);
                 if (err) {
@@ -1513,8 +1517,8 @@ static int lov_punch_interpret(struct ptlrpc_request_set *rqset,
 /* FIXME: maybe we'll just make one node the authoritative attribute node, then
  * we can send this 'punch' to just the authoritative node and the nodes
  * that the punch will affect. */
-static int lov_punch(struct obd_export *exp, struct obd_info *oinfo,
-                     struct obd_trans_info *oti,
+static int lov_punch(const struct lu_env *env, struct obd_export *exp,
+                     struct obd_info *oinfo, struct obd_trans_info *oti,
                      struct ptlrpc_request_set *rqset)
 {
         struct lov_request_set *set;
@@ -1538,7 +1542,7 @@ static int lov_punch(struct obd_export *exp, struct obd_info *oinfo,
         cfs_list_for_each (pos, &set->set_list) {
                 req = cfs_list_entry(pos, struct lov_request, rq_link);
 
-                rc = obd_punch(lov->lov_tgts[req->rq_idx]->ltd_exp,
+                rc = obd_punch(env, lov->lov_tgts[req->rq_idx]->ltd_exp,
                                &req->rq_oi, NULL, rqset);
                 if (rc) {
                         CERROR("error: punch objid "LPX64" subobj "LPX64
@@ -1575,8 +1579,8 @@ static int lov_sync_interpret(struct ptlrpc_request_set *rqset,
         RETURN(rc ?: err);
 }
 
-static int lov_sync(struct obd_export *exp, struct obd_info *oinfo,
-                    obd_off start, obd_off end,
+static int lov_sync(const struct lu_env *env, struct obd_export *exp,
+                    struct obd_info *oinfo, obd_off start, obd_off end,
                     struct ptlrpc_request_set *rqset)
 {
         struct lov_request_set *set = NULL;
@@ -1603,8 +1607,8 @@ static int lov_sync(struct obd_export *exp, struct obd_info *oinfo,
         cfs_list_for_each (pos, &set->set_list) {
                 req = cfs_list_entry(pos, struct lov_request, rq_link);
 
-                rc = obd_sync(lov->lov_tgts[req->rq_idx]->ltd_exp, &req->rq_oi,
-                              req->rq_oi.oi_policy.l_extent.start,
+                rc = obd_sync(env, lov->lov_tgts[req->rq_idx]->ltd_exp,
+                              &req->rq_oi, req->rq_oi.oi_policy.l_extent.start,
                               req->rq_oi.oi_policy.l_extent.end, rqset);
                 if (rc) {
                         CERROR("error: fsync objid "LPX64" subobj "LPX64
@@ -1949,9 +1953,10 @@ int lov_statfs_interpret(struct ptlrpc_request_set *rqset, void *data, int rc)
         RETURN(rc ? rc : err);
 }
 
-static int lov_statfs_async(struct obd_device *obd, struct obd_info *oinfo,
+static int lov_statfs_async(struct obd_export *exp, struct obd_info *oinfo,
                             __u64 max_age, struct ptlrpc_request_set *rqset)
 {
+        struct obd_device      *obd = class_exp2obd(exp);
         struct lov_request_set *set;
         struct lov_request *req;
         cfs_list_t *pos;
@@ -1968,12 +1973,9 @@ static int lov_statfs_async(struct obd_device *obd, struct obd_info *oinfo,
                 RETURN(rc);
 
         cfs_list_for_each (pos, &set->set_list) {
-                struct obd_device *osc_obd;
-
                 req = cfs_list_entry(pos, struct lov_request, rq_link);
-
-                osc_obd = class_exp2obd(lov->lov_tgts[req->rq_idx]->ltd_exp);
-                rc = obd_statfs_async(osc_obd, &req->rq_oi, max_age, rqset);
+                rc = obd_statfs_async(lov->lov_tgts[req->rq_idx]->ltd_exp,
+                                      &req->rq_oi, max_age, rqset);
                 if (rc)
                         break;
         }
@@ -1992,8 +1994,8 @@ static int lov_statfs_async(struct obd_device *obd, struct obd_info *oinfo,
         RETURN(0);
 }
 
-static int lov_statfs(struct obd_device *obd, struct obd_statfs *osfs,
-                      __u64 max_age, __u32 flags)
+static int lov_statfs(const struct lu_env *env, struct obd_export *exp,
+                      struct obd_statfs *osfs, __u64 max_age, __u32 flags)
 {
         struct ptlrpc_request_set *set = NULL;
         struct obd_info oinfo = { { { 0 } } };
@@ -2009,7 +2011,7 @@ static int lov_statfs(struct obd_device *obd, struct obd_statfs *osfs,
 
         oinfo.oi_osfs = osfs;
         oinfo.oi_flags = flags;
-        rc = lov_statfs_async(obd, &oinfo, max_age, set);
+        rc = lov_statfs_async(exp, &oinfo, max_age, set);
         if (rc == 0)
                 rc = ptlrpc_set_wait(set);
         ptlrpc_set_destroy(set);
@@ -2054,7 +2056,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                         RETURN(-EFAULT);
 
                 /* got statfs data */
-                rc = obd_statfs(osc_obd, &stat_buf,
+                rc = obd_statfs(NULL, lov->lov_tgts[index]->ltd_exp, &stat_buf,
                                 cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
                                 0);
                 if (rc)
@@ -2480,7 +2482,8 @@ static int lov_fiemap(struct lov_obd *lov, __u32 keylen, void *key,
                         fm_local->fm_flags &= ~FIEMAP_FLAG_DEVICE_ORDER;
                         memcpy(&fm_key->fiemap, fm_local, sizeof(*fm_local));
                         *vallen=fiemap_count_to_size(fm_local->fm_extent_count);
-                        rc = obd_get_info(lov->lov_tgts[ost_index]->ltd_exp,
+                        rc = obd_get_info(NULL,
+                                          lov->lov_tgts[ost_index]->ltd_exp,
                                           keylen, key, vallen, fm_local, lsm);
                         if (rc != 0)
                                 GOTO(out, rc);
@@ -2564,8 +2567,8 @@ out:
         return rc;
 }
 
-static int lov_get_info(struct obd_export *exp, __u32 keylen,
-                        void *key, __u32 *vallen, void *val,
+static int lov_get_info(const struct lu_env *env, struct obd_export *exp,
+                        __u32 keylen, void *key, __u32 *vallen, void *val,
                         struct lov_stripe_md *lsm)
 {
         struct obd_device *obddev = class_exp2obd(exp);
@@ -2622,7 +2625,8 @@ static int lov_get_info(struct obd_export *exp, __u32 keylen,
                 if (!tgt || !tgt->ltd_active)
                         GOTO(out, rc = -ESRCH);
 
-                rc = obd_get_info(tgt->ltd_exp, keylen, key, &size, info->data, NULL);
+                rc = obd_get_info(env, tgt->ltd_exp, keylen, key,
+                                  &size, info->data, NULL);
                 GOTO(out, rc = 0);
         } else if (KEY_IS(KEY_LOVDESC)) {
                 struct lov_desc *desc_ret = val;
@@ -2657,9 +2661,9 @@ out:
         RETURN(rc);
 }
 
-static int lov_set_info_async(struct obd_export *exp, obd_count keylen,
-                              void *key, obd_count vallen, void *val,
-                              struct ptlrpc_request_set *set)
+static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp,
+                              obd_count keylen, void *key, obd_count vallen,
+                              void *val, struct ptlrpc_request_set *set)
 {
         struct obd_device *obddev = class_exp2obd(exp);
         struct lov_obd *lov = &obddev->u.lov;
@@ -2723,11 +2727,11 @@ static int lov_set_info_async(struct obd_export *exp, obd_count keylen,
                                                 &tgt->ltd_uuid))
                                 continue;
 
-                        err = obd_set_info_async(tgt->ltd_exp,
+                        err = obd_set_info_async(env, tgt->ltd_exp,
                                          keylen, key, sizeof(int),
                                          &mgi->group, set);
                 } else if (next_id) {
-                        err = obd_set_info_async(tgt->ltd_exp,
+                        err = obd_set_info_async(env, tgt->ltd_exp,
                                          keylen, key, vallen,
                                          ((struct obd_id_info*)val)->data, set);
                 } else if (capa) {
@@ -2740,8 +2744,8 @@ static int lov_set_info_async(struct obd_export *exp, obd_count keylen,
                             !obd_uuid_equals(info->uuid, &tgt->ltd_uuid))
                                 continue;
 
-                        err = obd_set_info_async(tgt->ltd_exp, keylen, key,
-                                                 sizeof(*info->capa),
+                        err = obd_set_info_async(env, tgt->ltd_exp, keylen,
+                                                 key, sizeof(*info->capa),
                                                  info->capa, set);
                 } else {
                         /* Only want a specific OSC */
@@ -2749,7 +2753,7 @@ static int lov_set_info_async(struct obd_export *exp, obd_count keylen,
                             !obd_uuid_equals(val, &tgt->ltd_uuid))
                                 continue;
 
-                        err = obd_set_info_async(tgt->ltd_exp,
+                        err = obd_set_info_async(env, tgt->ltd_exp,
                                          keylen, key, vallen, val, set);
                 }