Whamcloud - gitweb
LU-822 osd: use bitmask to calculate seq hash
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_internal.h
index a9450a4..abb5c49 100644 (file)
@@ -402,7 +402,9 @@ osd_fid2oi(struct osd_device *osd, const struct lu_fid *fid)
                 return NULL;
 
         LASSERT(osd->od_oi_table != NULL && osd->od_oi_count >= 1);
-        return &osd->od_oi_table[fid->f_seq % osd->od_oi_count];
+        /* It can work even od_oi_count equals to 1 although it's unexpected,
+         * the only reason we set it to 1 is for performance measurement */
+        return &osd->od_oi_table[fid->f_seq & (osd->od_oi_count - 1)];
 }
 
 #endif /* __KERNEL__ */