diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-13 13:31:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-13 13:31:33 -0500 |
commit | 94b1984ab9ab61cc6047c07e074d766485299a9c (patch) | |
tree | 4b6cba21caf3d99129bea6a5eba0544b2fe8402a /fs/ubifs/tnc.c | |
parent | 1a52bb0b686844021597d190e562ab55d1210104 (diff) | |
parent | 515315a123af641a9533e4ff0f178c470dc08fc7 (diff) |
Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6
* 'linux-next' of git://git.infradead.org/ubifs-2.6:
UBIFS: fix key printing
UBIFS: use snprintf instead of sprintf when printing keys
UBIFS: fix debugging messages
UBIFS: make debugging messages light again
UBI: fix debugging messages
UBI: make vid_hdr non-static
Diffstat (limited to 'fs/ubifs/tnc.c')
-rw-r--r-- | fs/ubifs/tnc.c | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index e14ee53159db..16ad84d8402f 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c | |||
@@ -505,7 +505,7 @@ static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, | |||
505 | { | 505 | { |
506 | int ret; | 506 | int ret; |
507 | 507 | ||
508 | dbg_tnc("LEB %d:%d, key %s", zbr->lnum, zbr->offs, DBGKEY(key)); | 508 | dbg_tnck(key, "LEB %d:%d, key ", zbr->lnum, zbr->offs); |
509 | 509 | ||
510 | ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum, | 510 | ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum, |
511 | zbr->offs); | 511 | zbr->offs); |
@@ -519,8 +519,8 @@ static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, | |||
519 | ret = 0; | 519 | ret = 0; |
520 | } | 520 | } |
521 | if (ret == 0 && c->replaying) | 521 | if (ret == 0 && c->replaying) |
522 | dbg_mnt("dangling branch LEB %d:%d len %d, key %s", | 522 | dbg_mntk(key, "dangling branch LEB %d:%d len %d, key ", |
523 | zbr->lnum, zbr->offs, zbr->len, DBGKEY(key)); | 523 | zbr->lnum, zbr->offs, zbr->len); |
524 | return ret; | 524 | return ret; |
525 | } | 525 | } |
526 | 526 | ||
@@ -995,9 +995,9 @@ static int fallible_resolve_collision(struct ubifs_info *c, | |||
995 | if (adding || !o_znode) | 995 | if (adding || !o_znode) |
996 | return 0; | 996 | return 0; |
997 | 997 | ||
998 | dbg_mnt("dangling match LEB %d:%d len %d %s", | 998 | dbg_mntk(key, "dangling match LEB %d:%d len %d key ", |
999 | o_znode->zbranch[o_n].lnum, o_znode->zbranch[o_n].offs, | 999 | o_znode->zbranch[o_n].lnum, o_znode->zbranch[o_n].offs, |
1000 | o_znode->zbranch[o_n].len, DBGKEY(key)); | 1000 | o_znode->zbranch[o_n].len); |
1001 | *zn = o_znode; | 1001 | *zn = o_znode; |
1002 | *n = o_n; | 1002 | *n = o_n; |
1003 | return 1; | 1003 | return 1; |
@@ -1179,7 +1179,7 @@ int ubifs_lookup_level0(struct ubifs_info *c, const union ubifs_key *key, | |||
1179 | struct ubifs_znode *znode; | 1179 | struct ubifs_znode *znode; |
1180 | unsigned long time = get_seconds(); | 1180 | unsigned long time = get_seconds(); |
1181 | 1181 | ||
1182 | dbg_tnc("search key %s", DBGKEY(key)); | 1182 | dbg_tnck(key, "search key "); |
1183 | ubifs_assert(key_type(c, key) < UBIFS_INVALID_KEY); | 1183 | ubifs_assert(key_type(c, key) < UBIFS_INVALID_KEY); |
1184 | 1184 | ||
1185 | znode = c->zroot.znode; | 1185 | znode = c->zroot.znode; |
@@ -1315,7 +1315,7 @@ static int lookup_level0_dirty(struct ubifs_info *c, const union ubifs_key *key, | |||
1315 | struct ubifs_znode *znode; | 1315 | struct ubifs_znode *znode; |
1316 | unsigned long time = get_seconds(); | 1316 | unsigned long time = get_seconds(); |
1317 | 1317 | ||
1318 | dbg_tnc("search and dirty key %s", DBGKEY(key)); | 1318 | dbg_tnck(key, "search and dirty key "); |
1319 | 1319 | ||
1320 | znode = c->zroot.znode; | 1320 | znode = c->zroot.znode; |
1321 | if (unlikely(!znode)) { | 1321 | if (unlikely(!znode)) { |
@@ -1722,8 +1722,8 @@ static int validate_data_node(struct ubifs_info *c, void *buf, | |||
1722 | if (!keys_eq(c, &zbr->key, &key1)) { | 1722 | if (!keys_eq(c, &zbr->key, &key1)) { |
1723 | ubifs_err("bad key in node at LEB %d:%d", | 1723 | ubifs_err("bad key in node at LEB %d:%d", |
1724 | zbr->lnum, zbr->offs); | 1724 | zbr->lnum, zbr->offs); |
1725 | dbg_tnc("looked for key %s found node's key %s", | 1725 | dbg_tnck(&zbr->key, "looked for key "); |
1726 | DBGKEY(&zbr->key), DBGKEY1(&key1)); | 1726 | dbg_tnck(&key1, "found node's key "); |
1727 | goto out_err; | 1727 | goto out_err; |
1728 | } | 1728 | } |
1729 | 1729 | ||
@@ -1776,7 +1776,7 @@ int ubifs_tnc_bulk_read(struct ubifs_info *c, struct bu_info *bu) | |||
1776 | ubifs_err("failed to read from LEB %d:%d, error %d", | 1776 | ubifs_err("failed to read from LEB %d:%d, error %d", |
1777 | lnum, offs, err); | 1777 | lnum, offs, err); |
1778 | dbg_dump_stack(); | 1778 | dbg_dump_stack(); |
1779 | dbg_tnc("key %s", DBGKEY(&bu->key)); | 1779 | dbg_tnck(&bu->key, "key "); |
1780 | return err; | 1780 | return err; |
1781 | } | 1781 | } |
1782 | 1782 | ||
@@ -1811,7 +1811,7 @@ static int do_lookup_nm(struct ubifs_info *c, const union ubifs_key *key, | |||
1811 | int found, n, err; | 1811 | int found, n, err; |
1812 | struct ubifs_znode *znode; | 1812 | struct ubifs_znode *znode; |
1813 | 1813 | ||
1814 | dbg_tnc("name '%.*s' key %s", nm->len, nm->name, DBGKEY(key)); | 1814 | dbg_tnck(key, "name '%.*s' key ", nm->len, nm->name); |
1815 | mutex_lock(&c->tnc_mutex); | 1815 | mutex_lock(&c->tnc_mutex); |
1816 | found = ubifs_lookup_level0(c, key, &znode, &n); | 1816 | found = ubifs_lookup_level0(c, key, &znode, &n); |
1817 | if (!found) { | 1817 | if (!found) { |
@@ -1985,8 +1985,7 @@ again: | |||
1985 | zp = znode->parent; | 1985 | zp = znode->parent; |
1986 | if (znode->child_cnt < c->fanout) { | 1986 | if (znode->child_cnt < c->fanout) { |
1987 | ubifs_assert(n != c->fanout); | 1987 | ubifs_assert(n != c->fanout); |
1988 | dbg_tnc("inserted at %d level %d, key %s", n, znode->level, | 1988 | dbg_tnck(key, "inserted at %d level %d, key ", n, znode->level); |
1989 | DBGKEY(key)); | ||
1990 | 1989 | ||
1991 | insert_zbranch(znode, zbr, n); | 1990 | insert_zbranch(znode, zbr, n); |
1992 | 1991 | ||
@@ -2001,7 +2000,7 @@ again: | |||
2001 | * Unfortunately, @znode does not have more empty slots and we have to | 2000 | * Unfortunately, @znode does not have more empty slots and we have to |
2002 | * split it. | 2001 | * split it. |
2003 | */ | 2002 | */ |
2004 | dbg_tnc("splitting level %d, key %s", znode->level, DBGKEY(key)); | 2003 | dbg_tnck(key, "splitting level %d, key ", znode->level); |
2005 | 2004 | ||
2006 | if (znode->alt) | 2005 | if (znode->alt) |
2007 | /* | 2006 | /* |
@@ -2095,7 +2094,7 @@ do_split: | |||
2095 | } | 2094 | } |
2096 | 2095 | ||
2097 | /* Insert new key and branch */ | 2096 | /* Insert new key and branch */ |
2098 | dbg_tnc("inserting at %d level %d, key %s", n, zn->level, DBGKEY(key)); | 2097 | dbg_tnck(key, "inserting at %d level %d, key ", n, zn->level); |
2099 | 2098 | ||
2100 | insert_zbranch(zi, zbr, n); | 2099 | insert_zbranch(zi, zbr, n); |
2101 | 2100 | ||
@@ -2171,7 +2170,7 @@ int ubifs_tnc_add(struct ubifs_info *c, const union ubifs_key *key, int lnum, | |||
2171 | struct ubifs_znode *znode; | 2170 | struct ubifs_znode *znode; |
2172 | 2171 | ||
2173 | mutex_lock(&c->tnc_mutex); | 2172 | mutex_lock(&c->tnc_mutex); |
2174 | dbg_tnc("%d:%d, len %d, key %s", lnum, offs, len, DBGKEY(key)); | 2173 | dbg_tnck(key, "%d:%d, len %d, key ", lnum, offs, len); |
2175 | found = lookup_level0_dirty(c, key, &znode, &n); | 2174 | found = lookup_level0_dirty(c, key, &znode, &n); |
2176 | if (!found) { | 2175 | if (!found) { |
2177 | struct ubifs_zbranch zbr; | 2176 | struct ubifs_zbranch zbr; |
@@ -2220,8 +2219,8 @@ int ubifs_tnc_replace(struct ubifs_info *c, const union ubifs_key *key, | |||
2220 | struct ubifs_znode *znode; | 2219 | struct ubifs_znode *znode; |
2221 | 2220 | ||
2222 | mutex_lock(&c->tnc_mutex); | 2221 | mutex_lock(&c->tnc_mutex); |
2223 | dbg_tnc("old LEB %d:%d, new LEB %d:%d, len %d, key %s", old_lnum, | 2222 | dbg_tnck(key, "old LEB %d:%d, new LEB %d:%d, len %d, key ", old_lnum, |
2224 | old_offs, lnum, offs, len, DBGKEY(key)); | 2223 | old_offs, lnum, offs, len); |
2225 | found = lookup_level0_dirty(c, key, &znode, &n); | 2224 | found = lookup_level0_dirty(c, key, &znode, &n); |
2226 | if (found < 0) { | 2225 | if (found < 0) { |
2227 | err = found; | 2226 | err = found; |
@@ -2303,8 +2302,8 @@ int ubifs_tnc_add_nm(struct ubifs_info *c, const union ubifs_key *key, | |||
2303 | struct ubifs_znode *znode; | 2302 | struct ubifs_znode *znode; |
2304 | 2303 | ||
2305 | mutex_lock(&c->tnc_mutex); | 2304 | mutex_lock(&c->tnc_mutex); |
2306 | dbg_tnc("LEB %d:%d, name '%.*s', key %s", lnum, offs, nm->len, nm->name, | 2305 | dbg_tnck(key, "LEB %d:%d, name '%.*s', key ", |
2307 | DBGKEY(key)); | 2306 | lnum, offs, nm->len, nm->name); |
2308 | found = lookup_level0_dirty(c, key, &znode, &n); | 2307 | found = lookup_level0_dirty(c, key, &znode, &n); |
2309 | if (found < 0) { | 2308 | if (found < 0) { |
2310 | err = found; | 2309 | err = found; |
@@ -2397,7 +2396,7 @@ static int tnc_delete(struct ubifs_info *c, struct ubifs_znode *znode, int n) | |||
2397 | /* Delete without merge for now */ | 2396 | /* Delete without merge for now */ |
2398 | ubifs_assert(znode->level == 0); | 2397 | ubifs_assert(znode->level == 0); |
2399 | ubifs_assert(n >= 0 && n < c->fanout); | 2398 | ubifs_assert(n >= 0 && n < c->fanout); |
2400 | dbg_tnc("deleting %s", DBGKEY(&znode->zbranch[n].key)); | 2399 | dbg_tnck(&znode->zbranch[n].key, "deleting key "); |
2401 | 2400 | ||
2402 | zbr = &znode->zbranch[n]; | 2401 | zbr = &znode->zbranch[n]; |
2403 | lnc_free(zbr); | 2402 | lnc_free(zbr); |
@@ -2507,7 +2506,7 @@ int ubifs_tnc_remove(struct ubifs_info *c, const union ubifs_key *key) | |||
2507 | struct ubifs_znode *znode; | 2506 | struct ubifs_znode *znode; |
2508 | 2507 | ||
2509 | mutex_lock(&c->tnc_mutex); | 2508 | mutex_lock(&c->tnc_mutex); |
2510 | dbg_tnc("key %s", DBGKEY(key)); | 2509 | dbg_tnck(key, "key "); |
2511 | found = lookup_level0_dirty(c, key, &znode, &n); | 2510 | found = lookup_level0_dirty(c, key, &znode, &n); |
2512 | if (found < 0) { | 2511 | if (found < 0) { |
2513 | err = found; | 2512 | err = found; |
@@ -2538,7 +2537,7 @@ int ubifs_tnc_remove_nm(struct ubifs_info *c, const union ubifs_key *key, | |||
2538 | struct ubifs_znode *znode; | 2537 | struct ubifs_znode *znode; |
2539 | 2538 | ||
2540 | mutex_lock(&c->tnc_mutex); | 2539 | mutex_lock(&c->tnc_mutex); |
2541 | dbg_tnc("%.*s, key %s", nm->len, nm->name, DBGKEY(key)); | 2540 | dbg_tnck(key, "%.*s, key ", nm->len, nm->name); |
2542 | err = lookup_level0_dirty(c, key, &znode, &n); | 2541 | err = lookup_level0_dirty(c, key, &znode, &n); |
2543 | if (err < 0) | 2542 | if (err < 0) |
2544 | goto out_unlock; | 2543 | goto out_unlock; |
@@ -2653,7 +2652,7 @@ int ubifs_tnc_remove_range(struct ubifs_info *c, union ubifs_key *from_key, | |||
2653 | dbg_dump_znode(c, znode); | 2652 | dbg_dump_znode(c, znode); |
2654 | goto out_unlock; | 2653 | goto out_unlock; |
2655 | } | 2654 | } |
2656 | dbg_tnc("removing %s", DBGKEY(key)); | 2655 | dbg_tnck(key, "removing key "); |
2657 | } | 2656 | } |
2658 | if (k) { | 2657 | if (k) { |
2659 | for (i = n + 1 + k; i < znode->child_cnt; i++) | 2658 | for (i = n + 1 + k; i < znode->child_cnt; i++) |
@@ -2773,7 +2772,7 @@ struct ubifs_dent_node *ubifs_tnc_next_ent(struct ubifs_info *c, | |||
2773 | struct ubifs_zbranch *zbr; | 2772 | struct ubifs_zbranch *zbr; |
2774 | union ubifs_key *dkey; | 2773 | union ubifs_key *dkey; |
2775 | 2774 | ||
2776 | dbg_tnc("%s %s", nm->name ? (char *)nm->name : "(lowest)", DBGKEY(key)); | 2775 | dbg_tnck(key, "%s ", nm->name ? (char *)nm->name : "(lowest)"); |
2777 | ubifs_assert(is_hash_key(c, key)); | 2776 | ubifs_assert(is_hash_key(c, key)); |
2778 | 2777 | ||
2779 | mutex_lock(&c->tnc_mutex); | 2778 | mutex_lock(&c->tnc_mutex); |
@@ -3332,9 +3331,9 @@ int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode, | |||
3332 | 3331 | ||
3333 | out_dump: | 3332 | out_dump: |
3334 | block = key_block(c, key); | 3333 | block = key_block(c, key); |
3335 | ubifs_err("inode %lu has size %lld, but there are data at offset %lld " | 3334 | ubifs_err("inode %lu has size %lld, but there are data at offset %lld", |
3336 | "(data key %s)", (unsigned long)inode->i_ino, size, | 3335 | (unsigned long)inode->i_ino, size, |
3337 | ((loff_t)block) << UBIFS_BLOCK_SHIFT, DBGKEY(key)); | 3336 | ((loff_t)block) << UBIFS_BLOCK_SHIFT); |
3338 | mutex_unlock(&c->tnc_mutex); | 3337 | mutex_unlock(&c->tnc_mutex); |
3339 | dbg_dump_inode(c, inode); | 3338 | dbg_dump_inode(c, inode); |
3340 | dbg_dump_stack(); | 3339 | dbg_dump_stack(); |