From dd6623e657032bf34e70446a6d72851c70d605d9 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Thu, 16 Jun 2016 17:42:00 -0400 Subject: [PATCH] LU-7403 obd: const correct md_set_lock_data() Change the __u64 *cookie parameter of md_set_lock_data() to const struct lustre_handle *lockh. Signed-off-by: John L. Hammond Change-Id: Ie6de252a10c532ee395e407ad2aff258773478a8 Reviewed-on: http://review.whamcloud.com/17072 Reviewed-by: Frank Zago Reviewed-by: James Simmons Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/include/obd.h | 3 ++- lustre/include/obd_class.h | 3 ++- lustre/llite/file.c | 2 +- lustre/llite/llite_internal.h | 5 ++--- lustre/lmv/lmv_intent.c | 2 +- lustre/lmv/lmv_obd.c | 5 +++-- lustre/mdc/mdc_internal.h | 3 ++- lustre/mdc/mdc_locks.c | 10 +++++----- lustre/mdc/mdc_request.c | 5 ++--- 9 files changed, 20 insertions(+), 18 deletions(-) diff --git a/lustre/include/obd.h b/lustre/include/obd.h index ab5265d..385b8e2 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -1094,7 +1094,8 @@ struct md_ops { int (*m_clear_open_replay_data)(struct obd_export *, struct obd_client_handle *); - int (*m_set_lock_data)(struct obd_export *, __u64 *, void *, __u64 *); + int (*m_set_lock_data)(struct obd_export *, + const struct lustre_handle *, void *, __u64 *); enum ldlm_mode (*m_lock_match)(struct obd_export *, __u64, const struct lu_fid *, enum ldlm_type, diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index de5d32c..aac86852 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -1530,7 +1530,8 @@ static inline int md_clear_open_replay_data(struct obd_export *exp, } static inline int md_set_lock_data(struct obd_export *exp, - __u64 *lockh, void *data, __u64 *bits) + const struct lustre_handle *lockh, + void *data, __u64 *bits) { ENTRY; EXP_CHECK_MD_OP(exp, set_lock_data); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 244fa88..483fce6 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -4025,7 +4025,7 @@ static int ll_layout_lock_set(struct lustre_handle *lockh, enum ldlm_mode mode, PFID(&lli->lli_fid), inode); /* in case this is a caching lock and reinstate with new inode */ - md_set_lock_data(sbi->ll_md_exp, &lockh->cookie, inode, NULL); + md_set_lock_data(sbi->ll_md_exp, lockh, inode, NULL); lock_res_and_lock(lock); lvb_ready = ldlm_is_lvb_ready(lock); diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index da95fb6..cbc42e2 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -1331,7 +1331,7 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, "(%p) for remote lock "LPX64"\n", PFID(ll_inode2fid(inode)), inode, handle.cookie); - md_set_lock_data(exp, &handle.cookie, inode, NULL); + md_set_lock_data(exp, &handle, inode, NULL); } handle.cookie = it->it_lock_handle; @@ -1340,8 +1340,7 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, " for lock "LPX64"\n", PFID(ll_inode2fid(inode)), inode, handle.cookie); - md_set_lock_data(exp, &handle.cookie, inode, - &it->it_lock_bits); + md_set_lock_data(exp, &handle, inode, &it->it_lock_bits); it->it_lock_set = 1; } diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index bf3ed35..974f563 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -242,7 +242,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, LTIME_S(inode->i_mtime) = body->mbo_mtime; } - md_set_lock_data(tgt->ltd_exp, &lockh->cookie, inode, NULL); + md_set_lock_data(tgt->ltd_exp, lockh, inode, NULL); if (it.it_lock_mode != 0 && lockh != NULL) { ldlm_lock_decref(lockh, it.it_lock_mode); it.it_lock_mode = 0; diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index d146c0b..32ca60e 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -3011,8 +3011,9 @@ static int lmv_cancel_unused(struct obd_export *exp, const struct lu_fid *fid, RETURN(rc); } -int lmv_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data, - __u64 *bits) +static int lmv_set_lock_data(struct obd_export *exp, + const struct lustre_handle *lockh, + void *data, __u64 *bits) { struct lmv_obd *lmv = &exp->exp_obd->u.lmv; struct lmv_tgt_desc *tgt = lmv->tgts[0]; diff --git a/lustre/mdc/mdc_internal.h b/lustre/mdc/mdc_internal.h index 552eb3f..48bad01 100644 --- a/lustre/mdc/mdc_internal.h +++ b/lustre/mdc/mdc_internal.h @@ -69,7 +69,8 @@ void mdc_close_pack(struct ptlrpc_request *req, struct md_op_data *op_data); /* mdc/mdc_locks.c */ int mdc_set_lock_data(struct obd_export *exp, - __u64 *lockh, void *data, __u64 *bits); + const struct lustre_handle *lockh, + void *data, __u64 *bits); int mdc_null_inode(struct obd_export *exp, const struct lu_fid *fid); diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 115a733..53c74e7 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -99,8 +99,8 @@ int it_open_error(int phase, struct lookup_intent *it) EXPORT_SYMBOL(it_open_error); /* this must be called on a lockh that is known to have a referenced lock */ -int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data, - __u64 *bits) +int mdc_set_lock_data(struct obd_export *exp, const struct lustre_handle *lockh, + void *data, __u64 *bits) { struct ldlm_lock *lock; struct inode *new_inode = data; @@ -109,10 +109,10 @@ int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data, if(bits) *bits = 0; - if (!*lockh) - RETURN(0); + if (!lustre_handle_is_used(lockh)) + RETURN(0); - lock = ldlm_handle2lock((struct lustre_handle *)lockh); + lock = ldlm_handle2lock(lockh); LASSERT(lock != NULL); lock_res_and_lock(lock); diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index de8aa42..e347423 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -1296,7 +1296,8 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data, } rc = 0; - mdc_set_lock_data(exp, &it.it_lock_handle, dir, NULL); + lockh.cookie = it.it_lock_handle; + mdc_set_lock_data(exp, &lockh, dir, NULL); rp_param.rp_off = hash_offset; rp_param.rp_hash64 = op_data->op_cli_flags & CLI_HASH64; @@ -1384,9 +1385,7 @@ hash_collision: } *ppage = page; out_unlock: - lockh.cookie = it.it_lock_handle; ldlm_lock_decref(&lockh, it.it_lock_mode); - it.it_lock_handle = 0; return rc; fail: kunmap(page); -- 1.8.3.1