From 6c3f0cfb4a8e372e8c3ae612c6eee7b7715fbeb7 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Fri, 20 Nov 2020 13:20:23 +1100 Subject: [PATCH] LU-6142 libcfs: discard PO2_ROUNDUP_TYPED, LOWEST_BIT_SET 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 Change-Id: I075328ec935eef49d3aeaf5ea1b79b943aadfa2e Reviewed-on: https://review.whamcloud.com/40859 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger Reviewed-by: James Simmons --- libcfs/include/libcfs/libcfs.h | 3 --- lustre/osd-zfs/osd_io.c | 8 +++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/libcfs/include/libcfs/libcfs.h b/libcfs/include/libcfs/libcfs.h index df7234d..9ef72e4 100644 --- a/libcfs/include/libcfs/libcfs.h +++ b/libcfs/include/libcfs/libcfs.h @@ -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__ diff --git a/lustre/osd-zfs/osd_io.c b/lustre/osd-zfs/osd_io.c index ab1fc5f..dd26c0a 100644 --- a/lustre/osd-zfs/osd_io.c +++ b/lustre/osd-zfs/osd_io.c @@ -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, -- 1.8.3.1