jfs: Fix do_div precision in commit b40c2e66
In a hasty fix to replace a 64-bit division with do_div, I unintentionally assigned the divisor to a 32-bit variable. Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com> Cc: Tino Reichardt <milky-kernel@mcmilk.de>
This commit is contained in:
parent
550d6da288
commit
84f4141ee3
@ -1641,14 +1641,15 @@ s64 dbDiscardAG(struct inode *ip, int agno, s64 minlen)
|
|||||||
|
|
||||||
/* max blkno / nblocks pairs to trim */
|
/* max blkno / nblocks pairs to trim */
|
||||||
int count = 0, range_cnt;
|
int count = 0, range_cnt;
|
||||||
|
u64 max_ranges;
|
||||||
|
|
||||||
/* prevent others from writing new stuff here, while trimming */
|
/* prevent others from writing new stuff here, while trimming */
|
||||||
IWRITE_LOCK(ipbmap, RDWRLOCK_DMAP);
|
IWRITE_LOCK(ipbmap, RDWRLOCK_DMAP);
|
||||||
|
|
||||||
nblocks = bmp->db_agfree[agno];
|
nblocks = bmp->db_agfree[agno];
|
||||||
range_cnt = nblocks;
|
max_ranges = nblocks;
|
||||||
do_div(range_cnt, (int)minlen);
|
do_div(max_ranges, minlen);
|
||||||
range_cnt = min(range_cnt + 1, 32 * 1024);
|
range_cnt = min_t(u64, max_ranges + 1, 32 * 1024);
|
||||||
totrim = kmalloc(sizeof(struct range2trim) * range_cnt, GFP_NOFS);
|
totrim = kmalloc(sizeof(struct range2trim) * range_cnt, GFP_NOFS);
|
||||||
if (totrim == NULL) {
|
if (totrim == NULL) {
|
||||||
jfs_error(bmp->db_ipbmap->i_sb,
|
jfs_error(bmp->db_ipbmap->i_sb,
|
||||||
|
Loading…
Reference in New Issue
Block a user