+ CDEBUG(D_CONFIG, "last object "LPU64" from OST %d\n",
+ mds->mds_lov_objids[idx], idx);
+
+out:
+ up_read(&mds->mds_lov_objids_sem);
+ RETURN(rc);
+}
+
+int mds_update_objids_from_lastid(struct obd_device *obd)
+{
+ struct mds_obd *mds = &obd->u.mds;
+ int size;
+ int rc, i;
+
+ if (mds->mds_lov_objids_count < mds->mds_lov_desc.ld_tgt_count) {
+ obd_id *ids;
+
+ size = mds->mds_lov_desc.ld_tgt_count * sizeof(obd_id);
+ OBD_ALLOC(ids, size);
+ if (ids == NULL)
+ GOTO(out, rc = -ENOMEM);
+
+ OBD_FREE(mds->mds_lov_objids, mds_lov_objids_size(mds));
+ mds->mds_lov_objids = ids;
+ mds->mds_lov_objids_count = size / sizeof(obd_id);
+ }
+
+ size = mds->mds_lov_desc.ld_tgt_count * sizeof(obd_id);
+ rc = obd_get_info(mds->mds_osc_exp, sizeof("last_id"),
+ "last_id", &size, mds->mds_lov_objids);
+ if (!rc) {
+ for (i = 0; i < mds->mds_lov_desc.ld_tgt_count; i++)
+ CWARN("got last object "LPU64" from OST %d\n",
+ mds->mds_lov_objids[i], i);
+ mds->mds_lov_objids_dirty = 1;
+ rc = mds_lov_write_objids(obd);
+ if (rc)
+ CERROR("got last objids from OSTs, but error "
+ "writing objids file: %d\n", rc);
+ }
+out: