X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=lib%2Flfsr.c;h=a4f1fb13b64f7b1087970bba0e9c58afafd002db;hb=3740cfc89440001e393dee1a6abae41ec89bec27;hp=329ef85a8bf7a4e9529838c201482ee0eab78641;hpb=10aa136bddbaa7c845ab4eacb4a9a4a88d6657a3;p=fio.git diff --git a/lib/lfsr.c b/lib/lfsr.c index 329ef85a..a4f1fb13 100644 --- a/lib/lfsr.c +++ b/lib/lfsr.c @@ -1,5 +1,4 @@ #include -#include #include "lfsr.h" #include "../compiler/compiler.h" @@ -11,7 +10,7 @@ * The memory overhead of the following tap table should be relatively small, * no more than 400 bytes. */ -static uint8_t taps[64][FIO_MAX_TAPS] = +static uint8_t lfsr_taps[64][FIO_MAX_TAPS] = { {0}, {0}, {0}, //LFSRs with less that 3-bits cannot exist {3, 2}, //Tap position for 3-bit LFSR @@ -124,7 +123,7 @@ static inline void __lfsr_next(struct fio_lfsr *fl, unsigned int spin) * c. Check if the calculated value exceeds the desirable range. In this case, * go back to b, else return. */ -int lfsr_next(struct fio_lfsr *fl, uint64_t *off, uint64_t last) +int lfsr_next(struct fio_lfsr *fl, uint64_t *off) { if (fl->num_vals++ > fl->max_val) return 1; @@ -158,12 +157,12 @@ static uint8_t *find_lfsr(uint64_t size) /* * For an LFSR, there is always a prohibited state (all ones). - * Thus, if we need to find the proper LFSR for our size, we must take that - * into account. + * Thus, if we need to find the proper LFSR for our size, we must + * take that into account. */ for (i = 3; i < 64; i++) if ((1UL << i) > size) - return taps[i]; + return lfsr_taps[i]; return NULL; } @@ -234,15 +233,15 @@ int lfsr_reset(struct fio_lfsr *fl, unsigned long seed) int lfsr_init(struct fio_lfsr *fl, uint64_t nums, unsigned long seed, unsigned int spin) { - uint8_t *lfsr_taps; + uint8_t *taps; - lfsr_taps = find_lfsr(nums); - if (!lfsr_taps) + taps = find_lfsr(nums); + if (!taps) return 1; fl->max_val = nums - 1; - fl->xormask = lfsr_create_xormask(lfsr_taps); - fl->cached_bit = 1UL << (lfsr_taps[0] - 1); + fl->xormask = lfsr_create_xormask(taps); + fl->cached_bit = 1UL << (taps[0] - 1); if (prepare_spin(fl, spin)) return 1;