Skip to content

Commit be9c52e

Browse files
committed
dm persistent data: Simplify stack trace handling
Replace the indirection through struct stack_trace with an invocation of the storage array based interface. This results in less storage space and indirection. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: dm-devel@redhat.com Cc: Mike Snitzer <snitzer@redhat.com> Cc: Alasdair Kergon <agk@redhat.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Alexander Potapenko <glider@google.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Christoph Lameter <cl@linux.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: linux-mm@kvack.org Cc: David Rientjes <rientjes@google.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: kasan-dev@googlegroups.com Cc: Mike Rapoport <rppt@linux.vnet.ibm.com> Cc: Akinobu Mita <akinobu.mita@gmail.com> Cc: Christoph Hellwig <hch@lst.de> Cc: iommu@lists.linux-foundation.org Cc: Robin Murphy <robin.murphy@arm.com> Cc: Marek Szyprowski <m.szyprowski@samsung.com> Cc: Johannes Thumshirn <jthumshirn@suse.de> Cc: David Sterba <dsterba@suse.com> Cc: Chris Mason <clm@fb.com> Cc: Josef Bacik <josef@toxicpanda.com> Cc: linux-btrfs@vger.kernel.org Cc: Daniel Vetter <daniel@ffwll.ch> Cc: intel-gfx@lists.freedesktop.org Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: dri-devel@lists.freedesktop.org Cc: David Airlie <airlied@linux.ie> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Tom Zanussi <tom.zanussi@linux.intel.com> Cc: Miroslav Benes <mbenes@suse.cz> Cc: linux-arch@vger.kernel.org Link: https://lkml.kernel.org/r/20190425094802.533968922@linutronix.de
1 parent 741b58f commit be9c52e

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

‎drivers/md/persistent-data/dm-block-manager.c‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
#define MAX_HOLDERS 4
3636
#define MAX_STACK 10
3737

38-
typedef unsigned long stack_entries[MAX_STACK];
38+
struct stack_store {
39+
unsigned int nr_entries;
40+
unsigned long entries[MAX_STACK];
41+
};
3942

4043
struct block_lock {
4144
spinlock_t lock;
@@ -44,8 +47,7 @@ struct block_lock {
4447
struct task_struct *holders[MAX_HOLDERS];
4548

4649
#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];
4951
#endif
5052
};
5153

@@ -73,19 +75,15 @@ static void __add_holder(struct block_lock *lock, struct task_struct *task)
7375
{
7476
unsigned h = __find_holder(lock, NULL);
7577
#ifdef CONFIG_DM_DEBUG_BLOCK_STACK_TRACING
76-
struct stack_trace *t;
78+
struct stack_store *t;
7779
#endif
7880

7981
get_task_struct(task);
8082
lock->holders[h] = task;
8183

8284
#ifdef CONFIG_DM_DEBUG_BLOCK_STACK_TRACING
8385
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);
8987
#endif
9088
}
9189

@@ -106,7 +104,8 @@ static int __check_holder(struct block_lock *lock)
106104
DMERR("recursive lock detected in metadata");
107105
#ifdef CONFIG_DM_DEBUG_BLOCK_STACK_TRACING
108106
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);
110109

111110
DMERR("subsequent acquisition attempted here:");
112111
dump_stack();

0 commit comments

Comments
 (0)