projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
HOWTO: general consistency
[fio.git]
/
t
/
dedupe.c
diff --git
a/t/dedupe.c
b/t/dedupe.c
index 7edb3d8886857e000949f066271ef358ab98ce12..c3b837f7b698cdedd027f20be12e085ffe21faa1 100644
(file)
--- a/
t/dedupe.c
+++ b/
t/dedupe.c
@@
-14,17
+14,17
@@
#include <fcntl.h>
#include <string.h>
#include <fcntl.h>
#include <string.h>
-#include "../lib/rbtree.h"
#include "../flist.h"
#include "../log.h"
#include "../mutex.h"
#include "../smalloc.h"
#include "../minmax.h"
#include "../crc/md5.h"
#include "../flist.h"
#include "../log.h"
#include "../mutex.h"
#include "../smalloc.h"
#include "../minmax.h"
#include "../crc/md5.h"
-#include "../memalign.h"
+#include "../
lib/
memalign.h"
#include "../os/os.h"
#include "../gettime.h"
#include "../fio_time.h"
#include "../os/os.h"
#include "../gettime.h"
#include "../fio_time.h"
+#include "../lib/rbtree.h"
#include "../lib/bloom.h"
#include "debug.h"
#include "../lib/bloom.h"
#include "debug.h"
@@
-84,7
+84,7
@@
static uint64_t get_size(struct fio_file *f, struct stat *sb)
uint64_t ret;
if (S_ISBLK(sb->st_mode)) {
uint64_t ret;
if (S_ISBLK(sb->st_mode)) {
- unsigned long long bytes;
+ unsigned long long bytes
= 0
;
if (blockdev_size(f, &bytes)) {
log_err("dedupe: failed getting bdev size\n");
if (blockdev_size(f, &bytes)) {
log_err("dedupe: failed getting bdev size\n");
@@
-294,8
+294,7
@@
static int do_work(struct worker_thread *thread, void *buf)
for (i = 0; i < nblocks; i++) {
void *thisptr = buf + (i * blocksize);
for (i = 0; i < nblocks; i++) {
void *thisptr = buf + (i * blocksize);
- if (items)
- items[i].offset = offset;
+ items[i].offset = offset;
crc_buf(thisptr, items[i].hash);
offset += blocksize;
nitems++;
crc_buf(thisptr, items[i].hash);
offset += blocksize;
nitems++;
@@
-335,7
+334,7
@@
static void *thread_fn(void *data)
static void show_progress(struct worker_thread *threads, unsigned long total)
{
unsigned long last_nitems = 0;
static void show_progress(struct worker_thread *threads, unsigned long total)
{
unsigned long last_nitems = 0;
- struct time
val
last_tv;
+ struct time
spec
last_tv;
fio_gettime(&last_tv, NULL);
fio_gettime(&last_tv, NULL);
@@
-364,7
+363,7
@@
static void show_progress(struct worker_thread *threads, unsigned long total)
tdiff = mtime_since_now(&last_tv);
if (tdiff) {
this_items = (this_items * 1000) / (tdiff * 1024);
tdiff = mtime_since_now(&last_tv);
if (tdiff) {
this_items = (this_items * 1000) / (tdiff * 1024);
- printf("%3.2f%% done (%luKB/sec)\r", perc, this_items);
+ printf("%3.2f%% done (%luK
i
B/sec)\r", perc, this_items);
last_nitems = nitems;
fio_gettime(&last_tv, NULL);
} else
last_nitems = nitems;
fio_gettime(&last_tv, NULL);
} else
@@
-388,10
+387,8
@@
static int run_dedupe_threads(struct fio_file *f, uint64_t dev_size,
threads = malloc(num_threads * sizeof(struct worker_thread));
for (i = 0; i < num_threads; i++) {
threads = malloc(num_threads * sizeof(struct worker_thread));
for (i = 0; i < num_threads; i++) {
+ memset(&threads[i], 0, sizeof(struct worker_thread));
threads[i].fd = f->fd;
threads[i].fd = f->fd;
- threads[i].items = 0;
- threads[i].err = 0;
- threads[i].done = 0;
err = pthread_create(&threads[i].thread, NULL, thread_fn, &threads[i]);
if (err) {
err = pthread_create(&threads[i].thread, NULL, thread_fn, &threads[i]);
if (err) {
@@
-431,7
+428,7
@@
static int dedupe_check(const char *filename, uint64_t *nextents,
flags = O_RDONLY;
if (odirect)
flags = O_RDONLY;
if (odirect)
- flags |= O_DIRECT;
+ flags |= O
S_O
_DIRECT;
memset(&file, 0, sizeof(file));
file.file_name = strdup(filename);
memset(&file, 0, sizeof(file));
file.file_name = strdup(filename);
@@
-540,6
+537,7
@@
int main(int argc, char *argv[])
uint64_t nextents = 0, nchunks = 0;
int c, ret;
uint64_t nextents = 0, nchunks = 0;
int c, ret;
+ arch_init(argv);
debug_init();
while ((c = getopt(argc, argv, "b:t:d:o:c:p:B:")) != -1) {
debug_init();
while ((c = getopt(argc, argv, "b:t:d:o:c:p:B:")) != -1) {