diff options
author | Simon Kirby <sim@hostway.ca> | 2013-03-19 18:41:23 -0400 |
---|---|---|
committer | Josef Bacik <jbacik@fusionio.com> | 2013-05-06 15:54:23 -0400 |
commit | c2cf52eb71aeb902682e0c1fa29e4e9e4a7f4ffc (patch) | |
tree | 6c62e02e87bc92eb8eb66bf4c0fbebc00b64a1e5 /fs/btrfs/free-space-cache.c | |
parent | aa8259145ecb8d432685c1167a194094559647a1 (diff) |
Btrfs: Include the device in most error printk()s
With more than one btrfs volume mounted, it can be very difficult to find
out which volume is hitting an error. btrfs_error() will print this, but
it is currently rigged as more of a fatal error handler, while many of
the printk()s are currently for debugging and yet-unhandled cases.
This patch just changes the functions where the device information is
already available. Some cases remain where the root or fs_info is not
passed to the function emitting the error.
This may introduce some confusion with volumes backed by multiple devices
emitting errors referring to the primary device in the set instead of the
one on which the error occurred.
Use btrfs_printk(fs_info, format, ...) rather than writing the device
string every time, and introduce macro wrappers ala XFS for brevity.
Since the function already cannot be used for continuations, print a
newline as part of the btrfs_printk() message rather than at each caller.
Signed-off-by: Simon Kirby <sim@hostway.ca>
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Diffstat (limited to 'fs/btrfs/free-space-cache.c')
-rw-r--r-- | fs/btrfs/free-space-cache.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 6be083b6433e..fa1a8140bfb5 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -104,7 +104,8 @@ struct inode *lookup_free_space_inode(struct btrfs_root *root, | |||
104 | 104 | ||
105 | spin_lock(&block_group->lock); | 105 | spin_lock(&block_group->lock); |
106 | if (!((BTRFS_I(inode)->flags & flags) == flags)) { | 106 | if (!((BTRFS_I(inode)->flags & flags) == flags)) { |
107 | printk(KERN_INFO "Old style space inode found, converting.\n"); | 107 | btrfs_info(root->fs_info, |
108 | "Old style space inode found, converting."); | ||
108 | BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM | | 109 | BTRFS_I(inode)->flags |= BTRFS_INODE_NODATASUM | |
109 | BTRFS_INODE_NODATACOW; | 110 | BTRFS_INODE_NODATACOW; |
110 | block_group->disk_cache_state = BTRFS_DC_CLEAR; | 111 | block_group->disk_cache_state = BTRFS_DC_CLEAR; |
@@ -669,10 +670,11 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode, | |||
669 | btrfs_release_path(path); | 670 | btrfs_release_path(path); |
670 | 671 | ||
671 | if (BTRFS_I(inode)->generation != generation) { | 672 | if (BTRFS_I(inode)->generation != generation) { |
672 | printk(KERN_ERR "btrfs: free space inode generation (%llu) did" | 673 | btrfs_err(root->fs_info, |
673 | " not match free space cache generation (%llu)\n", | 674 | "free space inode generation (%llu) " |
674 | (unsigned long long)BTRFS_I(inode)->generation, | 675 | "did not match free space cache generation (%llu)", |
675 | (unsigned long long)generation); | 676 | (unsigned long long)BTRFS_I(inode)->generation, |
677 | (unsigned long long)generation); | ||
676 | return 0; | 678 | return 0; |
677 | } | 679 | } |
678 | 680 | ||
@@ -721,8 +723,8 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode, | |||
721 | ret = link_free_space(ctl, e); | 723 | ret = link_free_space(ctl, e); |
722 | spin_unlock(&ctl->tree_lock); | 724 | spin_unlock(&ctl->tree_lock); |
723 | if (ret) { | 725 | if (ret) { |
724 | printk(KERN_ERR "Duplicate entries in " | 726 | btrfs_err(root->fs_info, |
725 | "free space cache, dumping\n"); | 727 | "Duplicate entries in free space cache, dumping"); |
726 | kmem_cache_free(btrfs_free_space_cachep, e); | 728 | kmem_cache_free(btrfs_free_space_cachep, e); |
727 | goto free_cache; | 729 | goto free_cache; |
728 | } | 730 | } |
@@ -741,8 +743,8 @@ int __load_free_space_cache(struct btrfs_root *root, struct inode *inode, | |||
741 | ctl->op->recalc_thresholds(ctl); | 743 | ctl->op->recalc_thresholds(ctl); |
742 | spin_unlock(&ctl->tree_lock); | 744 | spin_unlock(&ctl->tree_lock); |
743 | if (ret) { | 745 | if (ret) { |
744 | printk(KERN_ERR "Duplicate entries in " | 746 | btrfs_err(root->fs_info, |
745 | "free space cache, dumping\n"); | 747 | "Duplicate entries in free space cache, dumping"); |
746 | kmem_cache_free(btrfs_free_space_cachep, e); | 748 | kmem_cache_free(btrfs_free_space_cachep, e); |
747 | goto free_cache; | 749 | goto free_cache; |
748 | } | 750 | } |
@@ -833,8 +835,8 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info, | |||
833 | 835 | ||
834 | if (!matched) { | 836 | if (!matched) { |
835 | __btrfs_remove_free_space_cache(ctl); | 837 | __btrfs_remove_free_space_cache(ctl); |
836 | printk(KERN_ERR "block group %llu has an wrong amount of free " | 838 | btrfs_err(fs_info, "block group %llu has wrong amount of free space", |
837 | "space\n", block_group->key.objectid); | 839 | block_group->key.objectid); |
838 | ret = -1; | 840 | ret = -1; |
839 | } | 841 | } |
840 | out: | 842 | out: |
@@ -845,8 +847,8 @@ out: | |||
845 | spin_unlock(&block_group->lock); | 847 | spin_unlock(&block_group->lock); |
846 | ret = 0; | 848 | ret = 0; |
847 | 849 | ||
848 | printk(KERN_ERR "btrfs: failed to load free space cache " | 850 | btrfs_err(fs_info, "failed to load free space cache for block group %llu", |
849 | "for block group %llu\n", block_group->key.objectid); | 851 | block_group->key.objectid); |
850 | } | 852 | } |
851 | 853 | ||
852 | iput(inode); | 854 | iput(inode); |
@@ -1104,8 +1106,9 @@ int btrfs_write_out_cache(struct btrfs_root *root, | |||
1104 | spin_unlock(&block_group->lock); | 1106 | spin_unlock(&block_group->lock); |
1105 | ret = 0; | 1107 | ret = 0; |
1106 | #ifdef DEBUG | 1108 | #ifdef DEBUG |
1107 | printk(KERN_ERR "btrfs: failed to write free space cache " | 1109 | btrfs_err(root->fs_info, |
1108 | "for block group %llu\n", block_group->key.objectid); | 1110 | "failed to write free space cache for block group %llu", |
1111 | block_group->key.objectid); | ||
1109 | #endif | 1112 | #endif |
1110 | } | 1113 | } |
1111 | 1114 | ||
@@ -2931,8 +2934,9 @@ int load_free_ino_cache(struct btrfs_fs_info *fs_info, struct btrfs_root *root) | |||
2931 | ret = __load_free_space_cache(root, inode, ctl, path, 0); | 2934 | ret = __load_free_space_cache(root, inode, ctl, path, 0); |
2932 | 2935 | ||
2933 | if (ret < 0) | 2936 | if (ret < 0) |
2934 | printk(KERN_ERR "btrfs: failed to load free ino cache for " | 2937 | btrfs_err(fs_info, |
2935 | "root %llu\n", root->root_key.objectid); | 2938 | "failed to load free ino cache for root %llu", |
2939 | root->root_key.objectid); | ||
2936 | out_put: | 2940 | out_put: |
2937 | iput(inode); | 2941 | iput(inode); |
2938 | out: | 2942 | out: |
@@ -2959,8 +2963,9 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root, | |||
2959 | if (ret) { | 2963 | if (ret) { |
2960 | btrfs_delalloc_release_metadata(inode, inode->i_size); | 2964 | btrfs_delalloc_release_metadata(inode, inode->i_size); |
2961 | #ifdef DEBUG | 2965 | #ifdef DEBUG |
2962 | printk(KERN_ERR "btrfs: failed to write free ino cache " | 2966 | btrfs_err(root->fs_info, |
2963 | "for root %llu\n", root->root_key.objectid); | 2967 | "failed to write free ino cache for root %llu", |
2968 | root->root_key.objectid); | ||
2964 | #endif | 2969 | #endif |
2965 | } | 2970 | } |
2966 | 2971 | ||