2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 04:34:11 +08:00

bcache: replace printk() by pr_*() routines

There are still many places in bcache use printk to display kernel
message, which are suggested to be preplaced by pr_*() routines like
pr_err(), pr_info(), or pr_notice().

This patch replaces all printk() with a proper pr_*() routine for
bcache code.

Signed-off-by: Coly Li <colyli@suse.de>
Reviewed-by: Shenghui Wang <shhuiw@foxmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Coly Li 2018-08-11 13:19:49 +08:00 committed by Jens Axboe
parent 958bf494ec
commit 6ae63e3501
4 changed files with 15 additions and 15 deletions

View File

@ -25,18 +25,18 @@ void bch_dump_bset(struct btree_keys *b, struct bset *i, unsigned int set)
for (k = i->start; k < bset_bkey_last(i); k = next) { for (k = i->start; k < bset_bkey_last(i); k = next) {
next = bkey_next(k); next = bkey_next(k);
printk(KERN_ERR "block %u key %u/%u: ", set, pr_err("block %u key %u/%u: ", set,
(unsigned int) ((u64 *) k - i->d), i->keys); (unsigned int) ((u64 *) k - i->d), i->keys);
if (b->ops->key_dump) if (b->ops->key_dump)
b->ops->key_dump(b, k); b->ops->key_dump(b, k);
else else
printk("%llu:%llu\n", KEY_INODE(k), KEY_OFFSET(k)); pr_err("%llu:%llu\n", KEY_INODE(k), KEY_OFFSET(k));
if (next < bset_bkey_last(i) && if (next < bset_bkey_last(i) &&
bkey_cmp(k, b->ops->is_extents ? bkey_cmp(k, b->ops->is_extents ?
&START_KEY(next) : next) > 0) &START_KEY(next) : next) > 0)
printk(KERN_ERR "Key skipped backwards\n"); pr_err("Key skipped backwards\n");
} }
} }
@ -482,7 +482,7 @@ void inorder_test(void)
unsigned int i = 1, j = rounddown_pow_of_two(size - 1); unsigned int i = 1, j = rounddown_pow_of_two(size - 1);
if (!(size % 4096)) if (!(size % 4096))
printk(KERN_NOTICE "loop %u, %llu per us\n", size, pr_notice("loop %u, %llu per us\n", size,
done / ktime_us_delta(ktime_get(), start)); done / ktime_us_delta(ktime_get(), start));
while (1) { while (1) {

View File

@ -74,28 +74,28 @@ void bch_btree_verify(struct btree *b)
console_lock(); console_lock();
printk(KERN_ERR "*** in memory:\n"); pr_err("*** in memory:\n");
bch_dump_bset(&b->keys, inmemory, 0); bch_dump_bset(&b->keys, inmemory, 0);
printk(KERN_ERR "*** read back in:\n"); pr_err("*** read back in:\n");
bch_dump_bset(&v->keys, sorted, 0); bch_dump_bset(&v->keys, sorted, 0);
for_each_written_bset(b, ondisk, i) { for_each_written_bset(b, ondisk, i) {
unsigned int block = ((void *) i - (void *) ondisk) / unsigned int block = ((void *) i - (void *) ondisk) /
block_bytes(b->c); block_bytes(b->c);
printk(KERN_ERR "*** on disk block %u:\n", block); pr_err("*** on disk block %u:\n", block);
bch_dump_bset(&b->keys, i, block); bch_dump_bset(&b->keys, i, block);
} }
printk(KERN_ERR "*** block %zu not written\n", pr_err("*** block %zu not written\n",
((void *) i - (void *) ondisk) / block_bytes(b->c)); ((void *) i - (void *) ondisk) / block_bytes(b->c));
for (j = 0; j < inmemory->keys; j++) for (j = 0; j < inmemory->keys; j++)
if (inmemory->d[j] != sorted->d[j]) if (inmemory->d[j] != sorted->d[j])
break; break;
printk(KERN_ERR "b->written %u\n", b->written); pr_err("b->written %u\n", b->written);
console_unlock(); console_unlock();
panic("verify failed at %u\n", j); panic("verify failed at %u\n", j);

View File

@ -130,18 +130,18 @@ static void bch_bkey_dump(struct btree_keys *keys, const struct bkey *k)
char buf[80]; char buf[80];
bch_extent_to_text(buf, sizeof(buf), k); bch_extent_to_text(buf, sizeof(buf), k);
printk(" %s", buf); pr_err(" %s", buf);
for (j = 0; j < KEY_PTRS(k); j++) { for (j = 0; j < KEY_PTRS(k); j++) {
size_t n = PTR_BUCKET_NR(b->c, k, j); size_t n = PTR_BUCKET_NR(b->c, k, j);
printk(" bucket %zu", n); pr_err(" bucket %zu", n);
if (n >= b->c->sb.first_bucket && n < b->c->sb.nbuckets) if (n >= b->c->sb.first_bucket && n < b->c->sb.nbuckets)
printk(" prio %i", pr_err(" prio %i",
PTR_BUCKET(b->c, k, j)->prio); PTR_BUCKET(b->c, k, j)->prio);
} }
printk(" %s\n", bch_ptr_status(b->c, k)); pr_err(" %s\n", bch_ptr_status(b->c, k));
} }
/* Btree ptrs */ /* Btree ptrs */

View File

@ -1472,13 +1472,13 @@ bool bch_cache_set_error(struct cache_set *c, const char *fmt, ...)
acquire_console_sem(); acquire_console_sem();
*/ */
printk(KERN_ERR "bcache: error on %pU: ", c->sb.set_uuid); pr_err("bcache: error on %pU: ", c->sb.set_uuid);
va_start(args, fmt); va_start(args, fmt);
vprintk(fmt, args); vprintk(fmt, args);
va_end(args); va_end(args);
printk(", disabling caching\n"); pr_err(", disabling caching\n");
if (c->on_error == ON_ERROR_PANIC) if (c->on_error == ON_ERROR_PANIC)
panic("panic forced after error\n"); panic("panic forced after error\n");