Skip to content

Commit 8ff8308

Browse files
Artem BityutskiyArtem Bityutskiy
authored andcommitted
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>
1 parent b137545 commit 8ff8308

3 files changed

Lines changed: 4 additions & 12 deletions

File tree

‎fs/ubifs/debug.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ void dbg_dump_budg(struct ubifs_info *c)
610610
struct ubifs_gced_idx_leb *idx_gc;
611611
long long available, outstanding, free;
612612

613-
ubifs_assert(spin_is_locked(&c->space_lock));
613+
spin_lock(&c->space_lock);
614614
spin_lock(&dbg_lock);
615615
printk(KERN_DEBUG "(pid %d) Budgeting info: budg_data_growth %lld, "
616616
"budg_dd_growth %lld, budg_idx_growth %lld\n", current->pid,
@@ -655,6 +655,7 @@ void dbg_dump_budg(struct ubifs_info *c)
655655
printk(KERN_DEBUG "\tavailable: %lld, outstanding %lld, free %lld\n",
656656
available, outstanding, free);
657657
spin_unlock(&dbg_lock);
658+
spin_unlock(&c->space_lock);
658659
}
659660

660661
void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp)
@@ -1046,10 +1047,7 @@ int dbg_check_space_info(struct ubifs_info *c)
10461047

10471048
ubifs_msg("current lprops statistics dump");
10481049
dbg_dump_lstats(&lst);
1049-
1050-
spin_lock(&c->space_lock);
10511050
dbg_dump_budg(c);
1052-
spin_unlock(&c->space_lock);
10531051
dump_stack();
10541052
return -EINVAL;
10551053
}
@@ -2796,11 +2794,9 @@ static ssize_t write_debugfs_file(struct file *file, const char __user *buf,
27962794

27972795
if (file->f_path.dentry == d->dfs_dump_lprops)
27982796
dbg_dump_lprops(c);
2799-
else if (file->f_path.dentry == d->dfs_dump_budg) {
2800-
spin_lock(&c->space_lock);
2797+
else if (file->f_path.dentry == d->dfs_dump_budg)
28012798
dbg_dump_budg(c);
2802-
spin_unlock(&c->space_lock);
2803-
} else if (file->f_path.dentry == d->dfs_dump_tnc) {
2799+
else if (file->f_path.dentry == d->dfs_dump_tnc) {
28042800
mutex_lock(&c->tnc_mutex);
28052801
dbg_dump_tnc(c);
28062802
mutex_unlock(&c->tnc_mutex);

‎fs/ubifs/journal.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,8 @@ static int make_reservation(struct ubifs_info *c, int jhead, int len)
380380
if (err == -ENOSPC) {
381381
/* This are some budgeting problems, print useful information */
382382
down_write(&c->commit_sem);
383-
spin_lock(&c->space_lock);
384383
dbg_dump_stack();
385384
dbg_dump_budg(c);
386-
spin_unlock(&c->space_lock);
387385
dbg_dump_lprops(c);
388386
cmt_retries = dbg_check_lprops(c);
389387
up_write(&c->commit_sem);

‎fs/ubifs/tnc_commit.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,9 +383,7 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt)
383383
* option which forces in-the-gaps is enabled.
384384
*/
385385
ubifs_err("out of space");
386-
spin_lock(&c->space_lock);
387386
dbg_dump_budg(c);
388-
spin_unlock(&c->space_lock);
389387
dbg_dump_lprops(c);
390388
}
391389
/* Try to commit anyway */

0 commit comments

Comments
 (0)