]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: micro optimizattion of apply_for_bitset_range
authorIgor Fedotov <ifedotov@suse.com>
Mon, 18 Nov 2019 09:43:12 +0000 (12:43 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Mon, 18 Nov 2019 10:07:41 +0000 (13:07 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/bluestore/bluestore_common.h

index 764574af59b978c9d85757bbd9eb8f08be2a349c..858cfd88fc5eeeb9eeb508a6d5ed059351c5b0da 100755 (executable)
@@ -24,12 +24,12 @@ void apply_for_bitset_range(uint64_t off,
   uint64_t granularity,
   Bitset &bitset,
   Func f) {
-  auto end = round_up_to(off + len, granularity);
-  while (off < end) {
-    uint64_t pos = off / granularity;
-    ceph_assert(pos < bitset.size());
+  auto end = round_up_to(off + len, granularity) / granularity;
+  ceph_assert(end <= bitset.size());
+  uint64_t pos = off / granularity;
+  while (pos < end) {
     f(pos, bitset);
-    off += granularity;
+    pos++;
   }
 }