#define write_barrier() __asm__ __volatile__ ("sync" : : : "memory")
+#ifdef __powerpc64__
+#define PPC_CNTLZL "cntlzd"
+#else
+#define PPC_CNTLZL "cntlzw"
+#endif
+
static inline int __ilog2(unsigned long bitmask)
{
int lz;
- asm ("cntlzw %0,%1" : "=r" (lz) : "r" (bitmask));
- return 31 - lz;
+ asm (PPC_CNTLZL " %0,%1" : "=r" (lz) : "r" (bitmask));
+ return BITS_PER_LONG - 1 - lz;
}
static inline int arch_ffz(unsigned long bitmask)
{
if ((bitmask = ~bitmask) == 0)
- return 32;
+ return BITS_PER_LONG;
return __ilog2(bitmask & -bitmask);
}
}
if (!in_ramp_time(td) && td->o.latency_target)
lat_target_check(td);
-
+
if (td->o.thinktime) {
unsigned long long b;
free(client);
}
+static int fio_client_dec_jobs_eta(struct client_eta *eta, client_eta_op eta_fn)
+{
+ if (!--eta->pending) {
+ eta_fn(&eta->eta);
+ free(eta);
+ return 0;
+ }
+
+ return 1;
+}
+
static void remove_client(struct fio_client *client)
{
assert(client->refs);
strcpy((char *) dst->run_str, (char *) je->run_str);
}
-void fio_client_dec_jobs_eta(struct client_eta *eta, client_eta_op eta_fn)
-{
- if (!--eta->pending) {
- eta_fn(&eta->eta);
- free(eta);
- }
-}
-
static void remove_reply_cmd(struct fio_client *client, struct fio_net_cmd *cmd)
{
struct fio_net_cmd_reply *reply = NULL;
(uintptr_t) eta, &client->cmd_list);
}
- while (skipped--)
- fio_client_dec_jobs_eta(eta, ops->eta);
+ while (skipped--) {
+ if (!fio_client_dec_jobs_eta(eta, ops->eta))
+ break;
+ }
dprint(FD_NET, "client: requested eta tag %p\n", eta);
}
};
extern int fio_handle_client(struct fio_client *);
-extern void fio_client_dec_jobs_eta(struct client_eta *eta, client_eta_op fn);
extern void fio_client_sum_jobs_eta(struct jobs_eta *dst, struct jobs_eta *je);
enum {
# Check whether we have MTD
mtd="no"
cat > $TMPC << EOF
+#include <string.h>
#include <mtd/mtd-user.h>
#include <sys/ioctl.h>
int main(int argc, char **argv)
{
+ struct mtd_write_req ops;
struct mtd_info_user info;
+ memset(&ops, 0, sizeof(ops));
info.type = MTD_MLCNANDFLASH;
return ioctl(0, MEMGETINFO, &info);
}
if (!thread_number)
return NULL;
- *size = sizeof(*je) + THREAD_RUNSTR_SZ;
+ *size = sizeof(*je) + THREAD_RUNSTR_SZ + 1;
je = malloc(*size);
if (!je)
return NULL;
return 1;
}
+/*
+ * Check if the number of blocks exceeds the randomness capability of
+ * the selected generator. Tausworthe is 32-bit, the others are fullly
+ * 64-bit capable.
+ */
+static int check_rand_gen_limits(struct thread_data *td, struct fio_file *f,
+ uint64_t blocks)
+{
+ if (blocks <= FRAND32_MAX)
+ return 0;
+ if (td->o.random_generator != FIO_RAND_GEN_TAUSWORTHE)
+ return 0;
+
+ /*
+ * If the user hasn't specified a random generator, switch
+ * to tausworthe64 with informational warning. If the user did
+ * specify one, just warn.
+ */
+ log_info("fio: file %s exceeds 32-bit tausworthe random generator.\n",
+ f->file_name);
+
+ if (!fio_option_is_set(&td->o, random_generator)) {
+ log_info("fio: Switching to tausworthe64. Use the "
+ "random_generator= option to get rid of this "
+ " warning.\n");
+ td->o.random_generator = FIO_RAND_GEN_TAUSWORTHE64;
+ return 0;
+ }
+
+ /*
+ * Just make this information to avoid breaking scripts.
+ */
+ log_info("fio: Use the random_generator= option to switch to lfsr or "
+ "tausworthe64.\n");
+ return 0;
+}
+
int init_random_map(struct thread_data *td)
{
unsigned long long blocks;
blocks = fsize / (unsigned long long) td->o.rw_min_bs;
- if (blocks > FRAND32_MAX &&
- td->o.random_generator == FIO_RAND_GEN_TAUSWORTHE &&
- !fio_option_is_set(&td->o, random_generator)) {
- log_err("fio: file %s exceeds 32-bit tausworthe "
- "random generator. Use lfsr or "
- "tausworthe64.\n", f->file_name);
- td_verror(td, EINVAL, "init file random");
+ if (check_rand_gen_limits(td, f, blocks))
return 1;
- }
if (td->o.random_generator == FIO_RAND_GEN_LFSR) {
unsigned long seed;
qsort(entries, tentries, sizeof(struct clock_entry), clock_cmp);
+ /* silence silly gcc */
+ prev = NULL;
for (failed = i = 0; i < tentries; i++) {
this = &entries[i];