mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 16:49:22 +00:00
UBIFS: do not allocate unneeded scan buffer
In 'ubifs_replay_journal()' we allocate 'sbuf' for scanning the log. However, we already have 'c->sbuf' for these purposes, so do not allocate yet another one. This reduces UBIFS memory consumption while recovering. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
parent
3601ba2735
commit
6599fcbd01
1 changed files with 1 additions and 7 deletions
|
@ -1013,7 +1013,6 @@ static int take_ihead(struct ubifs_info *c)
|
||||||
int ubifs_replay_journal(struct ubifs_info *c)
|
int ubifs_replay_journal(struct ubifs_info *c)
|
||||||
{
|
{
|
||||||
int err, i, lnum, offs, free;
|
int err, i, lnum, offs, free;
|
||||||
void *sbuf = NULL;
|
|
||||||
|
|
||||||
BUILD_BUG_ON(UBIFS_TRUN_KEY > 5);
|
BUILD_BUG_ON(UBIFS_TRUN_KEY > 5);
|
||||||
|
|
||||||
|
@ -1028,10 +1027,6 @@ int ubifs_replay_journal(struct ubifs_info *c)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sbuf = vmalloc(c->leb_size);
|
|
||||||
if (!sbuf)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
dbg_mnt("start replaying the journal");
|
dbg_mnt("start replaying the journal");
|
||||||
c->replaying = 1;
|
c->replaying = 1;
|
||||||
lnum = c->ltail_lnum = c->lhead_lnum;
|
lnum = c->ltail_lnum = c->lhead_lnum;
|
||||||
|
@ -1046,7 +1041,7 @@ int ubifs_replay_journal(struct ubifs_info *c)
|
||||||
lnum = UBIFS_LOG_LNUM;
|
lnum = UBIFS_LOG_LNUM;
|
||||||
offs = 0;
|
offs = 0;
|
||||||
}
|
}
|
||||||
err = replay_log_leb(c, lnum, offs, sbuf);
|
err = replay_log_leb(c, lnum, offs, c->sbuf);
|
||||||
if (err == 1)
|
if (err == 1)
|
||||||
/* We hit the end of the log */
|
/* We hit the end of the log */
|
||||||
break;
|
break;
|
||||||
|
@ -1079,7 +1074,6 @@ int ubifs_replay_journal(struct ubifs_info *c)
|
||||||
out:
|
out:
|
||||||
destroy_replay_tree(c);
|
destroy_replay_tree(c);
|
||||||
destroy_bud_list(c);
|
destroy_bud_list(c);
|
||||||
vfree(sbuf);
|
|
||||||
c->replaying = 0;
|
c->replaying = 0;
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue