Whamcloud - gitweb
LU-6174 lod: remove incorrect ll_do_div64 01/38101/2
authorJames Simmons <jsimmons@infradead.org>
Mon, 30 Mar 2020 17:06:19 +0000 (13:06 -0400)
committerOleg Drokin <green@whamcloud.com>
Tue, 7 Apr 2020 17:18:27 +0000 (17:18 +0000)
ll_do_div64() is just a wrapper around do_div() which is handled
incorrectly. do_div() expects a 32 bit value but stripe_count is
cast to 64 bits which is incorrect. Instead lets just avoid
casting and use do_div() directly.

Change-Id: I08601fdf8e9d5fdf26981f073dd602775c12281b
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/38101
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/lod/lod_object.c

index d19f91d..e81de8c 100644 (file)
@@ -5235,7 +5235,6 @@ out:
        EXIT;
 }
 
        EXIT;
 }
 
-#define ll_do_div64(aaa,bbb)    do_div((aaa), (bbb))
 /**
  * Size initialization on late striping.
  *
 /**
  * Size initialization on late striping.
  *
@@ -5299,14 +5298,13 @@ static int lod_declare_init_size(const struct lu_env *env,
                                continue;
 
                        LASSERT(objects != NULL && stripe_size != 0);
                                continue;
 
                        LASSERT(objects != NULL && stripe_size != 0);
-                       /* ll_do_div64(a, b) returns a % b, and a = a / b */
-                       ll_do_div64(size, (__u64)stripe_size);
-                       stripe = ll_do_div64(size, (__u64)stripe_count);
+                       do_div(size, stripe_size);
+                       stripe = do_div(size, stripe_count);
                        LASSERT(objects[stripe] != NULL);
 
                        size = size * stripe_size;
                        offs = attr->la_size;
                        LASSERT(objects[stripe] != NULL);
 
                        size = size * stripe_size;
                        offs = attr->la_size;
-                       size += ll_do_div64(offs, stripe_size);
+                       size += do_div(offs, stripe_size);
 
                        attr->la_valid = LA_SIZE;
                        attr->la_size = size;
 
                        attr->la_valid = LA_SIZE;
                        attr->la_size = size;