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 | |
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')
-rw-r--r-- | fs/ubifs/debug.c | 12 | ||||
-rw-r--r-- | fs/ubifs/journal.c | 2 | ||||
-rw-r--r-- | fs/ubifs/tnc_commit.c | 2 |
3 files changed, 4 insertions, 12 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); |
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index aed25e864227..65d485fc1eeb 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c | |||
@@ -380,10 +380,8 @@ out: | |||
380 | if (err == -ENOSPC) { | 380 | if (err == -ENOSPC) { |
381 | /* This are some budgeting problems, print useful information */ | 381 | /* This are some budgeting problems, print useful information */ |
382 | down_write(&c->commit_sem); | 382 | down_write(&c->commit_sem); |
383 | spin_lock(&c->space_lock); | ||
384 | dbg_dump_stack(); | 383 | dbg_dump_stack(); |
385 | dbg_dump_budg(c); | 384 | dbg_dump_budg(c); |
386 | spin_unlock(&c->space_lock); | ||
387 | dbg_dump_lprops(c); | 385 | dbg_dump_lprops(c); |
388 | cmt_retries = dbg_check_lprops(c); | 386 | cmt_retries = dbg_check_lprops(c); |
389 | up_write(&c->commit_sem); | 387 | up_write(&c->commit_sem); |
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c index 9c376b9e74ff..66f066de2c57 100644 --- a/fs/ubifs/tnc_commit.c +++ b/fs/ubifs/tnc_commit.c | |||
@@ -383,9 +383,7 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt) | |||
383 | * option which forces in-the-gaps is enabled. | 383 | * option which forces in-the-gaps is enabled. |
384 | */ | 384 | */ |
385 | ubifs_err("out of space"); | 385 | ubifs_err("out of space"); |
386 | spin_lock(&c->space_lock); | ||
387 | dbg_dump_budg(c); | 386 | dbg_dump_budg(c); |
388 | spin_unlock(&c->space_lock); | ||
389 | dbg_dump_lprops(c); | 387 | dbg_dump_lprops(c); |
390 | } | 388 | } |
391 | /* Try to commit anyway */ | 389 | /* Try to commit anyway */ |