#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
+#ifdef HAVE_LIBPTHREAD
#include <pthread.h>
+#endif
/*
* Usage: rw_seq_cst_vs_drop_caches [-m] /mnt/lustre/file0 /mnt/lustre2/file0
* contending with constant reads
*/
static uint64_t u, u_max = UINT64_MAX / 2;
-static uint64_t v[2];
char *ptr;
+#ifdef HAVE_LIBPTHREAD
+static uint64_t v[2];
+
static void *access_thread_start(void *unused)
{
char *ptr2 = NULL;
munmap(ptr2, sizeof(v[i]));
abort();
}
+#endif
static char stderr_buf[4096];
int main(int argc, char *argv[])
{
int drop_caches_fd = -1;
- pthread_t access_thread;
+ pthread_t access_thread __attribute__ ((unused));
struct stat st[2];
ssize_t rc;
int i, ch;
handle_error("pwrite");
}
+#ifdef HAVE_LIBPTHREAD
rc = pthread_create(&access_thread, NULL, &access_thread_start, NULL);
if (rc != 0)
handle_error("pthread_create");
+#endif
for (u = 1; u <= u_max; u++) {
if (mmap_mode) {
handle_error("drop caches");
}
+#ifdef HAVE_LIBPTHREAD
rc = pthread_cancel(access_thread);
if (rc != 0)
handle_error("pthread_cancel");
rc = pthread_join(access_thread, NULL);
if (rc != 0)
handle_error("pthread_join");
+#endif
if (mmap_mode)
munmap(ptr, sizeof(u));
*
* Author: Rajeev Mishra <rajeevm@hpe.com>
*/
- #include <errno.h>
- #include <stdio.h>
- #include <stdarg.h>
- #include <ctype.h>
- #include "lctl_thread.h"
- #include <stdlib.h>
- #include <libcfs/util/string.h>
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <ctype.h>
+#include "lctl_thread.h"
+#include <stdlib.h>
+#include <libcfs/util/string.h>
+
#if HAVE_LIBPTHREAD
/**
* Initialize the given set_param work queue.
free(sp_threads);
return rc;
}
-#else
-#define popt_is_parallel(popt) 0
-#define spwq_init(wq, popt) 0
-#define spwq_expand(wq, num_items) 0
-#define spwq_add_item(wq, path, param_name, value) 0
-#define sp_run_threads(wq) 0
-#define spwq_destroy(wq) 0
-struct sp_workq { int unused; }
+
#endif /* HAVE_LIBPTHREAD */
unsigned int po_header:1;
unsigned int po_parallel_threads;
};
-#define popt_is_parallel(popt) ((popt).po_parallel_threads > 0)
#ifdef HAVE_LIBPTHREAD
+#define popt_is_parallel(popt) ((popt).po_parallel_threads > 0)
+
int write_param(const char *path, const char *param_name,
struct param_opts *popt, const char *value);
int spwq_add_item(struct sp_workq *wq, char *path, char *param_name,
char *value);
int sp_run_threads(struct sp_workq *wq);
+#else
+#define popt_is_parallel(popt) 0
+
+struct sp_workq { int unused; };
+
+static inline int spwq_init(struct sp_workq *wq, struct param_opts *popt)
+{ return 0; }
+static inline int spwq_destroy(struct sp_workq *wq)
+{ return 0; }
+static inline int spwq_expand(struct sp_workq *wq, size_t num_items)
+{ return 0; }
+static inline int spwq_add_item(struct sp_workq *wq, char *path,
+ char *param_name, char *value)
+{ return 0; }
+static inline int sp_run_threads(struct sp_workq *wq)
+{ return 0; }
+
#endif
struct obd_ioctl_data data;
struct timeval start, next_time;
char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf;
- __u64 count, next_count, len, stride, thr_offset = 0, objid = 3;
+ __u64 count, next_count, len, thr_offset = 0, objid = 3;
int write = 0, verbose = 1, cmd, i, rc = 0, pages = 1;
int offset_pages = 0;
long n;
int repeat_offset = 0;
unsigned long long ull;
- int nthr_per_obj = 0;
int verify = 1;
- int obj_idx = 0;
char *end;
+ __u64 stride __attribute__ ((unused));
+ int nthr_per_obj __attribute__ ((unused)) = 0;
+ int obj_idx __attribute__ ((unused)) = 0;
+
if (argc < 2 || argc > 7) {
fprintf(stderr, "error: %s: bad number of arguments: %d\n",