Whamcloud - gitweb
LU-1962 util: Add --lazy flag to lfs df
[fs/lustre-release.git] / lustre / include / lustre_fid.h
index f36d257..b5c702a 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -109,14 +107,13 @@ enum local_oid {
         MDD_ORPHAN_OID          = 7UL,
         MDD_LOV_OBJ_OID         = 8UL,
         MDD_CAPA_KEYS_OID       = 9UL,
-        MDD_OBJECTS_OID         = 10UL,
         /** \see mdt_mod_init */
         MDT_LAST_RECV_OID       = 11UL,
-        /** \see osd_mod_init */
-        OSD_REM_OBJ_DIR_OID     = 12UL,
         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,
         OFD_GROUP0_LAST_OID     = 20UL,
         OFD_GROUP4K_LAST_OID    = 20UL+4096,
@@ -133,6 +130,32 @@ static inline void lu_local_obj_fid(struct lu_fid *fid, __u32 oid)
         fid->f_ver = 0;
 }
 
+static inline void lu_local_name_obj_fid(struct lu_fid *fid, __u32 oid)
+{
+        fid->f_seq = FID_SEQ_LOCAL_NAME;
+        fid->f_oid = oid;
+        fid->f_ver = 0;
+}
+
+static inline int fid_is_otable_it(const struct lu_fid *fid)
+{
+       return unlikely(fid_seq(fid) == FID_SEQ_LOCAL_FILE &&
+                       fid_oid(fid) == OTABLE_IT_OID);
+}
+
+static inline int fid_is_acct(const struct lu_fid *fid)
+{
+        return fid_seq(fid) == FID_SEQ_LOCAL_FILE &&
+               (fid_oid(fid) == ACCT_USER_OID ||
+                fid_oid(fid) == ACCT_GROUP_OID);
+}
+
+static inline int fid_is_quota(const struct lu_fid *fid)
+{
+       return fid_seq(fid) == FID_SEQ_QUOTA ||
+              fid_seq(fid) == FID_SEQ_QUOTA_GLB;
+}
+
 enum lu_mgr_type {
         LUSTRE_SEQ_SERVER,
         LUSTRE_SEQ_CONTROLLER
@@ -310,6 +333,36 @@ fid_build_reg_res_name(const struct lu_fid *f,
 }
 
 /*
+ * Build (DLM) resource identifier from global quota FID and quota ID.
+ */
+static inline struct ldlm_res_id *
+fid_build_quota_resid(const struct lu_fid *glb_fid, union lquota_id *qid,
+                     struct ldlm_res_id *res)
+{
+       fid_build_reg_res_name(glb_fid, res);
+       res->name[LUSTRE_RES_ID_QUOTA_SEQ_OFF] = fid_seq(&qid->qid_fid);
+       res->name[LUSTRE_RES_ID_QUOTA_VER_OID_OFF] = fid_ver_oid(&qid->qid_fid);
+       return res;
+}
+
+/*
+ * Extract global FID and quota ID from resource name
+ */
+static inline void fid_extract_quota_resid(struct ldlm_res_id *res,
+                                          struct lu_fid *glb_fid,
+                                          union lquota_id *qid)
+{
+       glb_fid->f_seq = res->name[LUSTRE_RES_ID_SEQ_OFF];
+       glb_fid->f_oid = (__u32)res->name[LUSTRE_RES_ID_VER_OID_OFF];
+       glb_fid->f_ver = (__u32)(res->name[LUSTRE_RES_ID_VER_OID_OFF] >> 32);
+
+       qid->qid_fid.f_seq = res->name[LUSTRE_RES_ID_QUOTA_SEQ_OFF];
+       qid->qid_fid.f_oid = (__u32)res->name[LUSTRE_RES_ID_QUOTA_VER_OID_OFF];
+       qid->qid_fid.f_ver =
+               (__u32)(res->name[LUSTRE_RES_ID_QUOTA_VER_OID_OFF] >> 32);
+}
+
+/*
  * Return true if resource is for object identified by fid.
  */
 static inline int fid_res_name_eq(const struct lu_fid *f,