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/lpt.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/lpt.c')
-rw-r--r-- | fs/ubifs/lpt.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index ab91ca628455..8b9ee9fe0a41 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c | |||
@@ -1222,7 +1222,7 @@ int ubifs_read_nnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip) | |||
1222 | if (c->big_lpt) | 1222 | if (c->big_lpt) |
1223 | nnode->num = calc_nnode_num_from_parent(c, parent, iip); | 1223 | nnode->num = calc_nnode_num_from_parent(c, parent, iip); |
1224 | } else { | 1224 | } else { |
1225 | err = ubi_read(c->ubi, lnum, buf, offs, c->nnode_sz); | 1225 | err = ubifs_leb_read(c, lnum, buf, offs, c->nnode_sz, 1); |
1226 | if (err) | 1226 | if (err) |
1227 | goto out; | 1227 | goto out; |
1228 | err = ubifs_unpack_nnode(c, buf, nnode); | 1228 | err = ubifs_unpack_nnode(c, buf, nnode); |
@@ -1291,7 +1291,7 @@ static int read_pnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip) | |||
1291 | lprops->flags = ubifs_categorize_lprops(c, lprops); | 1291 | lprops->flags = ubifs_categorize_lprops(c, lprops); |
1292 | } | 1292 | } |
1293 | } else { | 1293 | } else { |
1294 | err = ubi_read(c->ubi, lnum, buf, offs, c->pnode_sz); | 1294 | err = ubifs_leb_read(c, lnum, buf, offs, c->pnode_sz, 1); |
1295 | if (err) | 1295 | if (err) |
1296 | goto out; | 1296 | goto out; |
1297 | err = unpack_pnode(c, buf, pnode); | 1297 | err = unpack_pnode(c, buf, pnode); |
@@ -1333,7 +1333,7 @@ static int read_ltab(struct ubifs_info *c) | |||
1333 | buf = vmalloc(c->ltab_sz); | 1333 | buf = vmalloc(c->ltab_sz); |
1334 | if (!buf) | 1334 | if (!buf) |
1335 | return -ENOMEM; | 1335 | return -ENOMEM; |
1336 | err = ubi_read(c->ubi, c->ltab_lnum, buf, c->ltab_offs, c->ltab_sz); | 1336 | err = ubifs_leb_read(c, c->ltab_lnum, buf, c->ltab_offs, c->ltab_sz, 1); |
1337 | if (err) | 1337 | if (err) |
1338 | goto out; | 1338 | goto out; |
1339 | err = unpack_ltab(c, buf); | 1339 | err = unpack_ltab(c, buf); |
@@ -1356,7 +1356,8 @@ static int read_lsave(struct ubifs_info *c) | |||
1356 | buf = vmalloc(c->lsave_sz); | 1356 | buf = vmalloc(c->lsave_sz); |
1357 | if (!buf) | 1357 | if (!buf) |
1358 | return -ENOMEM; | 1358 | return -ENOMEM; |
1359 | err = ubi_read(c->ubi, c->lsave_lnum, buf, c->lsave_offs, c->lsave_sz); | 1359 | err = ubifs_leb_read(c, c->lsave_lnum, buf, c->lsave_offs, |
1360 | c->lsave_sz, 1); | ||
1360 | if (err) | 1361 | if (err) |
1361 | goto out; | 1362 | goto out; |
1362 | err = unpack_lsave(c, buf); | 1363 | err = unpack_lsave(c, buf); |
@@ -1816,8 +1817,8 @@ static struct ubifs_nnode *scan_get_nnode(struct ubifs_info *c, | |||
1816 | if (c->big_lpt) | 1817 | if (c->big_lpt) |
1817 | nnode->num = calc_nnode_num_from_parent(c, parent, iip); | 1818 | nnode->num = calc_nnode_num_from_parent(c, parent, iip); |
1818 | } else { | 1819 | } else { |
1819 | err = ubi_read(c->ubi, branch->lnum, buf, branch->offs, | 1820 | err = ubifs_leb_read(c, branch->lnum, buf, branch->offs, |
1820 | c->nnode_sz); | 1821 | c->nnode_sz, 1); |
1821 | if (err) | 1822 | if (err) |
1822 | return ERR_PTR(err); | 1823 | return ERR_PTR(err); |
1823 | err = ubifs_unpack_nnode(c, buf, nnode); | 1824 | err = ubifs_unpack_nnode(c, buf, nnode); |
@@ -1885,8 +1886,8 @@ static struct ubifs_pnode *scan_get_pnode(struct ubifs_info *c, | |||
1885 | ubifs_assert(branch->lnum >= c->lpt_first && | 1886 | ubifs_assert(branch->lnum >= c->lpt_first && |
1886 | branch->lnum <= c->lpt_last); | 1887 | branch->lnum <= c->lpt_last); |
1887 | ubifs_assert(branch->offs >= 0 && branch->offs < c->leb_size); | 1888 | ubifs_assert(branch->offs >= 0 && branch->offs < c->leb_size); |
1888 | err = ubi_read(c->ubi, branch->lnum, buf, branch->offs, | 1889 | err = ubifs_leb_read(c, branch->lnum, buf, branch->offs, |
1889 | c->pnode_sz); | 1890 | c->pnode_sz, 1); |
1890 | if (err) | 1891 | if (err) |
1891 | return ERR_PTR(err); | 1892 | return ERR_PTR(err); |
1892 | err = unpack_pnode(c, buf, pnode); | 1893 | err = unpack_pnode(c, buf, pnode); |