forked from Minki/linux
staging/lustre/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 <john.hammond@intel.com> Reviewed-on: http://review.whamcloud.com/17069 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7403 Reviewed-by: James Simmons <uja.ornl@yahoo.com> Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com> Reviewed-by: Frank Zago <fzago@cray.com> Signed-off-by: Oleg Drokin <green@linuxhacker.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d55d5e8f49
commit
e476f2e55a
@ -34,7 +34,11 @@
|
||||
#define LUSTRE_INTENT_H
|
||||
|
||||
/* intent IT_XXX are defined in lustre/include/obd.h */
|
||||
struct lustre_intent_data {
|
||||
|
||||
struct lookup_intent {
|
||||
int it_op;
|
||||
int it_create_mode;
|
||||
__u64 it_flags;
|
||||
int it_disposition;
|
||||
int it_status;
|
||||
__u64 it_lock_handle;
|
||||
@ -46,13 +50,4 @@ struct lustre_intent_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;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -202,27 +202,27 @@ 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 %#llx from it %p\n",
|
||||
handle.cookie, it);
|
||||
ldlm_lock_decref(&handle, it->d.lustre.it_lock_mode);
|
||||
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;
|
||||
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%#llx 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -233,13 +233,13 @@ 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);
|
||||
ptlrpc_req_finished(it->it_data);
|
||||
|
||||
it->d.lustre.it_disposition = 0;
|
||||
it->d.lustre.it_data = NULL;
|
||||
it->it_disposition = 0;
|
||||
it->it_data = NULL;
|
||||
}
|
||||
|
||||
void ll_invalidate_aliases(struct inode *inode)
|
||||
@ -279,7 +279,7 @@ int ll_revalidate_it_finish(struct ptlrpc_request *request,
|
||||
|
||||
void ll_lookup_finish_locks(struct lookup_intent *it, struct inode *inode)
|
||||
{
|
||||
if (it->d.lustre.it_lock_mode && inode) {
|
||||
if (it->it_lock_mode && inode) {
|
||||
struct ll_sb_info *sbi = ll_i2sbi(inode);
|
||||
|
||||
CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID"(%p)\n",
|
||||
|
@ -362,7 +362,7 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash,
|
||||
|
||||
ll_finish_md_op_data(op_data);
|
||||
|
||||
request = (struct ptlrpc_request *)it.d.lustre.it_data;
|
||||
request = (struct ptlrpc_request *)it.it_data;
|
||||
if (request)
|
||||
ptlrpc_req_finished(request);
|
||||
if (rc < 0) {
|
||||
@ -374,7 +374,7 @@ struct page *ll_get_dir_page(struct inode *dir, __u64 hash,
|
||||
CDEBUG(D_INODE, "setting lr_lvb_inode to inode "DFID"(%p)\n",
|
||||
PFID(ll_inode2fid(dir)), dir);
|
||||
md_set_lock_data(ll_i2sbi(dir)->ll_md_exp,
|
||||
&it.d.lustre.it_lock_handle, dir, NULL);
|
||||
&it.it_lock_handle, dir, NULL);
|
||||
} else {
|
||||
/* for cross-ref object, l_ast_data of the lock may not be set,
|
||||
* we reset it here
|
||||
|
@ -437,7 +437,7 @@ static int ll_intent_file_open(struct dentry *dentry, void *lmm,
|
||||
}
|
||||
|
||||
rc = ll_prep_inode(&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, inode, itp, NULL);
|
||||
|
||||
out:
|
||||
@ -464,13 +464,13 @@ void ll_ioepoch_open(struct ll_inode_info *lli, __u64 ioepoch)
|
||||
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->handle;
|
||||
och->och_fid = body->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;
|
||||
|
||||
@ -488,7 +488,7 @@ static int ll_local_open(struct file *file, struct lookup_intent *it,
|
||||
LASSERT(fd);
|
||||
|
||||
if (och) {
|
||||
struct ptlrpc_request *req = it->d.lustre.it_data;
|
||||
struct ptlrpc_request *req = it->it_data;
|
||||
struct mdt_body *body;
|
||||
int rc;
|
||||
|
||||
@ -563,7 +563,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
|
||||
@ -633,7 +633,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
|
||||
@ -670,7 +670,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)
|
||||
@ -713,7 +713,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);
|
||||
}
|
||||
|
||||
@ -854,12 +854,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/%llu.\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);
|
||||
rc = -EPROTO;
|
||||
goto out_close;
|
||||
}
|
||||
@ -869,10 +869,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(sbi->ll_md_exp, inode, och, NULL);
|
||||
@ -1388,7 +1388,7 @@ int ll_lov_setstripe_ea_info(struct inode *inode, struct dentry *dentry,
|
||||
rc = ll_intent_file_open(dentry, lum, lum_size, &oit);
|
||||
if (rc)
|
||||
goto out_unlock;
|
||||
rc = oit.d.lustre.it_status;
|
||||
rc = oit.it_status;
|
||||
if (rc < 0)
|
||||
goto out_req_free;
|
||||
|
||||
@ -1401,7 +1401,7 @@ out_unlock:
|
||||
out:
|
||||
return rc;
|
||||
out_req_free:
|
||||
ptlrpc_req_finished((struct ptlrpc_request *)oit.d.lustre.it_data);
|
||||
ptlrpc_req_finished((struct ptlrpc_request *)oit.it_data);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -1689,7 +1689,7 @@ int ll_release_openhandle(struct inode *inode, 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;
|
||||
@ -3595,13 +3595,13 @@ again:
|
||||
|
||||
rc = md_enqueue(sbi->ll_md_exp, &einfo, &it, op_data, &lockh,
|
||||
NULL, 0, NULL, 0);
|
||||
ptlrpc_req_finished(it.d.lustre.it_data);
|
||||
it.d.lustre.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) {
|
||||
|
@ -1196,7 +1196,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
|
||||
@ -1207,26 +1207,26 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode,
|
||||
* 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 %#llx\n",
|
||||
PFID(ll_inode2fid(inode)), inode,
|
||||
handle.cookie);
|
||||
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 %#llx\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)
|
||||
*bits = it->d.lustre.it_lock_bits;
|
||||
*bits = it->it_lock_bits;
|
||||
}
|
||||
|
||||
static inline int d_lustre_invalid(const struct dentry *dentry)
|
||||
|
@ -1945,11 +1945,11 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req,
|
||||
* 3. proc2: refresh layout and layout lock granted
|
||||
* 4. proc1: to apply a stale layout
|
||||
*/
|
||||
if (it && it->d.lustre.it_lock_mode != 0) {
|
||||
if (it && 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);
|
||||
if (ldlm_has_layout(lock)) {
|
||||
|
@ -393,7 +393,7 @@ static int ll_lookup_it_finish(struct ptlrpc_request *request,
|
||||
* 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)
|
||||
@ -445,7 +445,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 };
|
||||
|
||||
if (md_revalidate_lock(ll_i2mdexp(parent), &parent_it,
|
||||
&ll_i2info(parent)->lli_fid, NULL)) {
|
||||
@ -656,10 +656,10 @@ static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it)
|
||||
struct ll_sb_info *sbi = ll_i2sbi(dir);
|
||||
int rc;
|
||||
|
||||
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;
|
||||
request = it->it_data;
|
||||
it_clear_disposition(it, DISP_ENQ_CREATE_REF);
|
||||
rc = ll_prep_inode(&inode, request, dir->i_sb, it);
|
||||
if (rc) {
|
||||
|
@ -646,7 +646,7 @@ static void ll_post_statahead(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) {
|
||||
rc = -EAGAIN;
|
||||
@ -700,7 +700,7 @@ static int ll_statahead_interpret(struct ptlrpc_request *req,
|
||||
* 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);
|
||||
}
|
||||
|
||||
@ -850,7 +850,7 @@ static int do_sa_revalidate(struct inode *dir, struct ll_sa_entry *entry,
|
||||
{
|
||||
struct inode *inode = d_inode(dentry);
|
||||
struct lookup_intent it = { .it_op = IT_GETATTR,
|
||||
.d.lustre.it_lock_handle = 0 };
|
||||
.it_lock_handle = 0 };
|
||||
struct md_enqueue_info *minfo;
|
||||
struct ldlm_enqueue_info *einfo;
|
||||
int rc;
|
||||
@ -865,7 +865,7 @@ static int do_sa_revalidate(struct inode *dir, struct ll_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;
|
||||
}
|
||||
@ -1569,7 +1569,7 @@ int do_statahead_enter(struct inode *dir, struct dentry **dentryp,
|
||||
if (entry->se_stat == SA_ENTRY_SUCC && entry->se_inode) {
|
||||
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;
|
||||
|
||||
|
@ -288,8 +288,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;
|
||||
}
|
||||
}
|
||||
@ -315,7 +315,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);
|
||||
@ -362,10 +362,10 @@ static int ll_xattr_cache_refill(struct inode *inode, struct lookup_intent *oit)
|
||||
goto out_maybe_drop;
|
||||
}
|
||||
|
||||
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;
|
||||
@ -448,8 +448,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;
|
||||
}
|
||||
|
@ -80,11 +80,11 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm,
|
||||
/*
|
||||
* 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->fid1));
|
||||
@ -130,14 +130,14 @@ static int lmv_intent_remote(struct obd_export *exp, void *lmm,
|
||||
* 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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
out_free_op_data:
|
||||
kfree(op_data);
|
||||
@ -197,9 +197,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);
|
||||
|
@ -1679,7 +1679,7 @@ lmv_enqueue_remote(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
|
||||
struct lustre_handle *lockh, void *lmm, int lmmsize,
|
||||
__u64 extra_lock_flags)
|
||||
{
|
||||
struct ptlrpc_request *req = it->d.lustre.it_data;
|
||||
struct ptlrpc_request *req = it->it_data;
|
||||
struct obd_device *obd = exp->exp_obd;
|
||||
struct lmv_obd *lmv = &obd->u.lmv;
|
||||
struct lustre_handle plock;
|
||||
@ -1701,11 +1701,11 @@ lmv_enqueue_remote(struct obd_export *exp, struct ldlm_enqueue_info *einfo,
|
||||
/*
|
||||
* We got LOOKUP lock, but we really need attrs.
|
||||
*/
|
||||
pmode = it->d.lustre.it_lock_mode;
|
||||
pmode = it->it_lock_mode;
|
||||
LASSERT(pmode != 0);
|
||||
memcpy(&plock, lockh, sizeof(plock));
|
||||
it->d.lustre.it_lock_mode = 0;
|
||||
it->d.lustre.it_data = NULL;
|
||||
it->it_lock_mode = 0;
|
||||
it->it_data = NULL;
|
||||
fid1 = body->fid1;
|
||||
|
||||
ptlrpc_req_finished(req);
|
||||
|
@ -52,19 +52,19 @@ struct mdc_getattr_args {
|
||||
|
||||
int it_disposition(struct lookup_intent *it, int flag)
|
||||
{
|
||||
return it->d.lustre.it_disposition & flag;
|
||||
return it->it_disposition & flag;
|
||||
}
|
||||
EXPORT_SYMBOL(it_disposition);
|
||||
|
||||
void it_set_disposition(struct lookup_intent *it, int flag)
|
||||
{
|
||||
it->d.lustre.it_disposition |= flag;
|
||||
it->it_disposition |= flag;
|
||||
}
|
||||
EXPORT_SYMBOL(it_set_disposition);
|
||||
|
||||
void it_clear_disposition(struct lookup_intent *it, int flag)
|
||||
{
|
||||
it->d.lustre.it_disposition &= ~flag;
|
||||
it->it_disposition &= ~flag;
|
||||
}
|
||||
EXPORT_SYMBOL(it_clear_disposition);
|
||||
|
||||
@ -72,39 +72,39 @@ 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->d.lustre.it_status;
|
||||
return it->it_status;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (it_disposition(it, DISP_OPEN_CREATE)) {
|
||||
if (phase >= DISP_OPEN_CREATE)
|
||||
return it->d.lustre.it_status;
|
||||
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;
|
||||
return it->it_status;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (it_disposition(it, DISP_IT_EXECD)) {
|
||||
if (phase >= DISP_IT_EXECD)
|
||||
return it->d.lustre.it_status;
|
||||
return it->it_status;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
CERROR("it disp: %X, status: %d\n", it->d.lustre.it_disposition,
|
||||
it->d.lustre.it_status);
|
||||
CERROR("it disp: %X, status: %d\n", it->it_disposition,
|
||||
it->it_status);
|
||||
LBUG();
|
||||
return 0;
|
||||
}
|
||||
@ -542,7 +542,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;
|
||||
int lvb_len = 0;
|
||||
@ -576,17 +575,17 @@ static int mdc_finish_enqueue(struct obd_export *exp,
|
||||
|
||||
lockrep = req_capsule_server_get(pill, &RMF_DLM_REP);
|
||||
|
||||
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
|
||||
@ -597,11 +596,11 @@ static int mdc_finish_enqueue(struct obd_export *exp,
|
||||
* (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)) {
|
||||
@ -900,9 +899,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;
|
||||
@ -926,8 +925,8 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
|
||||
/* 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)
|
||||
@ -1010,15 +1009,15 @@ static int mdc_finish_intent_lock(struct obd_export *exp,
|
||||
LDLM_IBITS, &policy, LCK_NL,
|
||||
&old_lock, 0)) {
|
||||
ldlm_lock_decref_and_cancel(lockh,
|
||||
it->d.lustre.it_lock_mode);
|
||||
it->it_lock_mode);
|
||||
memcpy(lockh, &old_lock, sizeof(old_lock));
|
||||
it->d.lustre.it_lock_handle = lockh->cookie;
|
||||
it->it_lock_handle = lockh->cookie;
|
||||
}
|
||||
}
|
||||
CDEBUG(D_DENTRY,
|
||||
"D_IT dentry %.*s intent: %s status %d disp %x rc %d\n",
|
||||
op_data->op_namelen, op_data->op_name, ldlm_it2str(it->it_op),
|
||||
it->d.lustre.it_status, it->d.lustre.it_disposition, rc);
|
||||
it->it_status, it->it_disposition, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -1034,8 +1033,8 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it,
|
||||
ldlm_policy_data_t policy;
|
||||
enum ldlm_mode mode;
|
||||
|
||||
if (it->d.lustre.it_lock_handle) {
|
||||
lockh.cookie = it->d.lustre.it_lock_handle;
|
||||
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);
|
||||
@ -1076,11 +1075,11 @@ int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it,
|
||||
}
|
||||
|
||||
if (mode) {
|
||||
it->d.lustre.it_lock_handle = lockh.cookie;
|
||||
it->d.lustre.it_lock_mode = mode;
|
||||
it->it_lock_handle = lockh.cookie;
|
||||
it->it_lock_mode = mode;
|
||||
} else {
|
||||
it->d.lustre.it_lock_handle = 0;
|
||||
it->d.lustre.it_lock_mode = 0;
|
||||
it->it_lock_handle = 0;
|
||||
it->it_lock_mode = 0;
|
||||
}
|
||||
|
||||
return !!mode;
|
||||
@ -1102,15 +1101,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,
|
||||
@ -1143,7 +1142,7 @@ int mdc_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
|
||||
* 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)
|
||||
@ -1165,7 +1164,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;
|
||||
}
|
||||
|
@ -637,7 +637,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;
|
||||
|
||||
if (!open_req->rq_replay)
|
||||
|
Loading…
Reference in New Issue
Block a user