aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/persistent-data
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 00:19:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 00:19:53 -0500
commite0700ce70921fbe3d1913968c663beb9df2b01a9 (patch)
tree8f8163dbdce74942a6ebe849c43c4fdcf2b52799 /drivers/md/persistent-data
parentac322de6bf5416cb145b58599297b8be73cd86ac (diff)
parentaad9ae4550755edc020b5c511a8b54f0104b2f47 (diff)
Merge tag 'dm-4.4-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm
Pull device mapper updates from Mike Snitzer: "Smaller set of DM changes for this merge. I've based these changes on Jens' for-4.4/reservations branch because the associated DM changes required it. - Revert a dm-multipath change that caused a regression for unprivledged users (e.g. kvm guests) that issued ioctls when a multipath device had no available paths. - Include Christoph's refactoring of DM's ioctl handling and add support for passing through persistent reservations with DM multipath. - All other changes are very simple cleanups" * tag 'dm-4.4-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm: dm switch: simplify conditional in alloc_region_table() dm delay: document that offsets are specified in sectors dm delay: capitalize the start of an delay_ctr() error message dm delay: Use DM_MAPIO macros instead of open-coded equivalents dm linear: remove redundant target name from error messages dm persistent data: eliminate unnecessary return values dm: eliminate unused "bioset" process for each bio-based DM device dm: convert ffs to __ffs dm: drop NULL test before kmem_cache_destroy() and mempool_destroy() dm: add support for passing through persistent reservations dm: refactor ioctl handling Revert "dm mpath: fix stalls when handling invalid ioctls" dm: initialize non-blk-mq queue data before queue is used
Diffstat (limited to 'drivers/md/persistent-data')
-rw-r--r--drivers/md/persistent-data/dm-array.c4
-rw-r--r--drivers/md/persistent-data/dm-block-manager.c4
-rw-r--r--drivers/md/persistent-data/dm-block-manager.h2
-rw-r--r--drivers/md/persistent-data/dm-btree-internal.h2
-rw-r--r--drivers/md/persistent-data/dm-btree-remove.c36
-rw-r--r--drivers/md/persistent-data/dm-btree-spine.c20
-rw-r--r--drivers/md/persistent-data/dm-btree.c4
-rw-r--r--drivers/md/persistent-data/dm-space-map-common.c32
-rw-r--r--drivers/md/persistent-data/dm-transaction-manager.c4
-rw-r--r--drivers/md/persistent-data/dm-transaction-manager.h2
10 files changed, 42 insertions, 68 deletions
diff --git a/drivers/md/persistent-data/dm-array.c b/drivers/md/persistent-data/dm-array.c
index e64b61ad0ef3..431a03067d64 100644
--- a/drivers/md/persistent-data/dm-array.c
+++ b/drivers/md/persistent-data/dm-array.c
@@ -233,9 +233,9 @@ static int get_ablock(struct dm_array_info *info, dm_block_t b,
233/* 233/*
234 * Unlocks an array block. 234 * Unlocks an array block.
235 */ 235 */
236static int unlock_ablock(struct dm_array_info *info, struct dm_block *block) 236static void unlock_ablock(struct dm_array_info *info, struct dm_block *block)
237{ 237{
238 return dm_tm_unlock(info->btree_info.tm, block); 238 dm_tm_unlock(info->btree_info.tm, block);
239} 239}
240 240
241/*----------------------------------------------------------------*/ 241/*----------------------------------------------------------------*/
diff --git a/drivers/md/persistent-data/dm-block-manager.c b/drivers/md/persistent-data/dm-block-manager.c
index 88dbe7b97c2c..f2393ba838eb 100644
--- a/drivers/md/persistent-data/dm-block-manager.c
+++ b/drivers/md/persistent-data/dm-block-manager.c
@@ -578,7 +578,7 @@ int dm_bm_write_lock_zero(struct dm_block_manager *bm,
578} 578}
579EXPORT_SYMBOL_GPL(dm_bm_write_lock_zero); 579EXPORT_SYMBOL_GPL(dm_bm_write_lock_zero);
580 580
581int dm_bm_unlock(struct dm_block *b) 581void dm_bm_unlock(struct dm_block *b)
582{ 582{
583 struct buffer_aux *aux; 583 struct buffer_aux *aux;
584 aux = dm_bufio_get_aux_data(to_buffer(b)); 584 aux = dm_bufio_get_aux_data(to_buffer(b));
@@ -590,8 +590,6 @@ int dm_bm_unlock(struct dm_block *b)
590 bl_up_read(&aux->lock); 590 bl_up_read(&aux->lock);
591 591
592 dm_bufio_release(to_buffer(b)); 592 dm_bufio_release(to_buffer(b));
593
594 return 0;
595} 593}
596EXPORT_SYMBOL_GPL(dm_bm_unlock); 594EXPORT_SYMBOL_GPL(dm_bm_unlock);
597 595
diff --git a/drivers/md/persistent-data/dm-block-manager.h b/drivers/md/persistent-data/dm-block-manager.h
index 84330f59886d..3627d1b7667a 100644
--- a/drivers/md/persistent-data/dm-block-manager.h
+++ b/drivers/md/persistent-data/dm-block-manager.h
@@ -94,7 +94,7 @@ int dm_bm_write_lock_zero(struct dm_block_manager *bm, dm_block_t b,
94 struct dm_block_validator *v, 94 struct dm_block_validator *v,
95 struct dm_block **result); 95 struct dm_block **result);
96 96
97int dm_bm_unlock(struct dm_block *b); 97void dm_bm_unlock(struct dm_block *b);
98 98
99/* 99/*
100 * It's a common idiom to have a superblock that should be committed last. 100 * It's a common idiom to have a superblock that should be committed last.
diff --git a/drivers/md/persistent-data/dm-btree-internal.h b/drivers/md/persistent-data/dm-btree-internal.h
index 8731b6ea026b..a240990a7f33 100644
--- a/drivers/md/persistent-data/dm-btree-internal.h
+++ b/drivers/md/persistent-data/dm-btree-internal.h
@@ -52,7 +52,7 @@ void inc_children(struct dm_transaction_manager *tm, struct btree_node *n,
52 struct dm_btree_value_type *vt); 52 struct dm_btree_value_type *vt);
53 53
54int new_block(struct dm_btree_info *info, struct dm_block **result); 54int new_block(struct dm_btree_info *info, struct dm_block **result);
55int unlock_block(struct dm_btree_info *info, struct dm_block *b); 55void unlock_block(struct dm_btree_info *info, struct dm_block *b);
56 56
57/* 57/*
58 * Spines keep track of the rolling locks. There are 2 variants, read-only 58 * Spines keep track of the rolling locks. There are 2 variants, read-only
diff --git a/drivers/md/persistent-data/dm-btree-remove.c b/drivers/md/persistent-data/dm-btree-remove.c
index 2e4c4cb79e4d..21ea537bd55e 100644
--- a/drivers/md/persistent-data/dm-btree-remove.c
+++ b/drivers/md/persistent-data/dm-btree-remove.c
@@ -165,9 +165,9 @@ static int init_child(struct dm_btree_info *info, struct dm_btree_value_type *vt
165 return 0; 165 return 0;
166} 166}
167 167
168static int exit_child(struct dm_btree_info *info, struct child *c) 168static void exit_child(struct dm_btree_info *info, struct child *c)
169{ 169{
170 return dm_tm_unlock(info->tm, c->block); 170 dm_tm_unlock(info->tm, c->block);
171} 171}
172 172
173static void shift(struct btree_node *left, struct btree_node *right, int count) 173static void shift(struct btree_node *left, struct btree_node *right, int count)
@@ -249,13 +249,10 @@ static int rebalance2(struct shadow_spine *s, struct dm_btree_info *info,
249 249
250 __rebalance2(info, parent, &left, &right); 250 __rebalance2(info, parent, &left, &right);
251 251
252 r = exit_child(info, &left); 252 exit_child(info, &left);
253 if (r) { 253 exit_child(info, &right);
254 exit_child(info, &right);
255 return r;
256 }
257 254
258 return exit_child(info, &right); 255 return 0;
259} 256}
260 257
261/* 258/*
@@ -394,22 +391,9 @@ static int rebalance3(struct shadow_spine *s, struct dm_btree_info *info,
394 391
395 __rebalance3(info, parent, &left, &center, &right); 392 __rebalance3(info, parent, &left, &center, &right);
396 393
397 r = exit_child(info, &left); 394 exit_child(info, &left);
398 if (r) { 395 exit_child(info, &center);
399 exit_child(info, &center); 396 exit_child(info, &right);
400 exit_child(info, &right);
401 return r;
402 }
403
404 r = exit_child(info, &center);
405 if (r) {
406 exit_child(info, &right);
407 return r;
408 }
409
410 r = exit_child(info, &right);
411 if (r)
412 return r;
413 397
414 return 0; 398 return 0;
415} 399}
@@ -433,9 +417,7 @@ static int rebalance_children(struct shadow_spine *s,
433 417
434 memcpy(n, dm_block_data(child), 418 memcpy(n, dm_block_data(child),
435 dm_bm_block_size(dm_tm_get_bm(info->tm))); 419 dm_bm_block_size(dm_tm_get_bm(info->tm)));
436 r = dm_tm_unlock(info->tm, child); 420 dm_tm_unlock(info->tm, child);
437 if (r)
438 return r;
439 421
440 dm_tm_dec(info->tm, dm_block_location(child)); 422 dm_tm_dec(info->tm, dm_block_location(child));
441 return 0; 423 return 0;
diff --git a/drivers/md/persistent-data/dm-btree-spine.c b/drivers/md/persistent-data/dm-btree-spine.c
index 0dee514ba4c5..b27b8091a1ca 100644
--- a/drivers/md/persistent-data/dm-btree-spine.c
+++ b/drivers/md/persistent-data/dm-btree-spine.c
@@ -117,9 +117,9 @@ int new_block(struct dm_btree_info *info, struct dm_block **result)
117 return dm_tm_new_block(info->tm, &btree_node_validator, result); 117 return dm_tm_new_block(info->tm, &btree_node_validator, result);
118} 118}
119 119
120int unlock_block(struct dm_btree_info *info, struct dm_block *b) 120void unlock_block(struct dm_btree_info *info, struct dm_block *b)
121{ 121{
122 return dm_tm_unlock(info->tm, b); 122 dm_tm_unlock(info->tm, b);
123} 123}
124 124
125/*----------------------------------------------------------------*/ 125/*----------------------------------------------------------------*/
@@ -137,9 +137,7 @@ int exit_ro_spine(struct ro_spine *s)
137 int r = 0, i; 137 int r = 0, i;
138 138
139 for (i = 0; i < s->count; i++) { 139 for (i = 0; i < s->count; i++) {
140 int r2 = unlock_block(s->info, s->nodes[i]); 140 unlock_block(s->info, s->nodes[i]);
141 if (r2 < 0)
142 r = r2;
143 } 141 }
144 142
145 return r; 143 return r;
@@ -150,9 +148,7 @@ int ro_step(struct ro_spine *s, dm_block_t new_child)
150 int r; 148 int r;
151 149
152 if (s->count == 2) { 150 if (s->count == 2) {
153 r = unlock_block(s->info, s->nodes[0]); 151 unlock_block(s->info, s->nodes[0]);
154 if (r < 0)
155 return r;
156 s->nodes[0] = s->nodes[1]; 152 s->nodes[0] = s->nodes[1];
157 s->count--; 153 s->count--;
158 } 154 }
@@ -194,9 +190,7 @@ int exit_shadow_spine(struct shadow_spine *s)
194 int r = 0, i; 190 int r = 0, i;
195 191
196 for (i = 0; i < s->count; i++) { 192 for (i = 0; i < s->count; i++) {
197 int r2 = unlock_block(s->info, s->nodes[i]); 193 unlock_block(s->info, s->nodes[i]);
198 if (r2 < 0)
199 r = r2;
200 } 194 }
201 195
202 return r; 196 return r;
@@ -208,9 +202,7 @@ int shadow_step(struct shadow_spine *s, dm_block_t b,
208 int r; 202 int r;
209 203
210 if (s->count == 2) { 204 if (s->count == 2) {
211 r = unlock_block(s->info, s->nodes[0]); 205 unlock_block(s->info, s->nodes[0]);
212 if (r < 0)
213 return r;
214 s->nodes[0] = s->nodes[1]; 206 s->nodes[0] = s->nodes[1];
215 s->count--; 207 s->count--;
216 } 208 }
diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c
index 0e09aef43998..c573402033b2 100644
--- a/drivers/md/persistent-data/dm-btree.c
+++ b/drivers/md/persistent-data/dm-btree.c
@@ -141,7 +141,9 @@ int dm_btree_empty(struct dm_btree_info *info, dm_block_t *root)
141 n->header.value_size = cpu_to_le32(info->value_type.size); 141 n->header.value_size = cpu_to_le32(info->value_type.size);
142 142
143 *root = dm_block_location(b); 143 *root = dm_block_location(b);
144 return unlock_block(info, b); 144 unlock_block(info, b);
145
146 return 0;
145} 147}
146EXPORT_SYMBOL_GPL(dm_btree_empty); 148EXPORT_SYMBOL_GPL(dm_btree_empty);
147 149
diff --git a/drivers/md/persistent-data/dm-space-map-common.c b/drivers/md/persistent-data/dm-space-map-common.c
index aacbe70c2c2e..306d2e4502c4 100644
--- a/drivers/md/persistent-data/dm-space-map-common.c
+++ b/drivers/md/persistent-data/dm-space-map-common.c
@@ -259,9 +259,7 @@ int sm_ll_extend(struct ll_disk *ll, dm_block_t extra_blocks)
259 259
260 idx.blocknr = cpu_to_le64(dm_block_location(b)); 260 idx.blocknr = cpu_to_le64(dm_block_location(b));
261 261
262 r = dm_tm_unlock(ll->tm, b); 262 dm_tm_unlock(ll->tm, b);
263 if (r < 0)
264 return r;
265 263
266 idx.nr_free = cpu_to_le32(ll->entries_per_block); 264 idx.nr_free = cpu_to_le32(ll->entries_per_block);
267 idx.none_free_before = 0; 265 idx.none_free_before = 0;
@@ -293,7 +291,9 @@ int sm_ll_lookup_bitmap(struct ll_disk *ll, dm_block_t b, uint32_t *result)
293 291
294 *result = sm_lookup_bitmap(dm_bitmap_data(blk), b); 292 *result = sm_lookup_bitmap(dm_bitmap_data(blk), b);
295 293
296 return dm_tm_unlock(ll->tm, blk); 294 dm_tm_unlock(ll->tm, blk);
295
296 return 0;
297} 297}
298 298
299static int sm_ll_lookup_big_ref_count(struct ll_disk *ll, dm_block_t b, 299static int sm_ll_lookup_big_ref_count(struct ll_disk *ll, dm_block_t b,
@@ -373,9 +373,7 @@ int sm_ll_find_free_block(struct ll_disk *ll, dm_block_t begin,
373 return r; 373 return r;
374 } 374 }
375 375
376 r = dm_tm_unlock(ll->tm, blk); 376 dm_tm_unlock(ll->tm, blk);
377 if (r < 0)
378 return r;
379 377
380 *result = i * ll->entries_per_block + (dm_block_t) position; 378 *result = i * ll->entries_per_block + (dm_block_t) position;
381 return 0; 379 return 0;
@@ -429,9 +427,7 @@ static int sm_ll_mutate(struct ll_disk *ll, dm_block_t b,
429 if (ref_count <= 2) { 427 if (ref_count <= 2) {
430 sm_set_bitmap(bm_le, bit, ref_count); 428 sm_set_bitmap(bm_le, bit, ref_count);
431 429
432 r = dm_tm_unlock(ll->tm, nb); 430 dm_tm_unlock(ll->tm, nb);
433 if (r < 0)
434 return r;
435 431
436 if (old > 2) { 432 if (old > 2) {
437 r = dm_btree_remove(&ll->ref_count_info, 433 r = dm_btree_remove(&ll->ref_count_info,
@@ -445,9 +441,7 @@ static int sm_ll_mutate(struct ll_disk *ll, dm_block_t b,
445 __le32 le_rc = cpu_to_le32(ref_count); 441 __le32 le_rc = cpu_to_le32(ref_count);
446 442
447 sm_set_bitmap(bm_le, bit, 3); 443 sm_set_bitmap(bm_le, bit, 3);
448 r = dm_tm_unlock(ll->tm, nb); 444 dm_tm_unlock(ll->tm, nb);
449 if (r < 0)
450 return r;
451 445
452 __dm_bless_for_disk(&le_rc); 446 __dm_bless_for_disk(&le_rc);
453 r = dm_btree_insert(&ll->ref_count_info, ll->ref_count_root, 447 r = dm_btree_insert(&ll->ref_count_info, ll->ref_count_root,
@@ -556,7 +550,9 @@ static int metadata_ll_init_index(struct ll_disk *ll)
556 memcpy(dm_block_data(b), &ll->mi_le, sizeof(ll->mi_le)); 550 memcpy(dm_block_data(b), &ll->mi_le, sizeof(ll->mi_le));
557 ll->bitmap_root = dm_block_location(b); 551 ll->bitmap_root = dm_block_location(b);
558 552
559 return dm_tm_unlock(ll->tm, b); 553 dm_tm_unlock(ll->tm, b);
554
555 return 0;
560} 556}
561 557
562static int metadata_ll_open(struct ll_disk *ll) 558static int metadata_ll_open(struct ll_disk *ll)
@@ -570,7 +566,9 @@ static int metadata_ll_open(struct ll_disk *ll)
570 return r; 566 return r;
571 567
572 memcpy(&ll->mi_le, dm_block_data(block), sizeof(ll->mi_le)); 568 memcpy(&ll->mi_le, dm_block_data(block), sizeof(ll->mi_le));
573 return dm_tm_unlock(ll->tm, block); 569 dm_tm_unlock(ll->tm, block);
570
571 return 0;
574} 572}
575 573
576static dm_block_t metadata_ll_max_entries(struct ll_disk *ll) 574static dm_block_t metadata_ll_max_entries(struct ll_disk *ll)
@@ -590,7 +588,9 @@ static int metadata_ll_commit(struct ll_disk *ll)
590 memcpy(dm_block_data(b), &ll->mi_le, sizeof(ll->mi_le)); 588 memcpy(dm_block_data(b), &ll->mi_le, sizeof(ll->mi_le));
591 ll->bitmap_root = dm_block_location(b); 589 ll->bitmap_root = dm_block_location(b);
592 590
593 return dm_tm_unlock(ll->tm, b); 591 dm_tm_unlock(ll->tm, b);
592
593 return 0;
594} 594}
595 595
596int sm_ll_new_metadata(struct ll_disk *ll, struct dm_transaction_manager *tm) 596int sm_ll_new_metadata(struct ll_disk *ll, struct dm_transaction_manager *tm)
diff --git a/drivers/md/persistent-data/dm-transaction-manager.c b/drivers/md/persistent-data/dm-transaction-manager.c
index 9cb797d800cf..abe2c5dd0993 100644
--- a/drivers/md/persistent-data/dm-transaction-manager.c
+++ b/drivers/md/persistent-data/dm-transaction-manager.c
@@ -342,9 +342,9 @@ int dm_tm_read_lock(struct dm_transaction_manager *tm, dm_block_t b,
342} 342}
343EXPORT_SYMBOL_GPL(dm_tm_read_lock); 343EXPORT_SYMBOL_GPL(dm_tm_read_lock);
344 344
345int dm_tm_unlock(struct dm_transaction_manager *tm, struct dm_block *b) 345void dm_tm_unlock(struct dm_transaction_manager *tm, struct dm_block *b)
346{ 346{
347 return dm_bm_unlock(b); 347 dm_bm_unlock(b);
348} 348}
349EXPORT_SYMBOL_GPL(dm_tm_unlock); 349EXPORT_SYMBOL_GPL(dm_tm_unlock);
350 350
diff --git a/drivers/md/persistent-data/dm-transaction-manager.h b/drivers/md/persistent-data/dm-transaction-manager.h
index 2e0d4d66fb1b..f3a18be68f30 100644
--- a/drivers/md/persistent-data/dm-transaction-manager.h
+++ b/drivers/md/persistent-data/dm-transaction-manager.h
@@ -94,7 +94,7 @@ int dm_tm_read_lock(struct dm_transaction_manager *tm, dm_block_t b,
94 struct dm_block_validator *v, 94 struct dm_block_validator *v,
95 struct dm_block **result); 95 struct dm_block **result);
96 96
97int dm_tm_unlock(struct dm_transaction_manager *tm, struct dm_block *b); 97void dm_tm_unlock(struct dm_transaction_manager *tm, struct dm_block *b);
98 98
99/* 99/*
100 * Functions for altering the reference count of a block directly. 100 * Functions for altering the reference count of a block directly.