bcache patches for Linux v5.7-rc5
Subsystems (2)
cover bcache patches for Linux v5.7-rc5
Hi Jens,
These two patches are in my testing directory for weeks and it is about time to submit them for Linux v5.7-rc5.
The first one from Colin helps to remove unncessary local variables. And Joe contributes second patch to improve the kernel message format by remove extra '\n' from existing pr_format() and adds the '\n' to the location of printing kernel messages.
Please them for v5.7.
Thank you in advance.
Coly Li
---
Colin Ian King (1):
bcache: remove redundant variables i and n
Joe Perches (1):
bcache: Convert pr_<level> uses to a more typical style
drivers/md/bcache/bcache.h | 2 +- drivers/md/bcache/bset.c | 6 +- drivers/md/bcache/btree.c | 16 ++--- drivers/md/bcache/extents.c | 12 ++-- drivers/md/bcache/io.c | 8 +-- drivers/md/bcache/journal.c | 34 +++++----- drivers/md/bcache/request.c | 6 +- drivers/md/bcache/super.c | 123 +++++++++++++++++----------------- drivers/md/bcache/sysfs.c | 8 +-- drivers/md/bcache/writeback.c | 6 +- 10 files changed, 110 insertions(+), 111 deletions(-)
Signature · 1 line
2.25.0
PATCH 1/2 bcache: remove redundant variables i and n
From: Colin Ian King <[email protected]>
Variables i and n are being assigned but are never used. They are redundant and can be removed.
Addresses-Coverity: ("Unused value")
--- drivers/md/bcache/btree.c | 2 -- 1 file changed, 2 deletions(-)
drivers/md/bcache/btree.c +0 -2
@@ -1907,10 +1907,8 @@ static int bch_btree_check_thread(void *arg)struct btree_iter iter;struct bkey *k, *p;int cur_idx, prev_idx, skip_nr; -int i, n; k = p =NULL ; - i = n =0 ; cur_idx = prev_idx =0 ; ret =0 ;
Signature · 1 line
2.25.0
PATCH 2/2 bcache: Convert pr_<level> uses to a more typical style
In reply to Coly LiFrom: Joe Perches <[email protected]>
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
--- drivers/md/bcache/bcache.h | 2 +- drivers/md/bcache/bset.c | 6 +- drivers/md/bcache/btree.c | 14 ++-- drivers/md/bcache/extents.c | 12 ++-- drivers/md/bcache/io.c | 8 +-- drivers/md/bcache/journal.c | 34 +++++----- drivers/md/bcache/request.c | 6 +- drivers/md/bcache/super.c | 123 +++++++++++++++++----------------- drivers/md/bcache/sysfs.c | 8 +-- drivers/md/bcache/writeback.c | 6 +- 10 files changed, 110 insertions(+), 109 deletions(-)
drivers/md/bcache/bcache.h +1 -1
@@ -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>
drivers/md/bcache/bset.c +3 -3
@@ -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,
drivers/md/bcache/btree.c +7 -7
@@ -619,7 +619,7 @@ static int mca_reap(struct btree *b, unsigned int min_order, bool flush)* 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 @@ static void btree_node_free(struct btree *b)*/ 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 ; }
drivers/md/bcache/extents.c +6 -6
@@ -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" , -PTR_BUCKET (b->c, k, j)->prio); +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); }
drivers/md/bcache/io.c +4 -4
@@ -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); } }
drivers/md/bcache/journal.c +17 -17
@@ -47,7 +47,7 @@ static int journal_read_bucket(struct cache *ca, struct list_head *list,closure_init_stack (&cl); -pr_debug ("reading %u" , bucket_index); +pr_debug ("reading %u\n" , bucket_index);while (offset < ca->sb.bucket_size) { reread: left = ca->sb.bucket_size - offset;
@@ -78,13 +78,13 @@ reread: left = ca->sb.bucket_size - offset;size_t blocks, bytes =set_bytes (j);if (j->magic !=jset_magic (&ca->sb)) { -pr_debug ("%u: bad magic" , bucket_index); +pr_debug ("%u: bad magic\n" , bucket_index);return ret; }if (bytes > left <<9 || bytes >PAGE_SIZE <<JSET_BITS ) { -pr_info ("%u: too big, %zu bytes, offset %u" , +pr_info ("%u: too big, %zu bytes, offset %u\n" , bucket_index, bytes, offset);return ret; }
@@ -93,7 +93,7 @@ reread: left = ca->sb.bucket_size - offset; goto reread;if (j->csum !=csum_set (j)) { -pr_info ("%u: bad csum, %zu bytes, offset %u" , +pr_info ("%u: bad csum, %zu bytes, offset %u\n" , bucket_index, bytes, offset);return ret; }
@@ -190,7 +190,7 @@ int bch_journal_read(struct cache_set *c, struct list_head *list)uint64_t seq;bitmap_zero (bitmap,SB_JOURNAL_BUCKETS ); -pr_debug ("%u journal buckets" , ca->sb.njournal_buckets); +pr_debug ("%u journal buckets\n" , ca->sb.njournal_buckets);/* * Read journal buckets ordered by golden ratio hash to quickly
@@ -215,7 +215,7 @@ int bch_journal_read(struct cache_set *c, struct list_head *list)* If that fails, check all the buckets we haven't checked * already */ -pr_debug ("falling back to linear search" ); +pr_debug ("falling back to linear search\n" ); for (l = find_first_zero_bit(bitmap, ca->sb.njournal_buckets); l < ca->sb.njournal_buckets;
@@ -233,7 +233,7 @@ int bch_journal_read(struct cache_set *c, struct list_head *list)/* Binary search */ m = l; r =find_next_bit (bitmap, ca->sb.njournal_buckets, l +1 ); -pr_debug ("starting binary search, l %u r %u" , l, r); +pr_debug ("starting binary search, l %u r %u\n" , l, r);while (l +1 < r) { seq = list_entry(list->prev, struct journal_replay,
@@ -253,7 +253,7 @@ int bch_journal_read(struct cache_set *c, struct list_head *list)* Read buckets in reverse order until we stop finding more * journal entries */ -pr_debug ("finishing up: m %u njournal_buckets %u" , +pr_debug ("finishing up: m %u njournal_buckets %u\n" , m, ca->sb.njournal_buckets); l = m;
@@ -370,10 +370,10 @@ int bch_journal_replay(struct cache_set *s, struct list_head *list)if (n != i->j.seq) {if (n == start &&is_discard_enabled (s)) -pr_info ("bcache: journal entries %llu-%llu may be discarded! (replaying %llu-%llu)" , +pr_info ("journal entries %llu-%llu may be discarded! (replaying %llu-%llu)\n" , n, i->j.seq -1 , start, end);else { -pr_err ("bcache: journal entries %llu-%llu missing! (replaying %llu-%llu)" , +pr_err ("journal entries %llu-%llu missing! (replaying %llu-%llu)\n" , n, i->j.seq -1 , start, end); ret = -EIO ; goto err;
@@ -403,7 +403,7 @@ int bch_journal_replay(struct cache_set *s, struct list_head *list) entries++; } -pr_info ("journal replay done, %i keys in %i entries, seq %llu" , +pr_info ("journal replay done, %i keys in %i entries, seq %llu\n" , keys, entries, end); err:while (!list_empty (list)) {
@@ -481,7 +481,7 @@ static void btree_flush_write(struct cache_set *c)break ;if (btree_node_journal_flush (b)) -pr_err ("BUG: flush_write bit should not be set here!" ); +pr_err ("BUG: flush_write bit should not be set here!\n" );mutex_lock (&b->write_lock);
@@ -534,13 +534,13 @@ static void btree_flush_write(struct cache_set *c)for (i =0 ; i < nr; i++) { b = btree_nodes[i];if (!b) { -pr_err ("BUG: btree_nodes[%d] is NULL" , i); +pr_err ("BUG: btree_nodes[%d] is NULL\n" , i);continue ; }/* safe to check without holding b->write_lock */ if (!btree_node_journal_flush (b)) { -pr_err ("BUG: bnode %p: journal_flush bit cleaned" , b); +pr_err ("BUG: bnode %p: journal_flush bit cleaned\n" , b);continue ; }
@@ -548,14 +548,14 @@ static void btree_flush_write(struct cache_set *c)if (!btree_current_write (b)->journal) {clear_bit (BTREE_NODE_journal_flush, &b->flags);mutex_unlock (&b->write_lock); -pr_debug ("bnode %p: written by others" , b); +pr_debug ("bnode %p: written by others\n" , b);continue ; }if (!btree_node_dirty (b)) {clear_bit (BTREE_NODE_journal_flush, &b->flags);mutex_unlock (&b->write_lock); -pr_debug ("bnode %p: dirty bit cleaned by others" , b); +pr_debug ("bnode %p: dirty bit cleaned by others\n" , b);continue ; }
@@ -716,7 +716,7 @@ void bch_journal_next(struct journal *j) j->cur->data->keys =0 ;if (fifo_full (&j->pin)) -pr_debug ("journal_pin full (%zu)" ,fifo_used (&j->pin)); +pr_debug ("journal_pin full (%zu)\n" ,fifo_used (&j->pin)); }static void journal_write_endio (struct bio *bio)
drivers/md/bcache/request.c +3 -3
@@ -110,7 +110,7 @@ static void bch_data_invalidate(struct closure *cl) struct data_insert_op *op = container_of(cl, struct data_insert_op, cl);struct bio *bio = op->bio; -pr_debug ("invalidating %i sectors from %llu" , +pr_debug ("invalidating %i sectors from %llu\n" ,bio_sectors (bio), (uint64_t ) bio->bi_iter.bi_sector);while (bio_sectors (bio)) {
@@ -396,7 +396,7 @@ static bool check_should_bypass(struct cached_dev *dc, struct bio *bio)if (bio->bi_iter.bi_sector & (c->sb.block_size -1 ) ||bio_sectors (bio) & (c->sb.block_size -1 )) { -pr_debug ("skipping unaligned io" ); +pr_debug ("skipping unaligned io\n" ); goto skip; }
@@ -650,7 +650,7 @@ static void backing_request_endio(struct bio *bio)*/ if (unlikely (s->iop.writeback && bio->bi_opf &REQ_PREFLUSH )) { -pr_err ("Can't flush %s: returned bi_status %i" , +pr_err ("Can't flush %s: returned bi_status %i\n" , dc->backing_dev_name, bio->bi_status); }else {/* set to orig_bio->bi_status in bio_complete() */
drivers/md/bcache/super.c +62 -61
431 lines not on this page · raw message
drivers/md/bcache/sysfs.c +4 -4
@@ -421,7 +421,7 @@ STORE(__cached_dev)return size; }if (v == -ENOENT ) -pr_err ("Can't attach %s: cache set not found" , buf); +pr_err ("Can't attach %s: cache set not found\n" , buf);return v; }
@@ -455,7 +455,7 @@ STORE(bch_cached_dev)*/ if (dc->writeback_running) { dc->writeback_running = false; -pr_err ("%s: failed to run non-existent writeback thread" , +pr_err ("%s: failed to run non-existent writeback thread\n" , dc->disk.disk->disk_name); } }else
@@ -872,11 +872,11 @@ STORE(__bch_cache_set)if (v) {if (test_and_set_bit (CACHE_SET_IO_DISABLE , &c->flags)) -pr_warn ("CACHE_SET_IO_DISABLE already set" ); +pr_warn ("CACHE_SET_IO_DISABLE already set\n" ); }else {if (!test_and_clear_bit (CACHE_SET_IO_DISABLE , &c->flags)) -pr_warn ("CACHE_SET_IO_DISABLE already cleared" ); +pr_warn ("CACHE_SET_IO_DISABLE already cleared\n" ); } }
drivers/md/bcache/writeback.c +3 -3
@@ -809,7 +809,7 @@ static int bch_root_node_dirty_init(struct cache_set *c,schedule_timeout_interruptible (msecs_to_jiffies (INIT_KEYS_SLEEP_MS )); else if (ret < 0) { -pr_warn ("sectors dirty init failed, ret=%d!" , ret); +pr_warn ("sectors dirty init failed, ret=%d!\n" , ret);break ; } }while (ret == -EAGAIN );
@@ -917,7 +917,7 @@ void bch_sectors_dirty_init(struct bcache_device *d) state =kzalloc (sizeof (struct bch_dirty_init_state ),GFP_KERNEL );if (!state) { -pr_warn ("sectors dirty init failed: cannot allocate memory" ); +pr_warn ("sectors dirty init failed: cannot allocate memory\n" );return ; }
@@ -945,7 +945,7 @@ void bch_sectors_dirty_init(struct bcache_device *d) &state->infos[i], name);if (IS_ERR (state->infos[i].thread)) { -pr_err ("fails to run thread bch_dirty_init[%d]" , i); +pr_err ("fails to run thread bch_dirty_init[%d]\n" , i);for (--i; i >=0 ; i--)kthread_stop (state->infos[i].thread); goto out;
Signature · 1 line
2.25.0
Jens Axboe
maintainerQuoted 11 lines · Coly Li
Hi Jens,
These two patches are in my testing directory for weeks and it is about time to submit them for Linux v5.7-rc5.
The first one from Colin helps to remove unncessary local variables. And Joe contributes second patch to improve the kernel message format by remove extra '\n' from existing
pr_format()and adds the '\n' to the location of printing kernel messages.Please them for v5.7.
Why not 5.8? Doesn't look critical, nor something that was introduced in this series. More like cleanups, hence should go into 5.8 instead.
Signature · 1 line
Jens Axboe
Quoted 11 lines · Jens Axboe
Quoted 10 lines · Coly Li
Hi Jens,
These two patches are in my testing directory for weeks and it is about time to submit them for Linux v5.7-rc5.
The first one from Colin helps to remove unncessary local variables. And Joe contributes second patch to improve the kernel message format by remove extra '\n' from existing
pr_format()and adds the '\n' to the location of printing kernel messages.
Quoted 5 lines
Quoted 1 line
Please them for v5.7.
Why not 5.8? Doesn't look critical, nor something that was introduced in this series. More like cleanups, hence should go into 5.8 instead.
Sure, of cause. They will go with 5.8 series.
Thanks.
Coly Li