#include <linux/slab.h>
#include <linux/pagemap.h>
#include <asm/div64.h>
+#include <linux/seq_file.h>
#else
#include <liblustre.h>
#endif
#include <linux/lustre_mds.h>
#include <linux/obd_class.h>
#include <linux/obd_ost.h>
-#include <linux/seq_file.h>
#include <linux/lprocfs_status.h>
#include <linux/lustre_fsfilt.h>
#include <linux/obd_lmv.h>
obj->fid = *fid;
obj->obd = obd;
- OBD_ALLOC(obj->objs, sizeof(struct lmv_inode) * lmv->count);
+ OBD_ALLOC(obj->objs, sizeof(struct lmv_inode) * lmv->desc.ld_tgt_count);
if (!obj->objs) {
OBD_FREE(obj, sizeof(*obj));
RETURN(NULL);
}
- memset(obj->objs, 0, sizeof(struct lmv_inode) * lmv->count);
+ memset(obj->objs, 0, sizeof(struct lmv_inode) * lmv->desc.ld_tgt_count);
spin_lock(&lmv_obj_list_lock);
list_for_each(cur, &lmv_obj_list) {
obj2->fid.generation == fid->generation) {
/* someone created it already */
OBD_FREE(obj->objs,
- sizeof(struct lmv_inode) * lmv->count);
+ sizeof(struct lmv_inode) * lmv->desc.ld_tgt_count);
OBD_FREE(obj, sizeof(*obj));
atomic_inc(&obj2->count);
list_del(&obj->list);
OBD_FREE(obj->objs,
- sizeof(struct lmv_inode) * lmv->count);
+ sizeof(struct lmv_inode) * lmv->desc.ld_tgt_count);
OBD_FREE(obj, sizeof(*obj));
}
spin_unlock(&lmv_obj_list_lock);
(unsigned long) fid->generation);
if (!mea) {
+ unsigned long valid;
+
CDEBUG(D_OTHER, "mea isn't passed in, get it now\n");
mealen = MEA_SIZE_LMV(lmv);
+
/* time to update mea of parent fid */
i = fid->mds;
- rc = md_getattr(lmv->tgts[fid->mds].exp, fid,
- OBD_MD_FLEASIZE, mealen, &req);
- LASSERT(rc == 0);
md.mea = NULL;
- rc = mdc_req2lustre_md(req, 0, NULL, exp, &md);
- LASSERT(rc == 0);
- LASSERT(md.mea != NULL);
+
+ valid = OBD_MD_FLEASIZE | OBD_MD_FLDIREA;
+ rc = md_getattr(lmv->tgts[fid->mds].ltd_exp, fid,
+ valid, mealen, &req);
+ if (rc) {
+ CERROR("md_getattr() failed, rc = %d\n", rc);
+ GOTO(cleanup, rc);
+ }
+
+ rc = mdc_req2lustre_md(exp, req, 0, NULL, &md);
+ if (rc) {
+ CERROR("mdc_req2lustre_md() failed, rc = %d\n", rc);
+ GOTO(cleanup, rc);
+ }
+
+ if (md.mea == NULL)
+ GOTO(cleanup, rc = -ENODATA);
+
mea = md.mea;
}