Whamcloud - gitweb
LU-1198 idl: move FID VER to DLM resource name[1]
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 8 Mar 2012 14:22:59 +0000 (22:22 +0800)
committerJohann Lombardi <johann@whamcloud.com>
Tue, 13 Mar 2012 09:14:14 +0000 (05:14 -0400)
Until Lustre 1.8.7/2.1.1 the FID version was packed into name[2].

However, this leaves very little room in the LDLM resource name
for other uses.  The upcoming quota code needs to store another
FID into the LDLM resource to allow directory tree quotas, and
managed by the DLM.

The 32-bit VER, which is currently always 0, is moved into the high
bits of name[1] along with the 32-bit OID, to avoid consuming the
name[2] field.  Since future use of the FID version (including
snapshots, pools, etc) will need changes on the client side anyway,
there will never be non-zero VER on an existing client.

Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: If1e500cfb277dfc25bc056bb0c5763e48e7d500c
Reviewed-on: http://review.whamcloud.com/2275
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
lustre/include/lustre/lustre_idl.h
lustre/mdc/mdc_fid.c

index b26ad58..414427b 100644 (file)
@@ -777,13 +777,16 @@ enum lu_dirent_attrs {
 
 extern void lustre_swab_ll_fid (struct ll_fid *fid);
 
+/* NOTE: until Lustre 1.8.7/2.1.1 the fid_ver() was packed into name[2],
+ * but was moved into name[1] along with the OID to avoid consuming the
+ * renaming name[2,3] fields that need to be used for the quota identifier. */
 enum {
         /** put FID sequence at this offset in ldlm_res_id. */
         LUSTRE_RES_ID_SEQ_OFF = 0,
-        /** put FID oid at this offset in ldlm_res_id. */
-        LUSTRE_RES_ID_OID_OFF = 1,
+        /** put FID OID and VER at this offset in ldlm_res_id. */
+        LUSTRE_RES_ID_VER_OID_OFF = 1,
         /** put FID version at this offset in ldlm_res_id. */
-        LUSTRE_RES_ID_VER_OFF = 2,
+        LUSTRE_RES_ID_WAS_VER_OFF = 2,
         /** put pdo hash at this offset in ldlm_res_id. */
         LUSTRE_RES_ID_HSH_OFF = 3
 };
index 8921992..1dc3922 100644 (file)
@@ -388,17 +388,21 @@ void range_be_to_cpu(struct lu_seq_range *dst, const struct lu_seq_range *src)
 }
 EXPORT_SYMBOL(range_be_to_cpu);
 
-/**     
+/**
  * Build (DLM) resource name from fid.
+ *
+ * NOTE: until Lustre 1.8.7/2.1.1 the fid_ver() was packed into name[2],
+ * but was moved into name[1] along with the OID to avoid consuming the
+ * renaming name[2,3] fields that need to be used for the quota identifier.
  */
 struct ldlm_res_id *
 fid_build_reg_res_name(const struct lu_fid *f, struct ldlm_res_id *name)
-{       
+{
         memset(name, 0, sizeof *name);
         name->name[LUSTRE_RES_ID_SEQ_OFF] = fid_seq(f);
-        name->name[LUSTRE_RES_ID_OID_OFF] = fid_oid(f);
+        name->name[LUSTRE_RES_ID_VER_OID_OFF] = fid_oid(f);
         if (!fid_is_igif(f))
-                name->name[LUSTRE_RES_ID_VER_OFF] = fid_ver(f);
+                name->name[LUSTRE_RES_ID_VER_OID_OFF] |= (__u64)fid_ver(f)<<32;
         return name;
 }
 EXPORT_SYMBOL(fid_build_reg_res_name);
@@ -409,11 +413,11 @@ EXPORT_SYMBOL(fid_build_reg_res_name);
 int fid_res_name_eq(const struct lu_fid *f, const struct ldlm_res_id *name)
 {
         int ret;
-        
+
         ret = name->name[LUSTRE_RES_ID_SEQ_OFF] == fid_seq(f) &&
-              name->name[LUSTRE_RES_ID_OID_OFF] == fid_oid(f);
+              name->name[LUSTRE_RES_ID_VER_OID_OFF] == fid_oid(f);
         if (!fid_is_igif(f))
-                ret = ret && name->name[LUSTRE_RES_ID_VER_OFF] == fid_ver(f);
+                ret &= name->name[LUSTRE_RES_ID_VER_OID_OFF] == fid_ver(f);
         return ret;
 }
 EXPORT_SYMBOL(fid_res_name_eq);