diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2011-06-03 07:03:25 -0400 |
---|---|---|
committer | Artem Bityutskiy <dedekind1@gmail.com> | 2011-07-04 03:54:33 -0400 |
commit | d304820a1f6cdacab691bbcb7faa35ec631c6398 (patch) | |
tree | b958f273673000d68a2dc088298425ae1f32e85f /fs/ubifs/recovery.c | |
parent | 83cef708c606f46a2b527af025acb3d24555f0c4 (diff) |
UBIFS: switch to ubifs_leb_read
Instead of using 'ubi_read()' function directly, used the 'ubifs_leb_read()'
helper function instead. This allows to get rid of several redundant error
messages and make sure that we always have a stack dump on read errors.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/recovery.c')
-rw-r--r-- | fs/ubifs/recovery.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index c59154980719..f28070cb00c6 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c | |||
@@ -117,7 +117,7 @@ static int get_master_node(const struct ubifs_info *c, int lnum, void **pbuf, | |||
117 | if (!sbuf) | 117 | if (!sbuf) |
118 | return -ENOMEM; | 118 | return -ENOMEM; |
119 | 119 | ||
120 | err = ubi_read(c->ubi, lnum, sbuf, 0, c->leb_size); | 120 | err = ubifs_leb_read(c, lnum, sbuf, 0, c->leb_size, 0); |
121 | if (err && err != -EBADMSG) | 121 | if (err && err != -EBADMSG) |
122 | goto out_free; | 122 | goto out_free; |
123 | 123 | ||
@@ -539,8 +539,8 @@ static int fix_unclean_leb(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
539 | int len = ALIGN(endpt, c->min_io_size); | 539 | int len = ALIGN(endpt, c->min_io_size); |
540 | 540 | ||
541 | if (start) { | 541 | if (start) { |
542 | err = ubi_read(c->ubi, lnum, sleb->buf, 0, | 542 | err = ubifs_leb_read(c, lnum, sleb->buf, 0, |
543 | start); | 543 | start, 1); |
544 | if (err) | 544 | if (err) |
545 | return err; | 545 | return err; |
546 | } | 546 | } |
@@ -819,7 +819,8 @@ static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs, | |||
819 | return -ENOMEM; | 819 | return -ENOMEM; |
820 | if (c->leb_size - offs < UBIFS_CS_NODE_SZ) | 820 | if (c->leb_size - offs < UBIFS_CS_NODE_SZ) |
821 | goto out_err; | 821 | goto out_err; |
822 | err = ubi_read(c->ubi, lnum, (void *)cs_node, offs, UBIFS_CS_NODE_SZ); | 822 | err = ubifs_leb_read(c, lnum, (void *)cs_node, offs, |
823 | UBIFS_CS_NODE_SZ, 0); | ||
823 | if (err && err != -EBADMSG) | 824 | if (err && err != -EBADMSG) |
824 | goto out_free; | 825 | goto out_free; |
825 | ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0); | 826 | ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0); |
@@ -930,12 +931,12 @@ static int recover_head(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
930 | return 0; | 931 | return 0; |
931 | 932 | ||
932 | /* Read at the head location and check it is empty flash */ | 933 | /* Read at the head location and check it is empty flash */ |
933 | err = ubi_read(c->ubi, lnum, sbuf, offs, len); | 934 | err = ubifs_leb_read(c, lnum, sbuf, offs, len, 1); |
934 | if (err || !is_empty(sbuf, len)) { | 935 | if (err || !is_empty(sbuf, len)) { |
935 | dbg_rcvry("cleaning head at %d:%d", lnum, offs); | 936 | dbg_rcvry("cleaning head at %d:%d", lnum, offs); |
936 | if (offs == 0) | 937 | if (offs == 0) |
937 | return ubifs_leb_unmap(c, lnum); | 938 | return ubifs_leb_unmap(c, lnum); |
938 | err = ubi_read(c->ubi, lnum, sbuf, 0, offs); | 939 | err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1); |
939 | if (err) | 940 | if (err) |
940 | return err; | 941 | return err; |
941 | return ubi_leb_change(c->ubi, lnum, sbuf, offs, UBI_UNKNOWN); | 942 | return ubi_leb_change(c->ubi, lnum, sbuf, offs, UBI_UNKNOWN); |
@@ -1008,7 +1009,7 @@ static int clean_an_unclean_leb(struct ubifs_info *c, | |||
1008 | return 0; | 1009 | return 0; |
1009 | } | 1010 | } |
1010 | 1011 | ||
1011 | err = ubi_read(c->ubi, lnum, buf, offs, len); | 1012 | err = ubifs_leb_read(c, lnum, buf, offs, len, 0); |
1012 | if (err && err != -EBADMSG) | 1013 | if (err && err != -EBADMSG) |
1013 | return err; | 1014 | return err; |
1014 | 1015 | ||
@@ -1453,7 +1454,7 @@ static int fix_size_in_place(struct ubifs_info *c, struct size_entry *e) | |||
1453 | if (i_size >= e->d_size) | 1454 | if (i_size >= e->d_size) |
1454 | return 0; | 1455 | return 0; |
1455 | /* Read the LEB */ | 1456 | /* Read the LEB */ |
1456 | err = ubi_read(c->ubi, lnum, c->sbuf, 0, c->leb_size); | 1457 | err = ubifs_leb_read(c, lnum, c->sbuf, 0, c->leb_size, 1); |
1457 | if (err) | 1458 | if (err) |
1458 | goto out; | 1459 | goto out; |
1459 | /* Change the size field and recalculate the CRC */ | 1460 | /* Change the size field and recalculate the CRC */ |