mirror of https://gitee.com/openkylin/linux.git
btrfs: switch more printks to our helpers
Convert the simple cases, not all functions provide a way to reach the fs_info. Also skipped debugging messages (print-tree, integrity checker and pr_debug) and messages that are printed from possibly unfinished mount. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
9464732266
commit
f14d104dbd
|
@ -2347,8 +2347,7 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info,
|
||||||
u64 bytenr = btrfs_super_log_root(disk_super);
|
u64 bytenr = btrfs_super_log_root(disk_super);
|
||||||
|
|
||||||
if (fs_devices->rw_devices == 0) {
|
if (fs_devices->rw_devices == 0) {
|
||||||
printk(KERN_WARNING "BTRFS: log replay required "
|
btrfs_warn(fs_info, "log replay required on RO media");
|
||||||
"on RO media\n");
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2363,12 +2362,12 @@ static int btrfs_replay_log(struct btrfs_fs_info *fs_info,
|
||||||
log_tree_root->node = read_tree_block(tree_root, bytenr,
|
log_tree_root->node = read_tree_block(tree_root, bytenr,
|
||||||
fs_info->generation + 1);
|
fs_info->generation + 1);
|
||||||
if (IS_ERR(log_tree_root->node)) {
|
if (IS_ERR(log_tree_root->node)) {
|
||||||
printk(KERN_ERR "BTRFS: failed to read log tree\n");
|
btrfs_warn(fs_info, "failed to read log tree");
|
||||||
ret = PTR_ERR(log_tree_root->node);
|
ret = PTR_ERR(log_tree_root->node);
|
||||||
kfree(log_tree_root);
|
kfree(log_tree_root);
|
||||||
return ret;
|
return ret;
|
||||||
} else if (!extent_buffer_uptodate(log_tree_root->node)) {
|
} else if (!extent_buffer_uptodate(log_tree_root->node)) {
|
||||||
printk(KERN_ERR "BTRFS: failed to read log tree\n");
|
btrfs_err(fs_info, "failed to read log tree");
|
||||||
free_extent_buffer(log_tree_root->node);
|
free_extent_buffer(log_tree_root->node);
|
||||||
kfree(log_tree_root);
|
kfree(log_tree_root);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -3294,8 +3293,9 @@ static int write_dev_supers(struct btrfs_device *device,
|
||||||
bh = __getblk(device->bdev, bytenr / 4096,
|
bh = __getblk(device->bdev, bytenr / 4096,
|
||||||
BTRFS_SUPER_INFO_SIZE);
|
BTRFS_SUPER_INFO_SIZE);
|
||||||
if (!bh) {
|
if (!bh) {
|
||||||
printk(KERN_ERR "BTRFS: couldn't get super "
|
btrfs_err(device->dev_root->fs_info,
|
||||||
"buffer head for bytenr %Lu\n", bytenr);
|
"couldn't get super buffer head for bytenr %llu",
|
||||||
|
bytenr);
|
||||||
errors++;
|
errors++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5563,13 +5563,15 @@ void memcpy_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
|
||||||
unsigned long src_i;
|
unsigned long src_i;
|
||||||
|
|
||||||
if (src_offset + len > dst->len) {
|
if (src_offset + len > dst->len) {
|
||||||
printk(KERN_ERR "BTRFS: memmove bogus src_offset %lu move "
|
btrfs_err(dst->fs_info,
|
||||||
"len %lu dst len %lu\n", src_offset, len, dst->len);
|
"memmove bogus src_offset %lu move "
|
||||||
|
"len %lu dst len %lu", src_offset, len, dst->len);
|
||||||
BUG_ON(1);
|
BUG_ON(1);
|
||||||
}
|
}
|
||||||
if (dst_offset + len > dst->len) {
|
if (dst_offset + len > dst->len) {
|
||||||
printk(KERN_ERR "BTRFS: memmove bogus dst_offset %lu move "
|
btrfs_err(dst->fs_info,
|
||||||
"len %lu dst len %lu\n", dst_offset, len, dst->len);
|
"memmove bogus dst_offset %lu move "
|
||||||
|
"len %lu dst len %lu", dst_offset, len, dst->len);
|
||||||
BUG_ON(1);
|
BUG_ON(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5609,13 +5611,13 @@ void memmove_extent_buffer(struct extent_buffer *dst, unsigned long dst_offset,
|
||||||
unsigned long src_i;
|
unsigned long src_i;
|
||||||
|
|
||||||
if (src_offset + len > dst->len) {
|
if (src_offset + len > dst->len) {
|
||||||
printk(KERN_ERR "BTRFS: memmove bogus src_offset %lu move "
|
btrfs_err(dst->fs_info, "memmove bogus src_offset %lu move "
|
||||||
"len %lu len %lu\n", src_offset, len, dst->len);
|
"len %lu len %lu", src_offset, len, dst->len);
|
||||||
BUG_ON(1);
|
BUG_ON(1);
|
||||||
}
|
}
|
||||||
if (dst_offset + len > dst->len) {
|
if (dst_offset + len > dst->len) {
|
||||||
printk(KERN_ERR "BTRFS: memmove bogus dst_offset %lu move "
|
btrfs_err(dst->fs_info, "memmove bogus dst_offset %lu move "
|
||||||
"len %lu len %lu\n", dst_offset, len, dst->len);
|
"len %lu len %lu", dst_offset, len, dst->len);
|
||||||
BUG_ON(1);
|
BUG_ON(1);
|
||||||
}
|
}
|
||||||
if (dst_offset < src_offset) {
|
if (dst_offset < src_offset) {
|
||||||
|
|
|
@ -1342,7 +1342,7 @@ int btrfs_defrag_file(struct inode *inode, struct file *file,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (btrfs_defrag_cancelled(root->fs_info)) {
|
if (btrfs_defrag_cancelled(root->fs_info)) {
|
||||||
printk(KERN_DEBUG "BTRFS: defrag_file cancelled\n");
|
btrfs_debug(root->fs_info, "defrag_file cancelled");
|
||||||
ret = -EAGAIN;
|
ret = -EAGAIN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2081,7 +2081,7 @@ static noinline int search_ioctl(struct inode *inode,
|
||||||
key.offset = (u64)-1;
|
key.offset = (u64)-1;
|
||||||
root = btrfs_read_fs_root_no_name(info, &key);
|
root = btrfs_read_fs_root_no_name(info, &key);
|
||||||
if (IS_ERR(root)) {
|
if (IS_ERR(root)) {
|
||||||
printk(KERN_ERR "BTRFS: could not find root %llu\n",
|
btrfs_err(info, "could not find root %llu",
|
||||||
sk->tree_id);
|
sk->tree_id);
|
||||||
btrfs_free_path(path);
|
btrfs_free_path(path);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
@ -2221,7 +2221,7 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info,
|
||||||
key.offset = (u64)-1;
|
key.offset = (u64)-1;
|
||||||
root = btrfs_read_fs_root_no_name(info, &key);
|
root = btrfs_read_fs_root_no_name(info, &key);
|
||||||
if (IS_ERR(root)) {
|
if (IS_ERR(root)) {
|
||||||
printk(KERN_ERR "BTRFS: could not find root %llu\n", tree_id);
|
btrfs_err(info, "could not find root %llu", tree_id);
|
||||||
ret = -ENOENT;
|
ret = -ENOENT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,12 +45,13 @@ static void btrfs_read_root_item(struct extent_buffer *eb, int slot,
|
||||||
if (!need_reset && btrfs_root_generation(item)
|
if (!need_reset && btrfs_root_generation(item)
|
||||||
!= btrfs_root_generation_v2(item)) {
|
!= btrfs_root_generation_v2(item)) {
|
||||||
if (btrfs_root_generation_v2(item) != 0) {
|
if (btrfs_root_generation_v2(item) != 0) {
|
||||||
printk(KERN_WARNING "BTRFS: mismatching "
|
btrfs_warn(eb->fs_info,
|
||||||
|
"mismatching "
|
||||||
"generation and generation_v2 "
|
"generation and generation_v2 "
|
||||||
"found in root item. This root "
|
"found in root item. This root "
|
||||||
"was probably mounted with an "
|
"was probably mounted with an "
|
||||||
"older kernel. Resetting all "
|
"older kernel. Resetting all "
|
||||||
"new fields.\n");
|
"new fields.");
|
||||||
}
|
}
|
||||||
need_reset = 1;
|
need_reset = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2562,7 +2562,7 @@ verbose_printk("btrfs: send_create_inode %llu\n", ino);
|
||||||
} else if (S_ISSOCK(mode)) {
|
} else if (S_ISSOCK(mode)) {
|
||||||
cmd = BTRFS_SEND_C_MKSOCK;
|
cmd = BTRFS_SEND_C_MKSOCK;
|
||||||
} else {
|
} else {
|
||||||
printk(KERN_WARNING "btrfs: unexpected inode type %o",
|
btrfs_warn(sctx->send_root->fs_info, "unexpected inode type %o",
|
||||||
(int)(mode & S_IFMT));
|
(int)(mode & S_IFMT));
|
||||||
ret = -ENOTSUPP;
|
ret = -ENOTSUPP;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -2352,7 +2352,8 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
|
||||||
root->fs_info->fsid);
|
root->fs_info->fsid);
|
||||||
if (kobject_rename(&root->fs_info->fs_devices->super_kobj,
|
if (kobject_rename(&root->fs_info->fs_devices->super_kobj,
|
||||||
fsid_buf))
|
fsid_buf))
|
||||||
pr_warn("BTRFS: sysfs: failed to create fsid for sprout\n");
|
btrfs_warn(root->fs_info,
|
||||||
|
"sysfs: failed to create fsid for sprout");
|
||||||
}
|
}
|
||||||
|
|
||||||
root->fs_info->num_tolerated_disk_barrier_failures =
|
root->fs_info->num_tolerated_disk_barrier_failures =
|
||||||
|
|
Loading…
Reference in New Issue