return osd_seq->os_compat_dirs[b];
}
-/* XXX: f_ver is not counted, but may differ too */
-static void osd_fid2str(char *buf, const struct lu_fid *fid)
-{
- sprintf(buf, DFID_NOBRACE, PFID(fid));
-}
-
/*
* Determine the zap object id which is being used as the OI for the
* given fid. The lowest N bits in the sequence ID are used as the
*/
static uint64_t
osd_get_idx_for_fid(struct osd_device *osd, const struct lu_fid *fid,
- char *buf, dnode_t **zdn)
+ char *buf, dnode_t **zdn, int bufsize)
{
struct osd_oi *oi;
LASSERT(osd->od_oi_table != NULL);
oi = osd->od_oi_table[fid_seq(fid) & (osd->od_oi_count - 1)];
if (buf)
- osd_fid2str(buf, fid);
+ osd_fid2str(buf, fid, bufsize);
if (zdn)
*zdn = oi->oi_dn;
if (buf)
strncpy(buf, name, bufsize);
} else {
- zapid = osd_get_idx_for_fid(osd, fid, buf, NULL);
+ zapid = osd_get_idx_for_fid(osd, fid, buf, NULL,
+ bufsize);
}
} else {
- zapid = osd_get_idx_for_fid(osd, fid, buf, zdn);
+ zapid = osd_get_idx_for_fid(osd, fid, buf, zdn, bufsize);
}
return zapid;
if (buf)
strncpy(buf, name, bufsize);
} else {
- zapid = osd_get_idx_for_fid(osd, fid, buf, NULL);
+ zapid = osd_get_idx_for_fid(osd, fid, buf, NULL,
+ bufsize);
}
} else {
- zapid = osd_get_idx_for_fid(osd, fid, buf, zdn);
+ zapid = osd_get_idx_for_fid(osd, fid, buf, zdn, bufsize);
}
return zapid;
8, 1, &info->oti_zde);
} else if (fid_is_objseq(fid) || fid_is_batchid(fid)) {
zapid = osd_get_idx_for_fid(dev, fid,
- buf, NULL);
+ buf, NULL, sizeof(info->oti_buf));
rc = osd_zap_lookup(dev, zapid, zdn, buf,
8, 1, &info->oti_zde);
}
RETURN(rc);
}
+static void
+osd_oi_init_remote_parent(const struct lu_env *env, struct osd_device *o)
+{
+ uint64_t sdb;
+ int rc;
+ ENTRY;
+
+ if (o->od_is_ost) {
+ o->od_remote_parent_dir = ZFS_NO_OBJECT;
+ } else {
+ /* Remote parent only used for cross-MDT objects,
+ * it is usless for single MDT case or under read
+ * only mode. So ignore the failure. */
+ rc = osd_oi_find_or_create(env, o, o->od_root,
+ REMOTE_PARENT_DIR, &sdb);
+ if (!rc)
+ o->od_remote_parent_dir = sdb;
+ else
+ o->od_remote_parent_dir = ZFS_NO_OBJECT;
+ }
+}
+
/**
* Initialize the OIs by either opening or creating them as needed.
*/
int i, rc, count = 0;
ENTRY;
+ osd_oi_init_remote_parent(env, o);
+
rc = osd_oi_probe(env, o, &count);
if (rc)
RETURN(rc);