X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fliblustre%2Fnamei.c;h=c129f0b85ebdb8559bbbfe3d6baf233fd7ab5f60;hp=0e72637436fde050257d08ce552d4fedae2c63bf;hb=9d72ec94b56590ad5da7003e93dd268d81fc8d14;hpb=a1052417b78bc18898161c4ed44d79de4a1a2f23 diff --git a/lustre/liblustre/namei.c b/lustre/liblustre/namei.c index 0e72637..c129f0b 100644 --- a/lustre/liblustre/namei.c +++ b/lustre/liblustre/namei.c @@ -40,19 +40,27 @@ #define DEBUG_SUBSYSTEM S_LLITE +#include +#include +#include #include #include -#include -#include -#include #include -#include -#include - -#include "llite_lib.h" +#include +#include +#include +#include +#include +#include #include +#include +#include +#include +#include +#include +#include "llite_lib.h" -void ll_intent_drop_lock(struct lookup_intent *it) +static void ll_intent_drop_lock(struct lookup_intent *it) { struct lustre_handle *handle; @@ -68,7 +76,7 @@ void ll_intent_drop_lock(struct lookup_intent *it) } } -void ll_intent_release(struct lookup_intent *it) +static void ll_intent_release(struct lookup_intent *it) { ENTRY; @@ -80,7 +88,8 @@ void ll_intent_release(struct lookup_intent *it) EXIT; } -void llu_lookup_finish_locks(struct lookup_intent *it, struct pnode *pnode) +static void +llu_lookup_finish_locks(struct lookup_intent *it, struct pnode *pnode) { struct inode *inode; LASSERT(it); @@ -254,9 +263,8 @@ static int llu_pb_revalidate(struct pnode *pnode, int flags, pb->pb_ino, pb->pb_name.name, pb->pb_name.len, 0, LUSTRE_OPC_ANY); - rc = md_intent_lock(exp, &op_data, NULL, 0, it, flags, - &req, llu_md_blocking_ast, - LDLM_FL_CANCEL_ON_BLOCK); + rc = md_intent_lock(exp, &op_data, it, &req, &llu_md_blocking_ast, + LDLM_FL_CANCEL_ON_BLOCK); /* If req is NULL, then md_intent_lock only tried to do a lock match; * if all was well, it will return 1 if it found locks, 0 otherwise. */ if (req == NULL && rc >= 0) @@ -291,11 +299,9 @@ static int llu_pb_revalidate(struct pnode *pnode, int flags, } static int lookup_it_finish(struct ptlrpc_request *request, int offset, - struct lookup_intent *it, void *data) + struct lookup_intent *it, + struct inode *parent, struct pnode *child) { - struct it_cb_data *icbd = data; - struct pnode *child = icbd->icbd_child; - struct inode *parent = icbd->icbd_parent; struct llu_sb_info *sbi = llu_i2sbi(parent); struct inode *inode = NULL; int rc; @@ -315,10 +321,10 @@ static int lookup_it_finish(struct ptlrpc_request *request, int offset, /* undo which did by md_intent_lock */ if (it_disposition(it, DISP_OPEN_CREATE) && !it_open_error(DISP_OPEN_CREATE, it)) { - LASSERT(request); - LASSERT(cfs_atomic_read(&request->rq_refcount) > 1); - CDEBUG(D_INODE, "dec a ref of req %p\n", request); - ptlrpc_req_finished(request); + LASSERT(request); + LASSERT(atomic_read(&request->rq_refcount) > 1); + CDEBUG(D_INODE, "dec a ref of req %p\n", request); + ptlrpc_req_finished(request); } return it_open_error(DISP_OPEN_OPEN, it); } @@ -395,26 +401,10 @@ struct inode *llu_inode_from_resource_lock(struct ldlm_lock *lock) return inode; } -struct inode *llu_inode_from_lock(struct ldlm_lock *lock) -{ - struct inode *inode; - lock_res_and_lock(lock); - - if (lock->l_ast_data) { - inode = (struct inode *)lock->l_ast_data; - I_REF(inode); - } else - inode = NULL; - - unlock_res_and_lock(lock); - return inode; -} - static int llu_lookup_it(struct inode *parent, struct pnode *pnode, struct lookup_intent *it, int flags) { struct md_op_data op_data = {{ 0 }}; - struct it_cb_data icbd; struct ptlrpc_request *req = NULL; struct lookup_intent lookup_it = { .it_op = IT_LOOKUP }; __u32 opc; @@ -429,27 +419,21 @@ static int llu_lookup_it(struct inode *parent, struct pnode *pnode, it->it_op_release = ll_intent_release; } - icbd.icbd_child = pnode; - icbd.icbd_parent = parent; + if (it->it_op & IT_CREAT) + opc = LUSTRE_OPC_CREATE; + else + opc = LUSTRE_OPC_ANY; - if (it->it_op & IT_CREAT || - (it->it_op & IT_OPEN && it->it_create_mode & O_CREAT)) { - opc = LUSTRE_OPC_CREATE; - } else { - opc = LUSTRE_OPC_ANY; - } - llu_prep_md_op_data(&op_data, parent, NULL, pnode->p_base->pb_name.name, pnode->p_base->pb_name.len, flags, opc); - rc = md_intent_lock(llu_i2mdexp(parent), &op_data, NULL, 0, it, - flags, &req, llu_md_blocking_ast, - LDLM_FL_CANCEL_ON_BLOCK); + rc = md_intent_lock(llu_i2mdexp(parent), &op_data, it, &req, + &llu_md_blocking_ast, LDLM_FL_CANCEL_ON_BLOCK); if (rc < 0) GOTO(out, rc); - rc = lookup_it_finish(req, DLM_REPLY_REC_OFF, it, &icbd); + rc = lookup_it_finish(req, DLM_REPLY_REC_OFF, it, parent, pnode); if (rc != 0) { ll_intent_release(it); GOTO(out, rc);