diff options
Diffstat (limited to 'fs/btrfs/check-integrity.c')
-rw-r--r-- | fs/btrfs/check-integrity.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index 861d472564c1..e34a71b3e225 100644 --- a/fs/btrfs/check-integrity.c +++ b/fs/btrfs/check-integrity.c | |||
@@ -95,6 +95,7 @@ | |||
95 | #include <linux/genhd.h> | 95 | #include <linux/genhd.h> |
96 | #include <linux/blkdev.h> | 96 | #include <linux/blkdev.h> |
97 | #include <linux/vmalloc.h> | 97 | #include <linux/vmalloc.h> |
98 | #include <linux/string.h> | ||
98 | #include "ctree.h" | 99 | #include "ctree.h" |
99 | #include "disk-io.h" | 100 | #include "disk-io.h" |
100 | #include "hash.h" | 101 | #include "hash.h" |
@@ -105,6 +106,7 @@ | |||
105 | #include "locking.h" | 106 | #include "locking.h" |
106 | #include "check-integrity.h" | 107 | #include "check-integrity.h" |
107 | #include "rcu-string.h" | 108 | #include "rcu-string.h" |
109 | #include "compression.h" | ||
108 | 110 | ||
109 | #define BTRFSIC_BLOCK_HASHTABLE_SIZE 0x10000 | 111 | #define BTRFSIC_BLOCK_HASHTABLE_SIZE 0x10000 |
110 | #define BTRFSIC_BLOCK_LINK_HASHTABLE_SIZE 0x10000 | 112 | #define BTRFSIC_BLOCK_LINK_HASHTABLE_SIZE 0x10000 |
@@ -176,7 +178,7 @@ struct btrfsic_block { | |||
176 | * Elements of this type are allocated dynamically and required because | 178 | * Elements of this type are allocated dynamically and required because |
177 | * each block object can refer to and can be ref from multiple blocks. | 179 | * each block object can refer to and can be ref from multiple blocks. |
178 | * The key to lookup them in the hashtable is the dev_bytenr of | 180 | * The key to lookup them in the hashtable is the dev_bytenr of |
179 | * the block ref to plus the one from the block refered from. | 181 | * the block ref to plus the one from the block referred from. |
180 | * The fact that they are searchable via a hashtable and that a | 182 | * The fact that they are searchable via a hashtable and that a |
181 | * ref_cnt is maintained is not required for the btrfs integrity | 183 | * ref_cnt is maintained is not required for the btrfs integrity |
182 | * check algorithm itself, it is only used to make the output more | 184 | * check algorithm itself, it is only used to make the output more |
@@ -3076,7 +3078,7 @@ int btrfsic_mount(struct btrfs_root *root, | |||
3076 | 3078 | ||
3077 | list_for_each_entry(device, dev_head, dev_list) { | 3079 | list_for_each_entry(device, dev_head, dev_list) { |
3078 | struct btrfsic_dev_state *ds; | 3080 | struct btrfsic_dev_state *ds; |
3079 | char *p; | 3081 | const char *p; |
3080 | 3082 | ||
3081 | if (!device->bdev || !device->name) | 3083 | if (!device->bdev || !device->name) |
3082 | continue; | 3084 | continue; |
@@ -3092,11 +3094,7 @@ int btrfsic_mount(struct btrfs_root *root, | |||
3092 | ds->state = state; | 3094 | ds->state = state; |
3093 | bdevname(ds->bdev, ds->name); | 3095 | bdevname(ds->bdev, ds->name); |
3094 | ds->name[BDEVNAME_SIZE - 1] = '\0'; | 3096 | ds->name[BDEVNAME_SIZE - 1] = '\0'; |
3095 | for (p = ds->name; *p != '\0'; p++); | 3097 | p = kbasename(ds->name); |
3096 | while (p > ds->name && *p != '/') | ||
3097 | p--; | ||
3098 | if (*p == '/') | ||
3099 | p++; | ||
3100 | strlcpy(ds->name, p, sizeof(ds->name)); | 3098 | strlcpy(ds->name, p, sizeof(ds->name)); |
3101 | btrfsic_dev_state_hashtable_add(ds, | 3099 | btrfsic_dev_state_hashtable_add(ds, |
3102 | &btrfsic_dev_state_hashtable); | 3100 | &btrfsic_dev_state_hashtable); |