diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-05-26 01:36:52 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-06-01 05:29:06 -0400 |
commit | efcfde54ca68091b164f9aec544c7233a9760aff (patch) | |
tree | f94cd590448a23c2ba7c6566dcbeb72eb3f3dd1d /fs/ubifs | |
parent | 1a0b06997ceca96db9259e537eb935f9fe59a3de (diff) |
UBIFS: amend ubifs_recover_leb interface
Instead of passing "grouped" parameter to 'ubifs_recover_leb()' which tells
whether the nodes are grouped in the LEB to recover, pass the journal head
number and let 'ubifs_recover_leb()' look at the journal head's 'grouped' flag.
This patch is a preparation to a further fix where we'll need to know the
journal head number for other purposes.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/orphan.c | 2 | ||||
-rw-r--r-- | fs/ubifs/recovery.c | 10 | ||||
-rw-r--r-- | fs/ubifs/replay.c | 3 | ||||
-rw-r--r-- | fs/ubifs/ubifs.h | 2 |
4 files changed, 9 insertions, 8 deletions
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c index bd644bf587a8..a5422fffbd69 100644 --- a/fs/ubifs/orphan.c +++ b/fs/ubifs/orphan.c | |||
@@ -674,7 +674,7 @@ static int kill_orphans(struct ubifs_info *c) | |||
674 | if (IS_ERR(sleb)) { | 674 | if (IS_ERR(sleb)) { |
675 | if (PTR_ERR(sleb) == -EUCLEAN) | 675 | if (PTR_ERR(sleb) == -EUCLEAN) |
676 | sleb = ubifs_recover_leb(c, lnum, 0, | 676 | sleb = ubifs_recover_leb(c, lnum, 0, |
677 | c->sbuf, 0); | 677 | c->sbuf, -1); |
678 | if (IS_ERR(sleb)) { | 678 | if (IS_ERR(sleb)) { |
679 | err = PTR_ERR(sleb); | 679 | err = PTR_ERR(sleb); |
680 | break; | 680 | break; |
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 95e24183b710..6adb5328a016 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c | |||
@@ -604,7 +604,8 @@ static int drop_last_node(struct ubifs_scan_leb *sleb, int *offs, int grouped) | |||
604 | * @lnum: LEB number | 604 | * @lnum: LEB number |
605 | * @offs: offset | 605 | * @offs: offset |
606 | * @sbuf: LEB-sized buffer to use | 606 | * @sbuf: LEB-sized buffer to use |
607 | * @grouped: nodes may be grouped for recovery | 607 | * @jhead: journal head number this LEB belongs to (%-1 if the LEB does not |
608 | * belong to any journal head) | ||
608 | * | 609 | * |
609 | * This function does a scan of a LEB, but caters for errors that might have | 610 | * This function does a scan of a LEB, but caters for errors that might have |
610 | * been caused by the unclean unmount from which we are attempting to recover. | 611 | * been caused by the unclean unmount from which we are attempting to recover. |
@@ -612,13 +613,14 @@ static int drop_last_node(struct ubifs_scan_leb *sleb, int *offs, int grouped) | |||
612 | * found, and a negative error code in case of failure. | 613 | * found, and a negative error code in case of failure. |
613 | */ | 614 | */ |
614 | struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | 615 | struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, |
615 | int offs, void *sbuf, int grouped) | 616 | int offs, void *sbuf, int jhead) |
616 | { | 617 | { |
617 | int ret = 0, err, len = c->leb_size - offs, start = offs, min_io_unit; | 618 | int ret = 0, err, len = c->leb_size - offs, start = offs, min_io_unit; |
619 | int grouped = jhead == -1 ? 0 : c->jheads[jhead].grouped; | ||
618 | struct ubifs_scan_leb *sleb; | 620 | struct ubifs_scan_leb *sleb; |
619 | void *buf = sbuf + offs; | 621 | void *buf = sbuf + offs; |
620 | 622 | ||
621 | dbg_rcvry("%d:%d", lnum, offs); | 623 | dbg_rcvry("%d:%d, jhead %d, grouped %d", lnum, offs, jhead, grouped); |
622 | 624 | ||
623 | sleb = ubifs_start_scan(c, lnum, offs, sbuf); | 625 | sleb = ubifs_start_scan(c, lnum, offs, sbuf); |
624 | if (IS_ERR(sleb)) | 626 | if (IS_ERR(sleb)) |
@@ -881,7 +883,7 @@ struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum, | |||
881 | } | 883 | } |
882 | ubifs_scan_destroy(sleb); | 884 | ubifs_scan_destroy(sleb); |
883 | } | 885 | } |
884 | return ubifs_recover_leb(c, lnum, offs, sbuf, 0); | 886 | return ubifs_recover_leb(c, lnum, offs, sbuf, -1); |
885 | } | 887 | } |
886 | 888 | ||
887 | /** | 889 | /** |
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index 6617280d1679..5e97161ce4d3 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c | |||
@@ -557,8 +557,7 @@ static int replay_bud(struct ubifs_info *c, struct bud_entry *b) | |||
557 | * these LEBs could possibly be written to at the power cut | 557 | * these LEBs could possibly be written to at the power cut |
558 | * time. | 558 | * time. |
559 | */ | 559 | */ |
560 | sleb = ubifs_recover_leb(c, lnum, offs, c->sbuf, | 560 | sleb = ubifs_recover_leb(c, lnum, offs, c->sbuf, b->bud->jhead); |
561 | b->bud->jhead != GCHD); | ||
562 | else | 561 | else |
563 | sleb = ubifs_scan(c, lnum, offs, c->sbuf, 0); | 562 | sleb = ubifs_scan(c, lnum, offs, c->sbuf, 0); |
564 | if (IS_ERR(sleb)) | 563 | if (IS_ERR(sleb)) |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index adeca14c0e9f..f79983d6f860 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -1744,7 +1744,7 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum); | |||
1744 | int ubifs_recover_master_node(struct ubifs_info *c); | 1744 | int ubifs_recover_master_node(struct ubifs_info *c); |
1745 | int ubifs_write_rcvrd_mst_node(struct ubifs_info *c); | 1745 | int ubifs_write_rcvrd_mst_node(struct ubifs_info *c); |
1746 | struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | 1746 | struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, |
1747 | int offs, void *sbuf, int grouped); | 1747 | int offs, void *sbuf, int jhead); |
1748 | struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum, | 1748 | struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum, |
1749 | int offs, void *sbuf); | 1749 | int offs, void *sbuf); |
1750 | int ubifs_recover_inl_heads(const struct ubifs_info *c, void *sbuf); | 1750 | int ubifs_recover_inl_heads(const struct ubifs_info *c, void *sbuf); |