From: James Simmons Date: Fri, 13 Mar 2020 13:54:31 +0000 (-0400) Subject: LU-6174 osd-ldiskfs: perform proper division X-Git-Tag: 2.13.53~71 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=ed2c88b78c88b13f9cbcb3430909350915363ae5;p=fs%2Flustre-release.git LU-6174 osd-ldiskfs: perform proper division The used value calculated for osd_inode_iteration() and sf_items_updated_prior are both 64 bit values. The code wrongly using do_div() which could truncate sf_items_updated_prior to a 32 bit value. Use div64_u64() instead. Change-Id: I3d76e399e6cf50460d98b1174de83263d9c2d3cc Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/36750 Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Wang Shilong Reviewed-by: Shaun Tancheff --- diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index bd46b9e..c240aa1 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -1079,7 +1079,7 @@ static int osd_inode_iteration(struct osd_thread_info *info, if (rc == 0) { __u64 used = ksfs->f_files - ksfs->f_ffree; - do_div(used, sf->sf_items_updated_prior); + used = div64_u64(used, sf->sf_items_updated_prior); /* If we hit too much inconsistent OI * mappings during the partial scan, * then scan the device completely. */