aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/tnc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ubifs/tnc.c')
-rw-r--r--fs/ubifs/tnc.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index 066738647685..cbd6dd310987 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -506,7 +506,7 @@ static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key,
506{ 506{
507 int ret; 507 int ret;
508 508
509 dbg_tnc("LEB %d:%d, key %s", zbr->lnum, zbr->offs, DBGKEY(key)); 509 dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs);
510 510
511 ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum, 511 ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum,
512 zbr->offs); 512 zbr->offs);
@@ -520,8 +520,8 @@ static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key,
520 ret = 0; 520 ret = 0;
521 } 521 }
522 if (ret == 0 && c->replaying) 522 if (ret == 0 && c->replaying)
523 dbg_mnt("dangling branch LEB %d:%d len %d, key %s", 523 dbg_mntk(key, "dangling branch LEB %d:%d len %d, key ",
524 zbr->lnum, zbr->offs, zbr->len, DBGKEY(key)); 524 zbr->lnum, zbr->offs, zbr->len);
525 return ret; 525 return ret;
526} 526}
527 527
@@ -996,9 +996,9 @@ static int fallible_resolve_collision(struct ubifs_info *c,
996 if (adding || !o_znode) 996 if (adding || !o_znode)
997 return 0; 997 return 0;
998 998
999 dbg_mnt("dangling match LEB %d:%d len %d %s", 999 dbg_mntk(key, "dangling match LEB %d:%d len %d key ",
1000 o_znode->zbranch[o_n].lnum, o_znode->zbranch[o_n].offs, 1000 o_znode->zbranch[o_n].lnum, o_znode->zbranch[o_n].offs,
1001 o_znode->zbranch[o_n].len, DBGKEY(key)); 1001 o_znode->zbranch[o_n].len);
1002 *zn = o_znode; 1002 *zn = o_znode;
1003 *n = o_n; 1003 *n = o_n;
1004 return 1; 1004 return 1;
@@ -1180,7 +1180,7 @@ int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key,
1180 struct ubifs_znode *znode; 1180 struct ubifs_znode *znode;
1181 unsigned long time = get_seconds(); 1181 unsigned long time = get_seconds();
1182 1182
1183 dbg_tnc("search key %s", DBGKEY(key)); 1183 dbg_tnck(key, "search key ");
1184 ubifs_assert(key_type(c, key) < UBIFS_INVALID_KEY); 1184 ubifs_assert(key_type(c, key) < UBIFS_INVALID_KEY);
1185 1185
1186 znode = c->zroot.znode; 1186 znode = c->zroot.znode;
@@ -1316,7 +1316,7 @@ static int lookup_level0_dirty(struct ubifs_info *c, const union ubifs_key *key,
1316 struct ubifs_znode *znode; 1316 struct ubifs_znode *znode;
1317 unsigned long time = get_seconds(); 1317 unsigned long time = get_seconds();
1318 1318
1319 dbg_tnc("search and dirty key %s", DBGKEY(key)); 1319 dbg_tnck(key, "search and dirty key ");
1320 1320
1321 znode = c->zroot.znode; 1321 znode = c->zroot.znode;
1322 if (unlikely(!znode)) { 1322 if (unlikely(!znode)) {
@@ -1723,8 +1723,8 @@ static int validate_data_node(struct ubifs_info *c, void *buf,
1723 if (!keys_eq(c, &zbr->key, &key1)) { 1723 if (!keys_eq(c, &zbr->key, &key1)) {
1724 ubifs_err("bad key in node at LEB %d:%d", 1724 ubifs_err("bad key in node at LEB %d:%d",
1725 zbr->lnum, zbr->offs); 1725 zbr->lnum, zbr->offs);
1726 dbg_tnc("looked for key %s found node's key %s", 1726 dbg_tnck(&zbr->key, "looked for key ");
1727 DBGKEY(&zbr->key), DBGKEY1(&key1)); 1727 dbg_tnck(&key1, "found node's key ");
1728 goto out_err; 1728 goto out_err;
1729 } 1729 }
1730 1730
@@ -1777,7 +1777,7 @@ int ubifs_tnc_bulk_read(struct ubifs_info *c, struct bu_info *bu)
1777 ubifs_err("failed to read from LEB %d:%d, error %d", 1777 ubifs_err("failed to read from LEB %d:%d, error %d",
1778 lnum, offs, err); 1778 lnum, offs, err);
1779 dbg_dump_stack(); 1779 dbg_dump_stack();
1780 dbg_tnc("key %s", DBGKEY(&bu->key)); 1780 dbg_tnck(&bu->key, "key ");
1781 return err; 1781 return err;
1782 } 1782 }
1783 1783
@@ -1812,7 +1812,7 @@ static int do_lookup_nm(struct ubifs_info *c, const union ubifs_key *key,
1812 int found, n, err; 1812 int found, n, err;
1813 struct ubifs_znode *znode; 1813 struct ubifs_znode *znode;
1814 1814
1815 dbg_tnc("name '%.*s' key %s", nm->len, nm->name, DBGKEY(key)); 1815 dbg_tnck(key, "name '%.*s' key ", nm->len, nm->name);
1816 mutex_lock(&c->tnc_mutex); 1816 mutex_lock(&c->tnc_mutex);
1817 found = ubifs_lookup_level0(c, key, &znode, &n); 1817 found = ubifs_lookup_level0(c, key, &znode, &n);
1818 if (!found) { 1818 if (!found) {
@@ -1986,8 +1986,7 @@ again:
1986 zp = znode->parent; 1986 zp = znode->parent;
1987 if (znode->child_cnt < c->fanout) { 1987 if (znode->child_cnt < c->fanout) {
1988 ubifs_assert(n != c->fanout); 1988 ubifs_assert(n != c->fanout);
1989 dbg_tnc("inserted at %d level %d, key %s", n, znode->level, 1989 dbg_tnck(key, "inserted at %d level %d, key ", n, znode->level);
1990 DBGKEY(key));
1991 1990
1992 insert_zbranch(znode, zbr, n); 1991 insert_zbranch(znode, zbr, n);
1993 1992
@@ -2002,7 +2001,7 @@ again:
2002 * Unfortunately, @znode does not have more empty slots and we have to 2001 * Unfortunately, @znode does not have more empty slots and we have to
2003 * split it. 2002 * split it.
2004 */ 2003 */
2005 dbg_tnc("splitting level %d, key %s", znode->level, DBGKEY(key)); 2004 dbg_tnck(key, "splitting level %d, key ", znode->level);
2006 2005
2007 if (znode->alt) 2006 if (znode->alt)
2008 /* 2007 /*
@@ -2096,7 +2095,7 @@ do_split:
2096 } 2095 }
2097 2096
2098 /* Insert new key and branch */ 2097 /* Insert new key and branch */
2099 dbg_tnc("inserting at %d level %d, key %s", n, zn->level, DBGKEY(key)); 2098 dbg_tnck(key, "inserting at %d level %d, key ", n, zn->level);
2100 2099
2101 insert_zbranch(zi, zbr, n); 2100 insert_zbranch(zi, zbr, n);
2102 2101
@@ -2172,7 +2171,7 @@ int ubifs_tnc_add(struct ubifs_info *c, const union ubifs_key *key, int lnum,
2172 struct ubifs_znode *znode; 2171 struct ubifs_znode *znode;
2173 2172
2174 mutex_lock(&c->tnc_mutex); 2173 mutex_lock(&c->tnc_mutex);
2175 dbg_tnc("%d:%d, len %d, key %s", lnum, offs, len, DBGKEY(key)); 2174 dbg_tnck(key, "%d:%d, len %d, key ", lnum, offs, len);
2176 found = lookup_level0_dirty(c, key, &znode, &n); 2175 found = lookup_level0_dirty(c, key, &znode, &n);
2177 if (!found) { 2176 if (!found) {
2178 struct ubifs_zbranch zbr; 2177 struct ubifs_zbranch zbr;
@@ -2221,8 +2220,8 @@ int ubifs_tnc_replace(struct ubifs_info *c, const union ubifs_key *key,
2221 struct ubifs_znode *znode; 2220 struct ubifs_znode *znode;
2222 2221
2223 mutex_lock(&c->tnc_mutex); 2222 mutex_lock(&c->tnc_mutex);
2224 dbg_tnc("old LEB %d:%d, new LEB %d:%d, len %d, key %s", old_lnum, 2223 dbg_tnck(key, "old LEB %d:%d, new LEB %d:%d, len %d, key ", old_lnum,
2225 old_offs, lnum, offs, len, DBGKEY(key)); 2224 old_offs, lnum, offs, len);
2226 found = lookup_level0_dirty(c, key, &znode, &n); 2225 found = lookup_level0_dirty(c, key, &znode, &n);
2227 if (found < 0) { 2226 if (found < 0) {
2228 err = found; 2227 err = found;
@@ -2304,8 +2303,8 @@ int ubifs_tnc_add_nm(struct ubifs_info *c, const union ubifs_key *key,
2304 struct ubifs_znode *znode; 2303 struct ubifs_znode *znode;
2305 2304
2306 mutex_lock(&c->tnc_mutex); 2305 mutex_lock(&c->tnc_mutex);
2307 dbg_tnc("LEB %d:%d, name '%.*s', key %s", lnum, offs, nm->len, nm->name, 2306 dbg_tnck(key, "LEB %d:%d, name '%.*s', key ",
2308 DBGKEY(key)); 2307 lnum, offs, nm->len, nm->name);
2309 found = lookup_level0_dirty(c, key, &znode, &n); 2308 found = lookup_level0_dirty(c, key, &znode, &n);
2310 if (found < 0) { 2309 if (found < 0) {
2311 err = found; 2310 err = found;
@@ -2398,7 +2397,7 @@ static int tnc_delete(struct ubifs_info *c, struct ubifs_znode *znode, int n)
2398 /* Delete without merge for now */ 2397 /* Delete without merge for now */
2399 ubifs_assert(znode->level == 0); 2398 ubifs_assert(znode->level == 0);
2400 ubifs_assert(n >= 0 && n < c->fanout); 2399 ubifs_assert(n >= 0 && n < c->fanout);
2401 dbg_tnc("deleting %s", DBGKEY(&znode->zbranch[n].key)); 2400 dbg_tnck(&znode->zbranch[n].key, "deleting key ");
2402 2401
2403 zbr = &znode->zbranch[n]; 2402 zbr = &znode->zbranch[n];
2404 lnc_free(zbr); 2403 lnc_free(zbr);
@@ -2508,7 +2507,7 @@ int ubifs_tnc_remove(struct ubifs_info *c, const union ubifs_key *key)
2508 struct ubifs_znode *znode; 2507 struct ubifs_znode *znode;
2509 2508
2510 mutex_lock(&c->tnc_mutex); 2509 mutex_lock(&c->tnc_mutex);
2511 dbg_tnc("key %s", DBGKEY(key)); 2510 dbg_tnck(key, "key ");
2512 found = lookup_level0_dirty(c, key, &znode, &n); 2511 found = lookup_level0_dirty(c, key, &znode, &n);
2513 if (found < 0) { 2512 if (found < 0) {
2514 err = found; 2513 err = found;
@@ -2539,7 +2538,7 @@ int ubifs_tnc_remove_nm(struct ubifs_info *c, const union ubifs_key *key,
2539 struct ubifs_znode *znode; 2538 struct ubifs_znode *znode;
2540 2539
2541 mutex_lock(&c->tnc_mutex); 2540 mutex_lock(&c->tnc_mutex);
2542 dbg_tnc("%.*s, key %s", nm->len, nm->name, DBGKEY(key)); 2541 dbg_tnck(key, "%.*s, key ", nm->len, nm->name);
2543 err = lookup_level0_dirty(c, key, &znode, &n); 2542 err = lookup_level0_dirty(c, key, &znode, &n);
2544 if (err < 0) 2543 if (err < 0)
2545 goto out_unlock; 2544 goto out_unlock;
@@ -2654,7 +2653,7 @@ int ubifs_tnc_remove_range(struct ubifs_info *c, union ubifs_key *from_key,
2654 dbg_dump_znode(c, znode); 2653 dbg_dump_znode(c, znode);
2655 goto out_unlock; 2654 goto out_unlock;
2656 } 2655 }
2657 dbg_tnc("removing %s", DBGKEY(key)); 2656 dbg_tnck(key, "removing key ");
2658 } 2657 }
2659 if (k) { 2658 if (k) {
2660 for (i = n + 1 + k; i < znode->child_cnt; i++) 2659 for (i = n + 1 + k; i < znode->child_cnt; i++)
@@ -2774,7 +2773,7 @@ struct ubifs_dent_node *ubifs_tnc_next_ent(struct ubifs_info *c,
2774 struct ubifs_zbranch *zbr; 2773 struct ubifs_zbranch *zbr;
2775 union ubifs_key *dkey; 2774 union ubifs_key *dkey;
2776 2775
2777 dbg_tnc("%s %s", nm->name ? (char *)nm->name : "(lowest)", DBGKEY(key)); 2776 dbg_tnck(key, "%s ", nm->name ? (char *)nm->name : "(lowest)");
2778 ubifs_assert(is_hash_key(c, key)); 2777 ubifs_assert(is_hash_key(c, key));
2779 2778
2780 mutex_lock(&c->tnc_mutex); 2779 mutex_lock(&c->tnc_mutex);
@@ -3333,9 +3332,9 @@ int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode,
3333 3332
3334out_dump: 3333out_dump:
3335 block = key_block(c, key); 3334 block = key_block(c, key);
3336 ubifs_err("inode %lu has size %lld, but there are data at offset %lld " 3335 ubifs_err("inode %lu has size %lld, but there are data at offset %lld",
3337 "(data key %s)", (unsigned long)inode->i_ino, size, 3336 (unsigned long)inode->i_ino, size,
3338 ((loff_t)block) << UBIFS_BLOCK_SHIFT, DBGKEY(key)); 3337 ((loff_t)block) << UBIFS_BLOCK_SHIFT);
3339 mutex_unlock(&c->tnc_mutex); 3338 mutex_unlock(&c->tnc_mutex);
3340 dbg_dump_inode(c, inode); 3339 dbg_dump_inode(c, inode);
3341 dbg_dump_stack(); 3340 dbg_dump_stack();