mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
btrfs: use btrfs_dev_name() helper to handle missing devices better
[BUG] If dev-replace failed to re-construct its data/metadata, the kernel message would be incorrect for the missing device: BTRFS info (device dm-1): dev_replace from <missing disk> (devid 2) to /dev/mapper/test-scratch2 started BTRFS error (device dm-1): failed to rebuild valid logical 38862848 for dev (efault) Note the above "dev (efault)" of the second line. While the first line is properly reporting "<missing disk>". [CAUSE] Although dev-replace is using btrfs_dev_name(), the heavy lifting work is still done by scrub (scrub is reused by both dev-replace and regular scrub). Unfortunately scrub code never uses btrfs_dev_name() helper, as it's only declared locally inside dev-replace.c. [FIX] Fix the output by: - Move the btrfs_dev_name() helper to volumes.h - Use btrfs_dev_name() to replace open-coded rcu_str_deref() calls Only zoned code is not touched, as I'm not familiar with degraded zoned code. - Constify return value and parameter Now the output looks pretty sane: BTRFS info (device dm-1): dev_replace from <missing disk> (devid 2) to /dev/mapper/test-scratch2 started BTRFS error (device dm-1): failed to rebuild valid logical 38862848 for dev <missing disk> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
3c32c7212f
commit
cb3e217bdb
10 changed files with 36 additions and 39 deletions
|
@ -757,7 +757,7 @@ static int btrfsic_process_superblock_dev_mirror(
|
||||||
btrfs_info_in_rcu(fs_info,
|
btrfs_info_in_rcu(fs_info,
|
||||||
"new initial S-block (bdev %p, %s) @%llu (%pg/%llu/%d)",
|
"new initial S-block (bdev %p, %s) @%llu (%pg/%llu/%d)",
|
||||||
superblock_bdev,
|
superblock_bdev,
|
||||||
rcu_str_deref(device->name), dev_bytenr,
|
btrfs_dev_name(device), dev_bytenr,
|
||||||
dev_state->bdev, dev_bytenr,
|
dev_state->bdev, dev_bytenr,
|
||||||
superblock_mirror_num);
|
superblock_mirror_num);
|
||||||
list_add(&superblock_tmp->all_blocks_node,
|
list_add(&superblock_tmp->all_blocks_node,
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "volumes.h"
|
#include "volumes.h"
|
||||||
#include "async-thread.h"
|
#include "async-thread.h"
|
||||||
#include "check-integrity.h"
|
#include "check-integrity.h"
|
||||||
#include "rcu-string.h"
|
|
||||||
#include "dev-replace.h"
|
#include "dev-replace.h"
|
||||||
#include "sysfs.h"
|
#include "sysfs.h"
|
||||||
#include "zoned.h"
|
#include "zoned.h"
|
||||||
|
@ -451,14 +450,6 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static char* btrfs_dev_name(struct btrfs_device *device)
|
|
||||||
{
|
|
||||||
if (!device || test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state))
|
|
||||||
return "<missing disk>";
|
|
||||||
else
|
|
||||||
return rcu_str_deref(device->name);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int mark_block_group_to_copy(struct btrfs_fs_info *fs_info,
|
static int mark_block_group_to_copy(struct btrfs_fs_info *fs_info,
|
||||||
struct btrfs_device *src_dev)
|
struct btrfs_device *src_dev)
|
||||||
{
|
{
|
||||||
|
@ -674,7 +665,7 @@ static int btrfs_dev_replace_start(struct btrfs_fs_info *fs_info,
|
||||||
"dev_replace from %s (devid %llu) to %s started",
|
"dev_replace from %s (devid %llu) to %s started",
|
||||||
btrfs_dev_name(src_device),
|
btrfs_dev_name(src_device),
|
||||||
src_device->devid,
|
src_device->devid,
|
||||||
rcu_str_deref(tgt_device->name));
|
btrfs_dev_name(tgt_device));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* from now on, the writes to the srcdev are all duplicated to
|
* from now on, the writes to the srcdev are all duplicated to
|
||||||
|
@ -933,7 +924,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
|
||||||
"btrfs_scrub_dev(%s, %llu, %s) failed %d",
|
"btrfs_scrub_dev(%s, %llu, %s) failed %d",
|
||||||
btrfs_dev_name(src_device),
|
btrfs_dev_name(src_device),
|
||||||
src_device->devid,
|
src_device->devid,
|
||||||
rcu_str_deref(tgt_device->name), scrub_ret);
|
btrfs_dev_name(tgt_device), scrub_ret);
|
||||||
error:
|
error:
|
||||||
up_write(&dev_replace->rwsem);
|
up_write(&dev_replace->rwsem);
|
||||||
mutex_unlock(&fs_info->chunk_mutex);
|
mutex_unlock(&fs_info->chunk_mutex);
|
||||||
|
@ -951,7 +942,7 @@ error:
|
||||||
"dev_replace from %s (devid %llu) to %s finished",
|
"dev_replace from %s (devid %llu) to %s finished",
|
||||||
btrfs_dev_name(src_device),
|
btrfs_dev_name(src_device),
|
||||||
src_device->devid,
|
src_device->devid,
|
||||||
rcu_str_deref(tgt_device->name));
|
btrfs_dev_name(tgt_device));
|
||||||
clear_bit(BTRFS_DEV_STATE_REPLACE_TGT, &tgt_device->dev_state);
|
clear_bit(BTRFS_DEV_STATE_REPLACE_TGT, &tgt_device->dev_state);
|
||||||
tgt_device->devid = src_device->devid;
|
tgt_device->devid = src_device->devid;
|
||||||
src_device->devid = BTRFS_DEV_REPLACE_DEVID;
|
src_device->devid = BTRFS_DEV_REPLACE_DEVID;
|
||||||
|
|
|
@ -3944,7 +3944,7 @@ static void btrfs_end_super_write(struct bio *bio)
|
||||||
if (bio->bi_status) {
|
if (bio->bi_status) {
|
||||||
btrfs_warn_rl_in_rcu(device->fs_info,
|
btrfs_warn_rl_in_rcu(device->fs_info,
|
||||||
"lost page write due to IO error on %s (%d)",
|
"lost page write due to IO error on %s (%d)",
|
||||||
rcu_str_deref(device->name),
|
btrfs_dev_name(device),
|
||||||
blk_status_to_errno(bio->bi_status));
|
blk_status_to_errno(bio->bi_status));
|
||||||
ClearPageUptodate(page);
|
ClearPageUptodate(page);
|
||||||
SetPageError(page);
|
SetPageError(page);
|
||||||
|
|
|
@ -6048,7 +6048,7 @@ static int btrfs_trim_free_extents(struct btrfs_device *device, u64 *trimmed)
|
||||||
btrfs_warn_in_rcu(fs_info,
|
btrfs_warn_in_rcu(fs_info,
|
||||||
"ignoring attempt to trim beyond device size: offset %llu length %llu device %s device size %llu",
|
"ignoring attempt to trim beyond device size: offset %llu length %llu device %s device size %llu",
|
||||||
start, end - start + 1,
|
start, end - start + 1,
|
||||||
rcu_str_deref(device->name),
|
btrfs_dev_name(device),
|
||||||
device->total_bytes);
|
device->total_bytes);
|
||||||
mutex_unlock(&fs_info->chunk_mutex);
|
mutex_unlock(&fs_info->chunk_mutex);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
|
@ -611,8 +611,7 @@ static int repair_io_failure(struct btrfs_fs_info *fs_info, u64 ino, u64 start,
|
||||||
|
|
||||||
btrfs_info_rl_in_rcu(fs_info,
|
btrfs_info_rl_in_rcu(fs_info,
|
||||||
"read error corrected: ino %llu off %llu (dev %s sector %llu)",
|
"read error corrected: ino %llu off %llu (dev %s sector %llu)",
|
||||||
ino, start,
|
ino, start, btrfs_dev_name(dev), sector);
|
||||||
rcu_str_deref(dev->name), sector);
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
out_bio_uninit:
|
out_bio_uninit:
|
||||||
|
|
|
@ -1228,7 +1228,7 @@ static noinline int btrfs_ioctl_resize(struct file *file,
|
||||||
if (ret == 0 && new_size != old_size)
|
if (ret == 0 && new_size != old_size)
|
||||||
btrfs_info_in_rcu(fs_info,
|
btrfs_info_in_rcu(fs_info,
|
||||||
"resize device %s (devid %llu) from %llu to %llu",
|
"resize device %s (devid %llu) from %llu to %llu",
|
||||||
rcu_str_deref(device->name), device->devid,
|
btrfs_dev_name(device), device->devid,
|
||||||
old_size, new_size);
|
old_size, new_size);
|
||||||
out_finish:
|
out_finish:
|
||||||
btrfs_exclop_finish(fs_info);
|
btrfs_exclop_finish(fs_info);
|
||||||
|
@ -2860,7 +2860,7 @@ static long btrfs_ioctl_dev_info(struct btrfs_fs_info *fs_info,
|
||||||
di_args->total_bytes = btrfs_device_get_total_bytes(dev);
|
di_args->total_bytes = btrfs_device_get_total_bytes(dev);
|
||||||
memcpy(di_args->uuid, dev->uuid, sizeof(di_args->uuid));
|
memcpy(di_args->uuid, dev->uuid, sizeof(di_args->uuid));
|
||||||
if (dev->name) {
|
if (dev->name) {
|
||||||
strncpy(di_args->path, rcu_str_deref(dev->name),
|
strncpy(di_args->path, btrfs_dev_name(dev),
|
||||||
sizeof(di_args->path) - 1);
|
sizeof(di_args->path) - 1);
|
||||||
di_args->path[sizeof(di_args->path) - 1] = 0;
|
di_args->path[sizeof(di_args->path) - 1] = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#include "extent_io.h"
|
#include "extent_io.h"
|
||||||
#include "dev-replace.h"
|
#include "dev-replace.h"
|
||||||
#include "check-integrity.h"
|
#include "check-integrity.h"
|
||||||
#include "rcu-string.h"
|
|
||||||
#include "raid56.h"
|
#include "raid56.h"
|
||||||
#include "block-group.h"
|
#include "block-group.h"
|
||||||
#include "zoned.h"
|
#include "zoned.h"
|
||||||
|
@ -877,7 +876,7 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 num_bytes,
|
||||||
btrfs_warn_in_rcu(fs_info,
|
btrfs_warn_in_rcu(fs_info,
|
||||||
"%s at logical %llu on dev %s, physical %llu, root %llu, inode %llu, offset %llu, length %u, links %u (path: %s)",
|
"%s at logical %llu on dev %s, physical %llu, root %llu, inode %llu, offset %llu, length %u, links %u (path: %s)",
|
||||||
swarn->errstr, swarn->logical,
|
swarn->errstr, swarn->logical,
|
||||||
rcu_str_deref(swarn->dev->name),
|
btrfs_dev_name(swarn->dev),
|
||||||
swarn->physical,
|
swarn->physical,
|
||||||
root, inum, offset,
|
root, inum, offset,
|
||||||
fs_info->sectorsize, nlink,
|
fs_info->sectorsize, nlink,
|
||||||
|
@ -891,7 +890,7 @@ err:
|
||||||
btrfs_warn_in_rcu(fs_info,
|
btrfs_warn_in_rcu(fs_info,
|
||||||
"%s at logical %llu on dev %s, physical %llu, root %llu, inode %llu, offset %llu: path resolving failed with ret=%d",
|
"%s at logical %llu on dev %s, physical %llu, root %llu, inode %llu, offset %llu: path resolving failed with ret=%d",
|
||||||
swarn->errstr, swarn->logical,
|
swarn->errstr, swarn->logical,
|
||||||
rcu_str_deref(swarn->dev->name),
|
btrfs_dev_name(swarn->dev),
|
||||||
swarn->physical,
|
swarn->physical,
|
||||||
root, inum, offset, ret);
|
root, inum, offset, ret);
|
||||||
|
|
||||||
|
@ -922,8 +921,7 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock)
|
||||||
/* Super block error, no need to search extent tree. */
|
/* Super block error, no need to search extent tree. */
|
||||||
if (sblock->sectors[0]->flags & BTRFS_EXTENT_FLAG_SUPER) {
|
if (sblock->sectors[0]->flags & BTRFS_EXTENT_FLAG_SUPER) {
|
||||||
btrfs_warn_in_rcu(fs_info, "%s on device %s, physical %llu",
|
btrfs_warn_in_rcu(fs_info, "%s on device %s, physical %llu",
|
||||||
errstr, rcu_str_deref(dev->name),
|
errstr, btrfs_dev_name(dev), sblock->physical);
|
||||||
sblock->physical);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
path = btrfs_alloc_path();
|
path = btrfs_alloc_path();
|
||||||
|
@ -954,7 +952,7 @@ static void scrub_print_warning(const char *errstr, struct scrub_block *sblock)
|
||||||
btrfs_warn_in_rcu(fs_info,
|
btrfs_warn_in_rcu(fs_info,
|
||||||
"%s at logical %llu on dev %s, physical %llu: metadata %s (level %d) in tree %llu",
|
"%s at logical %llu on dev %s, physical %llu: metadata %s (level %d) in tree %llu",
|
||||||
errstr, swarn.logical,
|
errstr, swarn.logical,
|
||||||
rcu_str_deref(dev->name),
|
btrfs_dev_name(dev),
|
||||||
swarn.physical,
|
swarn.physical,
|
||||||
ref_level ? "node" : "leaf",
|
ref_level ? "node" : "leaf",
|
||||||
ret < 0 ? -1 : ref_level,
|
ret < 0 ? -1 : ref_level,
|
||||||
|
@ -1377,7 +1375,7 @@ corrected_error:
|
||||||
spin_unlock(&sctx->stat_lock);
|
spin_unlock(&sctx->stat_lock);
|
||||||
btrfs_err_rl_in_rcu(fs_info,
|
btrfs_err_rl_in_rcu(fs_info,
|
||||||
"fixed up error at logical %llu on dev %s",
|
"fixed up error at logical %llu on dev %s",
|
||||||
logical, rcu_str_deref(dev->name));
|
logical, btrfs_dev_name(dev));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
did_not_correct_error:
|
did_not_correct_error:
|
||||||
|
@ -1386,7 +1384,7 @@ did_not_correct_error:
|
||||||
spin_unlock(&sctx->stat_lock);
|
spin_unlock(&sctx->stat_lock);
|
||||||
btrfs_err_rl_in_rcu(fs_info,
|
btrfs_err_rl_in_rcu(fs_info,
|
||||||
"unable to fixup (regular) error at logical %llu on dev %s",
|
"unable to fixup (regular) error at logical %llu on dev %s",
|
||||||
logical, rcu_str_deref(dev->name));
|
logical, btrfs_dev_name(dev));
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@ -2332,14 +2330,14 @@ static void scrub_missing_raid56_worker(struct work_struct *work)
|
||||||
spin_unlock(&sctx->stat_lock);
|
spin_unlock(&sctx->stat_lock);
|
||||||
btrfs_err_rl_in_rcu(fs_info,
|
btrfs_err_rl_in_rcu(fs_info,
|
||||||
"IO error rebuilding logical %llu for dev %s",
|
"IO error rebuilding logical %llu for dev %s",
|
||||||
logical, rcu_str_deref(dev->name));
|
logical, btrfs_dev_name(dev));
|
||||||
} else if (sblock->header_error || sblock->checksum_error) {
|
} else if (sblock->header_error || sblock->checksum_error) {
|
||||||
spin_lock(&sctx->stat_lock);
|
spin_lock(&sctx->stat_lock);
|
||||||
sctx->stat.uncorrectable_errors++;
|
sctx->stat.uncorrectable_errors++;
|
||||||
spin_unlock(&sctx->stat_lock);
|
spin_unlock(&sctx->stat_lock);
|
||||||
btrfs_err_rl_in_rcu(fs_info,
|
btrfs_err_rl_in_rcu(fs_info,
|
||||||
"failed to rebuild valid logical %llu for dev %s",
|
"failed to rebuild valid logical %llu for dev %s",
|
||||||
logical, rcu_str_deref(dev->name));
|
logical, btrfs_dev_name(dev));
|
||||||
} else {
|
} else {
|
||||||
scrub_write_block_to_dev_replace(sblock);
|
scrub_write_block_to_dev_replace(sblock);
|
||||||
}
|
}
|
||||||
|
@ -4303,7 +4301,7 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start,
|
||||||
mutex_unlock(&fs_info->fs_devices->device_list_mutex);
|
mutex_unlock(&fs_info->fs_devices->device_list_mutex);
|
||||||
btrfs_err_in_rcu(fs_info,
|
btrfs_err_in_rcu(fs_info,
|
||||||
"scrub on devid %llu: filesystem on %s is not writable",
|
"scrub on devid %llu: filesystem on %s is not writable",
|
||||||
devid, rcu_str_deref(dev->name));
|
devid, btrfs_dev_name(dev));
|
||||||
ret = -EROFS;
|
ret = -EROFS;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2336,7 +2336,7 @@ static int btrfs_show_devname(struct seq_file *m, struct dentry *root)
|
||||||
* the end of RCU grace period.
|
* the end of RCU grace period.
|
||||||
*/
|
*/
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
seq_escape(m, rcu_str_deref(fs_info->fs_devices->latest_dev->name), " \t\n\\");
|
seq_escape(m, btrfs_dev_name(fs_info->fs_devices->latest_dev), " \t\n\\");
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -941,7 +941,7 @@ static noinline struct btrfs_device *device_list_add(const char *path,
|
||||||
}
|
}
|
||||||
btrfs_info_in_rcu(NULL,
|
btrfs_info_in_rcu(NULL,
|
||||||
"devid %llu device path %s changed to %s scanned by %s (%d)",
|
"devid %llu device path %s changed to %s scanned by %s (%d)",
|
||||||
devid, rcu_str_deref(device->name),
|
devid, btrfs_dev_name(device),
|
||||||
path, current->comm,
|
path, current->comm,
|
||||||
task_pid_nr(current));
|
task_pid_nr(current));
|
||||||
}
|
}
|
||||||
|
@ -2101,7 +2101,7 @@ int btrfs_rm_device(struct btrfs_fs_info *fs_info,
|
||||||
if (btrfs_pinned_by_swapfile(fs_info, device)) {
|
if (btrfs_pinned_by_swapfile(fs_info, device)) {
|
||||||
btrfs_warn_in_rcu(fs_info,
|
btrfs_warn_in_rcu(fs_info,
|
||||||
"cannot remove device %s (devid %llu) due to active swapfile",
|
"cannot remove device %s (devid %llu) due to active swapfile",
|
||||||
rcu_str_deref(device->name), device->devid);
|
btrfs_dev_name(device), device->devid);
|
||||||
return -ETXTBSY;
|
return -ETXTBSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6827,7 +6827,7 @@ static void btrfs_submit_dev_bio(struct btrfs_device *dev, struct bio *bio)
|
||||||
btrfs_debug_in_rcu(dev->fs_info,
|
btrfs_debug_in_rcu(dev->fs_info,
|
||||||
"%s: rw %d 0x%x, sector=%llu, dev=%lu (%s id %llu), size=%u",
|
"%s: rw %d 0x%x, sector=%llu, dev=%lu (%s id %llu), size=%u",
|
||||||
__func__, bio_op(bio), bio->bi_opf, bio->bi_iter.bi_sector,
|
__func__, bio_op(bio), bio->bi_opf, bio->bi_iter.bi_sector,
|
||||||
(unsigned long)dev->bdev->bd_dev, rcu_str_deref(dev->name),
|
(unsigned long)dev->bdev->bd_dev, btrfs_dev_name(dev),
|
||||||
dev->devid, bio->bi_iter.bi_size);
|
dev->devid, bio->bi_iter.bi_size);
|
||||||
|
|
||||||
btrfsic_check_bio(bio);
|
btrfsic_check_bio(bio);
|
||||||
|
@ -7908,7 +7908,7 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
btrfs_warn_in_rcu(fs_info,
|
btrfs_warn_in_rcu(fs_info,
|
||||||
"error %d while searching for dev_stats item for device %s",
|
"error %d while searching for dev_stats item for device %s",
|
||||||
ret, rcu_str_deref(device->name));
|
ret, btrfs_dev_name(device));
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7919,7 +7919,7 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
btrfs_warn_in_rcu(fs_info,
|
btrfs_warn_in_rcu(fs_info,
|
||||||
"delete too small dev_stats item for device %s failed %d",
|
"delete too small dev_stats item for device %s failed %d",
|
||||||
rcu_str_deref(device->name), ret);
|
btrfs_dev_name(device), ret);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
@ -7933,7 +7933,7 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
btrfs_warn_in_rcu(fs_info,
|
btrfs_warn_in_rcu(fs_info,
|
||||||
"insert dev_stats item for device %s failed %d",
|
"insert dev_stats item for device %s failed %d",
|
||||||
rcu_str_deref(device->name), ret);
|
btrfs_dev_name(device), ret);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7998,7 +7998,7 @@ void btrfs_dev_stat_inc_and_print(struct btrfs_device *dev, int index)
|
||||||
return;
|
return;
|
||||||
btrfs_err_rl_in_rcu(dev->fs_info,
|
btrfs_err_rl_in_rcu(dev->fs_info,
|
||||||
"bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u",
|
"bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u",
|
||||||
rcu_str_deref(dev->name),
|
btrfs_dev_name(dev),
|
||||||
btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS),
|
btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS),
|
||||||
btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_READ_ERRS),
|
btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_READ_ERRS),
|
||||||
btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_FLUSH_ERRS),
|
btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_FLUSH_ERRS),
|
||||||
|
@ -8018,7 +8018,7 @@ static void btrfs_dev_stat_print_on_load(struct btrfs_device *dev)
|
||||||
|
|
||||||
btrfs_info_in_rcu(dev->fs_info,
|
btrfs_info_in_rcu(dev->fs_info,
|
||||||
"bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u",
|
"bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u",
|
||||||
rcu_str_deref(dev->name),
|
btrfs_dev_name(dev),
|
||||||
btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS),
|
btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS),
|
||||||
btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_READ_ERRS),
|
btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_READ_ERRS),
|
||||||
btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_FLUSH_ERRS),
|
btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_FLUSH_ERRS),
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "async-thread.h"
|
#include "async-thread.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "disk-io.h"
|
#include "disk-io.h"
|
||||||
|
#include "rcu-string.h"
|
||||||
|
|
||||||
#define BTRFS_MAX_DATA_CHUNK_SIZE (10ULL * SZ_1G)
|
#define BTRFS_MAX_DATA_CHUNK_SIZE (10ULL * SZ_1G)
|
||||||
|
|
||||||
|
@ -770,6 +771,14 @@ static inline void btrfs_dev_stat_set(struct btrfs_device *dev,
|
||||||
atomic_inc(&dev->dev_stats_ccnt);
|
atomic_inc(&dev->dev_stats_ccnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline const char *btrfs_dev_name(const struct btrfs_device *device)
|
||||||
|
{
|
||||||
|
if (!device || test_bit(BTRFS_DEV_STATE_MISSING, &device->dev_state))
|
||||||
|
return "<missing disk>";
|
||||||
|
else
|
||||||
|
return rcu_str_deref(device->name);
|
||||||
|
}
|
||||||
|
|
||||||
void btrfs_commit_device_sizes(struct btrfs_transaction *trans);
|
void btrfs_commit_device_sizes(struct btrfs_transaction *trans);
|
||||||
|
|
||||||
struct list_head * __attribute_const__ btrfs_get_fs_uuids(void);
|
struct list_head * __attribute_const__ btrfs_get_fs_uuids(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue