* [PATCH] xfsprogs: simplify xfs_calc_dquots_per_chunk
@ 2017-04-05 21:55 Eric Sandeen
0 siblings, 0 replies; only message in thread
From: Eric Sandeen @ 2017-04-05 21:55 UTC (permalink / raw)
To: linux-xfs
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>
---
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
}
/*
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-04-05 21:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-05 21:55 [PATCH] xfsprogs: simplify xfs_calc_dquots_per_chunk Eric Sandeen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.