Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Sep 18, 2018 Library code

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit 0f9f1921197d79fe5069473b9d85ca4559ef8c42:

axmap: isset_fn() should use 1ULL, not 1UL (2018-09-16 21:58:26 -0600)

are available in the git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to ed06087e5f4f5dcb6660d1095005c777bcd661cb:

filesetup: use 64-bit type for file size generation (2018-09-17 13:46:51 -0600)

----------------------------------------------------------------
Jens Axboe (3):
zbd: fix various 32-bit compilation warnings Random distribution 32-bit fixes
filesetup: use 64-bit type for file size generation

 filesetup.c |  6 +++---
 lib/zipf.c  | 12 +++++------
 lib/zipf.h  |  8 ++++----
 zbd.c       | 66 ++++++++++++++++++++++++++++++++++---------------------------
 4 files changed, 50 insertions(+), 42 deletions(-)

---

Diff of recent changes:

filesetup.c +3 -3
index 580403d..c0fa3cd 100644
@@ -331,7 +331,7 @@ unsigned long long get_rand_file_size(struct thread_data *td)
 {
 	unsigned long long ret, sized;
 	uint64_t frand_max;
-	unsigned long r;
+	uint64_t r;
 
 	frand_max = rand_max(&td->file_size_state);
 	r = __rand(&td->file_size_state);
@@ -1192,13 +1192,13 @@ bool pre_read_files(struct thread_data *td)
 static void __init_rand_distribution(struct thread_data *td, struct fio_file *f)
 {
 	unsigned int range_size, seed;
-	unsigned long nranges;
+	uint64_t nranges;
 	uint64_t fsize;
 
 	range_size = min(td->o.min_bs[DDIR_READ], td->o.min_bs[DDIR_WRITE]);
 	fsize = min(f->real_file_size, f->io_size);
 
-	nranges = (fsize + range_size - 1) / range_size;
+	nranges = (fsize + range_size - 1ULL) / range_size;
 
 	seed = jhash(f->file_name, strlen(f->file_name), 0) * td->thread_number;
 	if (!td->o.rand_repeatable)
lib/zipf.c +6 -6
index 1ff8568..321a4fb 100644
@@ -8,7 +8,7 @@
 
 static void zipf_update(struct zipf_state *zs)
 {
-	unsigned long to_gen;
+	uint64_t to_gen;
 	unsigned int i;
 
 	/*
@@ -22,7 +22,7 @@ static void zipf_update(struct zipf_state *zs)
 		zs->zetan += pow(1.0 / (double) (i + 1), zs->theta);
 }
 
-static void shared_rand_init(struct zipf_state *zs, unsigned long nranges,
+static void shared_rand_init(struct zipf_state *zs, uint64_t nranges,
 			     unsigned int seed)
 {
 	memset(zs, 0, sizeof(*zs));
@@ -32,7 +32,7 @@ static void shared_rand_init(struct zipf_state *zs, unsigned long nranges,
 	zs->rand_off = __rand(&zs->rand);
 }
 
-void zipf_init(struct zipf_state *zs, unsigned long nranges, double theta,
+void zipf_init(struct zipf_state *zs, uint64_t nranges, double theta,
 	       unsigned int seed)
 {
 	shared_rand_init(zs, nranges, seed);
@@ -43,7 +43,7 @@ void zipf_init(struct zipf_state *zs, unsigned long nranges, double theta,
 	zipf_update(zs);
 }
 
-unsigned long long zipf_next(struct zipf_state *zs)
+uint64_t zipf_next(struct zipf_state *zs)
 {
 	double alpha, eta, rand_uni, rand_z;
 	unsigned long long n = zs->nranges;
@@ -70,14 +70,14 @@ unsigned long long zipf_next(struct zipf_state *zs)
 	return (val + zs->rand_off) % zs->nranges;
 }
 
-void pareto_init(struct zipf_state *zs, unsigned long nranges, double h,
+void pareto_init(struct zipf_state *zs, uint64_t nranges, double h,
 		 unsigned int seed)
 {
 	shared_rand_init(zs, nranges, seed);
 	zs->pareto_pow = log(h) / log(1.0 - h);
 }
 
-unsigned long long pareto_next(struct zipf_state *zs)
+uint64_t pareto_next(struct zipf_state *zs)
 {
 	double rand = (double) __rand(&zs->rand) / (double) FRAND32_MAX;
 	unsigned long long n;
lib/zipf.h +4 -4
index a4aa163..16b65f5 100644
@@ -16,11 +16,11 @@ struct zipf_state {
 	bool disable_hash;
 };
 
-void zipf_init(struct zipf_state *zs, unsigned long nranges, double theta, unsigned int seed);
-unsigned long long zipf_next(struct zipf_state *zs);
+void zipf_init(struct zipf_state *zs, uint64_t nranges, double theta, unsigned int seed);
+uint64_t zipf_next(struct zipf_state *zs);
 
-void pareto_init(struct zipf_state *zs, unsigned long nranges, double h, unsigned int seed);
-unsigned long long pareto_next(struct zipf_state *zs);
+void pareto_init(struct zipf_state *zs, uint64_t nranges, double h, unsigned int seed);
+uint64_t pareto_next(struct zipf_state *zs);
 void zipf_disable_hash(struct zipf_state *zs);
 
 #endif
zbd.c +37 -29

149 lines not on this page · raw message