Whamcloud - gitweb
b=19427 Correct lmm_object_id
authorRahul Deshmukh <Rahul.Deshmukh@sun.com>
Thu, 7 Oct 2010 12:06:46 +0000 (17:36 +0530)
committerVitaly Fertman <vitaly.fertman@sun.com>
Thu, 7 Oct 2010 22:12:22 +0000 (02:12 +0400)
o=adilger
i=wangdi
i=tapro
i=pravin
i=rahul

Fix boolean logic for limiting the maximum object ID created within a
single group (sequence).  For legacy IDIF objects this is 2^48 objects,
since we consume 2^16 SEQ numbers for the high bits of the object ID),
but for all other groups it is only 2^32 objects that can fit into f_oid.

Clean up some duplicate #defines that are no longer needed now that
we declare all of the FID_SEQ values in enum fid_seq in lustre_idl.h.

lustre/fid/fid_lib.c
lustre/fld/fld_handler.c
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_fid.h
lustre/obdfilter/filter.c
lustre/osd-ldiskfs/osd_handler.c

index f98efac..d818b2c 100644 (file)
@@ -73,7 +73,7 @@
  * FID_SEQ_START + 2 is for .lustre directory and its objects
  */
 const struct lu_seq_range LUSTRE_SEQ_SPACE_RANGE = {
-        FID_SEQ_DISTRIBUTED_START,
+        FID_SEQ_NORMAL,
         (__u64)~0ULL
 };
 EXPORT_SYMBOL(LUSTRE_SEQ_SPACE_RANGE);
@@ -92,13 +92,13 @@ const struct lu_fid LUSTRE_BFL_FID = { .f_seq = 0x0000000000000003,
 EXPORT_SYMBOL(LUSTRE_BFL_FID);
 
 /** Special fid for ".lustre" directory */
-const struct lu_fid LU_DOT_LUSTRE_FID = { .f_seq = LU_DOT_LUSTRE_SEQ,
+const struct lu_fid LU_DOT_LUSTRE_FID = { .f_seq = FID_SEQ_DOT_LUSTRE,
                                           .f_oid = 0x0000000000000001,
                                           .f_ver = 0x0000000000000000 };
 EXPORT_SYMBOL(LU_DOT_LUSTRE_FID);
 
 /** Special fid for "fid" special object in .lustre */
-const struct lu_fid LU_OBF_FID = { .f_seq = LU_DOT_LUSTRE_SEQ,
+const struct lu_fid LU_OBF_FID = { .f_seq = FID_SEQ_DOT_LUSTRE,
                                    .f_oid = 0x0000000000000002,
                                    .f_ver = 0x0000000000000000 };
 EXPORT_SYMBOL(LU_OBF_FID);
index aa44a97..e9dff56 100644 (file)
@@ -503,8 +503,8 @@ int fld_server_init(struct lu_server_fld *fld, struct dt_device *dt,
         fld->lsf_control_exp = NULL;
 
         /* Insert reserved sequence number of ".lustre" into fld cache. */
-        range.lsr_start = LU_DOT_LUSTRE_SEQ;
-        range.lsr_end = LU_DOT_LUSTRE_SEQ + 1;
+        range.lsr_start = FID_SEQ_DOT_LUSTRE;
+        range.lsr_end = FID_SEQ_DOT_LUSTRE + 1;
         range.lsr_mdt = 0;
         fld_cache_insert(fld->lsf_cache, &range);
 
index dc91a28..6ef74d1 100644 (file)
@@ -389,6 +389,10 @@ static inline obd_id fid_ver_oid(const struct lu_fid *fid)
 }
 
 /**
+ * Note that reserved SEQ numbers below 12 will conflict with ldiskfs
+ * inodes in the IGIF namespace, so these reserved SEQ numbers can be
+ * used for other purposes and not risk collisions with existing inodes.
+ *
  * Different FID Format
  * http://arch.lustre.org/index.php?title=Interoperability_fids_zfs#NEW.0
  */
index f31c4b5..1f93d4c 100644 (file)
@@ -88,22 +88,8 @@ enum {
         LUSTRE_SEQ_SUPER_WIDTH = ((1ULL << 30ULL) * LUSTRE_SEQ_META_WIDTH)
 };
 
-/** special fid seq: used for local object create. */
-#define FID_SEQ_LOCAL_FILE      (FID_SEQ_START + 1)
-
-/** special fid seq: used for .lustre objects. */
-#define LU_DOT_LUSTRE_SEQ       (FID_SEQ_START + 0x02ULL)
-
-/* Note that reserved SEQ numbers below 12 will conflict with ldiskfs
- * inodes in the IGIF namespace, so these reserved SEQ numbers must be
- * used sparingly until ldiskfs-based MDT backends and/or IGIF FIDs 
- * have been completely removed. */
-
-/** fid sequence for distributed fs objects */
-#define FID_SEQ_DISTRIBUTED_START     (FID_SEQ_START + 0x400ULL)
-
 /** special OID for local objects */
-enum {
+enum local_oid {
         /** \see osd_oi_index_create */
         OSD_OI_FID_16_OID       = 2UL,
         /** \see fld_mod_init */
index a498a66..3d11179 100644 (file)
@@ -3807,10 +3807,15 @@ static int filter_precreate(struct obd_device *obd, struct obdo *oa,
                 } else
                         next_id = filter_last_id(filter, group) + 1;
 
-                /* Temporary solution for oid in CMD before fid-on-OST */
-                if ((fid_seq_is_mdt0(oa->o_seq) && next_id >= IDIF_MAX_OID) &&
-                    (fid_seq_is_cmd(oa->o_seq) && next_id >= OBIF_MAX_OID)) {
-                        CERROR("%s:"POSTID" hit the max IDIF_MAX_OID(1<<48)!\n",
+                /* Don't create objects beyond the valid range for this SEQ */
+                if (unlikely(fid_seq_is_mdt0(group) &&
+                            next_id >= IDIF_MAX_OID)) {
+                        CERROR("%s:"POSTID" hit the IDIF_MAX_OID (1<<48)!\n",
+                                obd->obd_name, next_id, group);
+                        GOTO(cleanup, rc = -ENOSPC);
+               } else if (unlikely(!fid_seq_is_mdt0(group) &&
+                                   next_id >= OBIF_MAX_OID)) {
+                        CERROR("%s:"POSTID" hit the OBIF_MAX_OID (1<<32)!\n",
                                 obd->obd_name, next_id, group);
                         GOTO(cleanup, rc = -ENOSPC);
                 }
index 78a6778..3bdcaf9 100644 (file)
@@ -1944,7 +1944,7 @@ static int osd_object_ea_create(const struct lu_env *env, struct dt_object *dt,
         result = __osd_object_create(info, obj, attr, hint, dof, th);
 
         /* objects under osd root shld have igif fid, so dont add fid EA */
-        if (result == 0 && fid_seq(fid) >= FID_SEQ_DISTRIBUTED_START)
+        if (result == 0 && fid_seq(fid) >= FID_SEQ_NORMAL)
                 result = osd_ea_fid_set(env, dt, fid);
 
         if (result == 0)
@@ -2918,7 +2918,7 @@ static int __osd_ea_add_rec(struct osd_thread_info *info,
         child = osd_child_dentry_get(info->oti_env, pobj, name, strlen(name));
 
         if (fid_is_igif((struct lu_fid *)fid) ||
-            fid_seq((struct lu_fid *)fid) >= FID_SEQ_DISTRIBUTED_START) {
+            fid_seq((struct lu_fid *)fid) >= FID_SEQ_NORMAL) {
                 ldp = (struct ldiskfs_dentry_param *)info->oti_ldp;
                 osd_get_ldiskfs_dirent_param(ldp, fid);
                 child->d_fsdata = (void*) ldp;
@@ -2972,7 +2972,7 @@ static int osd_add_dot_dotdot(struct osd_thread_info *info,
 
                 if (!dir->oo_compat_dot_created)
                         return -EINVAL;
-                if (fid_seq((struct lu_fid *) dot_fid) >= FID_SEQ_DISTRIBUTED_START) {
+                if (fid_seq((struct lu_fid *)dot_fid) >= FID_SEQ_NORMAL) {
                         osd_get_ldiskfs_dirent_param(dot_ldp, dot_fid);
                         osd_get_ldiskfs_dirent_param(dot_dot_ldp, dot_dot_fid);
                 } else {