Whamcloud - gitweb
LU-2240 mds: Assign special fid sequence to root.
[fs/lustre-release.git] / lustre / include / lustre_fid.h
index 2c490f6..0deb5db 100644 (file)
@@ -217,13 +217,12 @@ enum local_oid {
        MDD_LOV_OBJ_OID         = 8UL,
        MDD_CAPA_KEYS_OID       = 9UL,
        /** \see mdt_mod_init */
-       MDT_LAST_RECV_OID       = 11UL,
+       LAST_RECV_OID           = 11UL,
        OSD_FS_ROOT_OID         = 13UL,
        ACCT_USER_OID           = 15UL,
        ACCT_GROUP_OID          = 16UL,
        LFSCK_BOOKMARK_OID      = 17UL,
        OTABLE_IT_OID           = 18UL,
-       OFD_LAST_RECV_OID       = 19UL,
        /* These two definitions are obsolete
         * OFD_GROUP0_LAST_OID     = 20UL,
         * OFD_GROUP4K_LAST_OID    = 20UL+4096,
@@ -233,6 +232,7 @@ enum local_oid {
        MGS_CONFIGS_OID         = 4119UL,
        OFD_HEALTH_CHECK_OID    = 4120UL,
        MDD_LOV_OBJ_OSEQ        = 4121UL,
+       LFSCK_NAMESPACE_OID     = 4122UL,
 };
 
 static inline void lu_local_obj_fid(struct lu_fid *fid, __u32 oid)
@@ -249,10 +249,13 @@ static inline void lu_local_name_obj_fid(struct lu_fid *fid, __u32 oid)
         fid->f_ver = 0;
 }
 
+/* For new FS (>= 2.4), the root FID will be changed to
+ * [FID_SEQ_ROOT:1:0], for existing FS, (upgraded to 2.4),
+ * the root FID will still be IGIF */
 static inline int fid_is_root(const struct lu_fid *fid)
 {
-       return unlikely(fid_seq(fid) == FID_SEQ_LOCAL_FILE &&
-                       fid_oid(fid) == MDD_ROOT_INDEX_OID);
+       return unlikely((fid_seq(fid) == FID_SEQ_ROOT &&
+                        fid_oid(fid) == 1));
 }
 
 static inline int fid_is_dot_lustre(const struct lu_fid *fid)
@@ -296,6 +299,12 @@ static inline int fid_is_client_visible(const struct lu_fid *fid)
        return fid_is_client_mdt_visible(fid) || fid_is_idif(fid);
 }
 
+static inline int fid_seq_in_fldb(__u64 seq)
+{
+       return fid_seq_is_igif(seq) || fid_seq_is_norm(seq) ||
+              seq == FID_SEQ_ROOT;
+}
+
 static inline void lu_last_id_fid(struct lu_fid *fid, __u64 seq)
 {
        if (fid_seq_is_mdt0(seq)) {