diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-15 05:34:29 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-16 03:31:41 -0400 |
commit | e76a452640dc110147f7a7da1dcfb1c5026f982d (patch) | |
tree | 20a6a5716e655817022c7c69d46d56c95161d06c | |
parent | debf12d54182b324a01c4276b003669c94b7b531 (diff) |
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>
-rw-r--r-- | fs/ubifs/replay.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index 47915a789927..4378baa6694b 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c | |||
@@ -475,25 +475,22 @@ int ubifs_validate_entry(struct ubifs_info *c, | |||
475 | /** | 475 | /** |
476 | * replay_bud - replay a bud logical eraseblock. | 476 | * replay_bud - replay a bud logical eraseblock. |
477 | * @c: UBIFS file-system description object | 477 | * @c: UBIFS file-system description object |
478 | * @lnum: bud logical eraseblock number to replay | 478 | * @b: bud entry which describes the bud |
479 | * @offs: bud start offset | ||
480 | * @jhead: journal head to which this bud belongs | ||
481 | * @free: amount of free space in the bud is returned here | ||
482 | * @dirty: amount of dirty space from padding and deletion nodes is returned | ||
483 | * here | ||
484 | * | 479 | * |
485 | * This function returns zero in case of success and a negative error code in | 480 | * This function replays bud @bud, recovers it if needed, and adds all nodes |
486 | * case of failure. | 481 | * from this bud to the replay list. Returns zero in case of success and a |
482 | * negative error code in case of failure. | ||
487 | */ | 483 | */ |
488 | static int replay_bud(struct ubifs_info *c, int lnum, int offs, int jhead, | 484 | static int replay_bud(struct ubifs_info *c, struct bud_entry *b) |
489 | int *free, int *dirty) | ||
490 | { | 485 | { |
491 | int err = 0, used = 0; | 486 | int err = 0, used = 0, lnum = b->bud->lnum, offs = b->bud->start; |
487 | int jhead = b->bud->jhead; | ||
492 | struct ubifs_scan_leb *sleb; | 488 | struct ubifs_scan_leb *sleb; |
493 | struct ubifs_scan_node *snod; | 489 | struct ubifs_scan_node *snod; |
494 | struct ubifs_bud *bud; | 490 | struct ubifs_bud *bud; |
495 | 491 | ||
496 | dbg_mnt("replay bud LEB %d, head %d, offs %d", lnum, jhead, offs); | 492 | dbg_mnt("replay bud LEB %d, head %d, offs %d", lnum, jhead, offs); |
493 | |||
497 | if (c->need_recovery) | 494 | if (c->need_recovery) |
498 | sleb = ubifs_recover_leb(c, lnum, offs, c->sbuf, jhead != GCHD); | 495 | sleb = ubifs_recover_leb(c, lnum, offs, c->sbuf, jhead != GCHD); |
499 | else | 496 | else |
@@ -618,9 +615,9 @@ static int replay_bud(struct ubifs_info *c, int lnum, int offs, int jhead, | |||
618 | ubifs_assert(sleb->endpt - offs >= used); | 615 | ubifs_assert(sleb->endpt - offs >= used); |
619 | ubifs_assert(sleb->endpt % c->min_io_size == 0); | 616 | ubifs_assert(sleb->endpt % c->min_io_size == 0); |
620 | 617 | ||
621 | *dirty = sleb->endpt - offs - used; | 618 | b->dirty = sleb->endpt - offs - used; |
622 | *free = c->leb_size - sleb->endpt; | 619 | b->free = c->leb_size - sleb->endpt; |
623 | dbg_mnt("bud LEB %d replied: dirty %d, free %d", lnum, *dirty, *free); | 620 | dbg_mnt("bud LEB %d replied: dirty %d, free %d", lnum, b->dirty, b->free); |
624 | 621 | ||
625 | out: | 622 | out: |
626 | ubifs_scan_destroy(sleb); | 623 | ubifs_scan_destroy(sleb); |
@@ -647,8 +644,7 @@ static int replay_buds(struct ubifs_info *c) | |||
647 | unsigned long long prev_sqnum = 0; | 644 | unsigned long long prev_sqnum = 0; |
648 | 645 | ||
649 | list_for_each_entry(b, &c->replay_buds, list) { | 646 | list_for_each_entry(b, &c->replay_buds, list) { |
650 | err = replay_bud(c, b->bud->lnum, b->bud->start, b->bud->jhead, | 647 | err = replay_bud(c, b); |
651 | &b->free, &b->dirty); | ||
652 | if (err) | 648 | if (err) |
653 | return err; | 649 | return err; |
654 | 650 | ||