]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
intarith: get rid of ROUND_UP* macros 21085/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Wed, 28 Mar 2018 06:19:49 +0000 (14:19 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Wed, 28 Mar 2018 06:53:10 +0000 (14:53 +0800)
Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/include/intarith.h
src/os/bluestore/BlueStore.h

index e08cbc0e4f26cc4dea1156e428dae10cc655bf81..242056e216f2e08a2183851ea41cc12205ed596e 100644 (file)
 
 #include <type_traits>
 
-#ifndef DIV_ROUND_UP
-#define DIV_ROUND_UP(n, d)  (((n) + (d) - 1) / (d))
-#endif
-
 template<typename T, typename U>
 constexpr inline std::make_unsigned_t<std::common_type_t<T, U>> div_round_up(T n, U d) {
   return (n + d - 1) / d;
 }
 
 
-#ifndef ROUND_UP_TO
-#define ROUND_UP_TO(n, d) ((n)%(d) ? ((n)+(d)-(n)%(d)) : (n))
-#endif
-
 template<typename T, typename U>
 constexpr inline std::make_unsigned_t<std::common_type_t<T, U>> round_up_to(T n, U d) {
   return (n % d ? (n + d - n % d) : n);
 }
 
-#ifndef SHIFT_ROUND_UP
-#define SHIFT_ROUND_UP(x,y) (((x)+(1<<(y))-1) >> (y))
-#endif
-
 template<typename T, typename U>
 constexpr inline std::make_unsigned_t<std::common_type_t<T, U>> shift_round_up(T x, U y) {
   return (x + (1 << y) - 1) >> y;
index da993a8a908e2900d0ff4ff8ebae63c309876d20..d31d8220b12b0c6d710e01fcd915209d1afc3226 100644 (file)
@@ -2707,13 +2707,13 @@ public:
       assert(min_alloc_size && isp2(min_alloc_size));
       assert(mem_cap);
       
-      total = ROUND_UP_TO(total, min_alloc_size);
+      total = round_up_to(total, min_alloc_size);
       granularity = total * BLOOM_FILTER_TABLE_SIZE * 2 / mem_cap;
 
       if (!granularity) {
        granularity = min_alloc_size;
       } else {
-       granularity = ROUND_UP_TO(granularity, min_alloc_size);
+       granularity = round_up_to(granularity, min_alloc_size);
       }
 
       uint64_t entries = p2roundup(total, granularity) / granularity;