- LASSERT(fid->mds < lmv->desc.ld_tgt_count);
- rc = md_getattr(lmv->tgts[i].ltd_exp, fid,
- valid, ea_size, request);
- if (rc == 0 && obj) {
- /* we have to loop over dirobjs here and gather attrs for all
- * the slaves. */
-#warning "attrs gathering here"
- }
+ /* if object is splitted, then we loop over all the slaves and gather
+ * size attribute. In ideal world we would have to gather also mds field
+ * from all slaves, as object is spread over the cluster and this is
+ * definitely interesting information and it is not good to loss it,
+ * but...*/
+ if (obj) {
+ struct mds_body *body;
+
+ if (*request == NULL) {
+ lmv_put_obj(obj);
+ RETURN(rc);
+ }
+
+ body = lustre_msg_buf((*request)->rq_repmsg, 0,
+ sizeof(*body));
+ LASSERT(body != NULL);
+
+ lmv_lock_obj(obj);
+
+ for (i = 0; i < obj->objcount; i++) {
+
+ if (lmv->tgts[i].ltd_exp == NULL) {
+ CWARN("%s: NULL export for %d\n",
+ obd->obd_name, i);
+ continue;
+ }
+
+ /* skip master obj. */
+ if (fid_equal(&obj->fid, &obj->objs[i].fid))
+ continue;
+
+ body->size += obj->objs[i].size;
+ }