Whamcloud - gitweb
LU-6142 libcfs: discard PO2_ROUNDUP_TYPED, LOWEST_BIT_SET 59/40859/3
authorMr NeilBrown <neilb@suse.de>
Fri, 20 Nov 2020 02:20:23 +0000 (13:20 +1100)
committerOleg Drokin <green@whamcloud.com>
Fri, 26 Feb 2021 22:10:50 +0000 (22:10 +0000)
LOWEST_BIT_SET() is never used.

PO2_ROUNDUP_TYPED() has the same function as 'round_up()'.

osd_roundup2blocksz() can be further simplified using
DIV_ROUND_UP_ULL().

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I075328ec935eef49d3aeaf5ea1b79b943aadfa2e
Reviewed-on: https://review.whamcloud.com/40859
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
libcfs/include/libcfs/libcfs.h
lustre/osd-zfs/osd_io.c

index df7234d..9ef72e4 100644 (file)
@@ -59,9 +59,6 @@
 
 #define LIBCFS_VERSION "0.7.1"
 
-#define PO2_ROUNDUP_TYPED(x, po2, type) (-(-(type)(x) & -(type)(po2)))
-#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
-
 /* Sparse annotations */
 #if !defined(__must_hold)
 # ifdef __CHECKER__
index ab1fc5f..dd26c0a 100644 (file)
@@ -614,11 +614,9 @@ static inline uint64_t osd_roundup2blocksz(uint64_t size,
        size += offset % blksz;
 
        if (likely(is_power_of_2(blksz)))
-               return PO2_ROUNDUP_TYPED(size, blksz, uint64_t);
-
-       size += blksz - 1;
-       do_div(size, blksz);
-       return size * blksz;
+               return round_up(size, blksz);
+       else
+               return DIV_ROUND_UP_ULL(size, blksz) * blksz;
 }
 
 static int osd_declare_write_commit(const struct lu_env *env,