diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-30 23:08:20 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-30 23:08:20 -0500 |
commit | e7651b819e90da924991d727d3c007200a18670d (patch) | |
tree | e7a943b5bb56c384972944fd86767a3f079b8a98 /fs/btrfs/volumes.c | |
parent | 060e8e3b6f8fc0ba97de2276249fbd80fa25b0a2 (diff) | |
parent | cf93da7bcf450cb4595055d491a0519cb39e68ed (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Pull btrfs updates from Chris Mason:
"This is a pretty big pull, and most of these changes have been
floating in btrfs-next for a long time. Filipe's properties work is a
cool building block for inheriting attributes like compression down on
a per inode basis.
Jeff Mahoney kicked in code to export filesystem info into sysfs.
Otherwise, lots of performance improvements, cleanups and bug fixes.
Looks like there are still a few other small pending incrementals, but
I wanted to get the bulk of this in first"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (149 commits)
Btrfs: fix spin_unlock in check_ref_cleanup
Btrfs: setup inode location during btrfs_init_inode_locked
Btrfs: don't use ram_bytes for uncompressed inline items
Btrfs: fix btrfs_search_slot_for_read backwards iteration
Btrfs: do not export ulist functions
Btrfs: rework ulist with list+rb_tree
Btrfs: fix memory leaks on walking backrefs failure
Btrfs: fix send file hole detection leading to data corruption
Btrfs: add a reschedule point in btrfs_find_all_roots()
Btrfs: make send's file extent item search more efficient
Btrfs: fix to catch all errors when resolving indirect ref
Btrfs: fix protection between walking backrefs and root deletion
btrfs: fix warning while merging two adjacent extents
Btrfs: fix infinite path build loops in incremental send
btrfs: undo sysfs when open_ctree() fails
Btrfs: fix snprintf usage by send's gen_unique_name
btrfs: fix defrag 32-bit integer overflow
btrfs: sysfs: list the NO_HOLES feature
btrfs: sysfs: don't show reserved incompat feature
btrfs: call permission checks earlier in ioctls and return EPERM
...
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 89 |
1 files changed, 44 insertions, 45 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 54d2685a3071..bab0b84d8f80 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -125,7 +125,7 @@ static void btrfs_kobject_uevent(struct block_device *bdev, | |||
125 | 125 | ||
126 | ret = kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, action); | 126 | ret = kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, action); |
127 | if (ret) | 127 | if (ret) |
128 | pr_warn("Sending event '%d' to kobject: '%s' (%p): failed\n", | 128 | pr_warn("BTRFS: Sending event '%d' to kobject: '%s' (%p): failed\n", |
129 | action, | 129 | action, |
130 | kobject_name(&disk_to_dev(bdev->bd_disk)->kobj), | 130 | kobject_name(&disk_to_dev(bdev->bd_disk)->kobj), |
131 | &disk_to_dev(bdev->bd_disk)->kobj); | 131 | &disk_to_dev(bdev->bd_disk)->kobj); |
@@ -200,7 +200,7 @@ btrfs_get_bdev_and_sb(const char *device_path, fmode_t flags, void *holder, | |||
200 | 200 | ||
201 | if (IS_ERR(*bdev)) { | 201 | if (IS_ERR(*bdev)) { |
202 | ret = PTR_ERR(*bdev); | 202 | ret = PTR_ERR(*bdev); |
203 | printk(KERN_INFO "btrfs: open %s failed\n", device_path); | 203 | printk(KERN_INFO "BTRFS: open %s failed\n", device_path); |
204 | goto error; | 204 | goto error; |
205 | } | 205 | } |
206 | 206 | ||
@@ -912,9 +912,9 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder, | |||
912 | if (disk_super->label[0]) { | 912 | if (disk_super->label[0]) { |
913 | if (disk_super->label[BTRFS_LABEL_SIZE - 1]) | 913 | if (disk_super->label[BTRFS_LABEL_SIZE - 1]) |
914 | disk_super->label[BTRFS_LABEL_SIZE - 1] = '\0'; | 914 | disk_super->label[BTRFS_LABEL_SIZE - 1] = '\0'; |
915 | printk(KERN_INFO "btrfs: device label %s ", disk_super->label); | 915 | printk(KERN_INFO "BTRFS: device label %s ", disk_super->label); |
916 | } else { | 916 | } else { |
917 | printk(KERN_INFO "btrfs: device fsid %pU ", disk_super->fsid); | 917 | printk(KERN_INFO "BTRFS: device fsid %pU ", disk_super->fsid); |
918 | } | 918 | } |
919 | 919 | ||
920 | printk(KERN_CONT "devid %llu transid %llu %s\n", devid, transid, path); | 920 | printk(KERN_CONT "devid %llu transid %llu %s\n", devid, transid, path); |
@@ -1813,7 +1813,7 @@ int btrfs_find_device_missing_or_by_path(struct btrfs_root *root, | |||
1813 | } | 1813 | } |
1814 | 1814 | ||
1815 | if (!*device) { | 1815 | if (!*device) { |
1816 | pr_err("btrfs: no missing device found\n"); | 1816 | btrfs_err(root->fs_info, "no missing device found"); |
1817 | return -ENOENT; | 1817 | return -ENOENT; |
1818 | } | 1818 | } |
1819 | 1819 | ||
@@ -3052,7 +3052,7 @@ loop: | |||
3052 | error: | 3052 | error: |
3053 | btrfs_free_path(path); | 3053 | btrfs_free_path(path); |
3054 | if (enospc_errors) { | 3054 | if (enospc_errors) { |
3055 | printk(KERN_INFO "btrfs: %d enospc errors during balance\n", | 3055 | btrfs_info(fs_info, "%d enospc errors during balance", |
3056 | enospc_errors); | 3056 | enospc_errors); |
3057 | if (!ret) | 3057 | if (!ret) |
3058 | ret = -ENOSPC; | 3058 | ret = -ENOSPC; |
@@ -3138,8 +3138,8 @@ int btrfs_balance(struct btrfs_balance_control *bctl, | |||
3138 | if (!(bctl->flags & BTRFS_BALANCE_DATA) || | 3138 | if (!(bctl->flags & BTRFS_BALANCE_DATA) || |
3139 | !(bctl->flags & BTRFS_BALANCE_METADATA) || | 3139 | !(bctl->flags & BTRFS_BALANCE_METADATA) || |
3140 | memcmp(&bctl->data, &bctl->meta, sizeof(bctl->data))) { | 3140 | memcmp(&bctl->data, &bctl->meta, sizeof(bctl->data))) { |
3141 | printk(KERN_ERR "btrfs: with mixed groups data and " | 3141 | btrfs_err(fs_info, "with mixed groups data and " |
3142 | "metadata balance options must be the same\n"); | 3142 | "metadata balance options must be the same"); |
3143 | ret = -EINVAL; | 3143 | ret = -EINVAL; |
3144 | goto out; | 3144 | goto out; |
3145 | } | 3145 | } |
@@ -3165,8 +3165,8 @@ int btrfs_balance(struct btrfs_balance_control *bctl, | |||
3165 | if ((bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) && | 3165 | if ((bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) && |
3166 | (!alloc_profile_is_valid(bctl->data.target, 1) || | 3166 | (!alloc_profile_is_valid(bctl->data.target, 1) || |
3167 | (bctl->data.target & ~allowed))) { | 3167 | (bctl->data.target & ~allowed))) { |
3168 | printk(KERN_ERR "btrfs: unable to start balance with target " | 3168 | btrfs_err(fs_info, "unable to start balance with target " |
3169 | "data profile %llu\n", | 3169 | "data profile %llu", |
3170 | bctl->data.target); | 3170 | bctl->data.target); |
3171 | ret = -EINVAL; | 3171 | ret = -EINVAL; |
3172 | goto out; | 3172 | goto out; |
@@ -3174,8 +3174,8 @@ int btrfs_balance(struct btrfs_balance_control *bctl, | |||
3174 | if ((bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT) && | 3174 | if ((bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT) && |
3175 | (!alloc_profile_is_valid(bctl->meta.target, 1) || | 3175 | (!alloc_profile_is_valid(bctl->meta.target, 1) || |
3176 | (bctl->meta.target & ~allowed))) { | 3176 | (bctl->meta.target & ~allowed))) { |
3177 | printk(KERN_ERR "btrfs: unable to start balance with target " | 3177 | btrfs_err(fs_info, |
3178 | "metadata profile %llu\n", | 3178 | "unable to start balance with target metadata profile %llu", |
3179 | bctl->meta.target); | 3179 | bctl->meta.target); |
3180 | ret = -EINVAL; | 3180 | ret = -EINVAL; |
3181 | goto out; | 3181 | goto out; |
@@ -3183,8 +3183,8 @@ int btrfs_balance(struct btrfs_balance_control *bctl, | |||
3183 | if ((bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) && | 3183 | if ((bctl->sys.flags & BTRFS_BALANCE_ARGS_CONVERT) && |
3184 | (!alloc_profile_is_valid(bctl->sys.target, 1) || | 3184 | (!alloc_profile_is_valid(bctl->sys.target, 1) || |
3185 | (bctl->sys.target & ~allowed))) { | 3185 | (bctl->sys.target & ~allowed))) { |
3186 | printk(KERN_ERR "btrfs: unable to start balance with target " | 3186 | btrfs_err(fs_info, |
3187 | "system profile %llu\n", | 3187 | "unable to start balance with target system profile %llu", |
3188 | bctl->sys.target); | 3188 | bctl->sys.target); |
3189 | ret = -EINVAL; | 3189 | ret = -EINVAL; |
3190 | goto out; | 3190 | goto out; |
@@ -3193,7 +3193,7 @@ int btrfs_balance(struct btrfs_balance_control *bctl, | |||
3193 | /* allow dup'ed data chunks only in mixed mode */ | 3193 | /* allow dup'ed data chunks only in mixed mode */ |
3194 | if (!mixed && (bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) && | 3194 | if (!mixed && (bctl->data.flags & BTRFS_BALANCE_ARGS_CONVERT) && |
3195 | (bctl->data.target & BTRFS_BLOCK_GROUP_DUP)) { | 3195 | (bctl->data.target & BTRFS_BLOCK_GROUP_DUP)) { |
3196 | printk(KERN_ERR "btrfs: dup for data is not allowed\n"); | 3196 | btrfs_err(fs_info, "dup for data is not allowed"); |
3197 | ret = -EINVAL; | 3197 | ret = -EINVAL; |
3198 | goto out; | 3198 | goto out; |
3199 | } | 3199 | } |
@@ -3213,11 +3213,10 @@ int btrfs_balance(struct btrfs_balance_control *bctl, | |||
3213 | (fs_info->avail_metadata_alloc_bits & allowed) && | 3213 | (fs_info->avail_metadata_alloc_bits & allowed) && |
3214 | !(bctl->meta.target & allowed))) { | 3214 | !(bctl->meta.target & allowed))) { |
3215 | if (bctl->flags & BTRFS_BALANCE_FORCE) { | 3215 | if (bctl->flags & BTRFS_BALANCE_FORCE) { |
3216 | printk(KERN_INFO "btrfs: force reducing metadata " | 3216 | btrfs_info(fs_info, "force reducing metadata integrity"); |
3217 | "integrity\n"); | ||
3218 | } else { | 3217 | } else { |
3219 | printk(KERN_ERR "btrfs: balance will reduce metadata " | 3218 | btrfs_err(fs_info, "balance will reduce metadata " |
3220 | "integrity, use force if you want this\n"); | 3219 | "integrity, use force if you want this"); |
3221 | ret = -EINVAL; | 3220 | ret = -EINVAL; |
3222 | goto out; | 3221 | goto out; |
3223 | } | 3222 | } |
@@ -3303,7 +3302,7 @@ static int balance_kthread(void *data) | |||
3303 | mutex_lock(&fs_info->balance_mutex); | 3302 | mutex_lock(&fs_info->balance_mutex); |
3304 | 3303 | ||
3305 | if (fs_info->balance_ctl) { | 3304 | if (fs_info->balance_ctl) { |
3306 | printk(KERN_INFO "btrfs: continuing balance\n"); | 3305 | btrfs_info(fs_info, "continuing balance"); |
3307 | ret = btrfs_balance(fs_info->balance_ctl, NULL); | 3306 | ret = btrfs_balance(fs_info->balance_ctl, NULL); |
3308 | } | 3307 | } |
3309 | 3308 | ||
@@ -3325,7 +3324,7 @@ int btrfs_resume_balance_async(struct btrfs_fs_info *fs_info) | |||
3325 | spin_unlock(&fs_info->balance_lock); | 3324 | spin_unlock(&fs_info->balance_lock); |
3326 | 3325 | ||
3327 | if (btrfs_test_opt(fs_info->tree_root, SKIP_BALANCE)) { | 3326 | if (btrfs_test_opt(fs_info->tree_root, SKIP_BALANCE)) { |
3328 | printk(KERN_INFO "btrfs: force skipping balance\n"); | 3327 | btrfs_info(fs_info, "force skipping balance"); |
3329 | return 0; | 3328 | return 0; |
3330 | } | 3329 | } |
3331 | 3330 | ||
@@ -3543,7 +3542,7 @@ update_tree: | |||
3543 | BTRFS_UUID_KEY_SUBVOL, | 3542 | BTRFS_UUID_KEY_SUBVOL, |
3544 | key.objectid); | 3543 | key.objectid); |
3545 | if (ret < 0) { | 3544 | if (ret < 0) { |
3546 | pr_warn("btrfs: uuid_tree_add failed %d\n", | 3545 | btrfs_warn(fs_info, "uuid_tree_add failed %d", |
3547 | ret); | 3546 | ret); |
3548 | break; | 3547 | break; |
3549 | } | 3548 | } |
@@ -3555,7 +3554,7 @@ update_tree: | |||
3555 | BTRFS_UUID_KEY_RECEIVED_SUBVOL, | 3554 | BTRFS_UUID_KEY_RECEIVED_SUBVOL, |
3556 | key.objectid); | 3555 | key.objectid); |
3557 | if (ret < 0) { | 3556 | if (ret < 0) { |
3558 | pr_warn("btrfs: uuid_tree_add failed %d\n", | 3557 | btrfs_warn(fs_info, "uuid_tree_add failed %d", |
3559 | ret); | 3558 | ret); |
3560 | break; | 3559 | break; |
3561 | } | 3560 | } |
@@ -3590,7 +3589,7 @@ out: | |||
3590 | if (trans && !IS_ERR(trans)) | 3589 | if (trans && !IS_ERR(trans)) |
3591 | btrfs_end_transaction(trans, fs_info->uuid_root); | 3590 | btrfs_end_transaction(trans, fs_info->uuid_root); |
3592 | if (ret) | 3591 | if (ret) |
3593 | pr_warn("btrfs: btrfs_uuid_scan_kthread failed %d\n", ret); | 3592 | btrfs_warn(fs_info, "btrfs_uuid_scan_kthread failed %d", ret); |
3594 | else | 3593 | else |
3595 | fs_info->update_uuid_tree_gen = 1; | 3594 | fs_info->update_uuid_tree_gen = 1; |
3596 | up(&fs_info->uuid_tree_rescan_sem); | 3595 | up(&fs_info->uuid_tree_rescan_sem); |
@@ -3654,7 +3653,7 @@ static int btrfs_uuid_rescan_kthread(void *data) | |||
3654 | */ | 3653 | */ |
3655 | ret = btrfs_uuid_tree_iterate(fs_info, btrfs_check_uuid_tree_entry); | 3654 | ret = btrfs_uuid_tree_iterate(fs_info, btrfs_check_uuid_tree_entry); |
3656 | if (ret < 0) { | 3655 | if (ret < 0) { |
3657 | pr_warn("btrfs: iterating uuid_tree failed %d\n", ret); | 3656 | btrfs_warn(fs_info, "iterating uuid_tree failed %d", ret); |
3658 | up(&fs_info->uuid_tree_rescan_sem); | 3657 | up(&fs_info->uuid_tree_rescan_sem); |
3659 | return ret; | 3658 | return ret; |
3660 | } | 3659 | } |
@@ -3695,7 +3694,7 @@ int btrfs_create_uuid_tree(struct btrfs_fs_info *fs_info) | |||
3695 | task = kthread_run(btrfs_uuid_scan_kthread, fs_info, "btrfs-uuid"); | 3694 | task = kthread_run(btrfs_uuid_scan_kthread, fs_info, "btrfs-uuid"); |
3696 | if (IS_ERR(task)) { | 3695 | if (IS_ERR(task)) { |
3697 | /* fs_info->update_uuid_tree_gen remains 0 in all error case */ | 3696 | /* fs_info->update_uuid_tree_gen remains 0 in all error case */ |
3698 | pr_warn("btrfs: failed to start uuid_scan task\n"); | 3697 | btrfs_warn(fs_info, "failed to start uuid_scan task"); |
3699 | up(&fs_info->uuid_tree_rescan_sem); | 3698 | up(&fs_info->uuid_tree_rescan_sem); |
3700 | return PTR_ERR(task); | 3699 | return PTR_ERR(task); |
3701 | } | 3700 | } |
@@ -3711,7 +3710,7 @@ int btrfs_check_uuid_tree(struct btrfs_fs_info *fs_info) | |||
3711 | task = kthread_run(btrfs_uuid_rescan_kthread, fs_info, "btrfs-uuid"); | 3710 | task = kthread_run(btrfs_uuid_rescan_kthread, fs_info, "btrfs-uuid"); |
3712 | if (IS_ERR(task)) { | 3711 | if (IS_ERR(task)) { |
3713 | /* fs_info->update_uuid_tree_gen remains 0 in all error case */ | 3712 | /* fs_info->update_uuid_tree_gen remains 0 in all error case */ |
3714 | pr_warn("btrfs: failed to start uuid_rescan task\n"); | 3713 | btrfs_warn(fs_info, "failed to start uuid_rescan task"); |
3715 | up(&fs_info->uuid_tree_rescan_sem); | 3714 | up(&fs_info->uuid_tree_rescan_sem); |
3716 | return PTR_ERR(task); | 3715 | return PTR_ERR(task); |
3717 | } | 3716 | } |
@@ -4033,7 +4032,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, | |||
4033 | max_stripe_size = 32 * 1024 * 1024; | 4032 | max_stripe_size = 32 * 1024 * 1024; |
4034 | max_chunk_size = 2 * max_stripe_size; | 4033 | max_chunk_size = 2 * max_stripe_size; |
4035 | } else { | 4034 | } else { |
4036 | printk(KERN_ERR "btrfs: invalid chunk type 0x%llx requested\n", | 4035 | btrfs_err(info, "invalid chunk type 0x%llx requested\n", |
4037 | type); | 4036 | type); |
4038 | BUG_ON(1); | 4037 | BUG_ON(1); |
4039 | } | 4038 | } |
@@ -4065,7 +4064,7 @@ static int __btrfs_alloc_chunk(struct btrfs_trans_handle *trans, | |||
4065 | 4064 | ||
4066 | if (!device->writeable) { | 4065 | if (!device->writeable) { |
4067 | WARN(1, KERN_ERR | 4066 | WARN(1, KERN_ERR |
4068 | "btrfs: read-only device in alloc_list\n"); | 4067 | "BTRFS: read-only device in alloc_list\n"); |
4069 | continue; | 4068 | continue; |
4070 | } | 4069 | } |
4071 | 4070 | ||
@@ -5193,13 +5192,13 @@ int btrfs_rmap_block(struct btrfs_mapping_tree *map_tree, | |||
5193 | read_unlock(&em_tree->lock); | 5192 | read_unlock(&em_tree->lock); |
5194 | 5193 | ||
5195 | if (!em) { | 5194 | if (!em) { |
5196 | printk(KERN_ERR "btrfs: couldn't find em for chunk %Lu\n", | 5195 | printk(KERN_ERR "BTRFS: couldn't find em for chunk %Lu\n", |
5197 | chunk_start); | 5196 | chunk_start); |
5198 | return -EIO; | 5197 | return -EIO; |
5199 | } | 5198 | } |
5200 | 5199 | ||
5201 | if (em->start != chunk_start) { | 5200 | if (em->start != chunk_start) { |
5202 | printk(KERN_ERR "btrfs: bad chunk start, em=%Lu, wanted=%Lu\n", | 5201 | printk(KERN_ERR "BTRFS: bad chunk start, em=%Lu, wanted=%Lu\n", |
5203 | em->start, chunk_start); | 5202 | em->start, chunk_start); |
5204 | free_extent_map(em); | 5203 | free_extent_map(em); |
5205 | return -EIO; | 5204 | return -EIO; |
@@ -6130,7 +6129,8 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans, | |||
6130 | BUG_ON(!path); | 6129 | BUG_ON(!path); |
6131 | ret = btrfs_search_slot(trans, dev_root, &key, path, -1, 1); | 6130 | ret = btrfs_search_slot(trans, dev_root, &key, path, -1, 1); |
6132 | if (ret < 0) { | 6131 | if (ret < 0) { |
6133 | printk_in_rcu(KERN_WARNING "btrfs: error %d while searching for dev_stats item for device %s!\n", | 6132 | printk_in_rcu(KERN_WARNING "BTRFS: " |
6133 | "error %d while searching for dev_stats item for device %s!\n", | ||
6134 | ret, rcu_str_deref(device->name)); | 6134 | ret, rcu_str_deref(device->name)); |
6135 | goto out; | 6135 | goto out; |
6136 | } | 6136 | } |
@@ -6140,7 +6140,8 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans, | |||
6140 | /* need to delete old one and insert a new one */ | 6140 | /* need to delete old one and insert a new one */ |
6141 | ret = btrfs_del_item(trans, dev_root, path); | 6141 | ret = btrfs_del_item(trans, dev_root, path); |
6142 | if (ret != 0) { | 6142 | if (ret != 0) { |
6143 | printk_in_rcu(KERN_WARNING "btrfs: delete too small dev_stats item for device %s failed %d!\n", | 6143 | printk_in_rcu(KERN_WARNING "BTRFS: " |
6144 | "delete too small dev_stats item for device %s failed %d!\n", | ||
6144 | rcu_str_deref(device->name), ret); | 6145 | rcu_str_deref(device->name), ret); |
6145 | goto out; | 6146 | goto out; |
6146 | } | 6147 | } |
@@ -6153,7 +6154,8 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans, | |||
6153 | ret = btrfs_insert_empty_item(trans, dev_root, path, | 6154 | ret = btrfs_insert_empty_item(trans, dev_root, path, |
6154 | &key, sizeof(*ptr)); | 6155 | &key, sizeof(*ptr)); |
6155 | if (ret < 0) { | 6156 | if (ret < 0) { |
6156 | printk_in_rcu(KERN_WARNING "btrfs: insert dev_stats item for device %s failed %d!\n", | 6157 | printk_in_rcu(KERN_WARNING "BTRFS: " |
6158 | "insert dev_stats item for device %s failed %d!\n", | ||
6157 | rcu_str_deref(device->name), ret); | 6159 | rcu_str_deref(device->name), ret); |
6158 | goto out; | 6160 | goto out; |
6159 | } | 6161 | } |
@@ -6206,16 +6208,14 @@ static void btrfs_dev_stat_print_on_error(struct btrfs_device *dev) | |||
6206 | { | 6208 | { |
6207 | if (!dev->dev_stats_valid) | 6209 | if (!dev->dev_stats_valid) |
6208 | return; | 6210 | return; |
6209 | printk_ratelimited_in_rcu(KERN_ERR | 6211 | printk_ratelimited_in_rcu(KERN_ERR "BTRFS: " |
6210 | "btrfs: bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u\n", | 6212 | "bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u\n", |
6211 | rcu_str_deref(dev->name), | 6213 | rcu_str_deref(dev->name), |
6212 | btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS), | 6214 | btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS), |
6213 | btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_READ_ERRS), | 6215 | btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_READ_ERRS), |
6214 | btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_FLUSH_ERRS), | 6216 | btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_FLUSH_ERRS), |
6215 | btrfs_dev_stat_read(dev, | 6217 | btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_CORRUPTION_ERRS), |
6216 | BTRFS_DEV_STAT_CORRUPTION_ERRS), | 6218 | btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_GENERATION_ERRS)); |
6217 | btrfs_dev_stat_read(dev, | ||
6218 | BTRFS_DEV_STAT_GENERATION_ERRS)); | ||
6219 | } | 6219 | } |
6220 | 6220 | ||
6221 | static void btrfs_dev_stat_print_on_load(struct btrfs_device *dev) | 6221 | static void btrfs_dev_stat_print_on_load(struct btrfs_device *dev) |
@@ -6228,7 +6228,8 @@ static void btrfs_dev_stat_print_on_load(struct btrfs_device *dev) | |||
6228 | if (i == BTRFS_DEV_STAT_VALUES_MAX) | 6228 | if (i == BTRFS_DEV_STAT_VALUES_MAX) |
6229 | return; /* all values == 0, suppress message */ | 6229 | return; /* all values == 0, suppress message */ |
6230 | 6230 | ||
6231 | printk_in_rcu(KERN_INFO "btrfs: bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u\n", | 6231 | printk_in_rcu(KERN_INFO "BTRFS: " |
6232 | "bdev %s errs: wr %u, rd %u, flush %u, corrupt %u, gen %u\n", | ||
6232 | rcu_str_deref(dev->name), | 6233 | rcu_str_deref(dev->name), |
6233 | btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS), | 6234 | btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_WRITE_ERRS), |
6234 | btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_READ_ERRS), | 6235 | btrfs_dev_stat_read(dev, BTRFS_DEV_STAT_READ_ERRS), |
@@ -6249,12 +6250,10 @@ int btrfs_get_dev_stats(struct btrfs_root *root, | |||
6249 | mutex_unlock(&fs_devices->device_list_mutex); | 6250 | mutex_unlock(&fs_devices->device_list_mutex); |
6250 | 6251 | ||
6251 | if (!dev) { | 6252 | if (!dev) { |
6252 | printk(KERN_WARNING | 6253 | btrfs_warn(root->fs_info, "get dev_stats failed, device not found"); |
6253 | "btrfs: get dev_stats failed, device not found\n"); | ||
6254 | return -ENODEV; | 6254 | return -ENODEV; |
6255 | } else if (!dev->dev_stats_valid) { | 6255 | } else if (!dev->dev_stats_valid) { |
6256 | printk(KERN_WARNING | 6256 | btrfs_warn(root->fs_info, "get dev_stats failed, not yet valid"); |
6257 | "btrfs: get dev_stats failed, not yet valid\n"); | ||
6258 | return -ENODEV; | 6257 | return -ENODEV; |
6259 | } else if (stats->flags & BTRFS_DEV_STATS_RESET) { | 6258 | } else if (stats->flags & BTRFS_DEV_STATS_RESET) { |
6260 | for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++) { | 6259 | for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++) { |