Skip to content

Commit fc2d598

Browse files
Coly Liaxboe
authored andcommitted
bcache: add identifier names to arguments of function definitions
There are many function definitions do not have identifier argument names, scripts/checkpatch.pl complains warnings like this, WARNING: function definition argument 'struct bcache_device *' should also have an identifier name #16735: FILE: writeback.h:120: +void bch_sectors_dirty_init(struct bcache_device *); This patch adds identifier argument names to all bcache function definitions to fix such warnings. Signed-off-by: Coly Li <colyli@suse.de> Reviewed: Shenghui Wang <shhuiw@foxmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 1fae7cf commit fc2d598

14 files changed

Lines changed: 215 additions & 185 deletions

File tree

‎drivers/md/bcache/bcache.h‎

Lines changed: 58 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,10 @@ struct bcache_device {
273273

274274
unsigned int data_csum:1;
275275

276-
int (*cache_miss)(struct btree *, struct search *,
277-
struct bio *, unsigned int);
278-
int (*ioctl) (struct bcache_device *, fmode_t, unsigned int, unsigned long);
276+
int (*cache_miss)(struct btree *b, struct search *s,
277+
struct bio *bio, unsigned int sectors);
278+
int (*ioctl) (struct bcache_device *d, fmode_t mode,
279+
unsigned int cmd, unsigned long arg);
279280
};
280281

281282
struct io {
@@ -925,41 +926,43 @@ static inline void wait_for_kthread_stop(void)
925926
/* Forward declarations */
926927

927928
void bch_count_backing_io_errors(struct cached_dev *dc, struct bio *bio);
928-
void bch_count_io_errors(struct cache *, blk_status_t, int, const char *);
929-
void bch_bbio_count_io_errors(struct cache_set *, struct bio *,
930-
blk_status_t, const char *);
931-
void bch_bbio_endio(struct cache_set *, struct bio *, blk_status_t,
932-
const char *);
933-
void bch_bbio_free(struct bio *, struct cache_set *);
934-
struct bio *bch_bbio_alloc(struct cache_set *);
935-
936-
void __bch_submit_bbio(struct bio *, struct cache_set *);
937-
void bch_submit_bbio(struct bio *, struct cache_set *,
938-
struct bkey *, unsigned int);
939-
940-
uint8_t bch_inc_gen(struct cache *, struct bucket *);
941-
void bch_rescale_priorities(struct cache_set *, int);
942-
943-
bool bch_can_invalidate_bucket(struct cache *, struct bucket *);
944-
void __bch_invalidate_one_bucket(struct cache *, struct bucket *);
945-
946-
void __bch_bucket_free(struct cache *, struct bucket *);
947-
void bch_bucket_free(struct cache_set *, struct bkey *);
948-
949-
long bch_bucket_alloc(struct cache *, unsigned int, bool);
950-
int __bch_bucket_alloc_set(struct cache_set *, unsigned int,
951-
struct bkey *, int, bool);
952-
int bch_bucket_alloc_set(struct cache_set *, unsigned int,
953-
struct bkey *, int, bool);
954-
bool bch_alloc_sectors(struct cache_set *, struct bkey *, unsigned int,
955-
unsigned int, unsigned int, bool);
929+
void bch_count_io_errors(struct cache *ca, blk_status_t error,
930+
int is_read, const char *m);
931+
void bch_bbio_count_io_errors(struct cache_set *c, struct bio *bio,
932+
blk_status_t error, const char *m);
933+
void bch_bbio_endio(struct cache_set *c, struct bio *bio,
934+
blk_status_t error, const char *m);
935+
void bch_bbio_free(struct bio *bio, struct cache_set *c);
936+
struct bio *bch_bbio_alloc(struct cache_set *c);
937+
938+
void __bch_submit_bbio(struct bio *bio, struct cache_set *c);
939+
void bch_submit_bbio(struct bio *bio, struct cache_set *c,
940+
struct bkey *k, unsigned int ptr);
941+
942+
uint8_t bch_inc_gen(struct cache *ca, struct bucket *b);
943+
void bch_rescale_priorities(struct cache_set *c, int sectors);
944+
945+
bool bch_can_invalidate_bucket(struct cache *ca, struct bucket *b);
946+
void __bch_invalidate_one_bucket(struct cache *ca, struct bucket *b);
947+
948+
void __bch_bucket_free(struct cache *ca, struct bucket *b);
949+
void bch_bucket_free(struct cache_set *c, struct bkey *k);
950+
951+
long bch_bucket_alloc(struct cache *ca, unsigned int reserve, bool wait);
952+
int __bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve,
953+
struct bkey *k, int n, bool wait);
954+
int bch_bucket_alloc_set(struct cache_set *c, unsigned int reserve,
955+
struct bkey *k, int n, bool wait);
956+
bool bch_alloc_sectors(struct cache_set *c, struct bkey *k,
957+
unsigned int sectors, unsigned int write_point,
958+
unsigned int write_prio, bool wait);
956959
bool bch_cached_dev_error(struct cached_dev *dc);
957960

958961
__printf(2, 3)
959-
bool bch_cache_set_error(struct cache_set *, const char *, ...);
962+
bool bch_cache_set_error(struct cache_set *c, const char *fmt, ...);
960963

961-
void bch_prio_write(struct cache *);
962-
void bch_write_bdev_super(struct cached_dev *, struct closure *);
964+
void bch_prio_write(struct cache *ca);
965+
void bch_write_bdev_super(struct cached_dev *dc, struct closure *parent);
963966

964967
extern struct workqueue_struct *bcache_wq;
965968
extern struct mutex bch_register_lock;
@@ -971,30 +974,31 @@ extern struct kobj_type bch_cache_set_ktype;
971974
extern struct kobj_type bch_cache_set_internal_ktype;
972975
extern struct kobj_type bch_cache_ktype;
973976

974-
void bch_cached_dev_release(struct kobject *);
975-
void bch_flash_dev_release(struct kobject *);
976-
void bch_cache_set_release(struct kobject *);
977-
void bch_cache_release(struct kobject *);
977+
void bch_cached_dev_release(struct kobject *kobj);
978+
void bch_flash_dev_release(struct kobject *kobj);
979+
void bch_cache_set_release(struct kobject *kobj);
980+
void bch_cache_release(struct kobject *kobj);
978981

979-
int bch_uuid_write(struct cache_set *);
980-
void bcache_write_super(struct cache_set *);
982+
int bch_uuid_write(struct cache_set *c);
983+
void bcache_write_super(struct cache_set *c);
981984

982985
int bch_flash_dev_create(struct cache_set *c, uint64_t size);
983986

984-
int bch_cached_dev_attach(struct cached_dev *, struct cache_set *, uint8_t *);
985-
void bch_cached_dev_detach(struct cached_dev *);
986-
void bch_cached_dev_run(struct cached_dev *);
987-
void bcache_device_stop(struct bcache_device *);
988-
989-
void bch_cache_set_unregister(struct cache_set *);
990-
void bch_cache_set_stop(struct cache_set *);
991-
992-
struct cache_set *bch_cache_set_alloc(struct cache_sb *);
993-
void bch_btree_cache_free(struct cache_set *);
994-
int bch_btree_cache_alloc(struct cache_set *);
995-
void bch_moving_init_cache_set(struct cache_set *);
996-
int bch_open_buckets_alloc(struct cache_set *);
997-
void bch_open_buckets_free(struct cache_set *);
987+
int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c,
988+
uint8_t *set_uuid);
989+
void bch_cached_dev_detach(struct cached_dev *dc);
990+
void bch_cached_dev_run(struct cached_dev *dc);
991+
void bcache_device_stop(struct bcache_device *d);
992+
993+
void bch_cache_set_unregister(struct cache_set *c);
994+
void bch_cache_set_stop(struct cache_set *c);
995+
996+
struct cache_set *bch_cache_set_alloc(struct cache_sb *sb);
997+
void bch_btree_cache_free(struct cache_set *c);
998+
int bch_btree_cache_alloc(struct cache_set *c);
999+
void bch_moving_init_cache_set(struct cache_set *c);
1000+
int bch_open_buckets_alloc(struct cache_set *c);
1001+
void bch_open_buckets_free(struct cache_set *c);
9981002

9991003
int bch_cache_allocator_start(struct cache *ca);
10001004

‎drivers/md/bcache/bset.h‎

Lines changed: 71 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,25 @@ struct bset_tree {
187187
};
188188

189189
struct btree_keys_ops {
190-
bool (*sort_cmp)(struct btree_iter_set,
191-
struct btree_iter_set);
192-
struct bkey *(*sort_fixup)(struct btree_iter *, struct bkey *);
193-
bool (*insert_fixup)(struct btree_keys *, struct bkey *,
194-
struct btree_iter *, struct bkey *);
195-
bool (*key_invalid)(struct btree_keys *,
196-
const struct bkey *);
197-
bool (*key_bad)(struct btree_keys *, const struct bkey *);
198-
bool (*key_merge)(struct btree_keys *,
199-
struct bkey *, struct bkey *);
200-
void (*key_to_text)(char *, size_t, const struct bkey *);
201-
void (*key_dump)(struct btree_keys *, const struct bkey *);
190+
bool (*sort_cmp)(struct btree_iter_set l,
191+
struct btree_iter_set r);
192+
struct bkey *(*sort_fixup)(struct btree_iter *iter,
193+
struct bkey *tmp);
194+
bool (*insert_fixup)(struct btree_keys *b,
195+
struct bkey *insert,
196+
struct btree_iter *iter,
197+
struct bkey *replace_key);
198+
bool (*key_invalid)(struct btree_keys *bk,
199+
const struct bkey *k);
200+
bool (*key_bad)(struct btree_keys *bk,
201+
const struct bkey *k);
202+
bool (*key_merge)(struct btree_keys *bk,
203+
struct bkey *l, struct bkey *r);
204+
void (*key_to_text)(char *buf,
205+
size_t size,
206+
const struct bkey *k);
207+
void (*key_dump)(struct btree_keys *keys,
208+
const struct bkey *k);
202209

203210
/*
204211
* Only used for deciding whether to use START_KEY(k) or just the key
@@ -280,18 +287,20 @@ static inline struct bset *bset_next_set(struct btree_keys *b,
280287
return ((void *) i) + roundup(set_bytes(i), block_bytes);
281288
}
282289

283-
void bch_btree_keys_free(struct btree_keys *);
284-
int bch_btree_keys_alloc(struct btree_keys *, unsigned int, gfp_t);
285-
void bch_btree_keys_init(struct btree_keys *, const struct btree_keys_ops *,
286-
bool *);
287-
288-
void bch_bset_init_next(struct btree_keys *, struct bset *, uint64_t);
289-
void bch_bset_build_written_tree(struct btree_keys *);
290-
void bch_bset_fix_invalidated_key(struct btree_keys *, struct bkey *);
291-
bool bch_bkey_try_merge(struct btree_keys *, struct bkey *, struct bkey *);
292-
void bch_bset_insert(struct btree_keys *, struct bkey *, struct bkey *);
293-
unsigned int bch_btree_insert_key(struct btree_keys *, struct bkey *,
294-
struct bkey *);
290+
void bch_btree_keys_free(struct btree_keys *b);
291+
int bch_btree_keys_alloc(struct btree_keys *b, unsigned int page_order,
292+
gfp_t gfp);
293+
void bch_btree_keys_init(struct btree_keys *b, const struct btree_keys_ops *ops,
294+
bool *expensive_debug_checks);
295+
296+
void bch_bset_init_next(struct btree_keys *b, struct bset *i, uint64_t magic);
297+
void bch_bset_build_written_tree(struct btree_keys *b);
298+
void bch_bset_fix_invalidated_key(struct btree_keys *b, struct bkey *k);
299+
bool bch_bkey_try_merge(struct btree_keys *b, struct bkey *l, struct bkey *r);
300+
void bch_bset_insert(struct btree_keys *b, struct bkey *where,
301+
struct bkey *insert);
302+
unsigned int bch_btree_insert_key(struct btree_keys *b, struct bkey *k,
303+
struct bkey *replace_key);
295304

296305
enum {
297306
BTREE_INSERT_STATUS_NO_INSERT = 0,
@@ -313,18 +322,21 @@ struct btree_iter {
313322
} data[MAX_BSETS];
314323
};
315324

316-
typedef bool (*ptr_filter_fn)(struct btree_keys *, const struct bkey *);
325+
typedef bool (*ptr_filter_fn)(struct btree_keys *b, const struct bkey *k);
317326

318-
struct bkey *bch_btree_iter_next(struct btree_iter *);
319-
struct bkey *bch_btree_iter_next_filter(struct btree_iter *,
320-
struct btree_keys *, ptr_filter_fn);
327+
struct bkey *bch_btree_iter_next(struct btree_iter *iter);
328+
struct bkey *bch_btree_iter_next_filter(struct btree_iter *iter,
329+
struct btree_keys *b,
330+
ptr_filter_fn fn);
321331

322-
void bch_btree_iter_push(struct btree_iter *, struct bkey *, struct bkey *);
323-
struct bkey *bch_btree_iter_init(struct btree_keys *, struct btree_iter *,
324-
struct bkey *);
332+
void bch_btree_iter_push(struct btree_iter *iter, struct bkey *k,
333+
struct bkey *end);
334+
struct bkey *bch_btree_iter_init(struct btree_keys *b,
335+
struct btree_iter *iter,
336+
struct bkey *search);
325337

326-
struct bkey *__bch_bset_search(struct btree_keys *, struct bset_tree *,
327-
const struct bkey *);
338+
struct bkey *__bch_bset_search(struct btree_keys *b, struct bset_tree *t,
339+
const struct bkey *search);
328340

329341
/*
330342
* Returns the first key that is strictly greater than search
@@ -355,15 +367,17 @@ struct bset_sort_state {
355367
struct time_stats time;
356368
};
357369

358-
void bch_bset_sort_state_free(struct bset_sort_state *);
359-
int bch_bset_sort_state_init(struct bset_sort_state *, unsigned int);
360-
void bch_btree_sort_lazy(struct btree_keys *, struct bset_sort_state *);
361-
void bch_btree_sort_into(struct btree_keys *, struct btree_keys *,
362-
struct bset_sort_state *);
363-
void bch_btree_sort_and_fix_extents(struct btree_keys *, struct btree_iter *,
364-
struct bset_sort_state *);
365-
void bch_btree_sort_partial(struct btree_keys *, unsigned int,
366-
struct bset_sort_state *);
370+
void bch_bset_sort_state_free(struct bset_sort_state *state);
371+
int bch_bset_sort_state_init(struct bset_sort_state *state,
372+
unsigned int page_order);
373+
void bch_btree_sort_lazy(struct btree_keys *b, struct bset_sort_state *state);
374+
void bch_btree_sort_into(struct btree_keys *b, struct btree_keys *new,
375+
struct bset_sort_state *state);
376+
void bch_btree_sort_and_fix_extents(struct btree_keys *b,
377+
struct btree_iter *iter,
378+
struct bset_sort_state *state);
379+
void bch_btree_sort_partial(struct btree_keys *b, unsigned int start,
380+
struct bset_sort_state *state);
367381

368382
static inline void bch_btree_sort(struct btree_keys *b,
369383
struct bset_sort_state *state)
@@ -377,7 +391,7 @@ struct bset_stats {
377391
size_t floats, failed;
378392
};
379393

380-
void bch_btree_keys_stats(struct btree_keys *, struct bset_stats *);
394+
void bch_btree_keys_stats(struct btree_keys *b, struct bset_stats *state);
381395

382396
/* Bkey utility code */
383397

@@ -401,10 +415,10 @@ static __always_inline int64_t bkey_cmp(const struct bkey *l,
401415
: (int64_t) KEY_OFFSET(l) - (int64_t) KEY_OFFSET(r);
402416
}
403417

404-
void bch_bkey_copy_single_ptr(struct bkey *, const struct bkey *,
405-
unsigned int);
406-
bool __bch_cut_front(const struct bkey *, struct bkey *);
407-
bool __bch_cut_back(const struct bkey *, struct bkey *);
418+
void bch_bkey_copy_single_ptr(struct bkey *dest, const struct bkey *src,
419+
unsigned int i);
420+
bool __bch_cut_front(const struct bkey *where, struct bkey *k);
421+
bool __bch_cut_back(const struct bkey *where, struct bkey *k);
408422

409423
static inline bool bch_cut_front(const struct bkey *where, struct bkey *k)
410424
{
@@ -522,26 +536,28 @@ static inline size_t bch_keylist_bytes(struct keylist *l)
522536
return bch_keylist_nkeys(l) * sizeof(uint64_t);
523537
}
524538

525-
struct bkey *bch_keylist_pop(struct keylist *);
526-
void bch_keylist_pop_front(struct keylist *);
527-
int __bch_keylist_realloc(struct keylist *, unsigned int);
539+
struct bkey *bch_keylist_pop(struct keylist *l);
540+
void bch_keylist_pop_front(struct keylist *l);
541+
int __bch_keylist_realloc(struct keylist *l, unsigned int u64s);
528542

529543
/* Debug stuff */
530544

531545
#ifdef CONFIG_BCACHE_DEBUG
532546

533-
int __bch_count_data(struct btree_keys *);
534-
void __printf(2, 3) __bch_check_keys(struct btree_keys *, const char *, ...);
535-
void bch_dump_bset(struct btree_keys *, struct bset *, unsigned int);
536-
void bch_dump_bucket(struct btree_keys *);
547+
int __bch_count_data(struct btree_keys *b);
548+
void __printf(2, 3) __bch_check_keys(struct btree_keys *b,
549+
const char *fmt,
550+
...);
551+
void bch_dump_bset(struct btree_keys *b, struct bset *i, unsigned int set);
552+
void bch_dump_bucket(struct btree_keys *b);
537553

538554
#else
539555

540556
static inline int __bch_count_data(struct btree_keys *b) { return -1; }
541557
static inline void __printf(2, 3)
542558
__bch_check_keys(struct btree_keys *b, const char *fmt, ...) {}
543559
static inline void bch_dump_bucket(struct btree_keys *b) {}
544-
void bch_dump_bset(struct btree_keys *, struct bset *, unsigned int);
560+
void bch_dump_bset(struct btree_keys *b, struct bset *i, unsigned int set);
545561

546562
#endif
547563

‎drivers/md/bcache/btree.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1309,8 +1309,10 @@ struct gc_merge_info {
13091309
unsigned int keys;
13101310
};
13111311

1312-
static int bch_btree_insert_node(struct btree *, struct btree_op *,
1313-
struct keylist *, atomic_t *, struct bkey *);
1312+
static int bch_btree_insert_node(struct btree *b, struct btree_op *op,
1313+
struct keylist *insert_keys,
1314+
atomic_t *journal_ref,
1315+
struct bkey *replace_key);
13141316

13151317
static int btree_gc_coalesce(struct btree *b, struct btree_op *op,
13161318
struct gc_stat *gc, struct gc_merge_info *r)

0 commit comments

Comments
 (0)