Whamcloud - gitweb
LU-5047 tests: correct cleanup files in sanity.sh
[fs/lustre-release.git] / lustre / osd-zfs / osd_oi.c
index 7c1731a..4acbd0d 100644 (file)
@@ -249,15 +249,15 @@ int fid_is_on_ost(const struct lu_env *env, struct osd_device *osd,
 
        rc = osd_fld_lookup(env, osd, fid_seq(fid), range);
        if (rc != 0) {
-               CERROR("%s: "DFID" lookup failed: rc = %d\n", osd_name(osd),
-                      PFID(fid), rc);
-               RETURN(rc);
+               if (rc != -ENOENT)
+                       CERROR("%s: "DFID" lookup failed: rc = %d\n",
+                              osd_name(osd), PFID(fid), rc);
+               RETURN(0);
        }
 
        if (fld_range_is_ost(range))
                RETURN(1);
 
-
        RETURN(0);
 }
 
@@ -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];
 }