- cfid = &body->fid1;
- obj2 = lmv_grab_obj(obd, cfid);
-
- if (!obj2 && (mea = body_of_splitted_dir(*reqp, 1))) {
- /* wow! this is splitted dir, we'd like to handle it. */
- body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
- LASSERT(body != NULL);
-
- obj2 = lmv_create_obj(exp, &body->fid1, mea);
- if (IS_ERR(obj2))
- RETURN(PTR_ERR(obj2));
- }
-
- if (obj2) {
- /* this is splitted dir and we'd want to get attrs */
- CDEBUG(D_OTHER, "attrs from slaves for %lu/%lu/%lu, rc %d\n",
- (unsigned long)cfid->mds, (unsigned long)cfid->id,
- (unsigned long)cfid->generation, rc);
-
- rc = lmv_revalidate_slaves(exp, reqp, cfid, it, 1, cb_blocking);
- lmv_put_obj(obj2);
- }
- RETURN(rc);
-}
-
-void lmv_update_body_from_obj(struct mds_body *body, struct lmv_inode *obj)
-{
- /* update size */
- body->size += obj->size;
-/* body->atime = obj->atime;
- body->ctime = obj->ctime;
- body->mtime = obj->mtime;
- body->nlink = obj->nlink;*/
-}
-
-int lmv_lookup_slaves(struct obd_export *exp, struct ptlrpc_request **reqp)
-{
- struct obd_device *obd = exp->exp_obd;
- struct lmv_obd *lmv = &obd->u.lmv;
- struct mds_body *body = NULL;
- struct lustre_handle *lockh;
- struct ldlm_lock *lock;
- struct mds_body *body2;
- struct ll_uctxt uctxt;
- struct lmv_obj *obj;
- int i, rc = 0;
- ENTRY;
-
- LASSERT(reqp);
- LASSERT(*reqp);
-
- /* master is locked. we'd like to take locks on slaves and update
- * attributes to be returned from the slaves it's important that lookup
- * is called in two cases:
-
- * - for first time (dcache has no such a resolving yet).
- * - ->d_revalidate() returned false.
-
- * last case possible only if all the objs (master and all slaves aren't
- * valid */
-
- body = lustre_msg_buf((*reqp)->rq_repmsg, 1, sizeof(*body));
- LASSERT(body != NULL);
-
- obj = lmv_grab_obj(obd, &body->fid1);
- LASSERT(obj != NULL);
-
- CDEBUG(D_OTHER, "lookup slaves for %lu/%lu/%lu\n",
- (unsigned long)body->fid1.mds,
- (unsigned long)body->fid1.id,
- (unsigned long)body->fid1.generation);
-
- uctxt.gid1 = 0;
- uctxt.gid2 = 0;
-
- lmv_lock_obj(obj);
-
- for (i = 0; i < obj->objcount; i++) {
- struct ll_fid fid = obj->objs[i].fid;
- struct ptlrpc_request *req = NULL;
- struct lookup_intent it;
-
- if (fid_equal(&fid, &obj->fid))
- /* skip master obj */
- continue;
-
- CDEBUG(D_OTHER, "lookup slave %lu/%lu/%lu\n",
- (unsigned long)fid.mds, (unsigned long)fid.id,
- (unsigned long)fid.generation);
-
- /* is obj valid? */
- memset(&it, 0, sizeof(it));
- it.it_op = IT_GETATTR;
- rc = md_intent_lock(lmv->tgts[fid.mds].ltd_exp, &uctxt, &fid,
- NULL, 0, NULL, 0, &fid, &it, 0, &req,
- lmv_dirobj_blocking_ast);
-
- lockh = (struct lustre_handle *)&it.d.lustre.it_lock_handle;
- if (rc > 0) {
- /* nice, this slave is valid */
- LASSERT(req == NULL);
- CDEBUG(D_OTHER, "cached\n");
- goto release_lock;
- }
-
- if (rc < 0)
- /* error during revalidation */
- GOTO(cleanup, rc);
-
- /* rc == 0, this means we have no such a lock and can't think
- * obj is still valid. lookup it again */
- LASSERT(req == NULL);
- req = NULL;
-
- memset(&it, 0, sizeof(it));
- it.it_op = IT_GETATTR;
- rc = md_intent_lock(lmv->tgts[fid.mds].ltd_exp, &uctxt, &fid,
- NULL, 0, NULL, 0, NULL, &it, 0, &req,
- lmv_dirobj_blocking_ast);
-
- lockh = (struct lustre_handle *) &it.d.lustre.it_lock_handle;
- LASSERT(rc <= 0);
-
- if (rc < 0)
- /* error during lookup */
- GOTO(cleanup, rc);
-
- lock = ldlm_handle2lock(lockh);
- LASSERT(lock);
-
- lock->l_ast_data = lmv_get_obj(obj);