UBIFS: change bud replay function conventions
This is a minor preparation patch which changes 'replay_bud()' interface - instead of passing bud lnum, offs, jhead, etc directly, pass a pointer to the bud entry which contains all the information. The bud entry will be also needed in one of the following patches. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
This commit is contained in:
parent
debf12d541
commit
e76a452640
|
@ -475,25 +475,22 @@ int ubifs_validate_entry(struct ubifs_info *c,
|
||||||
/**
|
/**
|
||||||
* replay_bud - replay a bud logical eraseblock.
|
* replay_bud - replay a bud logical eraseblock.
|
||||||
* @c: UBIFS file-system description object
|
* @c: UBIFS file-system description object
|
||||||
* @lnum: bud logical eraseblock number to replay
|
* @b: bud entry which describes the bud
|
||||||
* @offs: bud start offset
|
|
||||||
* @jhead: journal head to which this bud belongs
|
|
||||||
* @free: amount of free space in the bud is returned here
|
|
||||||
* @dirty: amount of dirty space from padding and deletion nodes is returned
|
|
||||||
* here
|
|
||||||
*
|
*
|
||||||
* This function returns zero in case of success and a negative error code in
|
* This function replays bud @bud, recovers it if needed, and adds all nodes
|
||||||
* case of failure.
|
* from this bud to the replay list. Returns zero in case of success and a
|
||||||
|
* negative error code in case of failure.
|
||||||
*/
|
*/
|
||||||
static int replay_bud(struct ubifs_info *c, int lnum, int offs, int jhead,
|
static int replay_bud(struct ubifs_info *c, struct bud_entry *b)
|
||||||
int *free, int *dirty)
|
|
||||||
{
|
{
|
||||||
int err = 0, used = 0;
|
int err = 0, used = 0, lnum = b->bud->lnum, offs = b->bud->start;
|
||||||
|
int jhead = b->bud->jhead;
|
||||||
struct ubifs_scan_leb *sleb;
|
struct ubifs_scan_leb *sleb;
|
||||||
struct ubifs_scan_node *snod;
|
struct ubifs_scan_node *snod;
|
||||||
struct ubifs_bud *bud;
|
struct ubifs_bud *bud;
|
||||||
|
|
||||||
dbg_mnt("replay bud LEB %d, head %d, offs %d", lnum, jhead, offs);
|
dbg_mnt("replay bud LEB %d, head %d, offs %d", lnum, jhead, offs);
|
||||||
|
|
||||||
if (c->need_recovery)
|
if (c->need_recovery)
|
||||||
sleb = ubifs_recover_leb(c, lnum, offs, c->sbuf, jhead != GCHD);
|
sleb = ubifs_recover_leb(c, lnum, offs, c->sbuf, jhead != GCHD);
|
||||||
else
|
else
|
||||||
|
@ -618,9 +615,9 @@ static int replay_bud(struct ubifs_info *c, int lnum, int offs, int jhead,
|
||||||
ubifs_assert(sleb->endpt - offs >= used);
|
ubifs_assert(sleb->endpt - offs >= used);
|
||||||
ubifs_assert(sleb->endpt % c->min_io_size == 0);
|
ubifs_assert(sleb->endpt % c->min_io_size == 0);
|
||||||
|
|
||||||
*dirty = sleb->endpt - offs - used;
|
b->dirty = sleb->endpt - offs - used;
|
||||||
*free = c->leb_size - sleb->endpt;
|
b->free = c->leb_size - sleb->endpt;
|
||||||
dbg_mnt("bud LEB %d replied: dirty %d, free %d", lnum, *dirty, *free);
|
dbg_mnt("bud LEB %d replied: dirty %d, free %d", lnum, b->dirty, b->free);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
ubifs_scan_destroy(sleb);
|
ubifs_scan_destroy(sleb);
|
||||||
|
@ -647,8 +644,7 @@ static int replay_buds(struct ubifs_info *c)
|
||||||
unsigned long long prev_sqnum = 0;
|
unsigned long long prev_sqnum = 0;
|
||||||
|
|
||||||
list_for_each_entry(b, &c->replay_buds, list) {
|
list_for_each_entry(b, &c->replay_buds, list) {
|
||||||
err = replay_bud(c, b->bud->lnum, b->bud->start, b->bud->jhead,
|
err = replay_bud(c, b);
|
||||||
&b->free, &b->dirty);
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue