Skip to content

Commit 176750b

Browse files
toddpoynorBrian Maly
authored and
Brian Maly
committed
ext4: fixup 64-bit divides in 3.0-stable backport of upstream fix
Orabug: 17488415 Replace C division operators with div64_u64 for divides introduced in: commit 503f4bdcc078e7abee273a85ce322de81b18a224 ext4: use atomic64_t for the per-flexbg free_clusters count Specific to the 3.0-stable backport of the upstream patch. Signed-off-by: Todd Poynor <[email protected]> Reviewed-by: "Theodore Ts'o" <[email protected]> Cc: Christoph Biedl <[email protected]> Cc: Lukas Czerner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit a58e3e13f5f8c03a88195c45771b2ef3a7a53f75) Signed-off-by: Todd Vierling <[email protected]> Acked-by: John Haxby <[email protected]> Signed-off-by: Brian Maly <[email protected]>
1 parent fa86ac6 commit 176750b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

fs/ext4/ialloc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/random.h>
2323
#include <linux/bitops.h>
2424
#include <linux/blkdev.h>
25+
#include <linux/math64.h>
2526
#include <asm/byteorder.h>
2627

2728
#include "ext4.h"
@@ -356,7 +357,7 @@ static int find_group_flex(struct super_block *sb, struct inode *parent,
356357

357358
find_close_to_parent:
358359
flexbg_free_blocks = atomic64_read(&flex_group[best_flex].free_blocks);
359-
flex_freeb_ratio = flexbg_free_blocks * 100 / blocks_per_flex;
360+
flex_freeb_ratio = div64_u64(flexbg_free_blocks * 100, blocks_per_flex);
360361
if (atomic_read(&flex_group[best_flex].free_inodes) &&
361362
flex_freeb_ratio > free_block_ratio)
362363
goto found_flexbg;
@@ -371,7 +372,7 @@ static int find_group_flex(struct super_block *sb, struct inode *parent,
371372
continue;
372373

373374
flexbg_free_blocks = atomic64_read(&flex_group[i].free_blocks);
374-
flex_freeb_ratio = flexbg_free_blocks * 100 / blocks_per_flex;
375+
flex_freeb_ratio = div64_u64(flexbg_free_blocks * 100, blocks_per_flex);
375376

376377
if (flex_freeb_ratio > free_block_ratio &&
377378
(atomic_read(&flex_group[i].free_inodes))) {

0 commit comments

Comments
 (0)