diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-21 20:08:06 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-21 20:08:06 -0500 |
| commit | b49249d10324d0fd6fb29725c2807dfd80d0edbc (patch) | |
| tree | 9a8fa724e6c9f9283530979c6e32a311c74999d5 /drivers/md/persistent-data | |
| parent | 10532b560bacf23766f9c7dc09778b31b198ff45 (diff) | |
| parent | 45e621d45e24ffc4cb2b2935e8438987b860063a (diff) | |
Merge tag 'dm-3.8-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm
Pull dm update from Alasdair G Kergon:
"Miscellaneous device-mapper fixes, cleanups and performance
improvements.
Of particular note:
- Disable broken WRITE SAME support in all targets except linear and
striped. Use it when kcopyd is zeroing blocks.
- Remove several mempools from targets by moving the data into the
bio's new front_pad area(which dm calls 'per_bio_data').
- Fix a race in thin provisioning if discards are misused.
- Prevent userspace from interfering with the ioctl parameters and
use kmalloc for the data buffer if it's small instead of vmalloc.
- Throttle some annoying error messages when I/O fails."
* tag 'dm-3.8-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-dm: (36 commits)
dm stripe: add WRITE SAME support
dm: remove map_info
dm snapshot: do not use map_context
dm thin: dont use map_context
dm raid1: dont use map_context
dm flakey: dont use map_context
dm raid1: rename read_record to bio_record
dm: move target request nr to dm_target_io
dm snapshot: use per_bio_data
dm verity: use per_bio_data
dm raid1: use per_bio_data
dm: introduce per_bio_data
dm kcopyd: add WRITE SAME support to dm_kcopyd_zero
dm linear: add WRITE SAME support
dm: add WRITE SAME support
dm: prepare to support WRITE SAME
dm ioctl: use kmalloc if possible
dm ioctl: remove PF_MEMALLOC
dm persistent data: improve improve space map block alloc failure message
dm thin: use DMERR_LIMIT for errors
...
Diffstat (limited to 'drivers/md/persistent-data')
| -rw-r--r-- | drivers/md/persistent-data/dm-block-manager.c | 12 | ||||
| -rw-r--r-- | drivers/md/persistent-data/dm-btree-internal.h | 16 | ||||
| -rw-r--r-- | drivers/md/persistent-data/dm-btree-remove.c | 50 | ||||
| -rw-r--r-- | drivers/md/persistent-data/dm-btree-spine.c | 20 | ||||
| -rw-r--r-- | drivers/md/persistent-data/dm-btree.c | 31 | ||||
| -rw-r--r-- | drivers/md/persistent-data/dm-space-map-common.c | 16 | ||||
| -rw-r--r-- | drivers/md/persistent-data/dm-space-map-metadata.c | 2 |
7 files changed, 77 insertions, 70 deletions
diff --git a/drivers/md/persistent-data/dm-block-manager.c b/drivers/md/persistent-data/dm-block-manager.c index a3ae09124a67..28c3ed072a79 100644 --- a/drivers/md/persistent-data/dm-block-manager.c +++ b/drivers/md/persistent-data/dm-block-manager.c | |||
| @@ -428,15 +428,17 @@ static int dm_bm_validate_buffer(struct dm_block_manager *bm, | |||
| 428 | if (!v) | 428 | if (!v) |
| 429 | return 0; | 429 | return 0; |
| 430 | r = v->check(v, (struct dm_block *) buf, dm_bufio_get_block_size(bm->bufio)); | 430 | r = v->check(v, (struct dm_block *) buf, dm_bufio_get_block_size(bm->bufio)); |
| 431 | if (unlikely(r)) | 431 | if (unlikely(r)) { |
| 432 | DMERR_LIMIT("%s validator check failed for block %llu", v->name, | ||
| 433 | (unsigned long long) dm_bufio_get_block_number(buf)); | ||
| 432 | return r; | 434 | return r; |
| 435 | } | ||
| 433 | aux->validator = v; | 436 | aux->validator = v; |
| 434 | } else { | 437 | } else { |
| 435 | if (unlikely(aux->validator != v)) { | 438 | if (unlikely(aux->validator != v)) { |
| 436 | DMERR("validator mismatch (old=%s vs new=%s) for block %llu", | 439 | DMERR_LIMIT("validator mismatch (old=%s vs new=%s) for block %llu", |
| 437 | aux->validator->name, v ? v->name : "NULL", | 440 | aux->validator->name, v ? v->name : "NULL", |
| 438 | (unsigned long long) | 441 | (unsigned long long) dm_bufio_get_block_number(buf)); |
| 439 | dm_bufio_get_block_number(buf)); | ||
| 440 | return -EINVAL; | 442 | return -EINVAL; |
| 441 | } | 443 | } |
| 442 | } | 444 | } |
diff --git a/drivers/md/persistent-data/dm-btree-internal.h b/drivers/md/persistent-data/dm-btree-internal.h index 5709bfeab1e8..accbb05f17b6 100644 --- a/drivers/md/persistent-data/dm-btree-internal.h +++ b/drivers/md/persistent-data/dm-btree-internal.h | |||
| @@ -36,13 +36,13 @@ struct node_header { | |||
| 36 | __le32 padding; | 36 | __le32 padding; |
| 37 | } __packed; | 37 | } __packed; |
| 38 | 38 | ||
| 39 | struct node { | 39 | struct btree_node { |
| 40 | struct node_header header; | 40 | struct node_header header; |
| 41 | __le64 keys[0]; | 41 | __le64 keys[0]; |
| 42 | } __packed; | 42 | } __packed; |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | void inc_children(struct dm_transaction_manager *tm, struct node *n, | 45 | void inc_children(struct dm_transaction_manager *tm, struct btree_node *n, |
| 46 | struct dm_btree_value_type *vt); | 46 | struct dm_btree_value_type *vt); |
| 47 | 47 | ||
| 48 | int new_block(struct dm_btree_info *info, struct dm_block **result); | 48 | int new_block(struct dm_btree_info *info, struct dm_block **result); |
| @@ -64,7 +64,7 @@ struct ro_spine { | |||
| 64 | void init_ro_spine(struct ro_spine *s, struct dm_btree_info *info); | 64 | void init_ro_spine(struct ro_spine *s, struct dm_btree_info *info); |
| 65 | int exit_ro_spine(struct ro_spine *s); | 65 | int exit_ro_spine(struct ro_spine *s); |
| 66 | int ro_step(struct ro_spine *s, dm_block_t new_child); | 66 | int ro_step(struct ro_spine *s, dm_block_t new_child); |
| 67 | struct node *ro_node(struct ro_spine *s); | 67 | struct btree_node *ro_node(struct ro_spine *s); |
| 68 | 68 | ||
| 69 | struct shadow_spine { | 69 | struct shadow_spine { |
| 70 | struct dm_btree_info *info; | 70 | struct dm_btree_info *info; |
| @@ -98,17 +98,17 @@ int shadow_root(struct shadow_spine *s); | |||
| 98 | /* | 98 | /* |
| 99 | * Some inlines. | 99 | * Some inlines. |
| 100 | */ | 100 | */ |
| 101 | static inline __le64 *key_ptr(struct node *n, uint32_t index) | 101 | static inline __le64 *key_ptr(struct btree_node *n, uint32_t index) |
| 102 | { | 102 | { |
| 103 | return n->keys + index; | 103 | return n->keys + index; |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | static inline void *value_base(struct node *n) | 106 | static inline void *value_base(struct btree_node *n) |
| 107 | { | 107 | { |
| 108 | return &n->keys[le32_to_cpu(n->header.max_entries)]; | 108 | return &n->keys[le32_to_cpu(n->header.max_entries)]; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | static inline void *value_ptr(struct node *n, uint32_t index) | 111 | static inline void *value_ptr(struct btree_node *n, uint32_t index) |
| 112 | { | 112 | { |
| 113 | uint32_t value_size = le32_to_cpu(n->header.value_size); | 113 | uint32_t value_size = le32_to_cpu(n->header.value_size); |
| 114 | return value_base(n) + (value_size * index); | 114 | return value_base(n) + (value_size * index); |
| @@ -117,7 +117,7 @@ static inline void *value_ptr(struct node *n, uint32_t index) | |||
| 117 | /* | 117 | /* |
| 118 | * Assumes the values are suitably-aligned and converts to core format. | 118 | * Assumes the values are suitably-aligned and converts to core format. |
| 119 | */ | 119 | */ |
| 120 | static inline uint64_t value64(struct node *n, uint32_t index) | 120 | static inline uint64_t value64(struct btree_node *n, uint32_t index) |
| 121 | { | 121 | { |
| 122 | __le64 *values_le = value_base(n); | 122 | __le64 *values_le = value_base(n); |
| 123 | 123 | ||
| @@ -127,7 +127,7 @@ static inline uint64_t value64(struct node *n, uint32_t index) | |||
| 127 | /* | 127 | /* |
| 128 | * Searching for a key within a single node. | 128 | * Searching for a key within a single node. |
| 129 | */ | 129 | */ |
| 130 | int lower_bound(struct node *n, uint64_t key); | 130 | int lower_bound(struct btree_node *n, uint64_t key); |
| 131 | 131 | ||
| 132 | extern struct dm_block_validator btree_node_validator; | 132 | extern struct dm_block_validator btree_node_validator; |
| 133 | 133 | ||
diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c index aa71e2359a07..c4f28133ef82 100644 --- a/drivers/md/persistent-data/dm-btree-remove.c +++ b/drivers/md/persistent-data/dm-btree-remove.c | |||
| @@ -53,7 +53,7 @@ | |||
| 53 | /* | 53 | /* |
| 54 | * Some little utilities for moving node data around. | 54 | * Some little utilities for moving node data around. |
| 55 | */ | 55 | */ |
| 56 | static void node_shift(struct node *n, int shift) | 56 | static void node_shift(struct btree_node *n, int shift) |
| 57 | { | 57 | { |
| 58 | uint32_t nr_entries = le32_to_cpu(n->header.nr_entries); | 58 | uint32_t nr_entries = le32_to_cpu(n->header.nr_entries); |
| 59 | uint32_t value_size = le32_to_cpu(n->header.value_size); | 59 | uint32_t value_size = le32_to_cpu(n->header.value_size); |
| @@ -79,7 +79,7 @@ static void node_shift(struct node *n, int shift) | |||
| 79 | } | 79 | } |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | static void node_copy(struct node *left, struct node *right, int shift) | 82 | static void node_copy(struct btree_node *left, struct btree_node *right, int shift) |
| 83 | { | 83 | { |
| 84 | uint32_t nr_left = le32_to_cpu(left->header.nr_entries); | 84 | uint32_t nr_left = le32_to_cpu(left->header.nr_entries); |
| 85 | uint32_t value_size = le32_to_cpu(left->header.value_size); | 85 | uint32_t value_size = le32_to_cpu(left->header.value_size); |
| @@ -108,7 +108,7 @@ static void node_copy(struct node *left, struct node *right, int shift) | |||
| 108 | /* | 108 | /* |
| 109 | * Delete a specific entry from a leaf node. | 109 | * Delete a specific entry from a leaf node. |
| 110 | */ | 110 | */ |
| 111 | static void delete_at(struct node *n, unsigned index) | 111 | static void delete_at(struct btree_node *n, unsigned index) |
| 112 | { | 112 | { |
| 113 | unsigned nr_entries = le32_to_cpu(n->header.nr_entries); | 113 | unsigned nr_entries = le32_to_cpu(n->header.nr_entries); |
| 114 | unsigned nr_to_copy = nr_entries - (index + 1); | 114 | unsigned nr_to_copy = nr_entries - (index + 1); |
| @@ -128,7 +128,7 @@ static void delete_at(struct node *n, unsigned index) | |||
| 128 | n->header.nr_entries = cpu_to_le32(nr_entries - 1); | 128 | n->header.nr_entries = cpu_to_le32(nr_entries - 1); |
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | static unsigned merge_threshold(struct node *n) | 131 | static unsigned merge_threshold(struct btree_node *n) |
| 132 | { | 132 | { |
| 133 | return le32_to_cpu(n->header.max_entries) / 3; | 133 | return le32_to_cpu(n->header.max_entries) / 3; |
| 134 | } | 134 | } |
| @@ -136,7 +136,7 @@ static unsigned merge_threshold(struct node *n) | |||
| 136 | struct child { | 136 | struct child { |
| 137 | unsigned index; | 137 | unsigned index; |
| 138 | struct dm_block *block; | 138 | struct dm_block *block; |
| 139 | struct node *n; | 139 | struct btree_node *n; |
| 140 | }; | 140 | }; |
| 141 | 141 | ||
| 142 | static struct dm_btree_value_type le64_type = { | 142 | static struct dm_btree_value_type le64_type = { |
| @@ -147,7 +147,7 @@ static struct dm_btree_value_type le64_type = { | |||
| 147 | .equal = NULL | 147 | .equal = NULL |
| 148 | }; | 148 | }; |
| 149 | 149 | ||
| 150 | static int init_child(struct dm_btree_info *info, struct node *parent, | 150 | static int init_child(struct dm_btree_info *info, |
