From: Alex Zhuravlev Date: Fri, 25 Nov 2011 07:37:24 +0000 (+0300) Subject: LU-911 obdapi: add env to few methods X-Git-Tag: 2.2.53~13 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=d1c8b37cc0b9808251300790ab9c91409fecfb96 LU-911 obdapi: add env to few methods so that soon-coming OFD doesn't need to reallocate env on every request. Instead OST will be passing env down as MDT does. Signed-off-by: Alex Zhuravlev Change-Id: I605b4cdb5eb1f2984c303646c161fbde43d155ef Reviewed-on: http://review.whamcloud.com/1847 Tested-by: Hudson Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/include/obd.h b/lustre/include/obd.h index b852f30..3cf3115 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -1326,9 +1326,11 @@ struct obd_ops { cfs_module_t *o_owner; int (*o_iocontrol)(unsigned int cmd, struct obd_export *exp, int len, void *karg, void *uarg); - int (*o_get_info)(struct obd_export *, __u32 keylen, void *key, - __u32 *vallen, void *val, struct lov_stripe_md *lsm); - int (*o_set_info_async)(struct obd_export *, __u32 keylen, void *key, + int (*o_get_info)(const struct lu_env *env, struct obd_export *, + __u32 keylen, void *key, __u32 *vallen, void *val, + struct lov_stripe_md *lsm); + int (*o_set_info_async)(const struct lu_env *, struct obd_export *, + __u32 keylen, void *key, __u32 vallen, void *val, struct ptlrpc_request_set *set); int (*o_attach)(struct obd_device *dev, obd_count len, void *data); @@ -1372,9 +1374,9 @@ struct obd_ops { */ int (*o_fid_delete)(struct obd_export *exp, const struct lu_fid *fid); - int (*o_statfs)(struct obd_device *obd, struct obd_statfs *osfs, - __u64 max_age, __u32 flags); - int (*o_statfs_async)(struct obd_device *obd, struct obd_info *oinfo, + int (*o_statfs)(const struct lu_env *, struct obd_export *exp, + struct obd_statfs *osfs, __u64 max_age, __u32 flags); + int (*o_statfs_async)(struct obd_export *exp, struct obd_info *oinfo, __u64 max_age, struct ptlrpc_request_set *set); int (*o_packmd)(struct obd_export *exp, struct lov_mds_md **disk_tgt, struct lov_stripe_md *mem_src); @@ -1384,20 +1386,23 @@ struct obd_ops { obd_id *ids); /* FIXME: add fid capability support for create & destroy! */ int (*o_precreate)(struct obd_export *exp); - int (*o_create)(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md **ea, struct obd_trans_info *oti); + int (*o_create)(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md **ea, + struct obd_trans_info *oti); int (*o_create_async)(struct obd_export *exp, struct obd_info *oinfo, struct lov_stripe_md **ea, struct obd_trans_info *oti); - int (*o_destroy)(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md *ea, struct obd_trans_info *oti, - struct obd_export *md_exp, void *capa); - int (*o_setattr)(struct obd_export *exp, struct obd_info *oinfo, - struct obd_trans_info *oti); + int (*o_destroy)(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md *ea, + struct obd_trans_info *oti, struct obd_export *md_exp, + void *capa); + int (*o_setattr)(const struct lu_env *, struct obd_export *exp, + struct obd_info *oinfo, struct obd_trans_info *oti); int (*o_setattr_async)(struct obd_export *exp, struct obd_info *oinfo, struct obd_trans_info *oti, struct ptlrpc_request_set *rqset); - int (*o_getattr)(struct obd_export *exp, struct obd_info *oinfo); + int (*o_getattr)(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo); int (*o_getattr_async)(struct obd_export *exp, struct obd_info *oinfo, struct ptlrpc_request_set *set); int (*o_brw)(int rw, struct obd_export *exp, struct obd_info *oinfo, @@ -1407,11 +1412,11 @@ struct obd_ops { struct ost_lvb *lvb, int kms_only); int (*o_adjust_kms)(struct obd_export *exp, struct lov_stripe_md *lsm, obd_off size, int shrink); - int (*o_punch)(struct obd_export *exp, struct obd_info *oinfo, - struct obd_trans_info *oti, + int (*o_punch)(const struct lu_env *, struct obd_export *exp, + struct obd_info *oinfo, struct obd_trans_info *oti, struct ptlrpc_request_set *rqset); - int (*o_sync)(struct obd_export *exp, struct obd_info *oinfo, - obd_size start, obd_size end, + int (*o_sync)(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo, obd_size start, obd_size end, struct ptlrpc_request_set *set); int (*o_migrate)(struct lustre_handle *conn, struct lov_stripe_md *dst, struct lov_stripe_md *src, obd_size start, @@ -1422,13 +1427,13 @@ struct obd_ops { int (*o_iterate)(struct lustre_handle *conn, int (*)(obd_id, obd_seq, void *), obd_id *startid, obd_seq seq, void *data); - int (*o_preprw)(int cmd, struct obd_export *exp, struct obdo *oa, - int objcount, struct obd_ioobj *obj, - struct niobuf_remote *remote, int *nr_pages, - struct niobuf_local *local, - struct obd_trans_info *oti, - struct lustre_capa *capa); - int (*o_commitrw)(int cmd, struct obd_export *exp, struct obdo *oa, + int (*o_preprw)(const struct lu_env *env, int cmd, + struct obd_export *exp, struct obdo *oa, int objcount, + struct obd_ioobj *obj, struct niobuf_remote *remote, + int *nr_pages, struct niobuf_local *local, + struct obd_trans_info *oti, struct lustre_capa *capa); + int (*o_commitrw)(const struct lu_env *env, int cmd, + struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, struct niobuf_remote *remote, int pages, struct niobuf_local *local, @@ -1466,7 +1471,7 @@ struct obd_ops { int (*o_notify)(struct obd_device *obd, struct obd_device *watched, enum obd_notify_event ev, void *data); - int (*o_health_check)(struct obd_device *); + int (*o_health_check)(const struct lu_env *env, struct obd_device *); struct obd_uuid *(*o_get_uuid) (struct obd_export *exp); /* quota methods */ @@ -1480,7 +1485,7 @@ struct obd_ops { struct ptlrpc_request_set *rqset); - int (*o_ping)(struct obd_export *exp); + int (*o_ping)(const struct lu_env *, struct obd_export *exp); /* pools methods */ int (*o_pool_new)(struct obd_device *obd, char *poolname); diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index fc2b398..87a961b 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -497,7 +497,8 @@ static inline int class_devno_max(void) return MAX_OBD_DEVICES; } -static inline int obd_get_info(struct obd_export *exp, __u32 keylen, +static inline int obd_get_info(const struct lu_env *env, + struct obd_export *exp, __u32 keylen, void *key, __u32 *vallen, void *val, struct lov_stripe_md *lsm) { @@ -507,11 +508,13 @@ static inline int obd_get_info(struct obd_export *exp, __u32 keylen, EXP_CHECK_DT_OP(exp, get_info); EXP_COUNTER_INCREMENT(exp, get_info); - rc = OBP(exp->exp_obd, get_info)(exp, keylen, key, vallen, val, lsm); + rc = OBP(exp->exp_obd, get_info)(env, exp, keylen, key, vallen, val, + lsm); RETURN(rc); } -static inline int obd_set_info_async(struct obd_export *exp, obd_count keylen, +static inline int obd_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) { @@ -521,8 +524,8 @@ static inline int obd_set_info_async(struct obd_export *exp, obd_count keylen, EXP_CHECK_DT_OP(exp, set_info_async); EXP_COUNTER_INCREMENT(exp, set_info_async); - rc = OBP(exp->exp_obd, set_info_async)(exp, keylen, key, vallen, val, - set); + rc = OBP(exp->exp_obd, set_info_async)(env, exp, keylen, key, vallen, + val, set); RETURN(rc); } @@ -809,8 +812,8 @@ static inline int obd_create_async(struct obd_export *exp, RETURN(rc); } -static inline int obd_create(struct obd_export *exp, struct obdo *obdo, - struct lov_stripe_md **ea, +static inline int obd_create(const struct lu_env *env, struct obd_export *exp, + struct obdo *obdo, struct lov_stripe_md **ea, struct obd_trans_info *oti) { int rc; @@ -819,12 +822,12 @@ static inline int obd_create(struct obd_export *exp, struct obdo *obdo, EXP_CHECK_DT_OP(exp, create); EXP_COUNTER_INCREMENT(exp, create); - rc = OBP(exp->exp_obd, create)(exp, obdo, ea, oti); + rc = OBP(exp->exp_obd, create)(env, exp, obdo, ea, oti); RETURN(rc); } -static inline int obd_destroy(struct obd_export *exp, struct obdo *obdo, - struct lov_stripe_md *ea, +static inline int obd_destroy(const struct lu_env *env, struct obd_export *exp, + struct obdo *obdo, struct lov_stripe_md *ea, struct obd_trans_info *oti, struct obd_export *md_exp, void *capa) { @@ -834,11 +837,12 @@ static inline int obd_destroy(struct obd_export *exp, struct obdo *obdo, EXP_CHECK_DT_OP(exp, destroy); EXP_COUNTER_INCREMENT(exp, destroy); - rc = OBP(exp->exp_obd, destroy)(exp, obdo, ea, oti, md_exp, capa); + rc = OBP(exp->exp_obd, destroy)(env, exp, obdo, ea, oti, md_exp, capa); RETURN(rc); } -static inline int obd_getattr(struct obd_export *exp, struct obd_info *oinfo) +static inline int obd_getattr(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo) { int rc; ENTRY; @@ -846,7 +850,7 @@ static inline int obd_getattr(struct obd_export *exp, struct obd_info *oinfo) EXP_CHECK_DT_OP(exp, getattr); EXP_COUNTER_INCREMENT(exp, getattr); - rc = OBP(exp->exp_obd, getattr)(exp, oinfo); + rc = OBP(exp->exp_obd, getattr)(env, exp, oinfo); RETURN(rc); } @@ -864,7 +868,8 @@ static inline int obd_getattr_async(struct obd_export *exp, RETURN(rc); } -static inline int obd_setattr(struct obd_export *exp, struct obd_info *oinfo, +static inline int obd_setattr(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo, struct obd_trans_info *oti) { int rc; @@ -873,7 +878,7 @@ static inline int obd_setattr(struct obd_export *exp, struct obd_info *oinfo, EXP_CHECK_DT_OP(exp, setattr); EXP_COUNTER_INCREMENT(exp, setattr); - rc = OBP(exp->exp_obd, setattr)(exp, oinfo, oti); + rc = OBP(exp->exp_obd, setattr)(env, exp, oinfo, oti); RETURN(rc); } @@ -1072,7 +1077,7 @@ static inline int obd_fid_delete(struct obd_export *exp, RETURN(rc); } -static inline int obd_ping(struct obd_export *exp) +static inline int obd_ping(const struct lu_env *env, struct obd_export *exp) { int rc; ENTRY; @@ -1080,7 +1085,7 @@ static inline int obd_ping(struct obd_export *exp) OBD_CHECK_DT_OP(exp->exp_obd, ping, 0); EXP_COUNTER_INCREMENT(exp, ping); - rc = OBP(exp->exp_obd, ping)(exp); + rc = OBP(exp->exp_obd, ping)(env, exp); RETURN(rc); } @@ -1207,24 +1212,26 @@ obd_lvfs_open_llog(struct obd_export *exp, __u64 id_ino, struct dentry *dentry) /* @max_age is the oldest time in jiffies that we accept using a cached data. * If the cache is older than @max_age we will get a new value from the * target. Use a value of "cfs_time_current() + HZ" to guarantee freshness. */ -static inline int obd_statfs_async(struct obd_device *obd, +static inline int obd_statfs_async(struct obd_export *exp, struct obd_info *oinfo, __u64 max_age, struct ptlrpc_request_set *rqset) { int rc = 0; + struct obd_device *obd; ENTRY; - if (obd == NULL) + if (exp == NULL || exp->exp_obd == NULL) RETURN(-EINVAL); + obd = exp->exp_obd; OBD_CHECK_DT_OP(obd, statfs, -EOPNOTSUPP); OBD_COUNTER_INCREMENT(obd, statfs); CDEBUG(D_SUPER, "%s: osfs %p age "LPU64", max_age "LPU64"\n", obd->obd_name, &obd->obd_osfs, obd->obd_osfs_age, max_age); if (cfs_time_before_64(obd->obd_osfs_age, max_age)) { - rc = OBP(obd, statfs_async)(obd, oinfo, max_age, rqset); + rc = OBP(obd, statfs_async)(exp, oinfo, max_age, rqset); } else { CDEBUG(D_SUPER,"%s: use %p cache blocks "LPU64"/"LPU64 " objects "LPU64"/"LPU64"\n", @@ -1241,7 +1248,7 @@ static inline int obd_statfs_async(struct obd_device *obd, RETURN(rc); } -static inline int obd_statfs_rqset(struct obd_device *obd, +static inline int obd_statfs_rqset(struct obd_export *exp, struct obd_statfs *osfs, __u64 max_age, __u32 flags) { @@ -1256,7 +1263,7 @@ static inline int obd_statfs_rqset(struct obd_device *obd, oinfo.oi_osfs = osfs; oinfo.oi_flags = flags; - rc = obd_statfs_async(obd, &oinfo, max_age, set); + rc = obd_statfs_async(exp, &oinfo, max_age, set); if (rc == 0) rc = ptlrpc_set_wait(set); ptlrpc_set_destroy(set); @@ -1266,10 +1273,12 @@ static inline int obd_statfs_rqset(struct obd_device *obd, /* @max_age is the oldest time in jiffies that we accept using a cached data. * If the cache is older than @max_age we will get a new value from the * target. Use a value of "cfs_time_current() + HZ" to guarantee freshness. */ -static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs, - __u64 max_age, __u32 flags) +static inline int obd_statfs(const struct lu_env *env, struct obd_export *exp, + struct obd_statfs *osfs, __u64 max_age, + __u32 flags) { int rc = 0; + struct obd_device *obd = exp->exp_obd; ENTRY; if (obd == NULL) @@ -1281,7 +1290,7 @@ static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs, CDEBUG(D_SUPER, "osfs "LPU64", max_age "LPU64"\n", obd->obd_osfs_age, max_age); if (cfs_time_before_64(obd->obd_osfs_age, max_age)) { - rc = OBP(obd, statfs)(obd, osfs, max_age, flags); + rc = OBP(obd, statfs)(env, exp, osfs, max_age, flags); if (rc == 0) { cfs_spin_lock(&obd->obd_osfs_lock); memcpy(&obd->obd_osfs, osfs, sizeof(obd->obd_osfs)); @@ -1315,15 +1324,15 @@ static inline int obd_sync_rqset(struct obd_export *exp, struct obd_info *oinfo, if (set == NULL) RETURN(-ENOMEM); - rc = OBP(exp->exp_obd, sync)(exp, oinfo, start, end, set); + rc = OBP(exp->exp_obd, sync)(NULL, exp, oinfo, start, end, set); if (rc == 0) rc = ptlrpc_set_wait(set); ptlrpc_set_destroy(set); RETURN(rc); } -static inline int obd_sync(struct obd_export *exp, struct obd_info *oinfo, - obd_size start, obd_size end, +static inline int obd_sync(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo, obd_size start, obd_size end, struct ptlrpc_request_set *set) { int rc; @@ -1332,7 +1341,7 @@ static inline int obd_sync(struct obd_export *exp, struct obd_info *oinfo, OBD_CHECK_DT_OP(exp->exp_obd, sync, -EOPNOTSUPP); EXP_COUNTER_INCREMENT(exp, sync); - rc = OBP(exp->exp_obd, sync)(exp, oinfo, start, end, set); + rc = OBP(exp->exp_obd, sync)(env, exp, oinfo, start, end, set); RETURN(rc); } @@ -1351,15 +1360,15 @@ static inline int obd_punch_rqset(struct obd_export *exp, if (set == NULL) RETURN(-ENOMEM); - rc = OBP(exp->exp_obd, punch)(exp, oinfo, oti, set); + rc = OBP(exp->exp_obd, punch)(NULL, exp, oinfo, oti, set); if (rc == 0) rc = ptlrpc_set_wait(set); ptlrpc_set_destroy(set); RETURN(rc); } -static inline int obd_punch(struct obd_export *exp, struct obd_info *oinfo, - struct obd_trans_info *oti, +static inline int obd_punch(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo, struct obd_trans_info *oti, struct ptlrpc_request_set *rqset) { int rc; @@ -1368,7 +1377,7 @@ static inline int obd_punch(struct obd_export *exp, struct obd_info *oinfo, EXP_CHECK_DT_OP(exp, punch); EXP_COUNTER_INCREMENT(exp, punch); - rc = OBP(exp->exp_obd, punch)(exp, oinfo, oti, rqset); + rc = OBP(exp->exp_obd, punch)(env, exp, oinfo, oti, rqset); RETURN(rc); } @@ -1392,7 +1401,8 @@ static inline int obd_brw(int cmd, struct obd_export *exp, RETURN(rc); } -static inline int obd_preprw(int cmd, struct obd_export *exp, struct obdo *oa, +static inline int obd_preprw(const struct lu_env *env, int cmd, + struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, struct niobuf_remote *remote, int *pages, struct niobuf_local *local, @@ -1405,12 +1415,13 @@ static inline int obd_preprw(int cmd, struct obd_export *exp, struct obdo *oa, EXP_CHECK_DT_OP(exp, preprw); EXP_COUNTER_INCREMENT(exp, preprw); - rc = OBP(exp->exp_obd, preprw)(cmd, exp, oa, objcount, obj, remote, + rc = OBP(exp->exp_obd, preprw)(env, cmd, exp, oa, objcount, obj, remote, pages, local, oti, capa); RETURN(rc); } -static inline int obd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa, +static inline int obd_commitrw(const struct lu_env *env, int cmd, + struct obd_export *exp, struct obdo *oa, int objcount, struct obd_ioobj *obj, struct niobuf_remote *rnb, int pages, struct niobuf_local *local, @@ -1421,7 +1432,7 @@ static inline int obd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa, EXP_CHECK_DT_OP(exp, commitrw); EXP_COUNTER_INCREMENT(exp, commitrw); - rc = OBP(exp->exp_obd, commitrw)(cmd, exp, oa, objcount, obj, + rc = OBP(exp->exp_obd, commitrw)(env, cmd, exp, oa, objcount, obj, rnb, pages, local, oti, rc); RETURN(rc); } @@ -1734,7 +1745,8 @@ static inline int obd_quota_adjust_qunit(struct obd_export *exp, RETURN(rc); } -static inline int obd_health_check(struct obd_device *obd) +static inline int obd_health_check(const struct lu_env *env, + struct obd_device *obd) { /* returns: 0 on healthy * >0 on unhealthy + reason code/flag @@ -1756,7 +1768,7 @@ static inline int obd_health_check(struct obd_device *obd) if (!OBP(obd, health_check)) RETURN(0); - rc = OBP(obd, health_check)(obd); + rc = OBP(obd, health_check)(env, obd); RETURN(rc); } diff --git a/lustre/lclient/lcommon_misc.c b/lustre/lclient/lcommon_misc.c index 04158d5..b5f9d7e 100644 --- a/lustre/lclient/lcommon_misc.c +++ b/lustre/lclient/lcommon_misc.c @@ -59,7 +59,7 @@ int cl_init_ea_size(struct obd_export *md_exp, struct obd_export *dt_exp) __u16 stripes; ENTRY; - rc = obd_get_info(dt_exp, sizeof(KEY_LOVDESC), KEY_LOVDESC, + rc = obd_get_info(NULL, dt_exp, sizeof(KEY_LOVDESC), KEY_LOVDESC, &valsize, &desc, NULL); if (rc) RETURN(rc); diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 4487d5a..5f39bb2 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -1119,8 +1119,9 @@ dont_check_exports: if (export->exp_imp_reverse != NULL) { /* destroyed import can be still referenced in ctxt */ - obd_set_info_async(export, sizeof(KEY_REVIMP_UPD), - KEY_REVIMP_UPD, 0, NULL, NULL); + obd_set_info_async(req->rq_svc_thread->t_env, export, + sizeof(KEY_REVIMP_UPD), KEY_REVIMP_UPD, + 0, NULL, NULL); client_destroy_import(export->exp_imp_reverse); } @@ -2240,7 +2241,7 @@ int target_queue_recovery_request(struct ptlrpc_request *req, int target_handle_ping(struct ptlrpc_request *req) { - obd_ping(req->rq_export); + obd_ping(req->rq_svc_thread->t_env, req->rq_export); return req_capsule_server_pack(&req->rq_pill); } diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index bfcbff1..f33dde1 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -1816,7 +1816,8 @@ static int ldlm_handle_setinfo(struct ptlrpc_request *req) if (KEY_IS(KEY_HSM_COPYTOOL_SEND)) /* Pass it on to mdc (the "export" in this case) */ - rc = obd_set_info_async(req->rq_export, + rc = obd_set_info_async(req->rq_svc_thread->t_env, + req->rq_export, sizeof(KEY_HSM_COPYTOOL_SEND), KEY_HSM_COPYTOOL_SEND, vallen, val, NULL); diff --git a/lustre/liblustre/file.c b/lustre/liblustre/file.c index c23a27d..85c307a 100644 --- a/lustre/liblustre/file.c +++ b/lustre/liblustre/file.c @@ -302,7 +302,7 @@ int llu_objects_destroy(struct ptlrpc_request *req, struct inode *dir) } } - rc = obd_destroy(llu_i2obdexp(dir), oa, lsm, &oti, NULL, NULL); + rc = obd_destroy(NULL, llu_i2obdexp(dir), oa, lsm, &oti, NULL, NULL); OBDO_FREE(oa); if (rc) CERROR("obd destroy objid 0x"LPX64" error %d\n", diff --git a/lustre/liblustre/rw.c b/lustre/liblustre/rw.c index c7af04b..1557089 100644 --- a/lustre/liblustre/rw.c +++ b/lustre/liblustre/rw.c @@ -75,7 +75,7 @@ static int llu_lock_to_stripe_offset(struct inode *inode, struct ldlm_lock *lock RETURN(0); /* get our offset in the lov */ - rc = obd_get_info(exp, sizeof(key), &key, &vallen, &stripe, lsm); + rc = obd_get_info(NULL, exp, sizeof(key), &key, &vallen, &stripe, lsm); if (rc != 0) { CERROR("obd_get_info: rc = %d\n", rc); LBUG(); diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 6467f39..e98c239 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -1095,7 +1095,7 @@ static int llu_statfs_internal(struct llu_sb_info *sbi, int rc; ENTRY; - rc = obd_statfs(class_exp2obd(sbi->ll_md_exp), osfs, max_age, 0); + rc = obd_statfs(NULL, sbi->ll_md_exp, osfs, max_age, 0); if (rc) { CERROR("md_statfs fails: rc = %d\n", rc); RETURN(rc); @@ -1922,8 +1922,8 @@ llu_fsswop_mount(const char *source, CERROR("MDC %s: not setup or attached\n", mdc); GOTO(out_free, err = -EINVAL); } - obd_set_info_async(obd->obd_self_export, sizeof(KEY_ASYNC), KEY_ASYNC, - sizeof(async), &async, NULL); + obd_set_info_async(NULL, obd->obd_self_export, sizeof(KEY_ASYNC), + KEY_ASYNC, sizeof(async), &async, NULL); ocd.ocd_connect_flags = OBD_CONNECT_IBITS | OBD_CONNECT_VERSION | OBD_CONNECT_FID | OBD_CONNECT_AT | @@ -1942,7 +1942,7 @@ llu_fsswop_mount(const char *source, GOTO(out_free, err); } - err = obd_statfs(obd, &osfs, 100000000, 0); + err = obd_statfs(NULL, sbi->ll_md_exp, &osfs, 100000000, 0); if (err) GOTO(out_md, err); @@ -1956,8 +1956,8 @@ llu_fsswop_mount(const char *source, CERROR("OSC %s: not setup or attached\n", osc); GOTO(out_md, err = -EINVAL); } - obd_set_info_async(obd->obd_self_export, sizeof(KEY_ASYNC), KEY_ASYNC, - sizeof(async), &async, NULL); + obd_set_info_async(NULL, obd->obd_self_export, sizeof(KEY_ASYNC), + KEY_ASYNC, sizeof(async), &async, NULL); obd->obd_upcall.onu_owner = &sbi->ll_lco; obd->obd_upcall.onu_upcall = cl_ocd_update; diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c index 62fb203..e063532 100644 --- a/lustre/llite/dir.c +++ b/lustre/llite/dir.c @@ -659,7 +659,7 @@ int ll_send_mgc_param(struct obd_export *mgc, char *string) return -ENOMEM; strncpy(msp->mgs_param, string, MGS_PARAM_MAXLEN); - rc = obd_set_info_async(mgc, sizeof(KEY_SET_INFO), KEY_SET_INFO, + rc = obd_set_info_async(NULL, mgc, sizeof(KEY_SET_INFO), KEY_SET_INFO, sizeof(struct mgs_send_param), msp, NULL); if (rc) CERROR("Failed to set parameter: %d\n", rc); @@ -1510,8 +1510,8 @@ out_free: /* get ost count when count is zero, get mdt count otherwise */ exp = count ? sbi->ll_md_exp : sbi->ll_dt_exp; vallen = sizeof(count); - rc = obd_get_info(exp, sizeof(KEY_TGT_COUNT), KEY_TGT_COUNT, - &vallen, &count, NULL); + rc = obd_get_info(NULL, exp, sizeof(KEY_TGT_COUNT), + KEY_TGT_COUNT, &vallen, &count, NULL); if (rc) { CERROR("get target count failed: %d\n", rc); RETURN(rc); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 55c20dc..de0a436 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -1251,7 +1251,7 @@ static int ll_lov_recreate(struct inode *inode, obd_id id, obd_seq seq, OBD_MD_FLMTIME | OBD_MD_FLCTIME); obdo_set_parent_fid(oa, &ll_i2info(inode)->lli_fid); memcpy(lsm2, lsm, lsm_size); - rc = obd_create(exp, oa, &lsm2, &oti); + rc = obd_create(NULL, exp, oa, &lsm2, &oti); OBD_FREE_LARGE(lsm2, lsm_size); GOTO(out, rc); @@ -1650,7 +1650,8 @@ int ll_do_fiemap(struct inode *inode, struct ll_user_fiemap *fiemap, memcpy(&fm_key.fiemap, fiemap, sizeof(*fiemap)); - rc = obd_get_info(exp, sizeof(fm_key), &fm_key, &vallen, fiemap, lsm); + rc = obd_get_info(NULL, exp, sizeof(fm_key), &fm_key, &vallen, + fiemap, lsm); if (rc) CERROR("obd_get_info failed: rc = %d\n", rc); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index f961699..bae0dc2 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -275,7 +275,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, GOTO(out_md, err); } - err = obd_statfs(obd, osfs, + err = obd_statfs(NULL, sbi->ll_md_exp, osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), 0); if (err) GOTO(out_md_fid, err); @@ -305,7 +305,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, } size = sizeof(*data); - err = obd_get_info(sbi->ll_md_exp, sizeof(KEY_CONN_DATA), + err = obd_get_info(NULL, sbi->ll_md_exp, sizeof(KEY_CONN_DATA), KEY_CONN_DATA, &size, data, NULL); if (err) { CERROR("Get connect data failed: %d \n", err); @@ -527,7 +527,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, #endif checksum = sbi->ll_flags & LL_SBI_CHECKSUM; - err = obd_set_info_async(sbi->ll_dt_exp, sizeof(KEY_CHECKSUM), + err = obd_set_info_async(NULL, sbi->ll_dt_exp, sizeof(KEY_CHECKSUM), KEY_CHECKSUM, sizeof(checksum), &checksum, NULL); cl_sb_init(sb); @@ -581,7 +581,7 @@ int ll_get_max_mdsize(struct ll_sb_info *sbi, int *lmmsize) *lmmsize = obd_size_diskmd(sbi->ll_dt_exp, NULL); size = sizeof(int); - rc = obd_get_info(sbi->ll_md_exp, sizeof(KEY_MAX_EASIZE), + rc = obd_get_info(NULL, sbi->ll_md_exp, sizeof(KEY_MAX_EASIZE), KEY_MAX_EASIZE, &size, lmmsize, NULL); if (rc) CERROR("Get max mdsize error rc %d \n", rc); @@ -1484,7 +1484,7 @@ int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs, int rc; ENTRY; - rc = obd_statfs(class_exp2obd(sbi->ll_md_exp), osfs, max_age, flags); + rc = obd_statfs(NULL, sbi->ll_md_exp, osfs, max_age, flags); if (rc) { CERROR("md_statfs fails: rc = %d\n", rc); RETURN(rc); @@ -1498,8 +1498,7 @@ int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs, if (sbi->ll_flags & LL_SBI_LAZYSTATFS) flags |= OBD_STATFS_NODELAY; - rc = obd_statfs_rqset(class_exp2obd(sbi->ll_dt_exp), - &obd_osfs, max_age, flags); + rc = obd_statfs_rqset(sbi->ll_dt_exp, &obd_osfs, max_age, flags); if (rc) { CERROR("obd_statfs fails: rc = %d\n", rc); RETURN(rc); @@ -1968,10 +1967,10 @@ int ll_flush_ctx(struct inode *inode) CDEBUG(D_SEC, "flush context for user %d\n", cfs_curproc_uid()); - obd_set_info_async(sbi->ll_md_exp, + obd_set_info_async(NULL, sbi->ll_md_exp, sizeof(KEY_FLUSH_CTX), KEY_FLUSH_CTX, 0, NULL, NULL); - obd_set_info_async(sbi->ll_dt_exp, + obd_set_info_async(NULL, sbi->ll_dt_exp, sizeof(KEY_FLUSH_CTX), KEY_FLUSH_CTX, 0, NULL, NULL); return 0; @@ -2063,7 +2062,7 @@ int ll_remount_fs(struct super_block *sb, int *flags, char *data) if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { read_only = *flags & MS_RDONLY; - err = obd_set_info_async(sbi->ll_md_exp, + err = obd_set_info_async(NULL, sbi->ll_md_exp, sizeof(KEY_READ_ONLY), KEY_READ_ONLY, sizeof(read_only), &read_only, NULL); diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 1ba0fd6..b3a7fe1 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -434,7 +434,7 @@ static int ll_wr_checksum(struct file *file, const char *buffer, else sbi->ll_flags &= ~LL_SBI_CHECKSUM; - rc = obd_set_info_async(sbi->ll_dt_exp, sizeof(KEY_CHECKSUM), + rc = obd_set_info_async(NULL, sbi->ll_dt_exp, sizeof(KEY_CHECKSUM), KEY_CHECKSUM, sizeof(val), &val, NULL); if (rc) CWARN("Failed to set OSC checksum flags: %d\n", rc); diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index cdfec91..64bbd87 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -1105,7 +1105,8 @@ int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir) GOTO(out_free_memmd, rc); } - rc = obd_destroy(ll_i2dtexp(dir), oa, lsm, &oti, ll_i2mdexp(dir), oc); + rc = obd_destroy(NULL, ll_i2dtexp(dir), oa, lsm, &oti, + ll_i2mdexp(dir), oc); capa_put(oc); OBDO_FREE(oa); if (rc) diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index d53fade..76f1db9 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -322,7 +322,7 @@ static void lmv_set_timeouts(struct obd_device *obd) if (tgts->ltd_exp == NULL) continue; - obd_set_info_async(tgts->ltd_exp, sizeof(KEY_INTERMDS), + obd_set_info_async(NULL, tgts->ltd_exp, sizeof(KEY_INTERMDS), KEY_INTERMDS, 0, NULL, NULL); } } @@ -757,7 +757,7 @@ static int lmv_iocontrol(unsigned int cmd, struct obd_export *exp, (int) sizeof(struct obd_uuid)))) RETURN(-EFAULT); - rc = obd_statfs(mdc_obd, &stat_buf, + rc = obd_statfs(NULL, lmv->tgts[index].ltd_exp, &stat_buf, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), 0); if (rc) @@ -1170,9 +1170,10 @@ out: RETURN(rc); } -static int lmv_statfs(struct obd_device *obd, struct obd_statfs *osfs, - __u64 max_age, __u32 flags) +static int lmv_statfs(const struct lu_env *env, struct obd_export *exp, + struct obd_statfs *osfs, __u64 max_age, __u32 flags) { + struct obd_device *obd = class_exp2obd(exp); struct lmv_obd *lmv = &obd->u.lmv; struct obd_statfs *temp; int rc = 0; @@ -1191,7 +1192,7 @@ static int lmv_statfs(struct obd_device *obd, struct obd_statfs *osfs, if (lmv->tgts[i].ltd_exp == NULL) continue; - rc = obd_statfs(lmv->tgts[i].ltd_exp->exp_obd, temp, + rc = obd_statfs(env, lmv->tgts[i].ltd_exp, temp, max_age, flags); if (rc) { CERROR("can't stat MDS #%d (%s), error %d\n", i, @@ -2648,8 +2649,8 @@ static int lmv_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage) RETURN(rc); } -static int lmv_get_info(struct obd_export *exp, __u32 keylen, - void *key, __u32 *vallen, void *val, +static int lmv_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 *obd; @@ -2685,7 +2686,7 @@ static int lmv_get_info(struct obd_export *exp, __u32 keylen, continue; } - if (!obd_get_info(tgts->ltd_exp, keylen, key, + if (!obd_get_info(env, tgts->ltd_exp, keylen, key, vallen, val, NULL)) RETURN(0); } @@ -2699,7 +2700,7 @@ static int lmv_get_info(struct obd_export *exp, __u32 keylen, * Forwarding this request to first MDS, it should know LOV * desc. */ - rc = obd_get_info(lmv->tgts[0].ltd_exp, keylen, key, + rc = obd_get_info(env, lmv->tgts[0].ltd_exp, keylen, key, vallen, val, NULL); if (!rc && KEY_IS(KEY_CONN_DATA)) { exp->exp_connect_flags = @@ -2715,9 +2716,9 @@ static int lmv_get_info(struct obd_export *exp, __u32 keylen, RETURN(-EINVAL); } -int lmv_set_info_async(struct obd_export *exp, obd_count keylen, - void *key, obd_count vallen, void *val, - struct ptlrpc_request_set *set) +int lmv_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 lmv_tgt_desc *tgt; struct obd_device *obd; @@ -2742,7 +2743,7 @@ int lmv_set_info_async(struct obd_export *exp, obd_count keylen, if (!tgt->ltd_exp) continue; - err = obd_set_info_async(tgt->ltd_exp, + err = obd_set_info_async(env, tgt->ltd_exp, keylen, key, vallen, val, set); if (err && rc == 0) rc = err; diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index a7696d3..211e04a 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -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); } diff --git a/lustre/lov/lov_pack.c b/lustre/lov/lov_pack.c index d0bd02e..777adde 100644 --- a/lustre/lov/lov_pack.c +++ b/lustre/lov/lov_pack.c @@ -534,7 +534,7 @@ int lov_setea(struct obd_export *exp, struct lov_stripe_md **lsmp, for (i = 0; i < lump->lmm_stripe_count; i++) { __u32 len = sizeof(last_id); oexp = lov->lov_tgts[lmm_objects[i].l_ost_idx]->ltd_exp; - rc = obd_get_info(oexp, sizeof(KEY_LAST_ID), KEY_LAST_ID, + rc = obd_get_info(NULL, oexp, sizeof(KEY_LAST_ID), KEY_LAST_ID, &len, &last_id, NULL); if (rc) RETURN(rc); diff --git a/lustre/lov/lov_qos.c b/lustre/lov/lov_qos.c index 3560d06..880ca0a 100644 --- a/lustre/lov/lov_qos.c +++ b/lustre/lov/lov_qos.c @@ -523,7 +523,7 @@ static int lov_check_and_create_object(struct lov_obd *lov, int ost_idx, if (stripe >= lsm->lsm_stripe_count) { req->rq_idx = ost_idx; - rc = obd_create(lov->lov_tgts[ost_idx]->ltd_exp, + rc = obd_create(NULL, lov->lov_tgts[ost_idx]->ltd_exp, req->rq_oi.oi_oa, &req->rq_oi.oi_md, oti); } @@ -1201,7 +1201,7 @@ void qos_statfs_update(struct obd_device *obd, __u64 max_age, int wait) if (!set) GOTO(out_failed, rc = -ENOMEM); - rc = obd_statfs_async(obd, oinfo, max_age, set); + rc = obd_statfs_async(obd->obd_self_export, oinfo, max_age, set); if (rc || cfs_list_empty(&set->set_requests)) { if (rc) CWARN("statfs failed with %d\n", rc); diff --git a/lustre/lov/lov_request.c b/lustre/lov/lov_request.c index 9c73bb0..87204c3 100644 --- a/lustre/lov/lov_request.c +++ b/lustre/lov/lov_request.c @@ -664,8 +664,8 @@ cleanup: continue; sub_exp = lov->lov_tgts[req->rq_idx]->ltd_exp; - err = obd_destroy(sub_exp, req->rq_oi.oi_oa, NULL, oti, NULL, - NULL); + err = obd_destroy(NULL, sub_exp, req->rq_oi.oi_oa, NULL, oti, + NULL, NULL); if (err) CERROR("Failed to uncreate objid "LPX64" subobj " LPX64" on OST idx %d: rc = %d\n", diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 89fb2c8..eca791a 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -1099,9 +1099,11 @@ restart_bulk: RETURN(0); } -static int mdc_statfs(struct obd_device *obd, struct obd_statfs *osfs, +static int mdc_statfs(const struct lu_env *env, + struct obd_export *exp, struct obd_statfs *osfs, __u64 max_age, __u32 flags) { + struct obd_device *obd = class_exp2obd(exp); struct ptlrpc_request *req; struct obd_statfs *msfs; struct obd_import *imp = NULL; @@ -1181,7 +1183,7 @@ static int mdc_ioc_fid2path(struct obd_export *exp, struct getinfo_fid2path *gf) /* Val is struct getinfo_fid2path result plus path */ vallen = sizeof(*gf) + gf->gf_pathlen; - rc = obd_get_info(exp, keylen, key, &vallen, gf, NULL); + rc = obd_get_info(NULL, exp, keylen, key, &vallen, gf, NULL); if (rc) GOTO(out, rc); @@ -1466,7 +1468,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, struct ioc_changelog *icc = karg; struct changelog_setinfo cs = {.cs_recno = icc->icc_recno, .cs_id = icc->icc_id}; - rc = obd_set_info_async(exp, strlen(KEY_CHANGELOG_CLEAR), + rc = obd_set_info_async(NULL, exp, strlen(KEY_CHANGELOG_CLEAR), KEY_CHANGELOG_CLEAR, sizeof(cs), &cs, NULL); GOTO(out, rc); @@ -1523,7 +1525,7 @@ static int mdc_iocontrol(unsigned int cmd, struct obd_export *exp, int len, (int) sizeof(struct obd_uuid)))) GOTO(out, rc = -EFAULT); - rc = mdc_statfs(obd, &stat_buf, + rc = mdc_statfs(NULL, obd->obd_self_export, &stat_buf, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), 0); if (rc != 0) @@ -1719,7 +1721,8 @@ static int mdc_hsm_copytool_send(int len, void *val) RETURN(rc); } -int mdc_set_info_async(struct obd_export *exp, +int mdc_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) @@ -1776,8 +1779,9 @@ int mdc_set_info_async(struct obd_export *exp, RETURN(rc); } -int mdc_get_info(struct obd_export *exp, __u32 keylen, void *key, - __u32 *vallen, void *val, struct lov_stripe_md *lsm) +int mdc_get_info(const struct lu_env *env, struct obd_export *exp, + __u32 keylen, void *key, __u32 *vallen, void *val, + struct lov_stripe_md *lsm) { int rc = -EINVAL; diff --git a/lustre/mdd/mdd_device.c b/lustre/mdd/mdd_device.c index 923cd45..f7bdbce 100644 --- a/lustre/mdd/mdd_device.c +++ b/lustre/mdd/mdd_device.c @@ -1194,8 +1194,8 @@ static int mdd_update_capa_key(const struct lu_env *env, int rc; ENTRY; - rc = obd_set_info_async(lov_exp, sizeof(KEY_CAPA_KEY), KEY_CAPA_KEY, - sizeof(info), &info, NULL); + rc = obd_set_info_async(env, lov_exp, sizeof(KEY_CAPA_KEY), + KEY_CAPA_KEY, sizeof(info), &info, NULL); RETURN(rc); } diff --git a/lustre/mdd/mdd_lov.c b/lustre/mdd/mdd_lov.c index d230662..0c8884a 100644 --- a/lustre/mdd/mdd_lov.c +++ b/lustre/mdd/mdd_lov.c @@ -484,7 +484,7 @@ int mdd_lov_create(const struct lu_env *env, struct mdd_device *mdd, } OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_OPEN_WAIT_CREATE, 10); - rc = obd_create(lov_exp, oa, &lsm, oti); + rc = obd_create(env, lov_exp, oa, &lsm, oti); if (rc) { if (rc > 0) { CERROR("Create error for "DFID": %d\n", @@ -632,7 +632,7 @@ int mdd_lovobj_unlink(const struct lu_env *env, struct mdd_device *mdd, CDEBUG(D_INFO, "destroying OSS object "LPU64":"LPU64"\n", oa->o_seq, oa->o_id); - rc = obd_destroy(lov_exp, oa, lsm, oti, NULL, NULL); + rc = obd_destroy(env, lov_exp, oa, lsm, oti, NULL, NULL); obd_free_memmd(lov_exp, &lsm); RETURN(rc); diff --git a/lustre/mds/lproc_mds.c b/lustre/mds/lproc_mds.c index bf8b66c..bd872fd 100644 --- a/lustre/mds/lproc_mds.c +++ b/lustre/mds/lproc_mds.c @@ -108,7 +108,7 @@ static int lprocfs_mds_wr_evict_client(struct file *file, const char *buffer, } if (obd->u.mds.mds_evict_ost_nids) { - rc = obd_set_info_async(mds->mds_lov_exp, + rc = obd_set_info_async(NULL, mds->mds_lov_exp, sizeof(KEY_EVICT_BY_NID), KEY_EVICT_BY_NID, strlen(tmpbuf + 4) + 1, tmpbuf + 4, set); diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c index aea43b3..6edf6c7 100644 --- a/lustre/mds/mds_fs.c +++ b/lustre/mds/mds_fs.c @@ -59,8 +59,9 @@ /* Creates an object with the same name as its fid. Because this is not at all * performance sensitive, it is accomplished by creating a file, checking the * fid, and renaming it. */ -int mds_obd_create(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md **ea, struct obd_trans_info *oti) +int mds_obd_create(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md **ea, + struct obd_trans_info *oti) { struct mds_obd *mds = &exp->exp_obd->u.mds; struct inode *parent_inode = mds->mds_objects_dir->d_inode; @@ -154,9 +155,10 @@ out_pop: RETURN(rc); } -int mds_obd_destroy(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md *ea, struct obd_trans_info *oti, - struct obd_export *md_exp, void *capa) +int mds_obd_destroy(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md *ea, + struct obd_trans_info *oti, struct obd_export *md_exp, + void *capa) { struct mds_obd *mds = &exp->exp_obd->u.mds; struct inode *parent_inode = mds->mds_objects_dir->d_inode; diff --git a/lustre/mds/mds_internal.h b/lustre/mds/mds_internal.h index ac3f613..2868a51 100644 --- a/lustre/mds/mds_internal.h +++ b/lustre/mds/mds_internal.h @@ -64,10 +64,12 @@ int mds_convert_lov_ea(struct obd_device *obd, struct inode *inode, __u64 connect_flags); int mds_init_lov_desc(struct obd_device *obd, struct obd_export *osc_exp); -int mds_obd_create(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md **ea, struct obd_trans_info *oti); -int mds_obd_destroy(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md *ea, struct obd_trans_info *oti, +int mds_obd_create(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md **ea, + struct obd_trans_info *oti); +int mds_obd_destroy(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md *ea, + struct obd_trans_info *oti, struct obd_export *md_exp, void *capa); /* mds/handler.c */ diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index 51d0e97..cdadb79 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -511,8 +511,8 @@ static int mds_lov_get_objid(struct obd_device * obd, size = sizeof(lastid); lastid.idx = idx; lastid.data = &data[off]; - rc = obd_get_info(lov_exp, sizeof(KEY_LAST_ID), KEY_LAST_ID, - &size, &lastid, NULL); + rc = obd_get_info(NULL, lov_exp, sizeof(KEY_LAST_ID), + KEY_LAST_ID, &size, &lastid, NULL); if (rc) GOTO(out, rc); @@ -548,7 +548,7 @@ int mds_lov_clear_orphans(struct mds_obd *mds, struct obd_uuid *ost_uuid) if (ost_uuid != NULL) oti.oti_ost_uuid = ost_uuid; - rc = obd_create(mds->mds_lov_exp, &oa, &empty_ea, &oti); + rc = obd_create(NULL, mds->mds_lov_exp, &oa, &empty_ea, &oti); RETURN(rc); } @@ -565,7 +565,7 @@ static int mds_lov_set_one_nextid(struct obd_device *obd, __u32 idx, obd_id *id) info.idx = idx; info.data = id; - rc = obd_set_info_async(mds->mds_lov_exp, sizeof(KEY_NEXT_ID), + rc = obd_set_info_async(NULL, mds->mds_lov_exp, sizeof(KEY_NEXT_ID), KEY_NEXT_ID, sizeof(info), &info, NULL); if (rc) CERROR ("%s: mds_lov_set_nextid failed (%d)\n", @@ -588,8 +588,8 @@ static int mds_lov_update_desc(struct obd_device *obd, int idx, if (!ld) RETURN(-ENOMEM); - rc = obd_get_info(mds->mds_lov_exp, sizeof(KEY_LOVDESC), KEY_LOVDESC, - &valsize, ld, NULL); + rc = obd_get_info(NULL, mds->mds_lov_exp, sizeof(KEY_LOVDESC), + KEY_LOVDESC, &valsize, ld, NULL); if (rc) GOTO(out, rc); @@ -801,8 +801,9 @@ static int mds_propagate_capa_keys(struct mds_obd *mds, struct obd_uuid *uuid) DEBUG_CAPA_KEY(D_SEC, key, "propagate"); info.capa = key; - rc = obd_set_info_async(mds->mds_lov_exp, sizeof(KEY_CAPA_KEY), - KEY_CAPA_KEY, sizeof(info), &info, NULL); + rc = obd_set_info_async(NULL, mds->mds_lov_exp, + sizeof(KEY_CAPA_KEY), KEY_CAPA_KEY, + sizeof(info), &info, NULL); if (rc) { DEBUG_CAPA_KEY(D_ERROR, key, "propagate failed (rc = %d) for", rc); @@ -851,7 +852,7 @@ static int __mds_lov_synchronize(void *data) mgi.group = mdt_to_obd_objseq(mds->mds_id); mgi.uuid = uuid; - rc = obd_set_info_async(mds->mds_lov_exp, sizeof(KEY_MDS_CONN), + rc = obd_set_info_async(NULL, mds->mds_lov_exp, sizeof(KEY_MDS_CONN), KEY_MDS_CONN, sizeof(mgi), &mgi, NULL); if (rc != 0) GOTO(out, rc); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 95094de..e50b8a4 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -4891,7 +4891,8 @@ static const struct lu_object_operations mdt_obj_ops = { .loo_object_print = mdt_object_print }; -static int mdt_obd_set_info_async(struct obd_export *exp, +static int mdt_obd_set_info_async(const struct lu_env *env, + struct obd_export *exp, __u32 keylen, void *key, __u32 vallen, void *val, struct ptlrpc_request_set *set) diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 0034b9c..459f5d3 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -1003,9 +1003,9 @@ static int mgc_target_register(struct obd_export *exp, RETURN(rc); } -int mgc_set_info_async(struct obd_export *exp, obd_count keylen, - void *key, obd_count vallen, void *val, - struct ptlrpc_request_set *set) +int mgc_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) { int rc = -EINVAL; ENTRY; @@ -1114,8 +1114,9 @@ int mgc_set_info_async(struct obd_export *exp, obd_count keylen, RETURN(rc); } -static int mgc_get_info(struct obd_export *exp, __u32 keylen, void *key, - __u32 *vallen, void *val, struct lov_stripe_md *unused) +static int mgc_get_info(const struct lu_env *env, struct obd_export *exp, + __u32 keylen, void *key, __u32 *vallen, void *val, + struct lov_stripe_md *unused) { int rc = -EINVAL; diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index b69773a..9839fcd 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -591,7 +591,7 @@ int class_notify_sptlrpc_conf(const char *fsname, int namelen) class_incref(obd, __FUNCTION__, obd); cfs_read_unlock(&obd_dev_lock); - rc2 = obd_set_info_async(obd->obd_self_export, + rc2 = obd_set_info_async(NULL, obd->obd_self_export, sizeof(KEY_SPTLRPC_CONF), KEY_SPTLRPC_CONF, 0, NULL, NULL); rc = rc ? rc : rc2; diff --git a/lustre/obdclass/linux/linux-module.c b/lustre/obdclass/linux/linux-module.c index 33de26f..381152e 100644 --- a/lustre/obdclass/linux/linux-module.c +++ b/lustre/obdclass/linux/linux-module.c @@ -304,7 +304,7 @@ static int obd_proc_read_health(char *page, char **start, off_t off, class_incref(obd, __FUNCTION__, cfs_current()); cfs_read_unlock(&obd_dev_lock); - if (obd_health_check(obd)) { + if (obd_health_check(NULL, obd)) { rc += snprintf(page + rc, count - rc, "device %s reported unhealthy\n", obd->obd_name); diff --git a/lustre/obdclass/llog_lvfs.c b/lustre/obdclass/llog_lvfs.c index 6fcf8e8b..53bbb4a 100644 --- a/lustre/obdclass/llog_lvfs.c +++ b/lustre/obdclass/llog_lvfs.c @@ -655,7 +655,7 @@ static int llog_lvfs_create(struct llog_ctxt *ctxt, struct llog_handle **res, oa->o_seq = FID_SEQ_LLOG; oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLGROUP; - rc = obd_create(ctxt->loc_exp, oa, NULL, NULL); + rc = obd_create(NULL, ctxt->loc_exp, oa, NULL, NULL); if (rc) GOTO(out, rc); @@ -755,7 +755,8 @@ static int llog_lvfs_destroy(struct llog_handle *handle) GOTO(out, rc = PTR_ERR(th)); } - rc = obd_destroy(handle->lgh_ctxt->loc_exp, oa, NULL, NULL, NULL, NULL); + rc = obd_destroy(NULL, handle->lgh_ctxt->loc_exp, oa, + NULL, NULL, NULL, NULL); rc1 = fsfilt_commit(obd, inode, th, 0); if (rc == 0 && rc1 != 0) diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 5bd2ea6..2055833 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -556,8 +556,9 @@ int lprocfs_rd_fstype(char *page, char **start, off_t off, int count, int *eof, int lprocfs_rd_blksize(char *page, char **start, off_t off, int count, int *eof, void *data) { - struct obd_statfs osfs; - int rc = obd_statfs(data, &osfs, + struct obd_device *obd = data; + struct obd_statfs osfs; + int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) { @@ -570,8 +571,9 @@ int lprocfs_rd_blksize(char *page, char **start, off_t off, int count, int lprocfs_rd_kbytestotal(char *page, char **start, off_t off, int count, int *eof, void *data) { - struct obd_statfs osfs; - int rc = obd_statfs(data, &osfs, + struct obd_device *obd = data; + struct obd_statfs osfs; + int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) { @@ -590,8 +592,9 @@ int lprocfs_rd_kbytestotal(char *page, char **start, off_t off, int count, int lprocfs_rd_kbytesfree(char *page, char **start, off_t off, int count, int *eof, void *data) { - struct obd_statfs osfs; - int rc = obd_statfs(data, &osfs, + struct obd_device *obd = data; + struct obd_statfs osfs; + int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) { @@ -610,8 +613,9 @@ int lprocfs_rd_kbytesfree(char *page, char **start, off_t off, int count, int lprocfs_rd_kbytesavail(char *page, char **start, off_t off, int count, int *eof, void *data) { - struct obd_statfs osfs; - int rc = obd_statfs(data, &osfs, + struct obd_device *obd = data; + struct obd_statfs osfs; + int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) { @@ -630,8 +634,9 @@ int lprocfs_rd_kbytesavail(char *page, char **start, off_t off, int count, int lprocfs_rd_filestotal(char *page, char **start, off_t off, int count, int *eof, void *data) { - struct obd_statfs osfs; - int rc = obd_statfs(data, &osfs, + struct obd_device *obd = data; + struct obd_statfs osfs; + int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) { @@ -645,8 +650,9 @@ int lprocfs_rd_filestotal(char *page, char **start, off_t off, int count, int lprocfs_rd_filesfree(char *page, char **start, off_t off, int count, int *eof, void *data) { - struct obd_statfs osfs; - int rc = obd_statfs(data, &osfs, + struct obd_device *obd = data; + struct obd_statfs osfs; + int rc = obd_statfs(NULL, obd->obd_self_export, &osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), OBD_STATFS_NODELAY); if (!rc) { diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index 9f02b7d..5392644 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -648,7 +648,7 @@ static int lustre_start_mgc(struct super_block *sb) obd = class_name2obd(mgcname); if (obd && !obd->obd_stopping) { - rc = obd_set_info_async(obd->obd_self_export, + rc = obd_set_info_async(NULL, obd->obd_self_export, strlen(KEY_MGSSEC), KEY_MGSSEC, strlen(mgssec), mgssec, NULL); if (rc) @@ -663,7 +663,7 @@ static int lustre_start_mgc(struct super_block *sb) int vallen = sizeof(*data); __u32 *flags = &lsi->lsi_lmd->lmd_flags; - rc = obd_get_info(obd->obd_self_export, + rc = obd_get_info(NULL, obd->obd_self_export, strlen(KEY_CONN_DATA), KEY_CONN_DATA, &vallen, data, NULL); LASSERT(rc == 0); @@ -697,7 +697,7 @@ static int lustre_start_mgc(struct super_block *sb) if at all possible. */ recov_bk++; CDEBUG(D_MOUNT, "%s: Set MGC reconnect %d\n", mgcname,recov_bk); - rc = obd_set_info_async(obd->obd_self_export, + rc = obd_set_info_async(NULL, obd->obd_self_export, sizeof(KEY_INIT_RECOV_BACKUP), KEY_INIT_RECOV_BACKUP, sizeof(recov_bk), &recov_bk, NULL); @@ -792,7 +792,7 @@ static int lustre_start_mgc(struct super_block *sb) GOTO(out_free, rc = -ENOTCONN); } - rc = obd_set_info_async(obd->obd_self_export, + rc = obd_set_info_async(NULL, obd->obd_self_export, strlen(KEY_MGSSEC), KEY_MGSSEC, strlen(mgssec), mgssec, NULL); if (rc) @@ -804,7 +804,7 @@ static int lustre_start_mgc(struct super_block *sb) /* Try all connections, but only once. */ recov_bk = 1; - rc = obd_set_info_async(obd->obd_self_export, + rc = obd_set_info_async(NULL, obd->obd_self_export, sizeof(KEY_INIT_RECOV_BACKUP), KEY_INIT_RECOV_BACKUP, sizeof(recov_bk), &recov_bk, NULL); @@ -925,7 +925,7 @@ static int server_mgc_set_fs(struct obd_device *mgc, struct super_block *sb) CDEBUG(D_MOUNT, "Set mgc disk for %s\n", lsi->lsi_lmd->lmd_dev); /* cl_mgc_sem in mgc insures we sleep if the mgc_fs is busy */ - rc = obd_set_info_async(mgc->obd_self_export, + rc = obd_set_info_async(NULL, mgc->obd_self_export, sizeof(KEY_SET_FS), KEY_SET_FS, sizeof(*sb), sb, NULL); if (rc) { @@ -942,7 +942,7 @@ static int server_mgc_clear_fs(struct obd_device *mgc) CDEBUG(D_MOUNT, "Unassign mgc disk\n"); - rc = obd_set_info_async(mgc->obd_self_export, + rc = obd_set_info_async(NULL, mgc->obd_self_export, sizeof(KEY_CLEAR_FS), KEY_CLEAR_FS, 0, NULL, NULL); RETURN(rc); @@ -1090,7 +1090,7 @@ int server_register_target(struct super_block *sb) /* Register the target */ /* FIXME use mgc_process_config instead */ - rc = obd_set_info_async(mgc->u.cli.cl_mgc_mgsexp, + rc = obd_set_info_async(NULL, mgc->u.cli.cl_mgc_mgsexp, sizeof(KEY_REGISTER_TARGET), KEY_REGISTER_TARGET, sizeof(*mti), mti, NULL); if (rc) { @@ -1173,7 +1173,7 @@ static int server_notify_target(struct super_block *sb, struct obd_device *obd) mti->mti_flags |= LDD_F_OPC_READY; /* FIXME use mgc_process_config instead */ - rc = obd_set_info_async(mgc->u.cli.cl_mgc_mgsexp, + rc = obd_set_info_async(NULL, mgc->u.cli.cl_mgc_mgsexp, sizeof(KEY_REGISTER_TARGET), KEY_REGISTER_TARGET, sizeof(*mti), mti, NULL); diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index 73add0a..17a3f6f 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -119,8 +119,9 @@ static int echo_destroy_export(struct obd_export *exp) return id; } -static int echo_create(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md **ea, struct obd_trans_info *oti) +static int echo_create(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md **ea, + struct obd_trans_info *oti) { struct obd_device *obd = class_exp2obd(exp); @@ -146,9 +147,10 @@ static int echo_create(struct obd_export *exp, struct obdo *oa, return 0; } -static int echo_destroy(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md *ea, struct obd_trans_info *oti, - struct obd_export *md_exp, void *capa) +static int echo_destroy(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md *ea, + struct obd_trans_info *oti, struct obd_export *md_exp, + void *capa) { struct obd_device *obd = class_exp2obd(exp); @@ -172,7 +174,8 @@ static int echo_destroy(struct obd_export *exp, struct obdo *oa, RETURN(0); } -static int echo_getattr(struct obd_export *exp, struct obd_info *oinfo) +static int echo_getattr(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo) { struct obd_device *obd = class_exp2obd(exp); obd_id id = oinfo->oi_oa->o_id; @@ -196,8 +199,8 @@ static int echo_getattr(struct obd_export *exp, struct obd_info *oinfo) RETURN(0); } -static int echo_setattr(struct obd_export *exp, struct obd_info *oinfo, - struct obd_trans_info *oti) +static int echo_setattr(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo, struct obd_trans_info *oti) { struct obd_device *obd = class_exp2obd(exp); @@ -390,11 +393,12 @@ static int echo_finalize_lb(struct obdo *oa, struct obd_ioobj *obj, return rc; } -static int echo_preprw(int cmd, struct obd_export *export, struct obdo *oa, - int objcount, struct obd_ioobj *obj, - struct niobuf_remote *nb, int *pages, - struct niobuf_local *res, struct obd_trans_info *oti, - struct lustre_capa *unused) +static int echo_preprw(const struct lu_env *env, int cmd, + struct obd_export *export, struct obdo *oa, + int objcount, struct obd_ioobj *obj, + struct niobuf_remote *nb, int *pages, + struct niobuf_local *res, struct obd_trans_info *oti, + struct lustre_capa *unused) { struct obd_device *obd; int tot_bytes = 0; @@ -467,11 +471,12 @@ preprw_cleanup: return rc; } -static int echo_commitrw(int cmd, struct obd_export *export, struct obdo *oa, - int objcount, struct obd_ioobj *obj, - struct niobuf_remote *rb, int niocount, - struct niobuf_local *res, struct obd_trans_info *oti, - int rc) +static int echo_commitrw(const struct lu_env *env, int cmd, + struct obd_export *export, struct obdo *oa, + int objcount, struct obd_ioobj *obj, + struct niobuf_remote *rb, int niocount, + struct niobuf_local *res, struct obd_trans_info *oti, + int rc) { struct obd_device *obd; int pgs = 0; diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index abc24b37..1484037 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -2051,9 +2051,9 @@ static int echo_md_handler(struct echo_device *ed, int command, return rc; } -static int echo_create_object(struct echo_device *ed, int on_target, - struct obdo *oa, void *ulsm, int ulsm_nob, - struct obd_trans_info *oti) +static int echo_create_object(const struct lu_env *env, struct echo_device *ed, + int on_target, struct obdo *oa, void *ulsm, + int ulsm_nob, struct obd_trans_info *oti) { struct echo_object *eco; struct echo_client_obd *ec = ed->ed_ec; @@ -2112,7 +2112,7 @@ static int echo_create_object(struct echo_device *ed, int on_target, /* Only echo objects are allowed to be created */ LASSERT((oa->o_valid & OBD_MD_FLGROUP) && (oa->o_seq == FID_SEQ_ECHO)); - rc = obd_create(ec->ec_exp, oa, &lsm, oti); + rc = obd_create(env, ec->ec_exp, oa, &lsm, oti); if (rc != 0) { CERROR("Cannot create objects: rc = %d\n", rc); GOTO(failed, rc); @@ -2134,7 +2134,7 @@ static int echo_create_object(struct echo_device *ed, int on_target, failed: if (created && rc) - obd_destroy(ec->ec_exp, oa, lsm, oti, NULL, NULL); + obd_destroy(env, ec->ec_exp, oa, lsm, oti, NULL, NULL); if (lsm) obd_free_memmd(ec->ec_exp, &lsm); if (rc) @@ -2421,8 +2421,8 @@ static int echo_client_prep_commit(struct obd_export *exp, int rw, oti->oti_transno = 0; lpages = npages; - ret = obd_preprw(rw, exp, oa, 1, &ioo, rnb, &lpages, lnb, oti, - NULL); + ret = obd_preprw(NULL, rw, exp, oa, 1, &ioo, rnb, &lpages, + lnb, oti, NULL); if (ret != 0) GOTO(out, ret); LASSERT(lpages == npages); @@ -2454,7 +2454,8 @@ static int echo_client_prep_commit(struct obd_export *exp, int rw, rnb[i].len); } - ret = obd_commitrw(rw, exp, oa, 1,&ioo,rnb,npages,lnb,oti,ret); + ret = obd_commitrw(NULL, rw, exp, oa, 1, &ioo, + rnb, npages, lnb, oti, ret); if (ret != 0) GOTO(out, ret); @@ -2576,8 +2577,8 @@ echo_client_cancel(struct obd_export *exp, struct obdo *oa) } static int -echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, - int len, void *karg, void *uarg) +echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len, + void *karg, void *uarg) { struct obd_device *obd = exp->exp_obd; struct echo_device *ed = obd2echo_dev(obd); @@ -2585,6 +2586,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, struct echo_object *eco; struct obd_ioctl_data *data = karg; struct obd_trans_info dummy_oti; + struct lu_env *env; struct oti_req_ack_lock *ack_lock; struct obdo *oa; struct lu_fid fid; @@ -2610,14 +2612,21 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, if (rc < 0) RETURN(rc); + OBD_ALLOC_PTR(env); + if (env == NULL) + RETURN(-ENOMEM); + + rc = lu_env_init(env, LCT_DT_THREAD); + if (rc) + GOTO(out, rc = -ENOMEM); + switch (cmd) { case OBD_IOC_CREATE: /* may create echo object */ if (!cfs_capable(CFS_CAP_SYS_ADMIN)) GOTO (out, rc = -EPERM); - rc = echo_create_object (ed, 1, oa, - data->ioc_pbuf1, data->ioc_plen1, - &dummy_oti); + rc = echo_create_object(env, ed, 1, oa, data->ioc_pbuf1, + data->ioc_plen1, &dummy_oti); GOTO(out, rc); case OBD_IOC_ECHO_MD: { @@ -2650,7 +2659,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, GOTO(out, rc); } case OBD_IOC_ECHO_ALLOC_SEQ: { - struct lu_env *env; + struct lu_env *cl_env; int refcheck; __u64 seq; int max_count; @@ -2658,19 +2667,19 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, if (!cfs_capable(CFS_CAP_SYS_ADMIN)) GOTO(out, rc = -EPERM); - env = cl_env_get(&refcheck); - if (IS_ERR(env)) - GOTO(out, rc = PTR_ERR(env)); + cl_env = cl_env_get(&refcheck); + if (IS_ERR(cl_env)) + GOTO(out, rc = PTR_ERR(cl_env)); - rc = lu_env_refill_by_tags(env, ECHO_MD_CTX_TAG, + rc = lu_env_refill_by_tags(cl_env, ECHO_MD_CTX_TAG, ECHO_MD_SES_TAG); if (rc != 0) { - cl_env_put(env, &refcheck); + cl_env_put(cl_env, &refcheck); GOTO(out, rc); } - rc = seq_client_get_seq(env, ed->ed_cl_seq, &seq); - cl_env_put(env, &refcheck); + rc = seq_client_get_seq(cl_env, ed->ed_cl_seq, &seq); + cl_env_put(cl_env, &refcheck); if (rc < 0) { CERROR("%s: Can not alloc seq: rc = %d\n", obd->obd_name, rc); @@ -2690,9 +2699,9 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, if (!cfs_capable(CFS_CAP_SYS_ADMIN)) GOTO (out, rc = -EPERM); - rc = echo_get_object (&eco, ed, oa); + rc = echo_get_object(&eco, ed, oa); if (rc == 0) { - rc = obd_destroy(ec->ec_exp, oa, eco->eo_lsm, + rc = obd_destroy(env, ec->ec_exp, oa, eco->eo_lsm, &dummy_oti, NULL, NULL); if (rc == 0) eco->eo_deleted = 1; @@ -2701,12 +2710,12 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, GOTO(out, rc); case OBD_IOC_GETATTR: - rc = echo_get_object (&eco, ed, oa); + rc = echo_get_object(&eco, ed, oa); if (rc == 0) { struct obd_info oinfo = { { { 0 } } }; oinfo.oi_md = eco->eo_lsm; oinfo.oi_oa = oa; - rc = obd_getattr(ec->ec_exp, &oinfo); + rc = obd_getattr(env, ec->ec_exp, &oinfo); echo_put_object(eco); } GOTO(out, rc); @@ -2715,13 +2724,13 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, if (!cfs_capable(CFS_CAP_SYS_ADMIN)) GOTO (out, rc = -EPERM); - rc = echo_get_object (&eco, ed, oa); + rc = echo_get_object(&eco, ed, oa); if (rc == 0) { struct obd_info oinfo = { { { 0 } } }; oinfo.oi_oa = oa; oinfo.oi_md = eco->eo_lsm; - rc = obd_setattr(ec->ec_exp, &oinfo, NULL); + rc = obd_setattr(env, ec->ec_exp, &oinfo, NULL); echo_put_object(eco); } GOTO(out, rc); @@ -2756,7 +2765,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, echo_put_object(eco); } } else { - rc = echo_create_object(ed, 0, oa, + rc = echo_create_object(env, ed, 0, oa, data->ioc_pbuf1, data->ioc_plen1, &dummy_oti); } @@ -2782,7 +2791,9 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, } EXIT; - out: +out: + lu_env_fini(env); + OBD_FREE_PTR(env); /* XXX this should be in a helper also called by target_send_reply */ for (ack_lock = dummy_oti.oti_ack_locks, i = 0; i < 4; diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c index 1dfa194..97af8b5 100644 --- a/lustre/obdfilter/filter.c +++ b/lustre/obdfilter/filter.c @@ -3114,7 +3114,7 @@ static void filter_revimp_update(struct obd_export *exp) EXIT; } -static int filter_ping(struct obd_export *exp) +static int filter_ping(const struct lu_env *env, struct obd_export *exp) { filter_fmd_expire(exp); return 0; @@ -3160,7 +3160,8 @@ struct dentry *__filter_oa2dentry(struct obd_device *obd, struct ost_id *ostid, return dchild; } -static int filter_getattr(struct obd_export *exp, struct obd_info *oinfo) +static int filter_getattr(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo) { struct dentry *dentry = NULL; struct obd_device *obd; @@ -3417,8 +3418,8 @@ out_unlock: } /* this is called from filter_truncate() until we have filter_punch() */ -int filter_setattr(struct obd_export *exp, struct obd_info *oinfo, - struct obd_trans_info *oti) +int filter_setattr(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo, struct obd_trans_info *oti) { struct obdo *oa = oinfo->oi_oa; struct lustre_capa *capa = oinfo_capa(oinfo); @@ -3609,7 +3610,7 @@ static int filter_destroy_precreated(struct obd_export *exp, struct obdo *oa, for (id = last; id > oa->o_id; id--) { doa.o_id = id; - rc = filter_destroy(exp, &doa, NULL, NULL, NULL, NULL); + rc = filter_destroy(NULL, exp, &doa, NULL, NULL, NULL, NULL); if (rc && rc != -ENOENT) /* this is pretty fatal... */ CEMERG("error destroying precreate objid "LPU64": %d\n", id, rc); @@ -3729,9 +3730,10 @@ out: return rc; } -static int filter_statfs(struct obd_device *obd, struct obd_statfs *osfs, - __u64 max_age, __u32 flags) +static int filter_statfs(const struct lu_env *env, struct obd_export *exp, + struct obd_statfs *osfs, __u64 max_age, __u32 flags) { + struct obd_device *obd = class_exp2obd(exp); struct filter_obd *filter = &obd->u.filter; int blockbits = obd->u.obt.obt_sb->s_blocksize_bits; struct lr_server_data *lsd = class_server_data(obd); @@ -3855,7 +3857,7 @@ static int filter_precreate(struct obd_device *obd, struct obdo *oa, OBD_ALLOC(osfs, sizeof(*osfs)); if (osfs == NULL) RETURN(-ENOMEM); - rc = filter_statfs(obd, osfs, + rc = filter_statfs(NULL, obd->obd_self_export, osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), 0); if (rc == 0 && osfs->os_bavail < (osfs->os_blocks >> 10)) { @@ -4057,8 +4059,9 @@ set_last_id: RETURN(rc); } -int filter_create(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md **ea, struct obd_trans_info *oti) +int filter_create(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md **ea, + struct obd_trans_info *oti) { struct obd_device *obd = exp->exp_obd; struct filter_export_data *fed; @@ -4137,9 +4140,10 @@ int filter_create(struct obd_export *exp, struct obdo *oa, RETURN(rc); } -int filter_destroy(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md *md, struct obd_trans_info *oti, - struct obd_export *md_exp, void *capa) +int filter_destroy(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md *md, + struct obd_trans_info *oti, struct obd_export *md_exp, + void *capa) { unsigned int qcids[MAXQUOTAS] = {0, 0}; struct obd_device *obd; @@ -4333,8 +4337,8 @@ cleanup: } /* NB start and end are used for punch, but not truncate */ -static int filter_truncate(struct obd_export *exp, struct obd_info *oinfo, - struct obd_trans_info *oti, +static int filter_truncate(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo, struct obd_trans_info *oti, struct ptlrpc_request_set *rqset) { int rc; @@ -4351,12 +4355,12 @@ static int filter_truncate(struct obd_export *exp, struct obd_info *oinfo, oinfo->oi_policy.l_extent.start); oinfo->oi_oa->o_size = oinfo->oi_policy.l_extent.start; - rc = filter_setattr(exp, oinfo, oti); + rc = filter_setattr(env, exp, oinfo, oti); RETURN(rc); } -static int filter_sync(struct obd_export *exp, struct obd_info *oinfo, - obd_off start, obd_off end, +static int filter_sync(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo, obd_off start, obd_off end, struct ptlrpc_request_set *set) { struct lvfs_run_ctxt saved; @@ -4412,8 +4416,8 @@ static int filter_sync(struct obd_export *exp, struct obd_info *oinfo, RETURN(rc); } -static int filter_get_info(struct obd_export *exp, __u32 keylen, - void *key, __u32 *vallen, void *val, +static int filter_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 *obd; @@ -4569,7 +4573,8 @@ out: RETURN(rc); } -static int filter_set_info_async(struct obd_export *exp, __u32 keylen, +static int filter_set_info_async(const struct lu_env *env, + struct obd_export *exp, __u32 keylen, void *key, __u32 vallen, void *val, struct ptlrpc_request_set *set) { @@ -4678,7 +4683,7 @@ int filter_iocontrol(unsigned int cmd, struct obd_export *exp, RETURN(0); } -static int filter_health_check(struct obd_device *obd) +static int filter_health_check(const struct lu_env *env, struct obd_device *obd) { #ifdef USE_HEALTH_CHECK_WRITE struct filter_obd *filter = &obd->u.filter; diff --git a/lustre/obdfilter/filter_internal.h b/lustre/obdfilter/filter_internal.h index e5926aa..27c41a0 100644 --- a/lustre/obdfilter/filter_internal.h +++ b/lustre/obdfilter/filter_internal.h @@ -144,16 +144,17 @@ int filter_update_server_data(struct obd_device *); int filter_update_last_objid(struct obd_device *, obd_seq, int force_sync); int filter_common_setup(struct obd_device *, struct lustre_cfg *lcfg, void *option); -int filter_destroy(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md *md, struct obd_trans_info *, - struct obd_export *, void *); +int filter_destroy(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md *md, + struct obd_trans_info *, struct obd_export *, void *); int filter_setattr_internal(struct obd_export *exp, struct dentry *dentry, struct obdo *oa, struct obd_trans_info *oti); -int filter_setattr(struct obd_export *exp, struct obd_info *oinfo, - struct obd_trans_info *oti); +int filter_setattr(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo, struct obd_trans_info *oti); -int filter_create(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md **ea, struct obd_trans_info *oti); +int filter_create(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md **ea, + struct obd_trans_info *oti); struct obd_llog_group *filter_find_olg(struct obd_device *obd, int seq); @@ -162,11 +163,13 @@ extern struct ldlm_valblock_ops filter_lvbo; /* filter_io.c */ -int filter_preprw(int cmd, struct obd_export *, struct obdo *, int objcount, +int filter_preprw(const struct lu_env *env, int cmd, struct obd_export *, + struct obdo *, int objcount, struct obd_ioobj *, struct niobuf_remote *, int *, struct niobuf_local *, struct obd_trans_info *, struct lustre_capa *); -int filter_commitrw(int cmd, struct obd_export *, struct obdo *, int objcount, +int filter_commitrw(const struct lu_env *, int cmd, struct obd_export *, + struct obdo *, int objcount, struct obd_ioobj *, struct niobuf_remote *, int, struct niobuf_local *, struct obd_trans_info *, int rc); void filter_release_cache(struct obd_device *, struct obd_ioobj *, diff --git a/lustre/obdfilter/filter_io.c b/lustre/obdfilter/filter_io.c index f377e02..d935942 100644 --- a/lustre/obdfilter/filter_io.c +++ b/lustre/obdfilter/filter_io.c @@ -696,7 +696,7 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa, noa->o_valid = OBD_MD_FLID; } - if (filter_create(exp, noa, NULL, oti) == 0) { + if (filter_create(NULL, exp, noa, NULL, oti) == 0) { f_dput(dentry); dentry = filter_fid2dentry(exp->exp_obd, NULL, obj->ioo_seq, @@ -901,8 +901,8 @@ cleanup: return rc; } -int filter_preprw(int cmd, struct obd_export *exp, struct obdo *oa, - int objcount, struct obd_ioobj *obj, +int filter_preprw(const struct lu_env *env, int cmd, struct obd_export *exp, + struct obdo *oa, int objcount, struct obd_ioobj *obj, struct niobuf_remote *nb, int *npages, struct niobuf_local *res, struct obd_trans_info *oti, struct lustre_capa *capa) @@ -996,8 +996,8 @@ void filter_grant_commit(struct obd_export *exp, int niocount, cfs_spin_unlock(&exp->exp_obd->obd_osfs_lock); } -int filter_commitrw(int cmd, struct obd_export *exp, struct obdo *oa, - int objcount, struct obd_ioobj *obj, +int filter_commitrw(const struct lu_env *env, int cmd, struct obd_export *exp, + struct obdo *oa, int objcount, struct obd_ioobj *obj, struct niobuf_remote *nb, int npages, struct niobuf_local *res, struct obd_trans_info *oti, int rc) @@ -1011,4 +1011,3 @@ int filter_commitrw(int cmd, struct obd_export *exp, struct obdo *oa, LBUG(); return -EPROTO; } - diff --git a/lustre/obdfilter/filter_log.c b/lustre/obdfilter/filter_log.c index 9fc46d2..53396d3 100644 --- a/lustre/obdfilter/filter_log.c +++ b/lustre/obdfilter/filter_log.c @@ -184,7 +184,7 @@ static int filter_recov_log_unlink_cb(struct llog_ctxt *ctxt, } while (count > 0) { - rc = filter_destroy(exp, oa, NULL, NULL, NULL, NULL); + rc = filter_destroy(NULL, exp, oa, NULL, NULL, NULL, NULL); if (rc == 0) CDEBUG(D_RPCTRACE, "object "LPU64" is destroyed\n", oid); @@ -240,7 +240,7 @@ static int filter_recov_log_setattr_cb(struct llog_ctxt *ctxt, oinfo.oi_oa->o_lcookie = *cookie; oid = oinfo.oi_oa->o_id; - rc = filter_setattr(exp, &oinfo, NULL); + rc = filter_setattr(NULL, exp, &oinfo, NULL); OBDO_FREE(oinfo.oi_oa); if (rc == -ENOENT) { diff --git a/lustre/osc/osc_create.c b/lustre/osc/osc_create.c index f5f3495..9ffb196 100644 --- a/lustre/osc/osc_create.c +++ b/lustre/osc/osc_create.c @@ -525,8 +525,9 @@ int osc_create_async(struct obd_export *exp, struct obd_info *oinfo, RETURN(rc); } -int osc_create(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md **ea, struct obd_trans_info *oti) +int osc_create(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md **ea, + struct obd_trans_info *oti) { struct osc_creator *oscc = &exp->exp_obd->u.cli.cl_oscc; struct obd_import *imp = exp->exp_obd->u.cli.cl_import; diff --git a/lustre/osc/osc_internal.h b/lustre/osc/osc_internal.h index 4bdd8c4..6890547 100644 --- a/lustre/osc/osc_internal.h +++ b/lustre/osc/osc_internal.h @@ -106,8 +106,9 @@ struct osc_cache_waiter { #define OSCC_FLAG_NOSPC_BLK 0x100 /* no more block space on OST */ int osc_precreate(struct obd_export *exp); -int osc_create(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md **ea, struct obd_trans_info *oti); +int osc_create(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md **ea, + struct obd_trans_info *oti); int osc_create_async(struct obd_export *exp, struct obd_info *oinfo, struct lov_stripe_md **ea, struct obd_trans_info *oti); int osc_real_create(struct obd_export *exp, struct obdo *oa, diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index a147557..1efb9a2 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -264,7 +264,8 @@ static int osc_getattr_async(struct obd_export *exp, struct obd_info *oinfo, RETURN(0); } -static int osc_getattr(struct obd_export *exp, struct obd_info *oinfo) +static int osc_getattr(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo) { struct ptlrpc_request *req; struct ost_body *body; @@ -307,8 +308,8 @@ static int osc_getattr(struct obd_export *exp, struct obd_info *oinfo) return rc; } -static int osc_setattr(struct obd_export *exp, struct obd_info *oinfo, - struct obd_trans_info *oti) +static int osc_setattr(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo, struct obd_trans_info *oti) { struct ptlrpc_request *req; struct ost_body *body; @@ -557,8 +558,8 @@ int osc_punch_base(struct obd_export *exp, struct obd_info *oinfo, RETURN(0); } -static int osc_punch(struct obd_export *exp, struct obd_info *oinfo, - struct obd_trans_info *oti, +static int osc_punch(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo, struct obd_trans_info *oti, struct ptlrpc_request_set *rqset) { oinfo->oi_oa->o_size = oinfo->oi_policy.l_extent.start; @@ -591,8 +592,8 @@ out: RETURN(rc); } -static int osc_sync(struct obd_export *exp, struct obd_info *oinfo, - obd_size start, obd_size end, +static int osc_sync(const struct lu_env *env, struct obd_export *exp, + struct obd_info *oinfo, obd_size start, obd_size end, struct ptlrpc_request_set *set) { struct ptlrpc_request *req; @@ -702,9 +703,10 @@ static int osc_can_send_destroy(struct client_obd *cli) * the records are not cancelled, and when the OST reconnects to the MDS next, * it will retrieve the llog unlink logs and then sends the log cancellation * cookies to the MDS after committing destroy transactions. */ -static int osc_destroy(struct obd_export *exp, struct obdo *oa, - struct lov_stripe_md *ea, struct obd_trans_info *oti, - struct obd_export *md_export, void *capa) +static int osc_destroy(const struct lu_env *env, struct obd_export *exp, + struct obdo *oa, struct lov_stripe_md *ea, + struct obd_trans_info *oti, struct obd_export *md_export, + void *capa) { struct client_obd *cli = &exp->exp_obd->u.cli; struct ptlrpc_request *req; @@ -955,9 +957,9 @@ static void osc_update_grant(struct client_obd *cli, struct ost_body *body) } } -static int osc_set_info_async(struct obd_export *exp, obd_count keylen, - void *key, obd_count vallen, void *val, - struct ptlrpc_request_set *set); +static int osc_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); static int osc_shrink_grant_interpret(const struct lu_env *env, struct ptlrpc_request *req, @@ -1047,7 +1049,7 @@ int osc_shrink_grant_to_target(struct client_obd *cli, long target) body->oa.o_flags |= OBD_FL_SHRINK_GRANT; osc_update_next_shrink(cli); - rc = osc_set_info_async(cli->cl_import->imp_obd->obd_self_export, + rc = osc_set_info_async(NULL, cli->cl_import->imp_obd->obd_self_export, sizeof(KEY_GRANT_SHRINK), KEY_GRANT_SHRINK, sizeof(*body), body, NULL); if (rc != 0) @@ -3698,9 +3700,11 @@ out: RETURN(rc); } -static int osc_statfs_async(struct obd_device *obd, struct obd_info *oinfo, - __u64 max_age, struct ptlrpc_request_set *rqset) +static int osc_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 ptlrpc_request *req; struct osc_async_args *aa; int rc; @@ -3740,9 +3744,10 @@ static int osc_statfs_async(struct obd_device *obd, struct obd_info *oinfo, RETURN(0); } -static int osc_statfs(struct obd_device *obd, struct obd_statfs *osfs, - __u64 max_age, __u32 flags) +static int osc_statfs(const struct lu_env *env, struct obd_export *exp, + struct obd_statfs *osfs, __u64 max_age, __u32 flags) { + struct obd_device *obd = class_exp2obd(exp); struct obd_statfs *msfs; struct ptlrpc_request *req; struct obd_import *imp = NULL; @@ -3953,8 +3958,8 @@ out: return err; } -static int osc_get_info(struct obd_export *exp, obd_count keylen, - void *key, __u32 *vallen, void *val, +static int osc_get_info(const struct lu_env *env, struct obd_export *exp, + obd_count keylen, void *key, __u32 *vallen, void *val, struct lov_stripe_md *lsm) { ENTRY; @@ -4084,9 +4089,9 @@ static int osc_setinfo_mds_conn_interpret(const struct lu_env *env, RETURN(osc_setinfo_mds_connect_import(req->rq_import)); } -static int osc_set_info_async(struct obd_export *exp, obd_count keylen, - void *key, obd_count vallen, void *val, - struct ptlrpc_request_set *set) +static int osc_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 ptlrpc_request *req; struct obd_device *obd = exp->exp_obd; diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index e200788..547dc8c 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -187,7 +187,8 @@ static int ost_destroy(struct obd_export *exp, struct ptlrpc_request *req, memcpy(&repbody->oa, &body->oa, sizeof(body->oa)); /* Do the destroy and set the reply status accordingly */ - req->rq_status = obd_destroy(exp, &repbody->oa, NULL, oti, NULL, capa); + req->rq_status = obd_destroy(req->rq_svc_thread->t_env, exp, + &repbody->oa, NULL, oti, NULL, capa); RETURN(0); } @@ -286,7 +287,7 @@ static int ost_getattr(struct obd_export *exp, struct ptlrpc_request *req) oinfo->oi_oa = &repbody->oa; oinfo->oi_capa = capa; - req->rq_status = obd_getattr(exp, oinfo); + req->rq_status = obd_getattr(req->rq_svc_thread->t_env, exp, oinfo); OBD_FREE_PTR(oinfo); @@ -309,7 +310,8 @@ static int ost_statfs(struct ptlrpc_request *req) osfs = req_capsule_server_get(&req->rq_pill, &RMF_OBD_STATFS); - req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs, + req->rq_status = obd_statfs(req->rq_svc_thread->t_env, req->rq_export, + osfs, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS), 0); if (req->rq_status != 0) @@ -341,7 +343,8 @@ static int ost_create(struct obd_export *exp, struct ptlrpc_request *req, repbody->oa = body->oa; oti->oti_logcookies = &body->oa.o_lcookie; - req->rq_status = obd_create(exp, &repbody->oa, NULL, oti); + req->rq_status = obd_create(req->rq_svc_thread->t_env, exp, + &repbody->oa, NULL, oti); //obd_log_cancel(conn, NULL, 1, oti->oti_logcookies, 0); RETURN(0); } @@ -414,7 +417,8 @@ static int ost_punch(struct obd_export *exp, struct ptlrpc_request *req, oinfo->oi_capa = capa; oinfo->oi_flags = OBD_FL_PUNCH; - req->rq_status = obd_punch(exp, oinfo, oti, NULL); + req->rq_status = obd_punch(req->rq_svc_thread->t_env, exp, + oinfo, oti, NULL); OBD_FREE_PTR(oinfo); unlock: ost_lock_put(exp, &lh, LCK_PW); @@ -461,8 +465,9 @@ static int ost_sync(struct obd_export *exp, struct ptlrpc_request *req) oinfo->oi_oa = &repbody->oa; oinfo->oi_capa = capa; - req->rq_status = obd_sync(exp, oinfo, repbody->oa.o_size, - repbody->oa.o_blocks, NULL); + req->rq_status = obd_sync(req->rq_svc_thread->t_env, exp, oinfo, + repbody->oa.o_size, repbody->oa.o_blocks, + NULL); OBD_FREE_PTR(oinfo); ost_drop_id(exp, &repbody->oa); @@ -507,7 +512,8 @@ static int ost_setattr(struct obd_export *exp, struct ptlrpc_request *req, oinfo->oi_oa = &repbody->oa; oinfo->oi_capa = capa; - req->rq_status = obd_setattr(exp, oinfo, oti); + req->rq_status = obd_setattr(req->rq_svc_thread->t_env, exp, oinfo, + oti); OBD_FREE_PTR(oinfo); @@ -729,8 +735,9 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti) memcpy(&repbody->oa, &body->oa, sizeof(repbody->oa)); npages = OST_THREAD_POOL_SIZE; - rc = obd_preprw(OBD_BRW_READ, exp, &repbody->oa, 1, ioo, - remote_nb, &npages, local_nb, oti, capa); + rc = obd_preprw(req->rq_svc_thread->t_env, OBD_BRW_READ, exp, + &repbody->oa, 1, ioo, remote_nb, &npages, local_nb, + oti, capa); if (rc != 0) GOTO(out_lock, rc); @@ -788,8 +795,9 @@ static int ost_brw_read(struct ptlrpc_request *req, struct obd_trans_info *oti) out_commitrw: /* Must commit after prep above in all cases */ - rc = obd_commitrw(OBD_BRW_READ, exp, &repbody->oa, 1, ioo, - remote_nb, npages, local_nb, oti, rc); + rc = obd_commitrw(req->rq_svc_thread->t_env, OBD_BRW_READ, exp, + &repbody->oa, 1, ioo, remote_nb, npages, local_nb, + oti, rc); if (rc == 0) ost_drop_id(exp, &repbody->oa); @@ -970,8 +978,9 @@ static int ost_brw_write(struct ptlrpc_request *req, struct obd_trans_info *oti) memcpy(&repbody->oa, &body->oa, sizeof(repbody->oa)); npages = OST_THREAD_POOL_SIZE; - rc = obd_preprw(OBD_BRW_WRITE, exp, &repbody->oa, objcount, - ioo, remote_nb, &npages, local_nb, oti, capa); + rc = obd_preprw(req->rq_svc_thread->t_env, OBD_BRW_WRITE, exp, + &repbody->oa, objcount, ioo, remote_nb, &npages, + local_nb, oti, capa); if (rc != 0) GOTO(out_lock, rc); @@ -1016,8 +1025,9 @@ skip_transfer: } /* Must commit after prep above in all cases */ - rc = obd_commitrw(OBD_BRW_WRITE, exp, &repbody->oa, objcount, ioo, - remote_nb, npages, local_nb, oti, rc); + rc = obd_commitrw(req->rq_svc_thread->t_env, OBD_BRW_WRITE, exp, + &repbody->oa, objcount, ioo, remote_nb, npages, + local_nb, oti, rc); if (rc == -ENOTCONN) /* quota acquire process has been given up because * either the client has been evicted or the client @@ -1203,7 +1213,8 @@ static int ost_set_info(struct obd_export *exp, struct ptlrpc_request *req) /* OBD will also check if KEY_IS(KEY_GRANT_SHRINK), and will cast val to * a struct ost_body * value */ - rc = obd_set_info_async(exp, keylen, key, vallen, val, NULL); + rc = obd_set_info_async(req->rq_svc_thread->t_env, exp, keylen, + key, vallen, val, NULL); out: lustre_msg_set_status(req->rq_repmsg, 0); RETURN(rc); @@ -1233,7 +1244,8 @@ static int ost_get_info(struct obd_export *exp, struct ptlrpc_request *req) RETURN(rc); } - rc = obd_get_info(exp, keylen, key, &replylen, NULL, NULL); + rc = obd_get_info(req->rq_svc_thread->t_env, exp, keylen, key, + &replylen, NULL, NULL); if (rc) RETURN(rc); @@ -1249,7 +1261,8 @@ static int ost_get_info(struct obd_export *exp, struct ptlrpc_request *req) RETURN(-ENOMEM); /* call again to fill in the reply buffer */ - rc = obd_get_info(exp, keylen, key, &replylen, reply, NULL); + rc = obd_get_info(req->rq_svc_thread->t_env, exp, keylen, key, + &replylen, reply, NULL); lustre_msg_set_status(req->rq_repmsg, 0); RETURN(rc); @@ -1519,7 +1532,7 @@ int ost_blocking_ast(struct ldlm_lock *lock, int rc = 0; ENTRY; - rc = obd_get_info(lock->l_export, sizeof(KEY_SYNC_LOCK_CANCEL), + rc = obd_get_info(NULL, lock->l_export, sizeof(KEY_SYNC_LOCK_CANCEL), KEY_SYNC_LOCK_CANCEL, &len, &sync_lock_cancel, NULL); if (!rc && flag == LDLM_CB_CANCELING && @@ -1544,7 +1557,7 @@ int ost_blocking_ast(struct ldlm_lock *lock, oa->o_valid = OBD_MD_FLID|OBD_MD_FLGROUP; oinfo->oi_oa = oa; - rc = obd_sync(lock->l_export, oinfo, + rc = obd_sync(NULL, lock->l_export, oinfo, lock->l_policy_data.l_extent.start, lock->l_policy_data.l_extent.end, NULL); if (rc) @@ -2528,7 +2541,7 @@ static int ost_cleanup(struct obd_device *obd) RETURN(err); } -static int ost_health_check(struct obd_device *obd) +static int ost_health_check(const struct lu_env *env, struct obd_device *obd) { struct ost_obd *ost = &obd->u.ost; int rc = 0;