aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/sb.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-12-18 07:06:51 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-12-23 05:23:40 -0500
commit4d61db4f87b527734ac0cc830dda8fcc4e2add2f (patch)
tree881cb7614a928ba004f588a82c064592f461fee3 /fs/ubifs/sb.c
parentaf14a1ad792621942a03e4bd0e5f17b6e177e2e0 (diff)
UBIFS: use nicer 64-bit math
Instead of using do_div(), use better primitives from linux/math64.h. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/sb.c')
-rw-r--r--fs/ubifs/sb.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index c5da201ab54f..e070c643d1bb 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -28,6 +28,7 @@
28 28
29#include "ubifs.h" 29#include "ubifs.h"
30#include <linux/random.h> 30#include <linux/random.h>
31#include <linux/math64.h>
31 32
32/* 33/*
33 * Default journal size in logical eraseblocks as a percent of total 34 * Default journal size in logical eraseblocks as a percent of total
@@ -80,7 +81,7 @@ static int create_default_filesystem(struct ubifs_info *c)
80 int err, tmp, jnl_lebs, log_lebs, max_buds, main_lebs, main_first; 81 int err, tmp, jnl_lebs, log_lebs, max_buds, main_lebs, main_first;
81 int lpt_lebs, lpt_first, orph_lebs, big_lpt, ino_waste, sup_flags = 0; 82 int lpt_lebs, lpt_first, orph_lebs, big_lpt, ino_waste, sup_flags = 0;
82 int min_leb_cnt = UBIFS_MIN_LEB_CNT; 83 int min_leb_cnt = UBIFS_MIN_LEB_CNT;
83 uint64_t tmp64, main_bytes; 84 long long tmp64, main_bytes;
84 __le64 tmp_le64; 85 __le64 tmp_le64;
85 86
86 /* Some functions called from here depend on the @c->key_len filed */ 87 /* Some functions called from here depend on the @c->key_len filed */
@@ -160,7 +161,7 @@ static int create_default_filesystem(struct ubifs_info *c)
160 if (!sup) 161 if (!sup)
161 return -ENOMEM; 162 return -ENOMEM;
162 163
163 tmp64 = (uint64_t)max_buds * c->leb_size; 164 tmp64 = (long long)max_buds * c->leb_size;
164 if (big_lpt) 165 if (big_lpt)
165 sup_flags |= UBIFS_FLG_BIGLPT; 166 sup_flags |= UBIFS_FLG_BIGLPT;
166 167
@@ -187,9 +188,8 @@ static int create_default_filesystem(struct ubifs_info *c)
187 188
188 generate_random_uuid(sup->uuid); 189 generate_random_uuid(sup->uuid);
189 190
190 main_bytes = (uint64_t)main_lebs * c->leb_size; 191 main_bytes = (long long)main_lebs * c->leb_size;
191 tmp64 = main_bytes * DEFAULT_RP_PERCENT; 192 tmp64 = div_u64(main_bytes * DEFAULT_RP_PERCENT, 100);
192 do_div(tmp64, 100);
193 if (tmp64 > DEFAULT_MAX_RP_SIZE) 193 if (tmp64 > DEFAULT_MAX_RP_SIZE)
194 tmp64 = DEFAULT_MAX_RP_SIZE; 194 tmp64 = DEFAULT_MAX_RP_SIZE;
195 sup->rp_size = cpu_to_le64(tmp64); 195 sup->rp_size = cpu_to_le64(tmp64);