xfsprogs: simplify xfs_calc_dquots_per_chunk
diff mbox

Message ID 2112d7f5-60d0-cb07-d186-d95cec3c8975@redhat.com
State Accepted
Headers show

Commit Message

Eric Sandeen April 5, 2017, 9:55 p.m. UTC
The do_div call was commented out because userspace's
do_div is not safe to call with a 32-bit dividend.

Just keep the simple division and remove the other cruft,
we'll change the kernel to match as well; there is no need
for do_div here.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---


--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/libxfs/xfs_dquot_buf.c b/libxfs/xfs_dquot_buf.c
index aae8854..a19a20a 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
 }
 
 /*