Commit 04ab956e authored by Jeff Mahoney's avatar Jeff Mahoney Committed by David Sterba

btrfs: convert send's verbose_printk to btrfs_debug

This was basically an open-coded, less flexible dynamic printk.  We can
just use btrfs_debug instead.
Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent ab8d0fc4
...@@ -36,10 +36,6 @@ ...@@ -36,10 +36,6 @@
#include "transaction.h" #include "transaction.h"
#include "compression.h" #include "compression.h"
static int g_verbose = 0;
#define verbose_printk(...) if (g_verbose) printk(__VA_ARGS__)
/* /*
* A fs_path is a helper to dynamically build path names with unknown size. * A fs_path is a helper to dynamically build path names with unknown size.
* It reallocates the internal buffer on demand. * It reallocates the internal buffer on demand.
...@@ -727,9 +723,10 @@ static int send_cmd(struct send_ctx *sctx) ...@@ -727,9 +723,10 @@ static int send_cmd(struct send_ctx *sctx)
static int send_rename(struct send_ctx *sctx, static int send_rename(struct send_ctx *sctx,
struct fs_path *from, struct fs_path *to) struct fs_path *from, struct fs_path *to)
{ {
struct btrfs_fs_info *fs_info = sctx->send_root->fs_info;
int ret; int ret;
verbose_printk("btrfs: send_rename %s -> %s\n", from->start, to->start); btrfs_debug(fs_info, "send_rename %s -> %s", from->start, to->start);
ret = begin_cmd(sctx, BTRFS_SEND_C_RENAME); ret = begin_cmd(sctx, BTRFS_SEND_C_RENAME);
if (ret < 0) if (ret < 0)
...@@ -751,9 +748,10 @@ verbose_printk("btrfs: send_rename %s -> %s\n", from->start, to->start); ...@@ -751,9 +748,10 @@ verbose_printk("btrfs: send_rename %s -> %s\n", from->start, to->start);
static int send_link(struct send_ctx *sctx, static int send_link(struct send_ctx *sctx,
struct fs_path *path, struct fs_path *lnk) struct fs_path *path, struct fs_path *lnk)
{ {
struct btrfs_fs_info *fs_info = sctx->send_root->fs_info;
int ret; int ret;
verbose_printk("btrfs: send_link %s -> %s\n", path->start, lnk->start); btrfs_debug(fs_info, "send_link %s -> %s", path->start, lnk->start);
ret = begin_cmd(sctx, BTRFS_SEND_C_LINK); ret = begin_cmd(sctx, BTRFS_SEND_C_LINK);
if (ret < 0) if (ret < 0)
...@@ -774,9 +772,10 @@ verbose_printk("btrfs: send_link %s -> %s\n", path->start, lnk->start); ...@@ -774,9 +772,10 @@ verbose_printk("btrfs: send_link %s -> %s\n", path->start, lnk->start);
*/ */
static int send_unlink(struct send_ctx *sctx, struct fs_path *path) static int send_unlink(struct send_ctx *sctx, struct fs_path *path)
{ {
struct btrfs_fs_info *fs_info = sctx->send_root->fs_info;
int ret; int ret;
verbose_printk("btrfs: send_unlink %s\n", path->start); btrfs_debug(fs_info, "send_unlink %s", path->start);
ret = begin_cmd(sctx, BTRFS_SEND_C_UNLINK); ret = begin_cmd(sctx, BTRFS_SEND_C_UNLINK);
if (ret < 0) if (ret < 0)
...@@ -796,9 +795,10 @@ verbose_printk("btrfs: send_unlink %s\n", path->start); ...@@ -796,9 +795,10 @@ verbose_printk("btrfs: send_unlink %s\n", path->start);
*/ */
static int send_rmdir(struct send_ctx *sctx, struct fs_path *path) static int send_rmdir(struct send_ctx *sctx, struct fs_path *path)
{ {
struct btrfs_fs_info *fs_info = sctx->send_root->fs_info;
int ret; int ret;
verbose_printk("btrfs: send_rmdir %s\n", path->start); btrfs_debug(fs_info, "send_rmdir %s", path->start);
ret = begin_cmd(sctx, BTRFS_SEND_C_RMDIR); ret = begin_cmd(sctx, BTRFS_SEND_C_RMDIR);
if (ret < 0) if (ret < 0)
...@@ -1313,6 +1313,7 @@ static int find_extent_clone(struct send_ctx *sctx, ...@@ -1313,6 +1313,7 @@ static int find_extent_clone(struct send_ctx *sctx,
u64 ino_size, u64 ino_size,
struct clone_root **found) struct clone_root **found)
{ {
struct btrfs_fs_info *fs_info = sctx->send_root->fs_info;
int ret; int ret;
int extent_type; int extent_type;
u64 logical; u64 logical;
...@@ -1371,10 +1372,10 @@ static int find_extent_clone(struct send_ctx *sctx, ...@@ -1371,10 +1372,10 @@ static int find_extent_clone(struct send_ctx *sctx,
} }
logical = disk_byte + btrfs_file_extent_offset(eb, fi); logical = disk_byte + btrfs_file_extent_offset(eb, fi);
down_read(&sctx->send_root->fs_info->commit_root_sem); down_read(&fs_info->commit_root_sem);
ret = extent_from_logical(sctx->send_root->fs_info, disk_byte, tmp_path, ret = extent_from_logical(fs_info, disk_byte, tmp_path,
&found_key, &flags); &found_key, &flags);
up_read(&sctx->send_root->fs_info->commit_root_sem); up_read(&fs_info->commit_root_sem);
btrfs_release_path(tmp_path); btrfs_release_path(tmp_path);
if (ret < 0) if (ret < 0)
...@@ -1429,7 +1430,7 @@ static int find_extent_clone(struct send_ctx *sctx, ...@@ -1429,7 +1430,7 @@ static int find_extent_clone(struct send_ctx *sctx,
extent_item_pos = logical - found_key.objectid; extent_item_pos = logical - found_key.objectid;
else else
extent_item_pos = 0; extent_item_pos = 0;
ret = iterate_extent_inodes(sctx->send_root->fs_info, ret = iterate_extent_inodes(fs_info,
found_key.objectid, extent_item_pos, 1, found_key.objectid, extent_item_pos, 1,
__iterate_backrefs, backref_ctx); __iterate_backrefs, backref_ctx);
...@@ -1439,17 +1440,18 @@ static int find_extent_clone(struct send_ctx *sctx, ...@@ -1439,17 +1440,18 @@ static int find_extent_clone(struct send_ctx *sctx,
if (!backref_ctx->found_itself) { if (!backref_ctx->found_itself) {
/* found a bug in backref code? */ /* found a bug in backref code? */
ret = -EIO; ret = -EIO;
btrfs_err(sctx->send_root->fs_info, btrfs_err(fs_info,
"did not find backref in send_root. inode=%llu, offset=%llu, disk_byte=%llu found extent=%llu", "did not find backref in send_root. inode=%llu, offset=%llu, disk_byte=%llu found extent=%llu",
ino, data_offset, disk_byte, found_key.objectid); ino, data_offset, disk_byte, found_key.objectid);
goto out; goto out;
} }
verbose_printk(KERN_DEBUG "btrfs: find_extent_clone: data_offset=%llu, ino=%llu, num_bytes=%llu, logical=%llu\n", btrfs_debug(fs_info,
"find_extent_clone: data_offset=%llu, ino=%llu, num_bytes=%llu, logical=%llu",
data_offset, ino, num_bytes, logical); data_offset, ino, num_bytes, logical);
if (!backref_ctx->found) if (!backref_ctx->found)
verbose_printk("btrfs: no clones found\n"); btrfs_debug(fs_info, "no clones found");
cur_clone_root = NULL; cur_clone_root = NULL;
for (i = 0; i < sctx->clone_roots_cnt; i++) { for (i = 0; i < sctx->clone_roots_cnt; i++) {
...@@ -2420,10 +2422,11 @@ static int send_subvol_begin(struct send_ctx *sctx) ...@@ -2420,10 +2422,11 @@ static int send_subvol_begin(struct send_ctx *sctx)
static int send_truncate(struct send_ctx *sctx, u64 ino, u64 gen, u64 size) static int send_truncate(struct send_ctx *sctx, u64 ino, u64 gen, u64 size)
{ {
struct btrfs_fs_info *fs_info = sctx->send_root->fs_info;
int ret = 0; int ret = 0;
struct fs_path *p; struct fs_path *p;
verbose_printk("btrfs: send_truncate %llu size=%llu\n", ino, size); btrfs_debug(fs_info, "send_truncate %llu size=%llu", ino, size);
p = fs_path_alloc(); p = fs_path_alloc();
if (!p) if (!p)
...@@ -2449,10 +2452,11 @@ verbose_printk("btrfs: send_truncate %llu size=%llu\n", ino, size); ...@@ -2449,10 +2452,11 @@ verbose_printk("btrfs: send_truncate %llu size=%llu\n", ino, size);
static int send_chmod(struct send_ctx *sctx, u64 ino, u64 gen, u64 mode) static int send_chmod(struct send_ctx *sctx, u64 ino, u64 gen, u64 mode)
{ {
struct btrfs_fs_info *fs_info = sctx->send_root->fs_info;
int ret = 0; int ret = 0;
struct fs_path *p; struct fs_path *p;
verbose_printk("btrfs: send_chmod %llu mode=%llu\n", ino, mode); btrfs_debug(fs_info, "send_chmod %llu mode=%llu", ino, mode);
p = fs_path_alloc(); p = fs_path_alloc();
if (!p) if (!p)
...@@ -2478,10 +2482,12 @@ verbose_printk("btrfs: send_chmod %llu mode=%llu\n", ino, mode); ...@@ -2478,10 +2482,12 @@ verbose_printk("btrfs: send_chmod %llu mode=%llu\n", ino, mode);
static int send_chown(struct send_ctx *sctx, u64 ino, u64 gen, u64 uid, u64 gid) static int send_chown(struct send_ctx *sctx, u64 ino, u64 gen, u64 uid, u64 gid)
{ {
struct btrfs_fs_info *fs_info = sctx->send_root->fs_info;
int ret = 0; int ret = 0;
struct fs_path *p; struct fs_path *p;
verbose_printk("btrfs: send_chown %llu uid=%llu, gid=%llu\n", ino, uid, gid); btrfs_debug(fs_info, "send_chown %llu uid=%llu, gid=%llu",
ino, uid, gid);
p = fs_path_alloc(); p = fs_path_alloc();
if (!p) if (!p)
...@@ -2508,6 +2514,7 @@ verbose_printk("btrfs: send_chown %llu uid=%llu, gid=%llu\n", ino, uid, gid); ...@@ -2508,6 +2514,7 @@ verbose_printk("btrfs: send_chown %llu uid=%llu, gid=%llu\n", ino, uid, gid);
static int send_utimes(struct send_ctx *sctx, u64 ino, u64 gen) static int send_utimes(struct send_ctx *sctx, u64 ino, u64 gen)
{ {
struct btrfs_fs_info *fs_info = sctx->send_root->fs_info;
int ret = 0; int ret = 0;
struct fs_path *p = NULL; struct fs_path *p = NULL;
struct btrfs_inode_item *ii; struct btrfs_inode_item *ii;
...@@ -2516,7 +2523,7 @@ static int send_utimes(struct send_ctx *sctx, u64 ino, u64 gen) ...@@ -2516,7 +2523,7 @@ static int send_utimes(struct send_ctx *sctx, u64 ino, u64 gen)
struct btrfs_key key; struct btrfs_key key;
int slot; int slot;
verbose_printk("btrfs: send_utimes %llu\n", ino); btrfs_debug(fs_info, "send_utimes %llu", ino);
p = fs_path_alloc(); p = fs_path_alloc();
if (!p) if (!p)
...@@ -2570,6 +2577,7 @@ verbose_printk("btrfs: send_utimes %llu\n", ino); ...@@ -2570,6 +2577,7 @@ verbose_printk("btrfs: send_utimes %llu\n", ino);
*/ */
static int send_create_inode(struct send_ctx *sctx, u64 ino) static int send_create_inode(struct send_ctx *sctx, u64 ino)
{ {
struct btrfs_fs_info *fs_info = sctx->send_root->fs_info;
int ret = 0; int ret = 0;
struct fs_path *p; struct fs_path *p;
int cmd; int cmd;
...@@ -2577,7 +2585,7 @@ static int send_create_inode(struct send_ctx *sctx, u64 ino) ...@@ -2577,7 +2585,7 @@ static int send_create_inode(struct send_ctx *sctx, u64 ino)
u64 mode; u64 mode;
u64 rdev; u64 rdev;
verbose_printk("btrfs: send_create_inode %llu\n", ino); btrfs_debug(fs_info, "send_create_inode %llu", ino);
p = fs_path_alloc(); p = fs_path_alloc();
if (!p) if (!p)
...@@ -3635,6 +3643,7 @@ static int wait_for_parent_move(struct send_ctx *sctx, ...@@ -3635,6 +3643,7 @@ static int wait_for_parent_move(struct send_ctx *sctx,
*/ */
static int process_recorded_refs(struct send_ctx *sctx, int *pending_move) static int process_recorded_refs(struct send_ctx *sctx, int *pending_move)
{ {
struct btrfs_fs_info *fs_info = sctx->send_root->fs_info;
int ret = 0; int ret = 0;
struct recorded_ref *cur; struct recorded_ref *cur;
struct recorded_ref *cur2; struct recorded_ref *cur2;
...@@ -3647,7 +3656,7 @@ static int process_recorded_refs(struct send_ctx *sctx, int *pending_move) ...@@ -3647,7 +3656,7 @@ static int process_recorded_refs(struct send_ctx *sctx, int *pending_move)
u64 last_dir_ino_rm = 0; u64 last_dir_ino_rm = 0;
bool can_rename = true; bool can_rename = true;
verbose_printk("btrfs: process_recorded_refs %llu\n", sctx->cur_ino); btrfs_debug(fs_info, "process_recorded_refs %llu", sctx->cur_ino);
/* /*
* This should never happen as the root dir always has the same ref * This should never happen as the root dir always has the same ref
...@@ -4657,6 +4666,7 @@ static ssize_t fill_read_buf(struct send_ctx *sctx, u64 offset, u32 len) ...@@ -4657,6 +4666,7 @@ static ssize_t fill_read_buf(struct send_ctx *sctx, u64 offset, u32 len)
*/ */
static int send_write(struct send_ctx *sctx, u64 offset, u32 len) static int send_write(struct send_ctx *sctx, u64 offset, u32 len)
{ {
struct btrfs_fs_info *fs_info = sctx->send_root->fs_info;
int ret = 0; int ret = 0;
struct fs_path *p; struct fs_path *p;
ssize_t num_read = 0; ssize_t num_read = 0;
...@@ -4665,7 +4675,7 @@ static int send_write(struct send_ctx *sctx, u64 offset, u32 len) ...@@ -4665,7 +4675,7 @@ static int send_write(struct send_ctx *sctx, u64 offset, u32 len)
if (!p) if (!p)
return -ENOMEM; return -ENOMEM;
verbose_printk("btrfs: send_write offset=%llu, len=%d\n", offset, len); btrfs_debug(fs_info, "send_write offset=%llu, len=%d", offset, len);
num_read = fill_read_buf(sctx, offset, len); num_read = fill_read_buf(sctx, offset, len);
if (num_read <= 0) { if (num_read <= 0) {
...@@ -4707,7 +4717,8 @@ static int send_clone(struct send_ctx *sctx, ...@@ -4707,7 +4717,8 @@ static int send_clone(struct send_ctx *sctx,
struct fs_path *p; struct fs_path *p;
u64 gen; u64 gen;
verbose_printk("btrfs: send_clone offset=%llu, len=%d, clone_root=%llu, clone_inode=%llu, clone_offset=%llu\n", btrfs_debug(sctx->send_root->fs_info,
"send_clone offset=%llu, len=%d, clone_root=%llu, clone_inode=%llu, clone_offset=%llu",
offset, len, clone_root->root->objectid, clone_root->ino, offset, len, clone_root->root->objectid, clone_root->ino,
clone_root->offset); clone_root->offset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment