Whamcloud - gitweb
LU-4263 osd-zfs: Avoid converting last ID FIDs to OST IDs 01/8301/4
authorLi Wei <wei.g.li@intel.com>
Fri, 30 Aug 2013 07:12:40 +0000 (15:12 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 17 Jan 2014 01:32:24 +0000 (01:32 +0000)
When obdfilter-survey first creates an object on a fresh ZFS OST, the
last ID object for FID_SEQ_ECHO has to be created in the first place.
The last ID FID, [FID_SEQ_ECHO:0:0], can not be converted to an OST ID
because the resulting OST ID would be indistinguishable from an
FID_SEQ_OST_MDT0 OST ID and would confuse ostid_id().  This patch
checks for last ID FIDs before converting them to OST IDs in
osd_get_idx_for_ost_obj().

Change-Id: I96cdf85b4725e4882cecabaf90466c7f77a5e0a6
Intel-bug-id: FF-182
Signed-off-by: Li Wei <wei.g.li@intel.com>
Reviewed-on: http://review.whamcloud.com/8301
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-zfs/osd_oi.c

index 00ce2ea..4acbd0d 100644 (file)
@@ -371,6 +371,7 @@ osd_get_idx_for_ost_obj(const struct lu_env *env, struct osd_device *osd,
 {
        struct osd_seq  *osd_seq;
        unsigned long   b;
+       obd_id          id;
        int             rc;
 
        osd_seq = osd_find_or_add_seq(env, osd, fid_seq(fid));
@@ -380,12 +381,18 @@ osd_get_idx_for_ost_obj(const struct lu_env *env, struct osd_device *osd,
                return PTR_ERR(osd_seq);
        }
 
-       rc = fid_to_ostid(fid, &osd_oti_get(env)->oti_ostid);
-       LASSERT(rc == 0); /* we should not get here with IGIF */
-       b = ostid_id(&osd_oti_get(env)->oti_ostid) % OSD_OST_MAP_SIZE;
+       if (fid_is_last_id(fid)) {
+               id = 0;
+       } else {
+               rc = fid_to_ostid(fid, &osd_oti_get(env)->oti_ostid);
+               LASSERT(rc == 0); /* we should not get here with IGIF */
+               id = ostid_id(&osd_oti_get(env)->oti_ostid);
+       }
+
+       b = id % OSD_OST_MAP_SIZE;
        LASSERT(osd_seq->os_compat_dirs[b]);
 
-       sprintf(buf, LPU64, ostid_id(&osd_oti_get(env)->oti_ostid));
+       sprintf(buf, LPU64, id);
 
        return osd_seq->os_compat_dirs[b];
 }