From 5db0e2de00f6b3d687fc4fe01f05a687fc74271c Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Fri, 6 Nov 2015 10:05:32 -0600 Subject: [PATCH] LU-7403 llite: flatten struct lookup_intent Replace the union in struct lookup_intent with the members of struct lustre_indent_data. Remove the then unused struct lustre_intent_data. Signed-off-by: John L. Hammond Change-Id: I47d815f7c8e51bcff33ea7dba6efbc08337ca509 Reviewed-on: http://review.whamcloud.com/17069 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Reviewed-by: Frank Zago Reviewed-by: Oleg Drokin --- lustre/include/lustre_intent.h | 35 +++++------ lustre/llite/dcache.c | 38 ++++++------ lustre/llite/file.c | 40 ++++++------ lustre/llite/llite_internal.h | 14 ++--- lustre/llite/llite_lib.c | 4 +- lustre/llite/namei.c | 14 ++--- lustre/llite/statahead.c | 10 +-- lustre/llite/xattr_cache.c | 16 ++--- lustre/lmv/lmv_intent.c | 64 +++++++++---------- lustre/mdc/mdc_locks.c | 137 +++++++++++++++++++++-------------------- lustre/mdc/mdc_request.c | 10 +-- 11 files changed, 189 insertions(+), 193 deletions(-) diff --git a/lustre/include/lustre_intent.h b/lustre/include/lustre_intent.h index 577345b..a8eac3f 100644 --- a/lustre/include/lustre_intent.h +++ b/lustre/include/lustre_intent.h @@ -38,40 +38,35 @@ #define LUSTRE_INTENT_H /* intent IT_XXX are defined in lustre/include/obd.h */ -struct lustre_intent_data { - int it_disposition; - int it_status; - __u64 it_lock_handle; - __u64 it_lock_bits; - int it_lock_mode; - int it_remote_lock_mode; - __u64 it_remote_lock_handle; - void *it_data; - unsigned int it_lock_set:1; -}; struct lookup_intent { - int it_op; - int it_create_mode; - __u64 it_flags; - union { - struct lustre_intent_data lustre; - } d; + int it_op; + int it_create_mode; + __u64 it_flags; + int it_disposition; + int it_status; + __u64 it_lock_handle; + __u64 it_lock_bits; + int it_lock_mode; + int it_remote_lock_mode; + __u64 it_remote_lock_handle; + void *it_data; + unsigned int it_lock_set:1; }; static inline int it_disposition(const struct lookup_intent *it, int flag) { - return it->d.lustre.it_disposition & flag; + return it->it_disposition & flag; } static inline void it_set_disposition(struct lookup_intent *it, int flag) { - it->d.lustre.it_disposition |= flag; + it->it_disposition |= flag; } static inline void it_clear_disposition(struct lookup_intent *it, int flag) { - it->d.lustre.it_disposition &= ~flag; + it->it_disposition &= ~flag; } #endif diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 6bf6d66..ee0c70c 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -203,26 +203,26 @@ int ll_d_init(struct dentry *de) void ll_intent_drop_lock(struct lookup_intent *it) { - if (it->it_op && it->d.lustre.it_lock_mode) { + if (it->it_op && it->it_lock_mode) { struct lustre_handle handle; - handle.cookie = it->d.lustre.it_lock_handle; + handle.cookie = it->it_lock_handle; - CDEBUG(D_DLMTRACE, "releasing lock with cookie "LPX64 - " from it %p\n", handle.cookie, it); - ldlm_lock_decref(&handle, it->d.lustre.it_lock_mode); + CDEBUG(D_DLMTRACE, "releasing lock with cookie "LPX64 + " from it %p\n", handle.cookie, it); + ldlm_lock_decref(&handle, it->it_lock_mode); - /* bug 494: intent_release may be called multiple times, from - * this thread and we don't want to double-decref this lock */ - it->d.lustre.it_lock_mode = 0; - if (it->d.lustre.it_remote_lock_mode != 0) { - handle.cookie = it->d.lustre.it_remote_lock_handle; + /* bug 494: intent_release may be called multiple times, from + * this thread and we don't want to double-decref this lock */ + it->it_lock_mode = 0; + if (it->it_remote_lock_mode != 0) { + handle.cookie = it->it_remote_lock_handle; CDEBUG(D_DLMTRACE, "releasing remote lock with cookie" LPX64" from it %p\n", handle.cookie, it); ldlm_lock_decref(&handle, - it->d.lustre.it_remote_lock_mode); - it->d.lustre.it_remote_lock_mode = 0; + it->it_remote_lock_mode); + it->it_remote_lock_mode = 0; } } } @@ -235,14 +235,14 @@ void ll_intent_release(struct lookup_intent *it) ll_intent_drop_lock(it); /* We are still holding extra reference on a request, need to free it */ if (it_disposition(it, DISP_ENQ_OPEN_REF)) - ptlrpc_req_finished(it->d.lustre.it_data); /* ll_file_open */ + ptlrpc_req_finished(it->it_data); /* ll_file_open */ - if (it_disposition(it, DISP_ENQ_CREATE_REF)) /* create rec */ - ptlrpc_req_finished(it->d.lustre.it_data); + if (it_disposition(it, DISP_ENQ_CREATE_REF)) /* create rec */ + ptlrpc_req_finished(it->it_data); - it->d.lustre.it_disposition = 0; - it->d.lustre.it_data = NULL; - EXIT; + it->it_disposition = 0; + it->it_data = NULL; + EXIT; } void ll_invalidate_aliases(struct inode *inode) @@ -301,7 +301,7 @@ void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry) LASSERT(it != NULL); LASSERT(dentry != NULL); - if (it->d.lustre.it_lock_mode && dentry->d_inode != NULL) { + if (it->it_lock_mode && dentry->d_inode != NULL) { struct inode *inode = dentry->d_inode; struct ll_sb_info *sbi = ll_i2sbi(dentry->d_inode); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index bbcbd29..3bbe2ad 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -421,7 +421,7 @@ static int ll_intent_file_open(struct file *file, void *lmm, int lmmsize, } rc = ll_prep_inode(&de->d_inode, req, NULL, itp); - if (!rc && itp->d.lustre.it_lock_mode) + if (!rc && itp->it_lock_mode) ll_set_lock_data(sbi->ll_md_exp, de->d_inode, itp, NULL); out: @@ -434,13 +434,13 @@ out: static int ll_och_fill(struct obd_export *md_exp, struct lookup_intent *it, struct obd_client_handle *och) { - struct ptlrpc_request *req = it->d.lustre.it_data; + struct ptlrpc_request *req = it->it_data; struct mdt_body *body; body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); och->och_fh = body->mbo_handle; och->och_fid = body->mbo_fid1; - och->och_lease_handle.cookie = it->d.lustre.it_lock_handle; + och->och_lease_handle.cookie = it->it_lock_handle; och->och_magic = OBD_CLIENT_HANDLE_MAGIC; och->och_flags = it->it_flags; @@ -519,7 +519,7 @@ int ll_file_open(struct inode *inode, struct file *file) RETURN(0); } - if (!it || !it->d.lustre.it_disposition) { + if (!it || !it->it_disposition) { /* Convert f_flags into access mode. We cannot use file->f_mode, * because everything but O_ACCMODE mask was stripped from * there */ @@ -584,7 +584,7 @@ restart: } } else { LASSERT(*och_usecount == 0); - if (!it->d.lustre.it_disposition) { + if (!it->it_disposition) { /* We cannot just request lock handle now, new ELC code means that one of other OPEN locks for this file could be cancelled, and since blocking ast handler @@ -627,7 +627,7 @@ restart: LASSERTF(it_disposition(it, DISP_ENQ_OPEN_REF), "inode %p: disposition %x, status %d\n", inode, - it_disposition(it, ~0), it->d.lustre.it_status); + it_disposition(it, ~0), it->it_status); rc = ll_local_open(file, it, fd, *och_p); if (rc) @@ -664,7 +664,7 @@ out_openerr: } if (it && it_disposition(it, DISP_ENQ_OPEN_REF)) { - ptlrpc_req_finished(it->d.lustre.it_data); + ptlrpc_req_finished(it->it_data); it_clear_disposition(it, DISP_ENQ_OPEN_REF); } @@ -799,12 +799,12 @@ ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode, /* already get lease, handle lease lock */ ll_set_lock_data(sbi->ll_md_exp, inode, &it, NULL); - if (it.d.lustre.it_lock_mode == 0 || - it.d.lustre.it_lock_bits != MDS_INODELOCK_OPEN) { + if (it.it_lock_mode == 0 || + it.it_lock_bits != MDS_INODELOCK_OPEN) { /* open lock must return for lease */ CERROR(DFID "lease granted but no open lock, %d/"LPU64".\n", - PFID(ll_inode2fid(inode)), it.d.lustre.it_lock_mode, - it.d.lustre.it_lock_bits); + PFID(ll_inode2fid(inode)), it.it_lock_mode, + it.it_lock_bits); GOTO(out_close, rc = -EPROTO); } @@ -813,10 +813,10 @@ ll_lease_open(struct inode *inode, struct file *file, fmode_t fmode, out_close: /* Cancel open lock */ - if (it.d.lustre.it_lock_mode != 0) { + if (it.it_lock_mode != 0) { ldlm_lock_decref_and_cancel(&och->och_lease_handle, - it.d.lustre.it_lock_mode); - it.d.lustre.it_lock_mode = 0; + it.it_lock_mode); + it.it_lock_mode = 0; och->och_lease_handle.cookie = 0ULL; } rc2 = ll_close_inode_openhandle(inode, och, 0, NULL); @@ -1746,7 +1746,7 @@ int ll_release_openhandle(struct dentry *dentry, struct lookup_intent *it) out: /* this one is in place of ll_file_open */ if (it_disposition(it, DISP_ENQ_OPEN_REF)) { - ptlrpc_req_finished(it->d.lustre.it_data); + ptlrpc_req_finished(it->it_data); it_clear_disposition(it, DISP_ENQ_OPEN_REF); } RETURN(rc); @@ -4119,14 +4119,14 @@ again: PFID(&lli->lli_fid), inode); rc = md_enqueue(sbi->ll_md_exp, &einfo, NULL, &it, op_data, &lockh, 0); - if (it.d.lustre.it_data != NULL) - ptlrpc_req_finished(it.d.lustre.it_data); - it.d.lustre.it_data = NULL; + if (it.it_data != NULL) + ptlrpc_req_finished(it.it_data); + it.it_data = NULL; ll_finish_md_op_data(op_data); - mode = it.d.lustre.it_lock_mode; - it.d.lustre.it_lock_mode = 0; + mode = it.it_lock_mode; + it.it_lock_mode = 0; ll_intent_drop_lock(&it); if (rc == 0) { diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 7149327..1ae08db 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -1376,7 +1376,7 @@ static inline int ll_file_nolock(const struct file *file) static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, struct lookup_intent *it, __u64 *bits) { - if (!it->d.lustre.it_lock_set) { + if (!it->it_lock_set) { struct lustre_handle handle; /* If this inode is a remote object, it will get two @@ -1386,8 +1386,8 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, * UPDATE|PERM lock. The inode will be attched to both * LOOKUP and PERM locks, so revoking either locks will * case the dcache being cleared */ - if (it->d.lustre.it_remote_lock_mode) { - handle.cookie = it->d.lustre.it_remote_lock_handle; + if (it->it_remote_lock_mode) { + handle.cookie = it->it_remote_lock_handle; CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID "(%p) for remote lock "LPX64"\n", PFID(ll_inode2fid(inode)), inode, @@ -1395,19 +1395,19 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, md_set_lock_data(exp, &handle.cookie, inode, NULL); } - handle.cookie = it->d.lustre.it_lock_handle; + handle.cookie = it->it_lock_handle; CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID"(%p)" " for lock "LPX64"\n", PFID(ll_inode2fid(inode)), inode, handle.cookie); md_set_lock_data(exp, &handle.cookie, inode, - &it->d.lustre.it_lock_bits); - it->d.lustre.it_lock_set = 1; + &it->it_lock_bits); + it->it_lock_set = 1; } if (bits != NULL) - *bits = it->d.lustre.it_lock_bits; + *bits = it->it_lock_bits; } static inline void ll_lock_dcache(struct inode *inode) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 5674ca4..23b1bf5 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -2341,11 +2341,11 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req, * 2. layout was changed by another client * 3. proc2: refresh layout and layout lock granted * 4. proc1: to apply a stale layout */ - if (it != NULL && it->d.lustre.it_lock_mode != 0) { + if (it != NULL && it->it_lock_mode != 0) { struct lustre_handle lockh; struct ldlm_lock *lock; - lockh.cookie = it->d.lustre.it_lock_handle; + lockh.cookie = it->it_lock_handle; lock = ldlm_handle2lock(&lockh); LASSERT(lock != NULL); if (ldlm_has_layout(lock)) { diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index c0fa6a9..eabbbab 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -470,7 +470,7 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request, /* NB 1 request reference will be taken away by ll_intent_lock() * when I return */ CDEBUG(D_DENTRY, "it %p it_disposition %x\n", it, - it->d.lustre.it_disposition); + it->it_disposition); if (!it_disposition(it, DISP_LOOKUP_NEG)) { rc = ll_prep_inode(&inode, request, (*de)->d_sb, it); if (rc) @@ -519,7 +519,7 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request, /* Check that parent has UPDATE lock. */ struct lookup_intent parent_it = { .it_op = IT_GETATTR, - .d.lustre.it_lock_handle = 0 }; + .it_lock_handle = 0 }; struct lu_fid fid = ll_i2info(parent)->lli_fid; /* If it is striped directory, get the real stripe parent */ @@ -859,10 +859,10 @@ static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it) int rc; ENTRY; - LASSERT(it && it->d.lustre.it_disposition); + LASSERT(it && it->it_disposition); - LASSERT(it_disposition(it, DISP_ENQ_CREATE_REF)); - request = it->d.lustre.it_data; + LASSERT(it_disposition(it, DISP_ENQ_CREATE_REF)); + request = it->it_data; it_clear_disposition(it, DISP_ENQ_CREATE_REF); rc = ll_prep_inode(&inode, request, dir->i_sb, it); if (rc) @@ -1103,8 +1103,8 @@ static int ll_create_nd(struct inode *dir, struct dentry *dentry, lld->lld_it = NULL; /* Was there an error? Propagate it! */ - if (it->d.lustre.it_status) { - rc = it->d.lustre.it_status; + if (it->it_status) { + rc = it->it_status; goto out; } diff --git a/lustre/llite/statahead.c b/lustre/llite/statahead.c index 384bd207..27c4158 100644 --- a/lustre/llite/statahead.c +++ b/lustre/llite/statahead.c @@ -592,7 +592,7 @@ static void sa_instantiate(struct ll_statahead_info *sai, } } - it->d.lustre.it_lock_handle = entry->se_handle; + it->it_lock_handle = entry->se_handle; rc = md_revalidate_lock(ll_i2mdexp(dir), it, ll_inode2fid(dir), NULL); if (rc != 1) GOTO(out, rc = -EAGAIN); @@ -683,7 +683,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req, * thread enqueues lock on parent in readdir and another * process enqueues lock on child with parent lock held, eg. * unlink. */ - handle = it->d.lustre.it_lock_handle; + handle = it->it_lock_handle; ll_intent_drop_lock(it); } @@ -789,7 +789,7 @@ static int sa_revalidate(struct inode *dir, struct sa_entry *entry, { struct inode *inode = dentry->d_inode; struct lookup_intent it = { .it_op = IT_GETATTR, - .d.lustre.it_lock_handle = 0 }; + .it_lock_handle = 0 }; struct md_enqueue_info *minfo; int rc; ENTRY; @@ -804,7 +804,7 @@ static int sa_revalidate(struct inode *dir, struct sa_entry *entry, rc = md_revalidate_lock(ll_i2mdexp(dir), &it, ll_inode2fid(inode), NULL); if (rc == 1) { - entry->se_handle = it.d.lustre.it_lock_handle; + entry->se_handle = it.it_lock_handle; ll_intent_release(&it); RETURN(1); } @@ -1461,7 +1461,7 @@ static int revalidate_statahead_dentry(struct inode *dir, if (entry->se_state == SA_ENTRY_SUCC && entry->se_inode != NULL) { struct inode *inode = entry->se_inode; struct lookup_intent it = { .it_op = IT_GETATTR, - .d.lustre.it_lock_handle = + .it_lock_handle = entry->se_handle }; __u64 bits; diff --git a/lustre/llite/xattr_cache.c b/lustre/llite/xattr_cache.c index e7d0a45..3444058 100644 --- a/lustre/llite/xattr_cache.c +++ b/lustre/llite/xattr_cache.c @@ -337,8 +337,8 @@ static int ll_xattr_find_get_lock(struct inode *inode, LCK_PR); if (mode != 0) { /* fake oit in mdc_revalidate_lock() manner */ - oit->d.lustre.it_lock_handle = lockh.cookie; - oit->d.lustre.it_lock_mode = mode; + oit->it_lock_handle = lockh.cookie; + oit->it_lock_mode = mode; goto out; } } @@ -363,7 +363,7 @@ static int ll_xattr_find_get_lock(struct inode *inode, RETURN(rc); } - *req = (struct ptlrpc_request *)oit->d.lustre.it_data; + *req = (struct ptlrpc_request *)oit->it_data; out: down_write(&lli->lli_xattrs_list_rwsem); mutex_unlock(&lli->lli_xattrs_enq_lock); @@ -410,10 +410,10 @@ static int ll_xattr_cache_refill(struct inode *inode, struct lookup_intent *oit) GOTO(out_maybe_drop, rc = -EIO); } - if (oit->d.lustre.it_status < 0) { + if (oit->it_status < 0) { CDEBUG(D_CACHE, "getxattr intent returned %d for fid "DFID"\n", - oit->d.lustre.it_status, PFID(ll_inode2fid(inode))); - rc = oit->d.lustre.it_status; + oit->it_status, PFID(ll_inode2fid(inode))); + rc = oit->it_status; /* xattr data is so large that we don't want to cache it */ if (rc == -ERANGE) rc = -EAGAIN; @@ -499,8 +499,8 @@ out_destroy: up_write(&lli->lli_xattrs_list_rwsem); ldlm_lock_decref_and_cancel((struct lustre_handle *) - &oit->d.lustre.it_lock_handle, - oit->d.lustre.it_lock_mode); + &oit->it_lock_handle, + oit->it_lock_mode); goto out_no_unlock; } diff --git a/lustre/lmv/lmv_intent.c b/lustre/lmv/lmv_intent.c index 2bed1b2..566f191 100644 --- a/lustre/lmv/lmv_intent.c +++ b/lustre/lmv/lmv_intent.c @@ -88,11 +88,11 @@ static int lmv_intent_remote(struct obd_export *exp, struct lookup_intent *it, /* * We got LOOKUP lock, but we really need attrs. */ - pmode = it->d.lustre.it_lock_mode; + pmode = it->it_lock_mode; if (pmode) { - plock.cookie = it->d.lustre.it_lock_handle; - it->d.lustre.it_lock_mode = 0; - it->d.lustre.it_data = NULL; + plock.cookie = it->it_lock_handle; + it->it_lock_mode = 0; + it->it_data = NULL; } LASSERT(fid_is_sane(&body->mbo_fid1)); @@ -129,15 +129,15 @@ static int lmv_intent_remote(struct obd_export *exp, struct lookup_intent *it, * maintain dcache consistency. Thus drop UPDATE|PERM lock here * and put LOOKUP in request. */ - if (it->d.lustre.it_lock_mode != 0) { - it->d.lustre.it_remote_lock_handle = - it->d.lustre.it_lock_handle; - it->d.lustre.it_remote_lock_mode = it->d.lustre.it_lock_mode; + if (it->it_lock_mode != 0) { + it->it_remote_lock_handle = + it->it_lock_handle; + it->it_remote_lock_mode = it->it_lock_mode; } if (pmode) { - it->d.lustre.it_lock_handle = plock.cookie; - it->d.lustre.it_lock_mode = pmode; + it->it_lock_handle = plock.cookie; + it->it_lock_mode = pmode; } EXIT; @@ -215,7 +215,7 @@ int lmv_revalidate_slaves(struct obd_export *exp, if (rc < 0) GOTO(cleanup, rc); - lockh = (struct lustre_handle *)&it.d.lustre.it_lock_handle; + lockh = (struct lustre_handle *)&it.it_lock_handle; if (rc > 0 && req == NULL) { /* slave inode is still valid */ CDEBUG(D_INODE, "slave "DFID" is still valid.\n", @@ -226,10 +226,10 @@ int lmv_revalidate_slaves(struct obd_export *exp, body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); if (body == NULL) { - if (it.d.lustre.it_lock_mode && lockh) { + if (it.it_lock_mode && lockh) { ldlm_lock_decref(lockh, - it.d.lustre.it_lock_mode); - it.d.lustre.it_lock_mode = 0; + it.it_lock_mode); + it.it_lock_mode = 0; } GOTO(cleanup, rc = -ENOENT); } @@ -243,9 +243,9 @@ int lmv_revalidate_slaves(struct obd_export *exp, } md_set_lock_data(tgt->ltd_exp, &lockh->cookie, inode, NULL); - if (it.d.lustre.it_lock_mode != 0 && lockh != NULL) { - ldlm_lock_decref(lockh, it.d.lustre.it_lock_mode); - it.d.lustre.it_lock_mode = 0; + if (it.it_lock_mode != 0 && lockh != NULL) { + ldlm_lock_decref(lockh, it.it_lock_mode); + it.it_lock_mode = 0; } } @@ -323,9 +323,9 @@ static int lmv_intent_open(struct obd_export *exp, struct md_op_data *op_data, * Nothing is found, do not access body->fid1 as it is zero and thus * pointless. */ - if ((it->d.lustre.it_disposition & DISP_LOOKUP_NEG) && - !(it->d.lustre.it_disposition & DISP_OPEN_CREATE) && - !(it->d.lustre.it_disposition & DISP_OPEN_OPEN)) + if ((it->it_disposition & DISP_LOOKUP_NEG) && + !(it->it_disposition & DISP_OPEN_CREATE) && + !(it->it_disposition & DISP_OPEN_OPEN)) RETURN(rc); body = req_capsule_server_get(&(*reqp)->rq_pill, &RMF_MDT_BODY); @@ -424,7 +424,7 @@ lmv_intent_lookup(struct obd_export *exp, struct md_op_data *op_data, /* release the previous request */ ptlrpc_req_finished(*reqp); - it->d.lustre.it_data = NULL; + it->it_data = NULL; *reqp = NULL; oinfo = &lsm->lsm_md_oinfo[stripe_index]; @@ -436,7 +436,7 @@ lmv_intent_lookup(struct obd_export *exp, struct md_op_data *op_data, PFID(&oinfo->lmo_fid)); op_data->op_fid1 = oinfo->lmo_fid; - it->d.lustre.it_disposition &= ~DISP_ENQ_COMPLETE; + it->it_disposition &= ~DISP_ENQ_COMPLETE; rc = md_intent_lock(tgt->ltd_exp, op_data, it, reqp, cb_blocking, extra_lock_flags); if (rc != 0) @@ -499,23 +499,23 @@ int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data, if (rc < 0) { struct lustre_handle lock_handle; - if (it->d.lustre.it_lock_mode != 0) { - lock_handle.cookie = it->d.lustre.it_lock_handle; + if (it->it_lock_mode != 0) { + lock_handle.cookie = it->it_lock_handle; ldlm_lock_decref(&lock_handle, - it->d.lustre.it_lock_mode); + it->it_lock_mode); } - it->d.lustre.it_lock_handle = 0; - it->d.lustre.it_lock_mode = 0; + it->it_lock_handle = 0; + it->it_lock_mode = 0; - if (it->d.lustre.it_remote_lock_mode != 0) { - lock_handle.cookie = it->d.lustre.it_remote_lock_handle; + if (it->it_remote_lock_mode != 0) { + lock_handle.cookie = it->it_remote_lock_handle; ldlm_lock_decref(&lock_handle, - it->d.lustre.it_remote_lock_mode); + it->it_remote_lock_mode); } - it->d.lustre.it_remote_lock_handle = 0; - it->d.lustre.it_remote_lock_mode = 0; + it->it_remote_lock_handle = 0; + it->it_remote_lock_mode = 0; } RETURN(rc); diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 593fb9d..d743188 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -59,40 +59,41 @@ int it_open_error(int phase, struct lookup_intent *it) { if (it_disposition(it, DISP_OPEN_LEASE)) { if (phase >= DISP_OPEN_LEASE) - return it->d.lustre.it_status; + return it->it_status; + else + return 0; + } + if (it_disposition(it, DISP_OPEN_OPEN)) { + if (phase >= DISP_OPEN_OPEN) + return it->it_status; else return 0; } - if (it_disposition(it, DISP_OPEN_OPEN)) { - if (phase >= DISP_OPEN_OPEN) - return it->d.lustre.it_status; - else - return 0; - } - if (it_disposition(it, DISP_OPEN_CREATE)) { - if (phase >= DISP_OPEN_CREATE) - return it->d.lustre.it_status; - else - return 0; - } + if (it_disposition(it, DISP_OPEN_CREATE)) { + if (phase >= DISP_OPEN_CREATE) + return it->it_status; + else + return 0; + } - if (it_disposition(it, DISP_LOOKUP_EXECD)) { - if (phase >= DISP_LOOKUP_EXECD) - return it->d.lustre.it_status; - else - return 0; - } + if (it_disposition(it, DISP_LOOKUP_EXECD)) { + if (phase >= DISP_LOOKUP_EXECD) + return it->it_status; + else + return 0; + } + + if (it_disposition(it, DISP_IT_EXECD)) { + if (phase >= DISP_IT_EXECD) + return it->it_status; + else + return 0; + } + + CERROR("it disp: %X, status: %d\n", it->it_disposition, it->it_status); + LBUG(); - if (it_disposition(it, DISP_IT_EXECD)) { - if (phase >= DISP_IT_EXECD) - return it->d.lustre.it_status; - else - return 0; - } - CERROR("it disp: %X, status: %d\n", it->d.lustre.it_disposition, - it->d.lustre.it_status); - LBUG(); return 0; } EXPORT_SYMBOL(it_open_error); @@ -529,7 +530,6 @@ static int mdc_finish_enqueue(struct obd_export *exp, struct req_capsule *pill = &req->rq_pill; struct ldlm_request *lockreq; struct ldlm_reply *lockrep; - struct lustre_intent_data *intent = &it->d.lustre; struct ldlm_lock *lock; void *lvb_data = NULL; __u32 lvb_len = 0; @@ -564,16 +564,16 @@ static int mdc_finish_enqueue(struct obd_export *exp, lockrep = req_capsule_server_get(pill, &RMF_DLM_REP); LASSERT(lockrep != NULL); /* checked by ldlm_cli_enqueue() */ - intent->it_disposition = (int)lockrep->lock_policy_res1; - intent->it_status = (int)lockrep->lock_policy_res2; - intent->it_lock_mode = einfo->ei_mode; - intent->it_lock_handle = lockh->cookie; - intent->it_data = req; + it->it_disposition = (int)lockrep->lock_policy_res1; + it->it_status = (int)lockrep->lock_policy_res2; + it->it_lock_mode = einfo->ei_mode; + it->it_lock_handle = lockh->cookie; + it->it_data = req; /* Technically speaking rq_transno must already be zero if * it_status is in error, so the check is a bit redundant */ - if ((!req->rq_transno || intent->it_status < 0) && req->rq_replay) - mdc_clear_replay_flag(req, intent->it_status); + if ((!req->rq_transno || it->it_status < 0) && req->rq_replay) + mdc_clear_replay_flag(req, it->it_status); /* If we're doing an IT_OPEN which did not result in an actual * successful open, then we need to remove the bit which saves @@ -583,11 +583,11 @@ static int mdc_finish_enqueue(struct obd_export *exp, * function without doing so, and try to replay a failed create * (bug 3440) */ if (it->it_op & IT_OPEN && req->rq_replay && - (!it_disposition(it, DISP_OPEN_OPEN) ||intent->it_status != 0)) - mdc_clear_replay_flag(req, intent->it_status); + (!it_disposition(it, DISP_OPEN_OPEN) || it->it_status != 0)) + mdc_clear_replay_flag(req, it->it_status); DEBUG_REQ(D_RPCTRACE, req, "op: %d disposition: %x, status: %d", - it->it_op, intent->it_disposition, intent->it_status); + it->it_op, it->it_disposition, it->it_status); /* We know what to expect, so we do any byte flipping required here */ if (it->it_op & (IT_OPEN | IT_UNLINK | IT_LOOKUP | IT_GETATTR)) { @@ -879,9 +879,9 @@ resend: } ptlrpc_req_finished(req); - it->d.lustre.it_lock_handle = 0; - it->d.lustre.it_lock_mode = 0; - it->d.lustre.it_data = NULL; + it->it_lock_handle = 0; + it->it_lock_mode = 0; + it->it_data = NULL; } RETURN(rc); @@ -909,8 +909,8 @@ static int mdc_finish_intent_lock(struct obd_export *exp, if (!it_disposition(it, DISP_IT_EXECD)) { /* The server failed before it even started executing the * intent, i.e. because it couldn't unpack the request. */ - LASSERT(it->d.lustre.it_status != 0); - RETURN(it->d.lustre.it_status); + LASSERT(it->it_status != 0); + RETURN(it->it_status); } rc = it_open_error(DISP_IT_EXECD, it); if (rc) @@ -968,16 +968,17 @@ static int mdc_finish_intent_lock(struct obd_export *exp, memcpy(&old_lock, lockh, sizeof(*lockh)); if (ldlm_lock_match(NULL, LDLM_FL_BLOCK_GRANTED, NULL, LDLM_IBITS, &policy, LCK_NL, &old_lock, 0)) { - ldlm_lock_decref_and_cancel(lockh, - it->d.lustre.it_lock_mode); - memcpy(lockh, &old_lock, sizeof(old_lock)); - it->d.lustre.it_lock_handle = lockh->cookie; - } - } + ldlm_lock_decref_and_cancel(lockh, it->it_lock_mode); + memcpy(lockh, &old_lock, sizeof(old_lock)); + it->it_lock_handle = lockh->cookie; + } + } + CDEBUG(D_DENTRY,"D_IT dentry %.*s intent: %s status %d disp %x rc %d\n", (int)op_data->op_namelen, op_data->op_name, - ldlm_it2str(it->it_op), it->d.lustre.it_status, - it->d.lustre.it_disposition, rc); + ldlm_it2str(it->it_op), it->it_status, + it->it_disposition, rc); + RETURN(rc); } @@ -993,9 +994,9 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, enum ldlm_mode mode; ENTRY; - if (it->d.lustre.it_lock_handle) { - lockh.cookie = it->d.lustre.it_lock_handle; - mode = ldlm_revalidate_lock_handle(&lockh, bits); + if (it->it_lock_handle) { + lockh.cookie = it->it_lock_handle; + mode = ldlm_revalidate_lock_handle(&lockh, bits); } else { fid_build_reg_res_name(fid, &res_id); switch (it->it_op) { @@ -1035,15 +1036,15 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, &lockh); } - if (mode) { - it->d.lustre.it_lock_handle = lockh.cookie; - it->d.lustre.it_lock_mode = mode; - } else { - it->d.lustre.it_lock_handle = 0; - it->d.lustre.it_lock_mode = 0; - } + if (mode) { + it->it_lock_handle = lockh.cookie; + it->it_lock_mode = mode; + } else { + it->it_lock_handle = 0; + it->it_lock_mode = 0; + } - RETURN(!!mode); + RETURN(!!mode); } /* @@ -1062,15 +1063,15 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it, * ll_create/ll_open gets called. * * The server will return to us, in it_disposition, an indication of - * exactly what d.lustre.it_status refers to. + * exactly what it_status refers to. * - * If DISP_OPEN_OPEN is set, then d.lustre.it_status refers to the open() call, + * If DISP_OPEN_OPEN is set, then it_status refers to the open() call, * otherwise if DISP_OPEN_CREATE is set, then it status is the * creation failure mode. In either case, one of DISP_LOOKUP_NEG or * DISP_LOOKUP_POS will be set, indicating whether the child lookup * was successful. * - * Else, if DISP_LOOKUP_EXECD then d.lustre.it_status is the rc of the + * Else, if DISP_LOOKUP_EXECD then it_status is the rc of the * child lookup. */ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data, @@ -1100,7 +1101,7 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data, /* We could just return 1 immediately, but since we should only * be called in revalidate_it if we already have a lock, let's * verify that. */ - it->d.lustre.it_lock_handle = 0; + it->it_lock_handle = 0; rc = mdc_revalidate_lock(exp, it, &op_data->op_fid2, NULL); /* Only return failure if it was not GETATTR by cfid (from inode_revalidate) */ @@ -1122,7 +1123,7 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data, if (rc < 0) RETURN(rc); - *reqp = it->d.lustre.it_data; + *reqp = it->it_data; rc = mdc_finish_intent_lock(exp, *reqp, op_data, it, &lockh); RETURN(rc); } diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index ef49a28..39077ef 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -656,7 +656,7 @@ int mdc_set_open_replay_data(struct obd_export *exp, struct md_open_data *mod; struct mdt_rec_create *rec; struct mdt_body *body; - struct ptlrpc_request *open_req = it->d.lustre.it_data; + struct ptlrpc_request *open_req = it->it_data; struct obd_import *imp = open_req->rq_import; ENTRY; @@ -1318,7 +1318,7 @@ static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data, } rc = 0; - mdc_set_lock_data(exp, &it.d.lustre.it_lock_handle, dir, NULL); + mdc_set_lock_data(exp, &it.it_lock_handle, dir, NULL); rp_param.rp_off = hash_offset; rp_param.rp_hash64 = op_data->op_cli_flags & CLI_HASH64; @@ -1406,9 +1406,9 @@ hash_collision: } *ppage = page; out_unlock: - lockh.cookie = it.d.lustre.it_lock_handle; - ldlm_lock_decref(&lockh, it.d.lustre.it_lock_mode); - it.d.lustre.it_lock_handle = 0; + 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