diff options
Diffstat (limited to 'fs/ubifs/debug.c')
-rw-r--r-- | fs/ubifs/debug.c | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 4cfb3e82c56f..4c46a9865fa7 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -746,7 +746,7 @@ void ubifs_dump_lprops(struct ubifs_info *c) | |||
746 | for (lnum = c->main_first; lnum < c->leb_cnt; lnum++) { | 746 | for (lnum = c->main_first; lnum < c->leb_cnt; lnum++) { |
747 | err = ubifs_read_one_lp(c, lnum, &lp); | 747 | err = ubifs_read_one_lp(c, lnum, &lp); |
748 | if (err) { | 748 | if (err) { |
749 | ubifs_err("cannot read lprops for LEB %d", lnum); | 749 | ubifs_err(c, "cannot read lprops for LEB %d", lnum); |
750 | continue; | 750 | continue; |
751 | } | 751 | } |
752 | 752 | ||
@@ -819,13 +819,13 @@ void ubifs_dump_leb(const struct ubifs_info *c, int lnum) | |||
819 | 819 | ||
820 | buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); | 820 | buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); |
821 | if (!buf) { | 821 | if (!buf) { |
822 | ubifs_err("cannot allocate memory for dumping LEB %d", lnum); | 822 | ubifs_err(c, "cannot allocate memory for dumping LEB %d", lnum); |
823 | return; | 823 | return; |
824 | } | 824 | } |
825 | 825 | ||
826 | sleb = ubifs_scan(c, lnum, 0, buf, 0); | 826 | sleb = ubifs_scan(c, lnum, 0, buf, 0); |
827 | if (IS_ERR(sleb)) { | 827 | if (IS_ERR(sleb)) { |
828 | ubifs_err("scan error %d", (int)PTR_ERR(sleb)); | 828 | ubifs_err(c, "scan error %d", (int)PTR_ERR(sleb)); |
829 | goto out; | 829 | goto out; |
830 | } | 830 | } |
831 | 831 | ||
@@ -1032,7 +1032,7 @@ int dbg_check_space_info(struct ubifs_info *c) | |||
1032 | spin_unlock(&c->space_lock); | 1032 | spin_unlock(&c->space_lock); |
1033 | 1033 | ||
1034 | if (free != d->saved_free) { | 1034 | if (free != d->saved_free) { |
1035 | ubifs_err("free space changed from %lld to %lld", | 1035 | ubifs_err(c, "free space changed from %lld to %lld", |
1036 | d->saved_free, free); | 1036 | d->saved_free, free); |
1037 | goto out; | 1037 | goto out; |
1038 | } | 1038 | } |
@@ -1040,15 +1040,15 @@ int dbg_check_space_info(struct ubifs_info *c) | |||
1040 | return 0; | 1040 | return 0; |
1041 | 1041 | ||
1042 | out: | 1042 | out: |
1043 | ubifs_msg("saved lprops statistics dump"); | 1043 | ubifs_msg(c, "saved lprops statistics dump"); |
1044 | ubifs_dump_lstats(&d->saved_lst); | 1044 | ubifs_dump_lstats(&d->saved_lst); |
1045 | ubifs_msg("saved budgeting info dump"); | 1045 | ubifs_msg(c, "saved budgeting info dump"); |
1046 | ubifs_dump_budg(c, &d->saved_bi); | 1046 | ubifs_dump_budg(c, &d->saved_bi); |
1047 | ubifs_msg("saved idx_gc_cnt %d", d->saved_idx_gc_cnt); | 1047 | ubifs_msg(c, "saved idx_gc_cnt %d", d->saved_idx_gc_cnt); |
1048 | ubifs_msg("current lprops statistics dump"); | 1048 | ubifs_msg(c, "current lprops statistics dump"); |
1049 | ubifs_get_lp_stats(c, &lst); | 1049 | ubifs_get_lp_stats(c, &lst); |
1050 | ubifs_dump_lstats(&lst); | 1050 | ubifs_dump_lstats(&lst); |
1051 | ubifs_msg("current budgeting info dump"); | 1051 | ubifs_msg(c, "current budgeting info dump"); |
1052 | ubifs_dump_budg(c, &c->bi); | 1052 | ubifs_dump_budg(c, &c->bi); |
1053 | dump_stack(); | 1053 | dump_stack(); |
1054 | return -EINVAL; | 1054 | return -EINVAL; |
@@ -1077,9 +1077,9 @@ int dbg_check_synced_i_size(const struct ubifs_info *c, struct inode *inode) | |||
1077 | mutex_lock(&ui->ui_mutex); | 1077 | mutex_lock(&ui->ui_mutex); |
1078 | spin_lock(&ui->ui_lock); | 1078 | spin_lock(&ui->ui_lock); |
1079 | if (ui->ui_size != ui->synced_i_size && !ui->dirty) { | 1079 | if (ui->ui_size != ui->synced_i_size && !ui->dirty) { |
1080 | ubifs_err("ui_size is %lld, synced_i_size is %lld, but inode is clean", | 1080 | ubifs_err(c, "ui_size is %lld, synced_i_size is %lld, but inode is clean", |
1081 | ui->ui_size, ui->synced_i_size); | 1081 | ui->ui_size, ui->synced_i_size); |
1082 | ubifs_err("i_ino %lu, i_mode %#x, i_size %lld", inode->i_ino, | 1082 | ubifs_err(c, "i_ino %lu, i_mode %#x, i_size %lld", inode->i_ino, |
1083 | inode->i_mode, i_size_read(inode)); | 1083 | inode->i_mode, i_size_read(inode)); |
1084 | dump_stack(); | 1084 | dump_stack(); |
1085 | err = -EINVAL; | 1085 | err = -EINVAL; |
@@ -1140,7 +1140,7 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir) | |||
1140 | kfree(pdent); | 1140 | kfree(pdent); |
1141 | 1141 | ||
1142 | if (i_size_read(dir) != size) { | 1142 | if (i_size_read(dir) != size) { |
1143 | ubifs_err("directory inode %lu has size %llu, but calculated size is %llu", | 1143 | ubifs_err(c, "directory inode %lu has size %llu, but calculated size is %llu", |
1144 | dir->i_ino, (unsigned long long)i_size_read(dir), | 1144 | dir->i_ino, (unsigned long long)i_size_read(dir), |
1145 | (unsigned long long)size); | 1145 | (unsigned long long)size); |
1146 | ubifs_dump_inode(c, dir); | 1146 | ubifs_dump_inode(c, dir); |
@@ -1148,7 +1148,7 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir) | |||
1148 | return -EINVAL; | 1148 | return -EINVAL; |
1149 | } | 1149 | } |
1150 | if (dir->i_nlink != nlink) { | 1150 | if (dir->i_nlink != nlink) { |
1151 | ubifs_err("directory inode %lu has nlink %u, but calculated nlink is %u", | 1151 | ubifs_err(c, "directory inode %lu has nlink %u, but calculated nlink is %u", |
1152 | dir->i_ino, dir->i_nlink, nlink); | 1152 | dir->i_ino, dir->i_nlink, nlink); |
1153 | ubifs_dump_inode(c, dir); | 1153 | ubifs_dump_inode(c, dir); |
1154 | dump_stack(); | 1154 | dump_stack(); |
@@ -1207,10 +1207,10 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1, | |||
1207 | err = 1; | 1207 | err = 1; |
1208 | key_read(c, &dent1->key, &key); | 1208 | key_read(c, &dent1->key, &key); |
1209 | if (keys_cmp(c, &zbr1->key, &key)) { | 1209 | if (keys_cmp(c, &zbr1->key, &key)) { |
1210 | ubifs_err("1st entry at %d:%d has key %s", zbr1->lnum, | 1210 | ubifs_err(c, "1st entry at %d:%d has key %s", zbr1->lnum, |
1211 | zbr1->offs, dbg_snprintf_key(c, &key, key_buf, | 1211 | zbr1->offs, dbg_snprintf_key(c, &key, key_buf, |
1212 | DBG_KEY_BUF_LEN)); | 1212 | DBG_KEY_BUF_LEN)); |
1213 | ubifs_err("but it should have key %s according to tnc", | 1213 | ubifs_err(c, "but it should have key %s according to tnc", |
1214 | dbg_snprintf_key(c, &zbr1->key, key_buf, | 1214 | dbg_snprintf_key(c, &zbr1->key, key_buf, |
1215 | DBG_KEY_BUF_LEN)); | 1215 | DBG_KEY_BUF_LEN)); |
1216 | ubifs_dump_node(c, dent1); | 1216 | ubifs_dump_node(c, dent1); |
@@ -1219,10 +1219,10 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1, | |||
1219 | 1219 | ||
1220 | key_read(c, &dent2->key, &key); | 1220 | key_read(c, &dent2->key, &key); |
1221 | if (keys_cmp(c, &zbr2->key, &key)) { | 1221 | if (keys_cmp(c, &zbr2->key, &key)) { |
1222 | ubifs_err("2nd entry at %d:%d has key %s", zbr1->lnum, | 1222 | ubifs_err(c, "2nd entry at %d:%d has key %s", zbr1->lnum, |
1223 | zbr1->offs, dbg_snprintf_key(c, &key, key_buf, | 1223 | zbr1->offs, dbg_snprintf_key(c, &key, key_buf, |
1224 | DBG_KEY_BUF_LEN)); | 1224 | DBG_KEY_BUF_LEN)); |
1225 | ubifs_err("but it should have key %s according to tnc", | 1225 | ubifs_err(c, "but it should have key %s according to tnc", |
1226 | dbg_snprintf_key(c, &zbr2->key, key_buf, | 1226 | dbg_snprintf_key(c, &zbr2->key, key_buf, |
1227 | DBG_KEY_BUF_LEN)); | 1227 | DBG_KEY_BUF_LEN)); |
1228 | ubifs_dump_node(c, dent2); | 1228 | ubifs_dump_node(c, dent2); |
@@ -1238,14 +1238,14 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1, | |||
1238 | goto out_free; | 1238 | goto out_free; |
1239 | } | 1239 | } |
1240 | if (cmp == 0 && nlen1 == nlen2) | 1240 | if (cmp == 0 && nlen1 == nlen2) |
1241 | ubifs_err("2 xent/dent nodes with the same name"); | 1241 | ubifs_err(c, "2 xent/dent nodes with the same name"); |
1242 | else | 1242 | else |
1243 | ubifs_err("bad order of colliding key %s", | 1243 | ubifs_err(c, "bad order of colliding key %s", |
1244 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); | 1244 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); |
1245 | 1245 | ||
1246 | ubifs_msg("first node at %d:%d\n", zbr1->lnum, zbr1->offs); | 1246 | ubifs_msg(c, "first node at %d:%d\n", zbr1->lnum, zbr1->offs); |
1247 | ubifs_dump_node(c, dent1); | 1247 | ubifs_dump_node(c, dent1); |
1248 | ubifs_msg("second node at %d:%d\n", zbr2->lnum, zbr2->offs); | 1248 | ubifs_msg(c, "second node at %d:%d\n", zbr2->lnum, zbr2->offs); |
1249 | ubifs_dump_node(c, dent2); | 1249 | ubifs_dump_node(c, dent2); |
1250 | 1250 | ||
1251 | out_free: | 1251 | out_free: |
@@ -1447,11 +1447,11 @@ static int dbg_check_znode(struct ubifs_info *c, struct ubifs_zbranch *zbr) | |||
1447 | return 0; | 1447 | return 0; |
1448 | 1448 | ||
1449 | out: | 1449 | out: |
1450 | ubifs_err("failed, error %d", err); | 1450 | ubifs_err(c, "failed, error %d", err); |
1451 | ubifs_msg("dump of the znode"); | 1451 | ubifs_msg(c, "dump of the znode"); |
1452 | ubifs_dump_znode(c, znode); | 1452 | ubifs_dump_znode(c, znode); |
1453 | if (zp) { | 1453 | if (zp) { |
1454 | ubifs_msg("dump of the parent znode"); | 1454 | ubifs_msg(c, "dump of the parent znode"); |
1455 | ubifs_dump_znode(c, zp); | 1455 | ubifs_dump_znode(c, zp); |
1456 | } | 1456 | } |
1457 | dump_stack(); | 1457 | dump_stack(); |
@@ -1518,9 +1518,9 @@ int dbg_check_tnc(struct ubifs_info *c, int extra) | |||
1518 | if (err < 0) | 1518 | if (err < 0) |
1519 | return err; | 1519 | return err; |
1520 | if (err) { | 1520 | if (err) { |
1521 | ubifs_msg("first znode"); | 1521 | ubifs_msg(c, "first znode"); |
1522 | ubifs_dump_znode(c, prev); | 1522 | ubifs_dump_znode(c, prev); |
1523 | ubifs_msg("second znode"); | 1523 | ubifs_msg(c, "second znode"); |
1524 | ubifs_dump_znode(c, znode); | 1524 | ubifs_dump_znode(c, znode); |
1525 | return -EINVAL; | 1525 | return -EINVAL; |
1526 | } | 1526 | } |
@@ -1529,13 +1529,13 @@ int dbg_check_tnc(struct ubifs_info *c, int extra) | |||
1529 | 1529 | ||
1530 | if (extra) { | 1530 | if (extra) { |
1531 | if (clean_cnt != atomic_long_read(&c->clean_zn_cnt)) { | 1531 | if (clean_cnt != atomic_long_read(&c->clean_zn_cnt)) { |
1532 | ubifs_err("incorrect clean_zn_cnt %ld, calculated %ld", | 1532 | ubifs_err(c, "incorrect clean_zn_cnt %ld, calculated %ld", |
1533 | atomic_long_read(&c->clean_zn_cnt), | 1533 | atomic_long_read(&c->clean_zn_cnt), |
1534 | clean_cnt); | 1534 | clean_cnt); |
1535 | return -EINVAL; | 1535 | return -EINVAL; |
1536 | } | 1536 | } |
1537 | if (dirty_cnt != atomic_long_read(&c->dirty_zn_cnt)) { | 1537 | if (dirty_cnt != atomic_long_read(&c->dirty_zn_cnt)) { |
1538 | ubifs_err("incorrect dirty_zn_cnt %ld, calculated %ld", | 1538 | ubifs_err(c, "incorrect dirty_zn_cnt %ld, calculated %ld", |
1539 | atomic_long_read(&c->dirty_zn_cnt), | 1539 | atomic_long_read(&c->dirty_zn_cnt), |
1540 | dirty_cnt); | 1540 | dirty_cnt); |
1541 | return -EINVAL; | 1541 | return -EINVAL; |
@@ -1608,7 +1608,7 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, | |||
1608 | if (znode_cb) { | 1608 | if (znode_cb) { |
1609 | err = znode_cb(c, znode, priv); | 1609 | err = znode_cb(c, znode, priv); |
1610 | if (err) { | 1610 | if (err) { |
1611 | ubifs_err("znode checking function returned error %d", | 1611 | ubifs_err(c, "znode checking function returned error %d", |
1612 | err); | 1612 | err); |
1613 | ubifs_dump_znode(c, znode); | 1613 | ubifs_dump_znode(c, znode); |
1614 | goto out_dump; | 1614 | goto out_dump; |
@@ -1619,7 +1619,7 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, | |||
1619 | zbr = &znode->zbranch[idx]; | 1619 | zbr = &znode->zbranch[idx]; |
1620 | err = leaf_cb(c, zbr, priv); | 1620 | err = leaf_cb(c, zbr, priv); |
1621 | if (err) { | 1621 | if (err) { |
1622 | ubifs_err("leaf checking function returned error %d, for leaf at LEB %d:%d", | 1622 | ubifs_err(c, "leaf checking function returned error %d, for leaf at LEB %d:%d", |
1623 | err, zbr->lnum, zbr->offs); | 1623 | err, zbr->lnum, zbr->offs); |
1624 | goto out_dump; | 1624 | goto out_dump; |
1625 | } | 1625 | } |
@@ -1675,7 +1675,7 @@ out_dump: | |||
1675 | zbr = &znode->parent->zbranch[znode->iip]; | 1675 | zbr = &znode->parent->zbranch[znode->iip]; |
1676 | else | 1676 | else |
1677 | zbr = &c->zroot; | 1677 | zbr = &c->zroot; |
1678 | ubifs_msg("dump of znode at LEB %d:%d", zbr->lnum, zbr->offs); | 1678 | ubifs_msg(c, "dump of znode at LEB %d:%d", zbr->lnum, zbr->offs); |
1679 | ubifs_dump_znode(c, znode); | 1679 | ubifs_dump_znode(c, znode); |
1680 | out_unlock: | 1680 | out_unlock: |
1681 | mutex_unlock(&c->tnc_mutex); | 1681 | mutex_unlock(&c->tnc_mutex); |
@@ -1722,12 +1722,12 @@ int dbg_check_idx_size(struct ubifs_info *c, long long idx_size) | |||
1722 | 1722 | ||
1723 | err = dbg_walk_index(c, NULL, add_size, &calc); | 1723 | err = dbg_walk_index(c, NULL, add_size, &calc); |
1724 | if (err) { | 1724 | if (err) { |
1725 | ubifs_err("error %d while walking the index", err); | 1725 | ubifs_err(c, "error %d while walking the index", err); |
1726 | return err; | 1726 | return err; |
1727 | } | 1727 | } |
1728 | 1728 | ||
1729 | if (calc != idx_size) { | 1729 | if (calc != idx_size) { |
1730 | ubifs_err("index size check failed: calculated size is %lld, should be %lld", | 1730 | ubifs_err(c, "index size check failed: calculated size is %lld, should be %lld", |
1731 | calc, idx_size); | 1731 | calc, idx_size); |
1732 | dump_stack(); | 1732 | dump_stack(); |
1733 | return -EINVAL; | 1733 | return -EINVAL; |
@@ -1814,7 +1814,7 @@ static struct fsck_inode *add_inode(struct ubifs_info *c, | |||
1814 | } | 1814 | } |
1815 | 1815 | ||
1816 | if (inum > c->highest_inum) { | 1816 | if (inum > c->highest_inum) { |
1817 | ubifs_err("too high inode number, max. is %lu", | 1817 | ubifs_err(c, "too high inode number, max. is %lu", |
1818 | (unsigned long)c->highest_inum); | 1818 | (unsigned long)c->highest_inum); |
1819 | return ERR_PTR(-EINVAL); | 1819 | return ERR_PTR(-EINVAL); |
1820 | } | 1820 | } |
@@ -1921,17 +1921,17 @@ static struct fsck_inode *read_add_inode(struct ubifs_info *c, | |||
1921 | ino_key_init(c, &key, inum); | 1921 | ino_key_init(c, &key, inum); |
1922 | err = ubifs_lookup_level0(c, &key, &znode, &n); | 1922 | err = ubifs_lookup_level0(c, &key, &znode, &n); |
1923 | if (!err) { | 1923 | if (!err) { |
1924 | ubifs_err("inode %lu not found in index", (unsigned long)inum); | 1924 | ubifs_err(c, "inode %lu not found in index", (unsigned long)inum); |
1925 | return ERR_PTR(-ENOENT); | 1925 | return ERR_PTR(-ENOENT); |
1926 | } else if (err < 0) { | 1926 | } else if (err < 0) { |
1927 | ubifs_err("error %d while looking up inode %lu", | 1927 | ubifs_err(c, "error %d while looking up inode %lu", |
1928 | err, (unsigned long)inum); | 1928 | err, (unsigned long)inum); |
1929 | return ERR_PTR(err); | 1929 | return ERR_PTR(err); |
1930 | } | 1930 | } |
1931 | 1931 | ||
1932 | zbr = &znode->zbranch[n]; | 1932 | zbr = &znode->zbranch[n]; |
1933 | if (zbr->len < UBIFS_INO_NODE_SZ) { | 1933 | if (zbr->len < UBIFS_INO_NODE_SZ) { |
1934 | ubifs_err("bad node %lu node length %d", | 1934 | ubifs_err(c, "bad node %lu node length %d", |
1935 | (unsigned long)inum, zbr->len); | 1935 | (unsigned long)inum, zbr->len); |
1936 | return ERR_PTR(-EINVAL); | 1936 | return ERR_PTR(-EINVAL); |
1937 | } | 1937 | } |
@@ -1942,7 +1942,7 @@ static struct fsck_inode *read_add_inode(struct ubifs_info *c, | |||
1942 | 1942 | ||
1943 | err = ubifs_tnc_read_node(c, zbr, ino); | 1943 | err = ubifs_tnc_read_node(c, zbr, ino); |
1944 | if (err) { | 1944 | if (err) { |
1945 | ubifs_err("cannot read inode node at LEB %d:%d, error %d", | 1945 | ubifs_err(c, "cannot read inode node at LEB %d:%d, error %d", |
1946 | zbr->lnum, zbr->offs, err); | 1946 | zbr->lnum, zbr->offs, err); |
1947 | kfree(ino); | 1947 | kfree(ino); |
1948 | return ERR_PTR(err); | 1948 | return ERR_PTR(err); |
@@ -1951,7 +1951,7 @@ static struct fsck_inode *read_add_inode(struct ubifs_info *c, | |||
1951 | fscki = add_inode(c, fsckd, ino); | 1951 | fscki = add_inode(c, fsckd, ino); |
1952 | kfree(ino); | 1952 | kfree(ino); |
1953 | if (IS_ERR(fscki)) { | 1953 | if (IS_ERR(fscki)) { |
1954 | ubifs_err("error %ld while adding inode %lu node", | 1954 | ubifs_err(c, "error %ld while adding inode %lu node", |
1955 | PTR_ERR(fscki), (unsigned long)inum); | 1955 | PTR_ERR(fscki), (unsigned long)inum); |
1956 | return fscki; | 1956 | return fscki; |
1957 | } | 1957 | } |
@@ -1985,7 +1985,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
1985 | struct fsck_inode *fscki; | 1985 | struct fsck_inode *fscki; |
1986 | 1986 | ||
1987 | if (zbr->len < UBIFS_CH_SZ) { | 1987 | if (zbr->len < UBIFS_CH_SZ) { |
1988 | ubifs_err("bad leaf length %d (LEB %d:%d)", | 1988 | ubifs_err(c, "bad leaf length %d (LEB %d:%d)", |
1989 | zbr->len, zbr->lnum, zbr->offs); | 1989 | zbr->len, zbr->lnum, zbr->offs); |
1990 | return -EINVAL; | 1990 | return -EINVAL; |
1991 | } | 1991 | } |
@@ -1996,7 +1996,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
1996 | 1996 | ||
1997 | err = ubifs_tnc_read_node(c, zbr, node); | 1997 | err = ubifs_tnc_read_node(c, zbr, node); |
1998 | if (err) { | 1998 | if (err) { |
1999 | ubifs_err("cannot read leaf node at LEB %d:%d, error %d", | 1999 | ubifs_err(c, "cannot read leaf node at LEB %d:%d, error %d", |
2000 | zbr->lnum, zbr->offs, err); | 2000 | zbr->lnum, zbr->offs, err); |
2001 | goto out_free; | 2001 | goto out_free; |
2002 | } | 2002 | } |
@@ -2006,7 +2006,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2006 | fscki = add_inode(c, priv, node); | 2006 | fscki = add_inode(c, priv, node); |
2007 | if (IS_ERR(fscki)) { | 2007 | if (IS_ERR(fscki)) { |
2008 | err = PTR_ERR(fscki); | 2008 | err = PTR_ERR(fscki); |
2009 | ubifs_err("error %d while adding inode node", err); | 2009 | ubifs_err(c, "error %d while adding inode node", err); |
2010 | goto out_dump; | 2010 | goto out_dump; |
2011 | } | 2011 | } |
2012 | goto out; | 2012 | goto out; |
@@ -2014,7 +2014,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2014 | 2014 | ||
2015 | if (type != UBIFS_DENT_KEY && type != UBIFS_XENT_KEY && | 2015 | if (type != UBIFS_DENT_KEY && type != UBIFS_XENT_KEY && |
2016 | type != UBIFS_DATA_KEY) { | 2016 | type != UBIFS_DATA_KEY) { |
2017 | ubifs_err("unexpected node type %d at LEB %d:%d", | 2017 | ubifs_err(c, "unexpected node type %d at LEB %d:%d", |
2018 | type, zbr->lnum, zbr->offs); | 2018 | type, zbr->lnum, zbr->offs); |
2019 | err = -EINVAL; | 2019 | err = -EINVAL; |
2020 | goto out_free; | 2020 | goto out_free; |
@@ -2022,7 +2022,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2022 | 2022 | ||
2023 | ch = node; | 2023 | ch = node; |
2024 | if (le64_to_cpu(ch->sqnum) > c->max_sqnum) { | 2024 | if (le64_to_cpu(ch->sqnum) > c->max_sqnum) { |
2025 | ubifs_err("too high sequence number, max. is %llu", | 2025 | ubifs_err(c, "too high sequence number, max. is %llu", |
2026 | c->max_sqnum); | 2026 | c->max_sqnum); |
2027 | err = -EINVAL; | 2027 | err = -EINVAL; |
2028 | goto out_dump; | 2028 | goto out_dump; |
@@ -2042,7 +2042,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2042 | fscki = read_add_inode(c, priv, inum); | 2042 | fscki = read_add_inode(c, priv, inum); |
2043 | if (IS_ERR(fscki)) { | 2043 | if (IS_ERR(fscki)) { |
2044 | err = PTR_ERR(fscki); | 2044 | err = PTR_ERR(fscki); |
2045 | ubifs_err("error %d while processing data node and trying to find inode node %lu", | 2045 | ubifs_err(c, "error %d while processing data node and trying to find inode node %lu", |
2046 | err, (unsigned long)inum); | 2046 | err, (unsigned long)inum); |
2047 | goto out_dump; | 2047 | goto out_dump; |
2048 | } | 2048 | } |
@@ -2052,7 +2052,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2052 | blk_offs <<= UBIFS_BLOCK_SHIFT; | 2052 | blk_offs <<= UBIFS_BLOCK_SHIFT; |
2053 | blk_offs += le32_to_cpu(dn->size); | 2053 | blk_offs += le32_to_cpu(dn->size); |
2054 | if (blk_offs > fscki->size) { | 2054 | if (blk_offs > fscki->size) { |
2055 | ubifs_err("data node at LEB %d:%d is not within inode size %lld", | 2055 | ubifs_err(c, "data node at LEB %d:%d is not within inode size %lld", |
2056 | zbr->lnum, zbr->offs, fscki->size); | 2056 | zbr->lnum, zbr->offs, fscki->size); |
2057 | err = -EINVAL; | 2057 | err = -EINVAL; |
2058 | goto out_dump; | 2058 | goto out_dump; |
@@ -2076,7 +2076,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2076 | fscki = read_add_inode(c, priv, inum); | 2076 | fscki = read_add_inode(c, priv, inum); |
2077 | if (IS_ERR(fscki)) { | 2077 | if (IS_ERR(fscki)) { |
2078 | err = PTR_ERR(fscki); | 2078 | err = PTR_ERR(fscki); |
2079 | ubifs_err("error %d while processing entry node and trying to find inode node %lu", | 2079 | ubifs_err(c, "error %d while processing entry node and trying to find inode node %lu", |
2080 | err, (unsigned long)inum); | 2080 | err, (unsigned long)inum); |
2081 | goto out_dump; | 2081 | goto out_dump; |
2082 | } | 2082 | } |
@@ -2088,7 +2088,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2088 | fscki1 = read_add_inode(c, priv, inum); | 2088 | fscki1 = read_add_inode(c, priv, inum); |
2089 | if (IS_ERR(fscki1)) { | 2089 | if (IS_ERR(fscki1)) { |
2090 | err = PTR_ERR(fscki1); | 2090 | err = PTR_ERR(fscki1); |
2091 | ubifs_err("error %d while processing entry node and trying to find parent inode node %lu", | 2091 | ubifs_err(c, "error %d while processing entry node and trying to find parent inode node %lu", |
2092 | err, (unsigned long)inum); | 2092 | err, (unsigned long)inum); |
2093 | goto out_dump; | 2093 | goto out_dump; |
2094 | } | 2094 | } |
@@ -2111,7 +2111,7 @@ out: | |||
2111 | return 0; | 2111 | return 0; |
2112 | 2112 | ||
2113 | out_dump: | 2113 | out_dump: |
2114 | ubifs_msg("dump of node at LEB %d:%d", zbr->lnum, zbr->offs); | 2114 | ubifs_msg(c, "dump of node at LEB %d:%d", zbr->lnum, zbr->offs); |
2115 | ubifs_dump_node(c, node); | 2115 | ubifs_dump_node(c, node); |
2116 | out_free: | 2116 | out_free: |
2117 | kfree(node); | 2117 | kfree(node); |
@@ -2162,52 +2162,52 @@ static int check_inodes(struct ubifs_info *c, struct fsck_data *fsckd) | |||
2162 | */ | 2162 | */ |
2163 | if (fscki->inum != UBIFS_ROOT_INO && | 2163 | if (fscki->inum != UBIFS_ROOT_INO && |
2164 | fscki->references != 1) { | 2164 | fscki->references != 1) { |
2165 | ubifs_err("directory inode %lu has %d direntries which refer it, but should be 1", | 2165 | ubifs_err(c, "directory inode %lu has %d direntries which refer it, but should be 1", |
2166 | (unsigned long)fscki->inum, | 2166 | (unsigned long)fscki->inum, |
2167 | fscki->references); | 2167 | fscki->references); |
2168 | goto out_dump; | 2168 | goto out_dump; |
2169 | } | 2169 | } |
2170 | if (fscki->inum == UBIFS_ROOT_INO && | 2170 | if (fscki->inum == UBIFS_ROOT_INO && |
2171 | fscki->references != 0) { | 2171 | fscki->references != 0) { |
2172 | ubifs_err("root inode %lu has non-zero (%d) direntries which refer it", | 2172 | ubifs_err(c, "root inode %lu has non-zero (%d) direntries which refer it", |
2173 | (unsigned long)fscki->inum, | 2173 | (unsigned long)fscki->inum, |
2174 | fscki->references); | 2174 | fscki->references); |
2175 | goto out_dump; | 2175 | goto out_dump; |
2176 | } | 2176 | } |
2177 | if (fscki->calc_sz != fscki->size) { | 2177 | if (fscki->calc_sz != fscki->size) { |
2178 | ubifs_err("directory inode %lu size is %lld, but calculated size is %lld", | 2178 | ubifs_err(c, "directory inode %lu size is %lld, but calculated size is %lld", |
2179 | (unsigned long)fscki->inum, | 2179 | (unsigned long)fscki->inum, |
2180 | fscki->size, fscki->calc_sz); | 2180 | fscki->size, fscki->calc_sz); |
2181 | goto out_dump; | 2181 | goto out_dump; |
2182 | } | 2182 | } |
2183 | if (fscki->calc_cnt != fscki->nlink) { | 2183 | if (fscki->calc_cnt != fscki->nlink) { |
2184 | ubifs_err("directory inode %lu nlink is %d, but calculated nlink is %d", | 2184 | ubifs_err(c, "directory inode %lu nlink is %d, but calculated nlink is %d", |
2185 | (unsigned long)fscki->inum, | 2185 | (unsigned long)fscki->inum, |
2186 | fscki->nlink, fscki->calc_cnt); | 2186 | fscki->nlink, fscki->calc_cnt); |
2187 | goto out_dump; | 2187 | goto out_dump; |
2188 | } | 2188 | } |
2189 | } else { | 2189 | } else { |
2190 | if (fscki->references != fscki->nlink) { | 2190 | if (fscki->references != fscki->nlink) { |
2191 | ubifs_err("inode %lu nlink is %d, but calculated nlink is %d", | 2191 | ubifs_err(c, "inode %lu nlink is %d, but calculated nlink is %d", |
2192 | (unsigned long)fscki->inum, | 2192 | (unsigned long)fscki->inum, |
2193 | fscki->nlink, fscki->references); | 2193 | fscki->nlink, fscki->references); |
2194 | goto out_dump; | 2194 | goto out_dump; |
2195 | } | 2195 | } |
2196 | } | 2196 | } |
2197 | if (fscki->xattr_sz != fscki->calc_xsz) { | 2197 | if (fscki->xattr_sz != fscki->calc_xsz) { |
2198 | ubifs_err("inode %lu has xattr size %u, but calculated size is %lld", | 2198 | ubifs_err(c, "inode %lu has xattr size %u, but calculated size is %lld", |
2199 | (unsigned long)fscki->inum, fscki->xattr_sz, | 2199 | (unsigned long)fscki->inum, fscki->xattr_sz, |
2200 | fscki->calc_xsz); | 2200 | fscki->calc_xsz); |
2201 | goto out_dump; | 2201 | goto out_dump; |
2202 | } | 2202 | } |
2203 | if (fscki->xattr_cnt != fscki->calc_xcnt) { | 2203 | if (fscki->xattr_cnt != fscki->calc_xcnt) { |
2204 | ubifs_err("inode %lu has %u xattrs, but calculated count is %lld", | 2204 | ubifs_err(c, "inode %lu has %u xattrs, but calculated count is %lld", |
2205 | (unsigned long)fscki->inum, | 2205 | (unsigned long)fscki->inum, |
2206 | fscki->xattr_cnt, fscki->calc_xcnt); | 2206 | fscki->xattr_cnt, fscki->calc_xcnt); |
2207 | goto out_dump; | 2207 | goto out_dump; |
2208 | } | 2208 | } |
2209 | if (fscki->xattr_nms != fscki->calc_xnms) { | 2209 | if (fscki->xattr_nms != fscki->calc_xnms) { |
2210 | ubifs_err("inode %lu has xattr names' size %u, but calculated names' size is %lld", | 2210 | ubifs_err(c, "inode %lu has xattr names' size %u, but calculated names' size is %lld", |
2211 | (unsigned long)fscki->inum, fscki->xattr_nms, | 2211 | (unsigned long)fscki->inum, fscki->xattr_nms, |
2212 | fscki->calc_xnms); | 2212 | fscki->calc_xnms); |
2213 | goto out_dump; | 2213 | goto out_dump; |
@@ -2221,11 +2221,11 @@ out_dump: | |||
2221 | ino_key_init(c, &key, fscki->inum); | 2221 | ino_key_init(c, &key, fscki->inum); |
2222 | err = ubifs_lookup_level0(c, &key, &znode, &n); | 2222 | err = ubifs_lookup_level0(c, &key, &znode, &n); |
2223 | if (!err) { | 2223 | if (!err) { |
2224 | ubifs_err("inode %lu not found in index", | 2224 | ubifs_err(c, "inode %lu not found in index", |
2225 | (unsigned long)fscki->inum); | 2225 | (unsigned long)fscki->inum); |
2226 | return -ENOENT; | 2226 | return -ENOENT; |
2227 | } else if (err < 0) { | 2227 | } else if (err < 0) { |
2228 | ubifs_err("error %d while looking up inode %lu", | 2228 | ubifs_err(c, "error %d while looking up inode %lu", |
2229 | err, (unsigned long)fscki->inum); | 2229 | err, (unsigned long)fscki->inum); |
2230 | return err; | 2230 | return err; |
2231 | } | 2231 | } |
@@ -2237,13 +2237,13 @@ out_dump: | |||
2237 | 2237 | ||
2238 | err = ubifs_tnc_read_node(c, zbr, ino); | 2238 | err = ubifs_tnc_read_node(c, zbr, ino); |
2239 | if (err) { | 2239 | if (err) { |
2240 | ubifs_err("cannot read inode node at LEB %d:%d, error %d", | 2240 | ubifs_err(c, "cannot read inode node at LEB %d:%d, error %d", |
2241 | zbr->lnum, zbr->offs, err); | 2241 | zbr->lnum, zbr->offs, err); |
2242 | kfree(ino); | 2242 | kfree(ino); |
2243 | return err; | 2243 | return err; |
2244 | } | 2244 | } |
2245 | 2245 | ||
2246 | ubifs_msg("dump of the inode %lu sitting in LEB %d:%d", | 2246 | ubifs_msg(c, "dump of the inode %lu sitting in LEB %d:%d", |
2247 | (unsigned long)fscki->inum, zbr->lnum, zbr->offs); | 2247 | (unsigned long)fscki->inum, zbr->lnum, zbr->offs); |
2248 | ubifs_dump_node(c, ino); | 2248 | ubifs_dump_node(c, ino); |
2249 | kfree(ino); | 2249 | kfree(ino); |
@@ -2284,7 +2284,7 @@ int dbg_check_filesystem(struct ubifs_info *c) | |||
2284 | return 0; | 2284 | return 0; |
2285 | 2285 | ||
2286 | out_free: | 2286 | out_free: |
2287 | ubifs_err("file-system check failed with error %d", err); | 2287 | ubifs_err(c, "file-system check failed with error %d", err); |
2288 | dump_stack(); | 2288 | dump_stack(); |
2289 | free_inodes(&fsckd); | 2289 | free_inodes(&fsckd); |
2290 | return err; | 2290 | return err; |
@@ -2315,12 +2315,12 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2315 | sb = container_of(cur->next, struct ubifs_scan_node, list); | 2315 | sb = container_of(cur->next, struct ubifs_scan_node, list); |
2316 | 2316 | ||
2317 | if (sa->type != UBIFS_DATA_NODE) { | 2317 | if (sa->type != UBIFS_DATA_NODE) { |
2318 | ubifs_err("bad node type %d", sa->type); | 2318 | ubifs_err(c, "bad node type %d", sa->type); |
2319 | ubifs_dump_node(c, sa->node); | 2319 | ubifs_dump_node(c, sa->node); |
2320 | return -EINVAL; | 2320 | return -EINVAL; |
2321 | } | 2321 | } |
2322 | if (sb->type != UBIFS_DATA_NODE) { | 2322 | if (sb->type != UBIFS_DATA_NODE) { |
2323 | ubifs_err("bad node type %d", sb->type); | 2323 | ubifs_err(c, "bad node type %d", sb->type); |
2324 | ubifs_dump_node(c, sb->node); | 2324 | ubifs_dump_node(c, sb->node); |
2325 | return -EINVAL; | 2325 | return -EINVAL; |
2326 | } | 2326 | } |
@@ -2331,7 +2331,7 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2331 | if (inuma < inumb) | 2331 | if (inuma < inumb) |
2332 | continue; | 2332 | continue; |
2333 | if (inuma > inumb) { | 2333 | if (inuma > inumb) { |
2334 | ubifs_err("larger inum %lu goes before inum %lu", | 2334 | ubifs_err(c, "larger inum %lu goes before inum %lu", |
2335 | (unsigned long)inuma, (unsigned long)inumb); | 2335 | (unsigned long)inuma, (unsigned long)inumb); |
2336 | goto error_dump; | 2336 | goto error_dump; |
2337 | } | 2337 | } |
@@ -2340,11 +2340,11 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2340 | blkb = key_block(c, &sb->key); | 2340 | blkb = key_block(c, &sb->key); |
2341 | 2341 | ||
2342 | if (blka > blkb) { | 2342 | if (blka > blkb) { |
2343 | ubifs_err("larger block %u goes before %u", blka, blkb); | 2343 | ubifs_err(c, "larger block %u goes before %u", blka, blkb); |
2344 | goto error_dump; | 2344 | goto error_dump; |
2345 | } | 2345 | } |
2346 | if (blka == blkb) { | 2346 | if (blka == blkb) { |
2347 | ubifs_err("two data nodes for the same block"); | 2347 | ubifs_err(c, "two data nodes for the same block"); |
2348 | goto error_dump; | 2348 | goto error_dump; |
2349 | } | 2349 | } |
2350 | } | 2350 | } |
@@ -2383,19 +2383,19 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2383 | 2383 | ||
2384 | if (sa->type != UBIFS_INO_NODE && sa->type != UBIFS_DENT_NODE && | 2384 | if (sa->type != UBIFS_INO_NODE && sa->type != UBIFS_DENT_NODE && |
2385 | sa->type != UBIFS_XENT_NODE) { | 2385 | sa->type != UBIFS_XENT_NODE) { |
2386 | ubifs_err("bad node type %d", sa->type); | 2386 | ubifs_err(c, "bad node type %d", sa->type); |
2387 | ubifs_dump_node(c, sa->node); | 2387 | ubifs_dump_node(c, sa->node); |
2388 | return -EINVAL; | 2388 | return -EINVAL; |
2389 | } | 2389 | } |
2390 | if (sa->type != UBIFS_INO_NODE && sa->type != UBIFS_DENT_NODE && | 2390 | if (sa->type != UBIFS_INO_NODE && sa->type != UBIFS_DENT_NODE && |
2391 | sa->type != UBIFS_XENT_NODE) { | 2391 | sa->type != UBIFS_XENT_NODE) { |
2392 | ubifs_err("bad node type %d", sb->type); | 2392 | ubifs_err(c, "bad node type %d", sb->type); |
2393 | ubifs_dump_node(c, sb->node); | 2393 | ubifs_dump_node(c, sb->node); |
2394 | return -EINVAL; | 2394 | return -EINVAL; |
2395 | } | 2395 | } |
2396 | 2396 | ||
2397 | if (sa->type != UBIFS_INO_NODE && sb->type == UBIFS_INO_NODE) { | 2397 | if (sa->type != UBIFS_INO_NODE && sb->type == UBIFS_INO_NODE) { |
2398 | ubifs_err("non-inode node goes before inode node"); | 2398 | ubifs_err(c, "non-inode node goes before inode node"); |
2399 | goto error_dump; | 2399 | goto error_dump; |
2400 | } | 2400 | } |
2401 | 2401 | ||
@@ -2405,7 +2405,7 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2405 | if (sa->type == UBIFS_INO_NODE && sb->type == UBIFS_INO_NODE) { | 2405 | if (sa->type == UBIFS_INO_NODE && sb->type == UBIFS_INO_NODE) { |
2406 | /* Inode nodes are sorted in descending size order */ | 2406 | /* Inode nodes are sorted in descending size order */ |
2407 | if (sa->len < sb->len) { | 2407 | if (sa->len < sb->len) { |
2408 | ubifs_err("smaller inode node goes first"); | 2408 | ubifs_err(c, "smaller inode node goes first"); |
2409 | goto error_dump; | 2409 | goto error_dump; |
2410 | } | 2410 | } |
2411 | continue; | 2411 | continue; |
@@ -2421,7 +2421,7 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2421 | if (inuma < inumb) | 2421 | if (inuma < inumb) |
2422 | continue; | 2422 | continue; |
2423 | if (inuma > inumb) { | 2423 | if (inuma > inumb) { |
2424 | ubifs_err("larger inum %lu goes before inum %lu", | 2424 | ubifs_err(c, "larger inum %lu goes before inum %lu", |
2425 | (unsigned long)inuma, (unsigned long)inumb); | 2425 | (unsigned long)inuma, (unsigned long)inumb); |
2426 | goto error_dump; | 2426 | goto error_dump; |
2427 | } | 2427 | } |
@@ -2430,7 +2430,7 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2430 | hashb = key_block(c, &sb->key); | 2430 | hashb = key_block(c, &sb->key); |
2431 | 2431 | ||
2432 | if (hasha > hashb) { | 2432 | if (hasha > hashb) { |
2433 | ubifs_err("larger hash %u goes before %u", | 2433 | ubifs_err(c, "larger hash %u goes before %u", |
2434 | hasha, hashb); | 2434 | hasha, hashb); |
2435 | goto error_dump; | 2435 | goto error_dump; |
2436 | } | 2436 | } |
@@ -2439,9 +2439,9 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2439 | return 0; | 2439 | return 0; |
2440 | 2440 | ||
2441 | error_dump: | 2441 | error_dump: |
2442 | ubifs_msg("dumping first node"); | 2442 | ubifs_msg(c, "dumping first node"); |
2443 | ubifs_dump_node(c, sa->node); | 2443 | ubifs_dump_node(c, sa->node); |
2444 | ubifs_msg("dumping second node"); | 2444 | ubifs_msg(c, "dumping second node"); |
2445 | ubifs_dump_node(c, sb->node); | 2445 | ubifs_dump_node(c, sb->node); |
2446 | return -EINVAL; | 2446 | return -EINVAL; |
2447 | return 0; | 2447 | return 0; |
@@ -2470,13 +2470,13 @@ static int power_cut_emulated(struct ubifs_info *c, int lnum, int write) | |||
2470 | delay = prandom_u32() % 60000; | 2470 | delay = prandom_u32() % 60000; |
2471 | d->pc_timeout = jiffies; | 2471 | d->pc_timeout = jiffies; |
2472 | d->pc_timeout += msecs_to_jiffies(delay); | 2472 | d->pc_timeout += msecs_to_jiffies(delay); |
2473 | ubifs_warn("failing after %lums", delay); | 2473 | ubifs_warn(c, "failing after %lums", delay); |
2474 | } else { | 2474 | } else { |
2475 | d->pc_delay = 2; | 2475 | d->pc_delay = 2; |
2476 | delay = prandom_u32() % 10000; | 2476 | delay = prandom_u32() % 10000; |
2477 | /* Fail within 10000 operations */ | 2477 | /* Fail within 10000 operations */ |
2478 | d->pc_cnt_max = delay; | 2478 | d->pc_cnt_max = delay; |
2479 | ubifs_warn("failing after %lu calls", delay); | 2479 | ubifs_warn(c, "failing after %lu calls", delay); |
2480 | } | 2480 | } |
2481 | } | 2481 | } |
2482 | 2482 | ||
@@ -2494,55 +2494,55 @@ static int power_cut_emulated(struct ubifs_info *c, int lnum, int write) | |||
2494 | return 0; | 2494 | return 0; |
2495 | if (chance(19, 20)) | 2495 | if (chance(19, 20)) |
2496 | return 0; | 2496 | return 0; |
2497 | ubifs_warn("failing in super block LEB %d", lnum); | 2497 | ubifs_warn(c, "failing in super block LEB %d", lnum); |
2498 | } else if (lnum == UBIFS_MST_LNUM || lnum == UBIFS_MST_LNUM + 1) { | 2498 | } else if (lnum == UBIFS_MST_LNUM || lnum == UBIFS_MST_LNUM + 1) { |
2499 | if (chance(19, 20)) | 2499 | if (chance(19, 20)) |
2500 | return 0; | 2500 | return 0; |
2501 | ubifs_warn("failing in master LEB %d", lnum); | 2501 | ubifs_warn(c, "failing in master LEB %d", lnum); |
2502 | } else if (lnum >= UBIFS_LOG_LNUM && lnum <= c->log_last) { | 2502 | } else if (lnum >= UBIFS_LOG_LNUM && lnum <= c->log_last) { |
2503 | if (write && chance(99, 100)) | 2503 | if (write && chance(99, 100)) |
2504 | return 0; | 2504 | return 0; |
2505 | if (chance(399, 400)) | 2505 | if (chance(399, 400)) |
2506 | return 0; | 2506 | return 0; |
2507 | ubifs_warn("failing in log LEB %d", lnum); | 2507 | ubifs_warn(c, "failing in log LEB %d", lnum); |
2508 | } else if (lnum >= c->lpt_first && lnum <= c->lpt_last) { | 2508 | } else if (lnum >= c->lpt_first && lnum <= c->lpt_last) { |
2509 | if (write && chance(7, 8)) | 2509 | if (write && chance(7, 8)) |
2510 | return 0; | 2510 | return 0; |
2511 | if (chance(19, 20)) | 2511 | if (chance(19, 20)) |
2512 | return 0; | 2512 | return 0; |
2513 | ubifs_warn("failing in LPT LEB %d", lnum); | 2513 | ubifs_warn(c, "failing in LPT LEB %d", lnum); |
2514 | } else if (lnum >= c->orph_first && lnum <= c->orph_last) { | 2514 | } else if (lnum >= c->orph_first && lnum <= c->orph_last) { |
2515 | if (write && chance(1, 2)) | 2515 | if (write && chance(1, 2)) |
2516 | return 0; | 2516 | return 0; |
2517 | if (chance(9, 10)) | 2517 | if (chance(9, 10)) |
2518 | return 0; | 2518 | return 0; |
2519 | ubifs_warn("failing in orphan LEB %d", lnum); | 2519 | ubifs_warn(c, "failing in orphan LEB %d", lnum); |
2520 | } else if (lnum == c->ihead_lnum) { | 2520 | } else if (lnum == c->ihead_lnum) { |
2521 | if (chance(99, 100)) | 2521 | if (chance(99, 100)) |
2522 | return 0; | 2522 | return 0; |
2523 | ubifs_warn("failing in index head LEB %d", lnum); | 2523 | ubifs_warn(c, "failing in index head LEB %d", lnum); |
2524 | } else if (c->jheads && lnum == c->jheads[GCHD].wbuf.lnum) { | 2524 | } else if (c->jheads && lnum == c->jheads[GCHD].wbuf.lnum) { |
2525 | if (chance(9, 10)) | 2525 | if (chance(9, 10)) |
2526 | return 0; | 2526 | return 0; |
2527 | ubifs_warn("failing in GC head LEB %d", lnum); | 2527 | ubifs_warn(c, "failing in GC head LEB %d", lnum); |
2528 | } else if (write && !RB_EMPTY_ROOT(&c->buds) && | 2528 | } else if (write && !RB_EMPTY_ROOT(&c->buds) && |
2529 | !ubifs_search_bud(c, lnum)) { | 2529 | !ubifs_search_bud(c, lnum)) { |
2530 | if (chance(19, 20)) | 2530 | if (chance(19, 20)) |
2531 | return 0; | 2531 | return 0; |
2532 | ubifs_warn("failing in non-bud LEB %d", lnum); | 2532 | ubifs_warn(c, "failing in non-bud LEB %d", lnum); |
2533 | } else if (c->cmt_state == COMMIT_RUNNING_BACKGROUND || | 2533 | } else if (c->cmt_state == COMMIT_RUNNING_BACKGROUND || |
2534 | c->cmt_state == COMMIT_RUNNING_REQUIRED) { | 2534 | c->cmt_state == COMMIT_RUNNING_REQUIRED) { |
2535 | if (chance(999, 1000)) | 2535 | if (chance(999, 1000)) |
2536 | return 0; | 2536 | return 0; |
2537 | ubifs_warn("failing in bud LEB %d commit running", lnum); | 2537 | ubifs_warn(c, "failing in bud LEB %d commit running", lnum); |
2538 | } else { | 2538 | } else { |
2539 | if (chance(9999, 10000)) | 2539 | if (chance(9999, 10000)) |
2540 | return 0; | 2540 | return 0; |
2541 | ubifs_warn("failing in bud LEB %d commit not running", lnum); | 2541 | ubifs_warn(c, "failing in bud LEB %d commit not running", lnum); |
2542 | } | 2542 | } |
2543 | 2543 | ||
2544 | d->pc_happened = 1; | 2544 | d->pc_happened = 1; |
2545 | ubifs_warn("========== Power cut emulated =========="); | 2545 | ubifs_warn(c, "========== Power cut emulated =========="); |
2546 | dump_stack(); | 2546 | dump_stack(); |
2547 | return 1; | 2547 | return 1; |
2548 | } | 2548 | } |
@@ -2557,7 +2557,7 @@ static int corrupt_data(const struct ubifs_info *c, const void *buf, | |||
2557 | /* Corruption span max to end of write unit */ | 2557 | /* Corruption span max to end of write unit */ |
2558 | to = min(len, ALIGN(from + 1, c->max_write_size)); | 2558 | to = min(len, ALIGN(from + 1, c->max_write_size)); |
2559 | 2559 | ||
2560 | ubifs_warn("filled bytes %u-%u with %s", from, to - 1, | 2560 | ubifs_warn(c, "filled bytes %u-%u with %s", from, to - 1, |
2561 | ffs ? "0xFFs" : "random data"); | 2561 | ffs ? "0xFFs" : "random data"); |
2562 | 2562 | ||
2563 | if (ffs) | 2563 | if (ffs) |
@@ -2579,7 +2579,7 @@ int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, | |||
2579 | failing = power_cut_emulated(c, lnum, 1); | 2579 | failing = power_cut_emulated(c, lnum, 1); |
2580 | if (failing) { | 2580 | if (failing) { |
2581 | len = corrupt_data(c, buf, len); | 2581 | len = corrupt_data(c, buf, len); |
2582 | ubifs_warn("actually write %d bytes to LEB %d:%d (the buffer was corrupted)", | 2582 | ubifs_warn(c, "actually write %d bytes to LEB %d:%d (the buffer was corrupted)", |
2583 | len, lnum, offs); | 2583 | len, lnum, offs); |
2584 | } | 2584 | } |
2585 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len); | 2585 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len); |
@@ -2909,7 +2909,7 @@ out_remove: | |||
2909 | debugfs_remove_recursive(d->dfs_dir); | 2909 | debugfs_remove_recursive(d->dfs_dir); |
2910 | out: | 2910 | out: |
2911 | err = dent ? PTR_ERR(dent) : -ENODEV; | 2911 | err = dent ? PTR_ERR(dent) : -ENODEV; |
2912 | ubifs_err("cannot create \"%s\" debugfs file or directory, error %d\n", | 2912 | ubifs_err(c, "cannot create \"%s\" debugfs file or directory, error %d\n", |
2913 | fname, err); | 2913 | fname, err); |
2914 | return err; | 2914 | return err; |
2915 | } | 2915 | } |
@@ -3063,8 +3063,8 @@ out_remove: | |||
3063 | debugfs_remove_recursive(dfs_rootdir); | 3063 | debugfs_remove_recursive(dfs_rootdir); |
3064 | out: | 3064 | out: |
3065 | err = dent ? PTR_ERR(dent) : -ENODEV; | 3065 | err = dent ? PTR_ERR(dent) : -ENODEV; |
3066 | ubifs_err("cannot create \"%s\" debugfs file or directory, error %d\n", | 3066 | pr_err("UBIFS error (pid %d): cannot create \"%s\" debugfs file or directory, error %d\n", |
3067 | fname, err); | 3067 | current->pid, fname, err); |
3068 | return err; | 3068 | return err; |
3069 | } | 3069 | } |
3070 | 3070 | ||