diff options
Diffstat (limited to 'fs/ubifs/lpt_commit.c')
-rw-r--r-- | fs/ubifs/lpt_commit.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index dfcb5748a7d..cddd6bd214f 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include <linux/crc16.h> | 28 | #include <linux/crc16.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/random.h> | ||
30 | #include "ubifs.h" | 31 | #include "ubifs.h" |
31 | 32 | ||
32 | #ifdef CONFIG_UBIFS_FS_DEBUG | 33 | #ifdef CONFIG_UBIFS_FS_DEBUG |
@@ -116,8 +117,8 @@ static int get_cnodes_to_commit(struct ubifs_info *c) | |||
116 | return 0; | 117 | return 0; |
117 | cnt += 1; | 118 | cnt += 1; |
118 | while (1) { | 119 | while (1) { |
119 | ubifs_assert(!test_bit(COW_ZNODE, &cnode->flags)); | 120 | ubifs_assert(!test_bit(COW_CNODE, &cnode->flags)); |
120 | __set_bit(COW_ZNODE, &cnode->flags); | 121 | __set_bit(COW_CNODE, &cnode->flags); |
121 | cnext = next_dirty_cnode(cnode); | 122 | cnext = next_dirty_cnode(cnode); |
122 | if (!cnext) { | 123 | if (!cnext) { |
123 | cnode->cnext = c->lpt_cnext; | 124 | cnode->cnext = c->lpt_cnext; |
@@ -465,7 +466,7 @@ static int write_cnodes(struct ubifs_info *c) | |||
465 | */ | 466 | */ |
466 | clear_bit(DIRTY_CNODE, &cnode->flags); | 467 | clear_bit(DIRTY_CNODE, &cnode->flags); |
467 | smp_mb__before_clear_bit(); | 468 | smp_mb__before_clear_bit(); |
468 | clear_bit(COW_ZNODE, &cnode->flags); | 469 | clear_bit(COW_CNODE, &cnode->flags); |
469 | smp_mb__after_clear_bit(); | 470 | smp_mb__after_clear_bit(); |
470 | offs += len; | 471 | offs += len; |
471 | dbg_chk_lpt_sz(c, 1, len); | 472 | dbg_chk_lpt_sz(c, 1, len); |
@@ -1160,11 +1161,11 @@ static int lpt_gc_lnum(struct ubifs_info *c, int lnum) | |||
1160 | void *buf = c->lpt_buf; | 1161 | void *buf = c->lpt_buf; |
1161 | 1162 | ||
1162 | dbg_lp("LEB %d", lnum); | 1163 | dbg_lp("LEB %d", lnum); |
1163 | err = ubi_read(c->ubi, lnum, buf, 0, c->leb_size); | 1164 | |
1164 | if (err) { | 1165 | err = ubifs_leb_read(c, lnum, buf, 0, c->leb_size, 1); |
1165 | ubifs_err("cannot read LEB %d, error %d", lnum, err); | 1166 | if (err) |
1166 | return err; | 1167 | return err; |
1167 | } | 1168 | |
1168 | while (1) { | 1169 | while (1) { |
1169 | if (!is_a_node(c, buf, len)) { | 1170 | if (!is_a_node(c, buf, len)) { |
1170 | int pad_len; | 1171 | int pad_len; |
@@ -1640,7 +1641,7 @@ static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum) | |||
1640 | int ret; | 1641 | int ret; |
1641 | void *buf, *p; | 1642 | void *buf, *p; |
1642 | 1643 | ||
1643 | if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS)) | 1644 | if (!dbg_is_chk_lprops(c)) |
1644 | return 0; | 1645 | return 0; |
1645 | 1646 | ||
1646 | buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); | 1647 | buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); |
@@ -1650,11 +1651,11 @@ static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum) | |||
1650 | } | 1651 | } |
1651 | 1652 | ||
1652 | dbg_lp("LEB %d", lnum); | 1653 | dbg_lp("LEB %d", lnum); |
1653 | err = ubi_read(c->ubi, lnum, buf, 0, c->leb_size); | 1654 | |
1654 | if (err) { | 1655 | err = ubifs_leb_read(c, lnum, buf, 0, c->leb_size, 1); |
1655 | dbg_msg("ubi_read failed, LEB %d, error %d", lnum, err); | 1656 | if (err) |
1656 | goto out; | 1657 | goto out; |
1657 | } | 1658 | |
1658 | while (1) { | 1659 | while (1) { |
1659 | if (!is_a_node(c, p, len)) { | 1660 | if (!is_a_node(c, p, len)) { |
1660 | int i, pad_len; | 1661 | int i, pad_len; |
@@ -1711,7 +1712,7 @@ int dbg_check_ltab(struct ubifs_info *c) | |||
1711 | { | 1712 | { |
1712 | int lnum, err, i, cnt; | 1713 | int lnum, err, i, cnt; |
1713 | 1714 | ||
1714 | if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS)) | 1715 | if (!dbg_is_chk_lprops(c)) |
1715 | return 0; | 1716 | return 0; |
1716 | 1717 | ||
1717 | /* Bring the entire tree into memory */ | 1718 | /* Bring the entire tree into memory */ |
@@ -1754,7 +1755,7 @@ int dbg_chk_lpt_free_spc(struct ubifs_info *c) | |||
1754 | long long free = 0; | 1755 | long long free = 0; |
1755 | int i; | 1756 | int i; |
1756 | 1757 | ||
1757 | if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS)) | 1758 | if (!dbg_is_chk_lprops(c)) |
1758 | return 0; | 1759 | return 0; |
1759 | 1760 | ||
1760 | for (i = 0; i < c->lpt_lebs; i++) { | 1761 | for (i = 0; i < c->lpt_lebs; i++) { |
@@ -1796,7 +1797,7 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) | |||
1796 | long long chk_lpt_sz, lpt_sz; | 1797 | long long chk_lpt_sz, lpt_sz; |
1797 | int err = 0; | 1798 | int err = 0; |
1798 | 1799 | ||
1799 | if (!(ubifs_chk_flags & UBIFS_CHK_LPROPS)) | 1800 | if (!dbg_is_chk_lprops(c)) |
1800 | return 0; | 1801 | return 0; |
1801 | 1802 | ||
1802 | switch (action) { | 1803 | switch (action) { |
@@ -1901,11 +1902,10 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) | |||
1901 | return; | 1902 | return; |
1902 | } | 1903 | } |
1903 | 1904 | ||
1904 | err = ubi_read(c->ubi, lnum, buf, 0, c->leb_size); | 1905 | err = ubifs_leb_read(c, lnum, buf, 0, c->leb_size, 1); |
1905 | if (err) { | 1906 | if (err) |
1906 | ubifs_err("cannot read LEB %d, error %d", lnum, err); | ||
1907 | goto out; | 1907 | goto out; |
1908 | } | 1908 | |
1909 | while (1) { | 1909 | while (1) { |
1910 | offs = c->leb_size - len; | 1910 | offs = c->leb_size - len; |
1911 | if (!is_a_node(c, p, len)) { | 1911 | if (!is_a_node(c, p, len)) { |
@@ -2019,7 +2019,7 @@ static int dbg_populate_lsave(struct ubifs_info *c) | |||
2019 | struct ubifs_lpt_heap *heap; | 2019 | struct ubifs_lpt_heap *heap; |
2020 | int i; | 2020 | int i; |
2021 | 2021 | ||
2022 | if (!(ubifs_chk_flags & UBIFS_CHK_GEN)) | 2022 | if (!dbg_is_chk_gen(c)) |
2023 | return 0; | 2023 | return 0; |
2024 | if (random32() & 3) | 2024 | if (random32() & 3) |
2025 | return 0; | 2025 | return 0; |