bcache: Build fixes from test robot
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): 20130325135252.GC5401-tSWWG44O7X1aa/[email protected]
PATCH 1/2 bcache: Build fixes from test robot
config: make ARCH=i386 allmodconfig
All error/warnings:
drivers/md/bcache/bset.c: In function 'bch_ptr_bad':
Quoted 1 line
Quoted 1 line
drivers/md/bcache/bset.c:164:2: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'size_t' [-Wformat]
--
drivers/md/bcache/debug.c: In function 'bch_pbtree':
Quoted 1 line
Quoted 1 line
drivers/md/bcache/debug.c:86:4: warning: format '%li' expects argument of type 'long int', but argument 4 has type 'size_t' [-Wformat]
--
drivers/md/bcache/btree.c: In function 'bch_btree_read_done':
Quoted 1 line
Quoted 1 line
drivers/md/bcache/btree.c:245:8: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' [-Wformat]
--
drivers/md/bcache/closure.o: In function `closure_debug_init':
Quoted 2 lines
Quoted 2 lines
(.init.text+0x0): multiple definition of `init_module' drivers/md/bcache/super.o:super.c:(.init.text+0x0): first defined here
--- drivers/md/bcache/bset.c | 2 +- drivers/md/bcache/btree.c | 2 +- drivers/md/bcache/closure.c | 4 +--- drivers/md/bcache/closure.h | 2 ++ drivers/md/bcache/super.c | 1 + 5 files changed, 6 insertions(+), 5 deletions(-)
drivers/md/bcache/bset.c +1 -1
@@ -161,7 +161,7 @@ bool bch_ptr_bad(struct btree *b, const struct bkey *k)#ifdef CONFIG_BCACHE_EDEBUG bug:mutex_unlock (&b->c->bucket_lock); -btree_bug (b,"inconsistent pointer %s: bucket %li pin %i " +btree_bug (b,"inconsistent pointer %s: bucket %zu pin %i " "prio %i gen %i last_gc %i mark %llu gc_gen %i" ,pkey (k),PTR_BUCKET_NR (b->c, k, i),atomic_read (&g->pin), g->prio, g->gen, g->last_gc,GC_MARK (g), g->gc_gen);
drivers/md/bcache/btree.c +1 -1
@@ -240,7 +240,7 @@ out:closure_return (cl); err:set_btree_node_io_error (b); -bch_cache_set_error (b->c,"%s at bucket %lu, block %zu, %u keys" , +bch_cache_set_error (b->c,"%s at bucket %zu, block %zu, %u keys" , err,PTR_BUCKET_NR (b->c, &b->key,0 ),index (i, b), i->keys); goto out;
drivers/md/bcache/closure.c +1 -3
@@ -334,14 +334,12 @@ static const struct file_operations debug_ops = { .release = single_release }; -int __init closure_debug_init (void ) +void __init closure_debug_init (void ) { debug =debugfs_create_file ("closures" ,0400 ,NULL ,NULL , &debug_ops);return 0 ; } -module_init (closure_debug_init); -#endif MODULE_AUTHOR ("Kent Overstreet <[email protected]>" );
drivers/md/bcache/closure.h +2 -0
@@ -313,11 +313,13 @@ void __closure_flush_sync(struct closure *cl, struct timer_list *timer);#ifdef CONFIG_BCACHE_CLOSURES_DEBUG +void closure_debug_init (void );void closure_debug_create (struct closure *cl);void closure_debug_destroy (struct closure *cl);#else +static inline void closure_debug_init (void ) {}static inline void closure_debug_create (struct closure *cl) {}static inline void closure_debug_destroy (struct closure *cl) {}
drivers/md/bcache/super.c +1 -0
@@ -1917,6 +1917,7 @@ static int __init bcache_init(void)mutex_init (&bch_register_lock);init_waitqueue_head (&unregister_wait);register_reboot_notifier (&reboot); +closure_debug_init (); bcache_major =register_blkdev (0 ,"bcache" );if (bcache_major <0 )
Signature · 1 line
1.8.1.3
A message that is not in the archive (sent off-list or not yet received): 1364237204-5467-1-git-send-email-koverstreet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org
PATCH 2/2 bcache: Style/checkpatch fixes
Took out some nested functions, and fixed some more checkpatch complaints.
--- drivers/md/bcache/alloc.c | 22 ++++++---------------- drivers/md/bcache/bcache.h | 10 +++++----- drivers/md/bcache/bset.c | 9 +++++---- drivers/md/bcache/btree.c | 4 ++-- drivers/md/bcache/debug.c | 8 ++++---- drivers/md/bcache/journal.c | 8 ++++---- drivers/md/bcache/movinggc.c | 24 ++++++++++++------------ drivers/md/bcache/request.c | 12 +++++++----- drivers/md/bcache/stats.c | 3 ++- drivers/md/bcache/super.c | 7 ++++--- 10 files changed, 51 insertions(+), 56 deletions(-)
drivers/md/bcache/alloc.c +6 -16
@@ -229,24 +229,14 @@ static void invalidate_one_bucket(struct cache *ca, struct bucket *b)fifo_push (&ca->free_inc, b - ca->buckets); } -static void invalidate_buckets_lru (struct cache *ca) -{ -unsigned bucket_prio (struct bucket *b) - { -return ((unsigned ) (b->prio - ca->set->min_prio)) * -GC_SECTORS_USED (b); - } - -bool bucket_max_cmp (struct bucket *l,struct bucket *r) - { -return bucket_prio (l) <bucket_prio (r); - } +#define bucket_prio (b) \ + (((unsigned) (b->prio - ca->set->min_prio)) * GC_SECTORS_USED(b)) -bool bucket_min_cmp (struct bucket *l,struct bucket *r) - { -return bucket_prio (l) >bucket_prio (r); - } +#define bucket_max_cmp (l, r) (bucket_prio(l) < bucket_prio(r)) +#define bucket_min_cmp (l, r) (bucket_prio(l) > bucket_prio(r)) +static void invalidate_buckets_lru (struct cache *ca) +{struct bucket *b;ssize_t i;
drivers/md/bcache/bcache.h +5 -5
@@ -644,8 +644,8 @@ struct gc_stat {* we'll continue to run normally for awhile with CACHE_SET_STOPPING set (i.e. * flushing dirty data). * -* CACHE_SET_STOPPING_2 gets set at the last phase, when it's time to shut down the -* allocation thread. +* CACHE_SET_STOPPING_2 gets set at the last phase, when it's time to shut down +* the allocation thread. */ #define CACHE_SET_UNREGISTERING 0#define CACHE_SET_STOPPING 1
@@ -1012,11 +1012,11 @@ static inline struct bucket *PTR_BUCKET(struct cache_set *c,* searches - it told you where a key started. It's not used anymore, * and can probably be safely dropped. */ -#define KEY (dev, sector, len) (struct bkey) \ -{ \ +#define KEY (dev, sector, len) \ +((struct bkey) { \ .high = (1ULL << 63) | ((uint64_t) (len) << 20) | (dev), \ .low = (sector) \ -} +})static inline void bkey_init (struct bkey *k) {
drivers/md/bcache/bset.c +5 -4
@@ -161,9 +161,9 @@ bool bch_ptr_bad(struct btree *b, const struct bkey *k)#ifdef CONFIG_BCACHE_EDEBUG bug:mutex_unlock (&b->c->bucket_lock); -btree_bug (b,"inconsistent pointer %s: bucket %zu pin %i " -"prio %i gen %i last_gc %i mark %llu gc_gen %i" ,pkey (k), -PTR_BUCKET_NR (b->c, k, i),atomic_read (&g->pin), +btree_bug (b, +"inconsistent pointer %s: bucket %zu pin %i prio %i gen %i last_gc %i mark %llu gc_gen %i" , +pkey (k),PTR_BUCKET_NR (b->c, k, i),atomic_read (&g->pin), g->prio, g->gen, g->last_gc,GC_MARK (g), g->gc_gen);return true;#endif
@@ -1049,7 +1049,8 @@ void bch_btree_sort_partial(struct btree *b, unsigned start)for (i = start; i <= b->nsets; i++) keys += b->sets[i].data->keys; - order =roundup_pow_of_two (__set_bytes (b->sets->data, keys)) /PAGE_SIZE ; + order =roundup_pow_of_two (__set_bytes (b->sets->data, + keys)) /PAGE_SIZE ;if (order) order =ilog2 (order); }
drivers/md/bcache/btree.c +2 -2
@@ -1021,8 +1021,8 @@ retry: goto err_free;if (!b) { -cache_bug (c,"Tried to allocate bucket" -" that was in btree cache" ); +cache_bug (c, +"Tried to allocate bucket that was in btree cache" );__bkey_put (c, &k.key); goto retry; }
drivers/md/bcache/debug.c +4 -4
@@ -217,8 +217,8 @@ void bch_data_verify(struct search *s)if (memcmp (p1 + bv->bv_offset, p2 + bv->bv_offset, bv->bv_len)) -printk (KERN_ERR "bcache (%s): verify failed" -" at sector %llu\n" , +printk (KERN_ERR +"bcache (%s): verify failed at sector %llu\n" ,bdevname (dc->bdev, name), (uint64_t ) s->orig_bio->bi_sector);
@@ -525,8 +525,8 @@ static ssize_t btree_fuzz(struct kobject *k, struct kobj_attribute *a, k = bkey_next(k), l = bkey_next(l))if (bkey_cmp (k, l) ||KEY_SIZE (k) !=KEY_SIZE (l)) -pr_err ("key %zi differs: %s " -"!= %s" , (uint64_t *) k - i->d, +pr_err ("key %zi differs: %s != %s" , + (uint64_t *) k - i->d,pkey (k),pkey (l));for (j =0 ; j <3 ; j++) {
drivers/md/bcache/journal.c +4 -4
@@ -293,9 +293,9 @@ int bch_journal_replay(struct cache_set *s, struct list_head *list,BUG_ON (i->pin &&atomic_read (i->pin) !=1 );if (n != i->j.seq) -pr_err ("journal entries %llu-%llu " -"missing! (replaying %llu-%llu)\n" , - n, i->j.seq -1 , start, end); +pr_err ( +"journal entries %llu-%llu missing! (replaying %llu-%llu)\n" , + n, i->j.seq -1 , start, end); for (k = i->j.start; k < end(&i->j);
@@ -439,7 +439,7 @@ static void do_journal_discard(struct cache *ca)bio_init (bio); bio->bi_sector =bucket_to_sector (ca->set, - ca->sb.d[ja->discard_idx]); + ca->sb.d[ja->discard_idx]); bio->bi_bdev = ca->bdev; bio->bi_rw =REQ_WRITE |REQ_DISCARD ; bio->bi_max_vecs =1 ;
drivers/md/bcache/movinggc.c +12 -12
@@ -183,6 +183,16 @@ err: if (!IS_ERR_OR_NULL(w->private))closure_return (cl); } +static bool bucket_cmp (struct bucket *l,struct bucket *r) +{ +return GC_SECTORS_USED (l) <GC_SECTORS_USED (r); +} + +static unsigned bucket_heap_top (struct cache *ca) +{ +return GC_SECTORS_USED (heap_peek (&ca->heap)); +} +void bch_moving_gc (struct closure *cl) { struct cache_set *c = container_of(cl, struct cache_set, gc.cl);
@@ -190,16 +200,6 @@ void bch_moving_gc(struct closure *cl)struct bucket *b;unsigned i; -bool bucket_cmp (struct bucket *l,struct bucket *r) - { -return GC_SECTORS_USED (l) <GC_SECTORS_USED (r); - } - -unsigned top (struct cache *ca) - { -return GC_SECTORS_USED (heap_peek (&ca->heap)); - } -if (!c->copy_gc_enabled)closure_return (cl);
@@ -220,7 +220,7 @@ void bch_moving_gc(struct closure *cl) sectors_to_move +=GC_SECTORS_USED (b);heap_add (&ca->heap, b, bucket_cmp); }else if (bucket_cmp (b,heap_peek (&ca->heap))) { - sectors_to_move -=top (ca); + sectors_to_move -=bucket_heap_top (ca); sectors_to_move +=GC_SECTORS_USED (b); ca->heap.data[0 ] = b;
@@ -233,7 +233,7 @@ void bch_moving_gc(struct closure *cl) sectors_to_move -=GC_SECTORS_USED (b); } - ca->gc_move_threshold =top (ca); + ca->gc_move_threshold =bucket_heap_top (ca);pr_debug ("threshold %u" , ca->gc_move_threshold); }
drivers/md/bcache/request.c +7 -5
@@ -1117,11 +1117,13 @@ static void add_sequential(struct task_struct *t) t->sequential_io =0 ; } -static void check_should_skip (struct cached_dev *dc,struct search *s) +static struct hlist_head *iohash (struct cached_dev *dc,uint64_t k) { -struct hlist_head *iohash (uint64_t k) - {return &dc->io_hash[hash_64 (k,RECENT_IO_BITS )]; } +return &dc->io_hash[hash_64 (k,RECENT_IO_BITS )]; +} +static void check_should_skip (struct cached_dev *dc,struct search *s) +{struct cache_set *c = s->op.c;struct bio *bio = &s->bio.bio;
@@ -1162,7 +1164,7 @@ static void check_should_skip(struct cached_dev *dc, struct search *s)spin_lock (&dc->io_lock); -hlist_for_each_entry (i,iohash (bio->bi_sector), hash) +hlist_for_each_entry (i,iohash (dc, bio->bi_sector), hash)if (i->last == bio->bi_sector &&time_before (jiffies, i->jiffies)) goto found;
@@ -1180,7 +1182,7 @@ found: s->task->sequential_io = i->sequential;hlist_del (&i->hash); -hlist_add_head (&i->hash,iohash (i->last)); +hlist_add_head (&i->hash,iohash (dc, i->last));list_move_tail (&i->lru, &dc->io_lru);spin_unlock (&dc->io_lock);
drivers/md/bcache/stats.c +2 -1
@@ -95,7 +95,8 @@ static KTYPE(bch_stats);static void scale_accounting (unsigned long data); -void bch_cache_accounting_init (struct cache_accounting *acc,struct closure *parent) +void bch_cache_accounting_init (struct cache_accounting *acc, +struct closure *parent) {kobject_init (&acc->total.kobj, &bch_stats_ktype);kobject_init (&acc->five_minute.kobj, &bch_stats_ktype);
drivers/md/bcache/super.c +4 -3
@@ -526,7 +526,8 @@ void bch_prio_write(struct cache *ca)for (i =prio_buckets (ca) -1 ; i >=0 ; --i) {long bucket;struct prio_set *p = ca->disk_buckets; -struct bucket_disk *d = p->data, *end = d +prios_per_bucket (ca); +struct bucket_disk *d = p->data; +struct bucket_disk *end = d +prios_per_bucket (ca); for (b = ca->buckets + i * prios_per_bucket(ca); b < ca->buckets + ca->sb.nbuckets && d < end;
@@ -865,8 +866,8 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)if (dc->sb.block_size < c->sb.block_size) {/* Will die */ -pr_err ("Couldn't attach %s: block size " -"less than set's block size" , buf); +pr_err ("Couldn't attach %s: block size less than set's block size" , + buf);return -EINVAL ; }
Signature · 1 line
1.8.1.3