| .. | .. |
|---|
| 35 | 35 | #define MAX_HOLDERS 4 |
|---|
| 36 | 36 | #define MAX_STACK 10 |
|---|
| 37 | 37 | |
|---|
| 38 | | -typedef unsigned long stack_entries[MAX_STACK]; |
|---|
| 38 | +struct stack_store { |
|---|
| 39 | + unsigned int nr_entries; |
|---|
| 40 | + unsigned long entries[MAX_STACK]; |
|---|
| 41 | +}; |
|---|
| 39 | 42 | |
|---|
| 40 | 43 | struct block_lock { |
|---|
| 41 | 44 | spinlock_t lock; |
|---|
| .. | .. |
|---|
| 44 | 47 | struct task_struct *holders[MAX_HOLDERS]; |
|---|
| 45 | 48 | |
|---|
| 46 | 49 | #ifdef CONFIG_DM_DEBUG_BLOCK_STACK_TRACING |
|---|
| 47 | | - struct stack_trace traces[MAX_HOLDERS]; |
|---|
| 48 | | - stack_entries entries[MAX_HOLDERS]; |
|---|
| 50 | + struct stack_store traces[MAX_HOLDERS]; |
|---|
| 49 | 51 | #endif |
|---|
| 50 | 52 | }; |
|---|
| 51 | 53 | |
|---|
| .. | .. |
|---|
| 73 | 75 | { |
|---|
| 74 | 76 | unsigned h = __find_holder(lock, NULL); |
|---|
| 75 | 77 | #ifdef CONFIG_DM_DEBUG_BLOCK_STACK_TRACING |
|---|
| 76 | | - struct stack_trace *t; |
|---|
| 78 | + struct stack_store *t; |
|---|
| 77 | 79 | #endif |
|---|
| 78 | 80 | |
|---|
| 79 | 81 | get_task_struct(task); |
|---|
| .. | .. |
|---|
| 81 | 83 | |
|---|
| 82 | 84 | #ifdef CONFIG_DM_DEBUG_BLOCK_STACK_TRACING |
|---|
| 83 | 85 | t = lock->traces + h; |
|---|
| 84 | | - t->nr_entries = 0; |
|---|
| 85 | | - t->max_entries = MAX_STACK; |
|---|
| 86 | | - t->entries = lock->entries[h]; |
|---|
| 87 | | - t->skip = 2; |
|---|
| 88 | | - save_stack_trace(t); |
|---|
| 86 | + t->nr_entries = stack_trace_save(t->entries, MAX_STACK, 2); |
|---|
| 89 | 87 | #endif |
|---|
| 90 | 88 | } |
|---|
| 91 | 89 | |
|---|
| .. | .. |
|---|
| 106 | 104 | DMERR("recursive lock detected in metadata"); |
|---|
| 107 | 105 | #ifdef CONFIG_DM_DEBUG_BLOCK_STACK_TRACING |
|---|
| 108 | 106 | DMERR("previously held here:"); |
|---|
| 109 | | - print_stack_trace(lock->traces + i, 4); |
|---|
| 107 | + stack_trace_print(lock->traces[i].entries, |
|---|
| 108 | + lock->traces[i].nr_entries, 4); |
|---|
| 110 | 109 | |
|---|
| 111 | 110 | DMERR("subsequent acquisition attempted here:"); |
|---|
| 112 | 111 | dump_stack(); |
|---|
| .. | .. |
|---|
| 462 | 461 | int r; |
|---|
| 463 | 462 | |
|---|
| 464 | 463 | p = dm_bufio_read(bm->bufio, b, (struct dm_buffer **) result); |
|---|
| 465 | | - if (unlikely(IS_ERR(p))) |
|---|
| 464 | + if (IS_ERR(p)) |
|---|
| 466 | 465 | return PTR_ERR(p); |
|---|
| 467 | 466 | |
|---|
| 468 | 467 | aux = dm_bufio_get_aux_data(to_buffer(*result)); |
|---|
| .. | .. |
|---|
| 498 | 497 | return -EPERM; |
|---|
| 499 | 498 | |
|---|
| 500 | 499 | p = dm_bufio_read(bm->bufio, b, (struct dm_buffer **) result); |
|---|
| 501 | | - if (unlikely(IS_ERR(p))) |
|---|
| 500 | + if (IS_ERR(p)) |
|---|
| 502 | 501 | return PTR_ERR(p); |
|---|
| 503 | 502 | |
|---|
| 504 | 503 | aux = dm_bufio_get_aux_data(to_buffer(*result)); |
|---|
| .. | .. |
|---|
| 531 | 530 | int r; |
|---|
| 532 | 531 | |
|---|
| 533 | 532 | p = dm_bufio_get(bm->bufio, b, (struct dm_buffer **) result); |
|---|
| 534 | | - if (unlikely(IS_ERR(p))) |
|---|
| 533 | + if (IS_ERR(p)) |
|---|
| 535 | 534 | return PTR_ERR(p); |
|---|
| 536 | 535 | if (unlikely(!p)) |
|---|
| 537 | 536 | return -EWOULDBLOCK; |
|---|
| .. | .. |
|---|
| 567 | 566 | return -EPERM; |
|---|
| 568 | 567 | |
|---|
| 569 | 568 | p = dm_bufio_new(bm->bufio, b, (struct dm_buffer **) result); |
|---|
| 570 | | - if (unlikely(IS_ERR(p))) |
|---|
| 569 | + if (IS_ERR(p)) |
|---|
| 571 | 570 | return PTR_ERR(p); |
|---|
| 572 | 571 | |
|---|
| 573 | 572 | memset(p, 0, dm_bm_block_size(bm)); |
|---|