Whamcloud - gitweb
LU-827 lov: Implement a per file data_version.
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_internal.h
index a9450a4..ca6749b 100644 (file)
@@ -28,9 +28,8 @@
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
- */
-/*
- * Copyright (c) 2011 Whamcloud, Inc.
+ *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -402,7 +401,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__ */