From 2db39f3d92737847ccdaf9ebd7a030e9426fa8a8 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Thu, 11 May 2017 14:01:07 -0500 Subject: [PATCH] xfs: simplify xfs_calc_dquots_per_chunk Source kernel commit: d956f813b6e731ef82699a18e468e37d59a1366d 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 Signed-off-by: Eric Sandeen --- libxfs/xfs_dquot_buf.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/libxfs/xfs_dquot_buf.c b/libxfs/xfs_dquot_buf.c index aae88548e..a19a20a16 100644 --- a/libxfs/xfs_dquot_buf.c +++ b/libxfs/xfs_dquot_buf.c @@ -29,27 +29,12 @@ #include "xfs_trace.h" #include "xfs_quota_defs.h" -/* - * XXX: kernel implementation causes ndquots calc to go real - * bad. Just leaving the existing userspace calc here right now. - */ int xfs_calc_dquots_per_chunk( unsigned int nbblks) /* basic block units */ { - ASSERT(nbblks > 0); return BBTOB(nbblks) / sizeof(xfs_dqblk_t); - -#if 0 /* kernel code that goes wrong in userspace! */ - unsigned int ndquots; - - ASSERT(nbblks > 0); - ndquots = BBTOB(nbblks); - do_div(ndquots, sizeof(xfs_dqblk_t)); - - return ndquots; -#endif } /* -- 2.47.2