diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-03-29 11:19:50 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-13 12:23:53 -0400 |
commit | 8ff83089f8bcbd9a2e898b68f1a46487c8b6e38c (patch) | |
tree | 36b286946894a4b797d850cca67603cac89ec1f2 /fs/ubifs/debug.c | |
parent | b137545c44fc0c80fb778abb0c582bda5601e8f8 (diff) |
UBIFS: simplify dbg_dump_budg calling conventions
The current 'dbg_dump_budg()' calling convention is that the
'c->space_lock' spinlock is held. However, none of the callers
actually use it from contects which have 'c->space_lock' locked,
so all callers have to explicitely lock and unlock the spinlock.
This is not very sensible convention. This patch changes it and
makes 'dbg_dump_budg()' lock the spinlock instead of imposing this
to the callers. This simplifies the code a little.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/debug.c')
-rw-r--r-- | fs/ubifs/debug.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index c58867cbd019..aad4fb80d187 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -610,7 +610,7 @@ void dbg_dump_budg(struct ubifs_info *c) | |||
610 | struct ubifs_gced_idx_leb *idx_gc; | 610 | struct ubifs_gced_idx_leb *idx_gc; |
611 | long long available, outstanding, free; | 611 | long long available, outstanding, free; |
612 | 612 | ||
613 | ubifs_assert(spin_is_locked(&c->space_lock)); | 613 | spin_lock(&c->space_lock); |
614 | spin_lock(&dbg_lock); | 614 | spin_lock(&dbg_lock); |
615 | printk(KERN_DEBUG "(pid %d) Budgeting info: budg_data_growth %lld, " | 615 | printk(KERN_DEBUG "(pid %d) Budgeting info: budg_data_growth %lld, " |
616 | "budg_dd_growth %lld, budg_idx_growth %lld\n", current->pid, | 616 | "budg_dd_growth %lld, budg_idx_growth %lld\n", current->pid, |
@@ -655,6 +655,7 @@ void dbg_dump_budg(struct ubifs_info *c) | |||
655 | printk(KERN_DEBUG "\tavailable: %lld, outstanding %lld, free %lld\n", | 655 | printk(KERN_DEBUG "\tavailable: %lld, outstanding %lld, free %lld\n", |
656 | available, outstanding, free); | 656 | available, outstanding, free); |
657 | spin_unlock(&dbg_lock); | 657 | spin_unlock(&dbg_lock); |
658 | spin_unlock(&c->space_lock); | ||
658 | } | 659 | } |
659 | 660 | ||
660 | void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) | 661 | void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) |
@@ -1046,10 +1047,7 @@ out: | |||
1046 | 1047 | ||
1047 | ubifs_msg("current lprops statistics dump"); | 1048 | ubifs_msg("current lprops statistics dump"); |
1048 | dbg_dump_lstats(&lst); | 1049 | dbg_dump_lstats(&lst); |
1049 | |||
1050 | spin_lock(&c->space_lock); | ||
1051 | dbg_dump_budg(c); | 1050 | dbg_dump_budg(c); |
1052 | spin_unlock(&c->space_lock); | ||
1053 | dump_stack(); | 1051 | dump_stack(); |
1054 | return -EINVAL; | 1052 | return -EINVAL; |
1055 | } | 1053 | } |
@@ -2796,11 +2794,9 @@ static ssize_t write_debugfs_file(struct file *file, const char __user *buf, | |||
2796 | 2794 | ||
2797 | if (file->f_path.dentry == d->dfs_dump_lprops) | 2795 | if (file->f_path.dentry == d->dfs_dump_lprops) |
2798 | dbg_dump_lprops(c); | 2796 | dbg_dump_lprops(c); |
2799 | else if (file->f_path.dentry == d->dfs_dump_budg) { | 2797 | else if (file->f_path.dentry == d->dfs_dump_budg) |
2800 | spin_lock(&c->space_lock); | ||
2801 | dbg_dump_budg(c); | 2798 | dbg_dump_budg(c); |
2802 | spin_unlock(&c->space_lock); | 2799 | else if (file->f_path.dentry == d->dfs_dump_tnc) { |
2803 | } else if (file->f_path.dentry == d->dfs_dump_tnc) { | ||
2804 | mutex_lock(&c->tnc_mutex); | 2800 | mutex_lock(&c->tnc_mutex); |
2805 | dbg_dump_tnc(c); | 2801 | dbg_dump_tnc(c); |
2806 | mutex_unlock(&c->tnc_mutex); | 2802 | mutex_unlock(&c->tnc_mutex); |