return name;
}
+static inline __u64 fid_flatten(const struct lu_fid *fid)
+{
+ return (fid_seq(fid) - 1) * LUSTRE_SEQ_MAX_WIDTH + fid_oid(fid);
+}
+
#define LUSTRE_SEQ_SRV_NAME "seq_srv"
#define LUSTRE_SEQ_CTL_NAME "seq_ctl"
* Very stupid and having many downsides inode allocation algorithm
* based on fid.
*/
- ino = (fid_seq(fid) - 1) * LUSTRE_SEQ_MAX_WIDTH + fid_oid(fid);
+ ino = fid_flatten(fid);
RETURN(ino & 0x7fffffff);
}
snprintf(name, strlen(MDD_OBD_NAME) + 5, "%s-%d",
MDD_OBD_NAME, mds_id);
-
+
snprintf(uuid, strlen(MDD_OBD_UUID) + 5, "%s-%d",
MDD_OBD_UUID, mds_id);
-
+
lustre_cfg_bufs_reset(bufs, name);
lustre_cfg_bufs_set_string(bufs, 1, MDD_OBD_TYPE);
lustre_cfg_bufs_set_string(bufs, 2, uuid);
obd->obd_upcall.onu_upcall = mdd_lov_update;
obd->obd_upcall.onu_owner = mdd;
mdd->mdd_obd_dev = obd;
-
+
EXIT;
class_detach:
if (rc)
OBD_ALLOC_PTR(bufs);
if (!bufs)
RETURN(-ENOMEM);
-
+
lustre_cfg_bufs_reset(bufs, MDD_OBD_NAME);
lcfg = lustre_cfg_new(LCFG_ATTACH, bufs);
OBD_FREE_PTR(bufs);
*/
static obd_id mdd_lov_create_id(const struct lu_fid *fid)
{
- return ((fid_seq(fid) - 1) * LUSTRE_SEQ_MAX_WIDTH + fid_oid(fid));
+ return fid_flatten(fid);
}
static int mdd_lov_objid_alloc(const struct lu_env *env,
{
/* all objects with same id and different versions will belong to same
* collisions list. */
-#if 1
- return hash_long((fid_seq(f) - 1) * LUSTRE_SEQ_MAX_WIDTH + fid_oid(f),
- bits);
-#else
- unsigned long hash;
- __u64 seq;
-
- seq = fid_seq(f);
- hash = seq ^ fid_oid(f);
- if (sizeof hash != sizeof seq)
- hash ^= seq >> 32;
- return hash_long(hash, 32);
-#endif
+ return hash_long(fid_flatten(f), bits);
}
/*