xfs: simplify xfs_calc_dquots_per_chunk

ndquots is a 32-bit value, and we don't care
about the remainder; there is no reason to use do_div
here, it seems to be the result of a decade+ historical
accident.

Worse, the do_div implementation in userspace breaks
when fed a 32-bit dividend, so we commented it out there
in any case.

Change to simple division, and then we can change
userspace to match, and mandate a 64-bit dividend in
the do_div() in userspace as well.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
This commit is contained in:
Eric Sandeen 2017-04-06 16:01:47 -07:00 committed by Darrick J. Wong
parent 84358536dc
commit d956f813b6
1 changed files with 1 additions and 6 deletions

View File

@ -35,13 +35,8 @@ int
xfs_calc_dquots_per_chunk(
unsigned int nbblks) /* basic block units */
{
unsigned int ndquots;
ASSERT(nbblks > 0);
ndquots = BBTOB(nbblks);
do_div(ndquots, sizeof(xfs_dqblk_t));
return ndquots;
return BBTOB(nbblks) / sizeof(xfs_dqblk_t);
}
/*