Commit 46f5aa88 authored by Joe Perches's avatar Joe Perches Committed by Jens Axboe
Browse files

bcache: Convert pr_<level> uses to a more typical style



Remove the trailing newline from the define of pr_fmt and add newlines
to the uses.

Miscellanea:

o Convert bch_bkey_dump from multiple uses of pr_err to pr_cont
  as the earlier conversion was inappropriate done causing multiple
  lines to be emitted where only a single output line was desired
o Use vsprintf extension %pV in bch_cache_set_error to avoid multiple
  line output where only a single line output was desired
o Coalesce formats

Fixes: 6ae63e35 ("bcache: replace printk() by pr_*() routines")

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarColy Li <colyli@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 3b5b7b1f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@
 * - updates to non leaf nodes just happen synchronously (see btree_split()).
 */

#define pr_fmt(fmt) "bcache: %s() " fmt "\n", __func__
#define pr_fmt(fmt) "bcache: %s() " fmt, __func__

#include <linux/bcache.h>
#include <linux/bio.h>
+3 −3
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
 * Copyright 2012 Google, Inc.
 */

#define pr_fmt(fmt) "bcache: %s() " fmt "\n", __func__
#define pr_fmt(fmt) "bcache: %s() " fmt, __func__

#include "util.h"
#include "bset.h"
@@ -31,7 +31,7 @@ void bch_dump_bset(struct btree_keys *b, struct bset *i, unsigned int set)
		if (b->ops->key_dump)
			b->ops->key_dump(b, k);
		else
			pr_err("%llu:%llu\n", KEY_INODE(k), KEY_OFFSET(k));
			pr_cont("%llu:%llu\n", KEY_INODE(k), KEY_OFFSET(k));

		if (next < bset_bkey_last(i) &&
		    bkey_cmp(k, b->ops->is_extents ?
@@ -1225,7 +1225,7 @@ static void btree_mergesort(struct btree_keys *b, struct bset *out,

	out->keys = last ? (uint64_t *) bkey_next(last) - out->d : 0;

	pr_debug("sorted %i keys", out->keys);
	pr_debug("sorted %i keys\n", out->keys);
}

static void __btree_sort(struct btree_keys *b, struct btree_iter *iter,
+7 −7
Original line number Diff line number Diff line
@@ -619,7 +619,7 @@ retry:
	 * and BTREE_NODE_journal_flush bit cleared by btree_flush_write().
	 */
	if (btree_node_journal_flush(b)) {
		pr_debug("bnode %p is flushing by journal, retry", b);
		pr_debug("bnode %p is flushing by journal, retry\n", b);
		mutex_unlock(&b->write_lock);
		udelay(1);
		goto retry;
@@ -802,7 +802,7 @@ int bch_btree_cache_alloc(struct cache_set *c)
	c->shrink.batch = c->btree_pages * 2;

	if (register_shrinker(&c->shrink))
		pr_warn("bcache: %s: could not register shrinker",
		pr_warn("bcache: %s: could not register shrinker\n",
				__func__);

	return 0;
@@ -1054,7 +1054,7 @@ retry:
	 */
	if (btree_node_journal_flush(b)) {
		mutex_unlock(&b->write_lock);
		pr_debug("bnode %p journal_flush set, retry", b);
		pr_debug("bnode %p journal_flush set, retry\n", b);
		udelay(1);
		goto retry;
	}
@@ -1798,7 +1798,7 @@ static void bch_btree_gc(struct cache_set *c)
			schedule_timeout_interruptible(msecs_to_jiffies
						       (GC_SLEEP_MS));
		else if (ret)
			pr_warn("gc failed!");
			pr_warn("gc failed!\n");
	} while (ret && !test_bit(CACHE_SET_IO_DISABLE, &c->flags));

	bch_btree_gc_finish(c);
@@ -2043,7 +2043,7 @@ int bch_btree_check(struct cache_set *c)
				    &check_state->infos[i],
				    name);
		if (IS_ERR(check_state->infos[i].thread)) {
			pr_err("fails to run thread bch_btrchk[%d]", i);
			pr_err("fails to run thread bch_btrchk[%d]\n", i);
			for (--i; i >= 0; i--)
				kthread_stop(check_state->infos[i].thread);
			ret = -ENOMEM;
@@ -2454,7 +2454,7 @@ int bch_btree_insert(struct cache_set *c, struct keylist *keys,
	if (ret) {
		struct bkey *k;

		pr_err("error %i", ret);
		pr_err("error %i\n", ret);

		while ((k = bch_keylist_pop(keys)))
			bkey_put(c, k);
@@ -2742,7 +2742,7 @@ struct keybuf_key *bch_keybuf_next_rescan(struct cache_set *c,
			break;

		if (bkey_cmp(&buf->last_scanned, end) >= 0) {
			pr_debug("scan finished");
			pr_debug("scan finished\n");
			break;
		}

+6 −6
Original line number Diff line number Diff line
@@ -130,18 +130,18 @@ static void bch_bkey_dump(struct btree_keys *keys, const struct bkey *k)
	char buf[80];

	bch_extent_to_text(buf, sizeof(buf), k);
	pr_err(" %s", buf);
	pr_cont(" %s", buf);

	for (j = 0; j < KEY_PTRS(k); j++) {
		size_t n = PTR_BUCKET_NR(b->c, k, j);

		pr_err(" bucket %zu", n);
		pr_cont(" bucket %zu", n);
		if (n >= b->c->sb.first_bucket && n < b->c->sb.nbuckets)
			pr_err(" prio %i",
			pr_cont(" prio %i",
				PTR_BUCKET(b->c, k, j)->prio);
	}

	pr_err(" %s\n", bch_ptr_status(b->c, k));
	pr_cont(" %s\n", bch_ptr_status(b->c, k));
}

/* Btree ptrs */
@@ -553,7 +553,7 @@ static bool bch_extent_bad(struct btree_keys *bk, const struct bkey *k)

		if (stale && KEY_DIRTY(k)) {
			bch_extent_to_text(buf, sizeof(buf), k);
			pr_info("stale dirty pointer, stale %u, key: %s",
			pr_info("stale dirty pointer, stale %u, key: %s\n",
				stale, buf);
		}

+4 −4
Original line number Diff line number Diff line
@@ -65,14 +65,14 @@ void bch_count_backing_io_errors(struct cached_dev *dc, struct bio *bio)
	 * we shouldn't count failed REQ_RAHEAD bio to dc->io_errors.
	 */
	if (bio->bi_opf & REQ_RAHEAD) {
		pr_warn_ratelimited("%s: Read-ahead I/O failed on backing device, ignore",
		pr_warn_ratelimited("%s: Read-ahead I/O failed on backing device, ignore\n",
				    dc->backing_dev_name);
		return;
	}

	errors = atomic_add_return(1, &dc->io_errors);
	if (errors < dc->error_limit)
		pr_err("%s: IO error on backing device, unrecoverable",
		pr_err("%s: IO error on backing device, unrecoverable\n",
			dc->backing_dev_name);
	else
		bch_cached_dev_error(dc);
@@ -123,12 +123,12 @@ void bch_count_io_errors(struct cache *ca,
		errors >>= IO_ERROR_SHIFT;

		if (errors < ca->set->error_limit)
			pr_err("%s: IO error on %s%s",
			pr_err("%s: IO error on %s%s\n",
			       ca->cache_dev_name, m,
			       is_read ? ", recovering." : ".");
		else
			bch_cache_set_error(ca->set,
					    "%s: too many IO errors %s",
					    "%s: too many IO errors %s\n",
					    ca->cache_dev_name, m);
	}
}
Loading