summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-07-15 18:39:24 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-07-15 18:39:45 -0400
commitac9ca56637a7ee85f022a06c6f66c3a6c9eda3a3 (patch)
tree7bf3f8624292540e91a6a418a406bd3e7dd6dbc0
parent97b8348d28006c87bf6d60a1e13df8e56fa2585f (diff)
posix_to_bcachefs: plumb verbosity
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r--c_src/cmd_image.c4
-rw-r--r--c_src/posix_to_bcachefs.c6
-rw-r--r--c_src/posix_to_bcachefs.h1
3 files changed, 7 insertions, 4 deletions
diff --git a/c_src/cmd_image.c b/c_src/cmd_image.c
index 0d947da9..d00d85cf 100644
--- a/c_src/cmd_image.c
+++ b/c_src/cmd_image.c
@@ -477,7 +477,7 @@ static void image_create(struct bch_opt_strs fs_opt_strs,
if (ret)
goto err;
- struct copy_fs_state s = {};
+ struct copy_fs_state s = { .verbosity = verbosity };
ret = copy_fs(c, &s, src_fd, src_path) ?:
finish_image(c, keep_alloc, verbosity);
if (ret)
@@ -705,7 +705,7 @@ static int image_update(const char *src_path, const char *dst_image,
goto err_stop;
bch_verbose(c, "Syncing data");
- struct copy_fs_state s = {};
+ struct copy_fs_state s = { .verbosity = verbosity };
ret = copy_fs(c, &s, src_fd, src_path) ?:
finish_image(c, keep_alloc, verbosity);
diff --git a/c_src/posix_to_bcachefs.c b/c_src/posix_to_bcachefs.c
index 084b56cf..0e7d4c29 100644
--- a/c_src/posix_to_bcachefs.c
+++ b/c_src/posix_to_bcachefs.c
@@ -671,6 +671,7 @@ static int recursive_remove(struct bch_fs *c,
}
static int delete_non_matching_dirents(struct bch_fs *c,
+ struct copy_fs_state *s,
subvol_inum dst_dir_inum,
struct bch_inode_unpacked *dst_dir,
dirents src_dirents)
@@ -694,7 +695,8 @@ static int delete_non_matching_dirents(struct bch_fs *c,
!strcmp(dst_d->d_name, "lost+found"))
continue;
- printf("deleting %s type %u\n", dst_d->d_name, dst_d->d_type);
+ if (s->verbosity > 1)
+ printf("deleting %s\n", dst_d->d_name);
ret = recursive_remove(c, dst_dir_inum, dst_dir, dst_d);
if (ret)
@@ -726,7 +728,7 @@ static int copy_dir(struct bch_fs *c,
sort(dirents.data, dirents.nr, sizeof(dirents.data[0]), dirent_cmp, NULL);
subvol_inum dir_inum = { 1, dst->bi_inum };
- int ret = delete_non_matching_dirents(c, dir_inum, dst, dirents);
+ int ret = delete_non_matching_dirents(c, s, dir_inum, dst, dirents);
if (ret)
goto err;
diff --git a/c_src/posix_to_bcachefs.h b/c_src/posix_to_bcachefs.h
index 542ae171..3fc586d8 100644
--- a/c_src/posix_to_bcachefs.h
+++ b/c_src/posix_to_bcachefs.h
@@ -36,6 +36,7 @@ struct copy_fs_state {
GENRADIX(u64) hardlinks;
ranges extents;
enum bch_migrate_type type;
+ unsigned verbosity;
u64 reserve_start;