summaryrefslogtreecommitdiff
path: root/fs/ext4
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/ext4fs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index 06536ba..80b3b90 100644
--- a/fs/ext4/ext4fs.c
+++ b/fs/ext4/ext4fs.c
@@ -40,6 +40,7 @@
#include <linux/stat.h>
#include <linux/time.h>
#include <asm/byteorder.h>
+#include <div64.h>
#include "ext4_common.h"
int ext4fs_symlinknest;
@@ -1051,8 +1052,8 @@ int ext4fs_write(const char *fname, unsigned char *buffer,
}
/* calucalate how many blocks required */
bytes_reqd_for_file = sizebytes;
- blks_reqd_for_file = bytes_reqd_for_file / fs->blksz;
- if (bytes_reqd_for_file % fs->blksz != 0) {
+ blks_reqd_for_file = lldiv(bytes_reqd_for_file, fs->blksz);
+ if (do_div(bytes_reqd_for_file, fs->blksz) != 0) {
blks_reqd_for_file++;
debug("total bytes for a file %u\n", blks_reqd_for_file);
}