#include <fcntl.h>
#include <unistd.h>
#include <getopt.h>
+#include <pthread.h>
#include <stdbool.h>
#include "ctree.h"
task_period_start(priv->info, 1000 /* 1s */);
while (1) {
count++;
+ pthread_mutex_lock(&priv->mutex);
printf("copy inodes [%c] [%10llu/%10llu]\r",
work_indicator[count % 4],
(unsigned long long)priv->cur_copy_inodes,
(unsigned long long)priv->max_copy_inodes);
+ pthread_mutex_unlock(&priv->mutex);
fflush(stdout);
task_period_wait(priv->info);
}
}
printf("creating btrfs metadata");
+ ret = pthread_mutex_init(&ctx.mutex, NULL);
+ if (ret) {
+ error("failed to initialize mutex: %d", ret);
+ goto fail;
+ }
ctx.max_copy_inodes = (cctx.inodes_count - cctx.free_inodes_count);
ctx.cur_copy_inodes = 0;
#include "kerncompat.h"
#include <linux/limits.h>
+#include <pthread.h>
#include "disk-io.h"
#include "transaction.h"
#include "utils.h"
ret = ext2_copy_single_inode(trans, root,
objectid, ext2_fs, ext2_ino,
&ext2_inode, convert_flags);
+ pthread_mutex_lock(&p->mutex);
p->cur_copy_inodes++;
+ pthread_mutex_unlock(&p->mutex);
if (ret)
return ret;
if (trans->blocks_used >= 4096) {