Commit 169ef1cf6171d35550fef85645b83b960e241cff
Committed by
Jens Axboe
1 parent
0b6ef4164f
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
bcache: Don't export utility code, prefix with bch_
Signed-off-by: Kent Overstreet <koverstreet@google.com> Cc: linux-bcache@vger.kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
Showing 13 changed files with 89 additions and 101 deletions Side-by-side Diff
- drivers/md/bcache/bcache.h
- drivers/md/bcache/bset.c
- drivers/md/bcache/btree.c
- drivers/md/bcache/debug.c
- drivers/md/bcache/journal.c
- drivers/md/bcache/movinggc.c
- drivers/md/bcache/request.c
- drivers/md/bcache/super.c
- drivers/md/bcache/sysfs.c
- drivers/md/bcache/sysfs.h
- drivers/md/bcache/util.c
- drivers/md/bcache/util.h
- drivers/md/bcache/writeback.c
drivers/md/bcache/bcache.h
... | ... | @@ -1033,7 +1033,7 @@ |
1033 | 1033 | * jset: The checksum is _always_ the first 8 bytes of these structs |
1034 | 1034 | */ |
1035 | 1035 | #define csum_set(i) \ |
1036 | - crc64(((void *) (i)) + sizeof(uint64_t), \ | |
1036 | + bch_crc64(((void *) (i)) + sizeof(uint64_t), \ | |
1037 | 1037 | ((void *) end(i)) - (((void *) (i)) + sizeof(uint64_t))) |
1038 | 1038 | |
1039 | 1039 | /* Error handling macros */ |
drivers/md/bcache/bset.c
... | ... | @@ -1026,7 +1026,7 @@ |
1026 | 1026 | |
1027 | 1027 | if (!start) { |
1028 | 1028 | spin_lock(&b->c->sort_time_lock); |
1029 | - time_stats_update(&b->c->sort_time, start_time); | |
1029 | + bch_time_stats_update(&b->c->sort_time, start_time); | |
1030 | 1030 | spin_unlock(&b->c->sort_time_lock); |
1031 | 1031 | } |
1032 | 1032 | } |
... | ... | @@ -1076,7 +1076,7 @@ |
1076 | 1076 | btree_mergesort(b, new->sets->data, &iter, false, true); |
1077 | 1077 | |
1078 | 1078 | spin_lock(&b->c->sort_time_lock); |
1079 | - time_stats_update(&b->c->sort_time, start_time); | |
1079 | + bch_time_stats_update(&b->c->sort_time, start_time); | |
1080 | 1080 | spin_unlock(&b->c->sort_time_lock); |
1081 | 1081 | |
1082 | 1082 | bkey_copy_key(&new->key, &b->key); |
drivers/md/bcache/btree.c
... | ... | @@ -129,7 +129,7 @@ |
129 | 129 | uint64_t crc = b->key.ptr[0]; |
130 | 130 | void *data = (void *) i + 8, *end = end(i); |
131 | 131 | |
132 | - crc = crc64_update(crc, data, end - data); | |
132 | + crc = bch_crc64_update(crc, data, end - data); | |
133 | 133 | return crc ^ 0xffffffffffffffff; |
134 | 134 | } |
135 | 135 | |
... | ... | @@ -231,7 +231,7 @@ |
231 | 231 | mutex_unlock(&b->c->fill_lock); |
232 | 232 | |
233 | 233 | spin_lock(&b->c->btree_read_time_lock); |
234 | - time_stats_update(&b->c->btree_read_time, b->io_start_time); | |
234 | + bch_time_stats_update(&b->c->btree_read_time, b->io_start_time); | |
235 | 235 | spin_unlock(&b->c->btree_read_time_lock); |
236 | 236 | |
237 | 237 | smp_wmb(); /* read_done is our write lock */ |
... | ... | @@ -259,7 +259,7 @@ |
259 | 259 | b->bio->bi_rw = REQ_META|READ_SYNC; |
260 | 260 | b->bio->bi_size = KEY_SIZE(&b->key) << 9; |
261 | 261 | |
262 | - bio_map(b->bio, b->sets[0].data); | |
262 | + bch_bio_map(b->bio, b->sets[0].data); | |
263 | 263 | |
264 | 264 | pr_debug("%s", pbtree(b)); |
265 | 265 | trace_bcache_btree_read(b->bio); |
266 | 266 | |
... | ... | @@ -327,12 +327,12 @@ |
327 | 327 | btree_bio_init(b); |
328 | 328 | b->bio->bi_rw = REQ_META|WRITE_SYNC; |
329 | 329 | b->bio->bi_size = set_blocks(i, b->c) * block_bytes(b->c); |
330 | - bio_map(b->bio, i); | |
330 | + bch_bio_map(b->bio, i); | |
331 | 331 | |
332 | 332 | bkey_copy(&k.key, &b->key); |
333 | 333 | SET_PTR_OFFSET(&k.key, 0, PTR_OFFSET(&k.key, 0) + bset_offset(b, i)); |
334 | 334 | |
335 | - if (!bio_alloc_pages(b->bio, GFP_NOIO)) { | |
335 | + if (!bch_bio_alloc_pages(b->bio, GFP_NOIO)) { | |
336 | 336 | int j; |
337 | 337 | struct bio_vec *bv; |
338 | 338 | void *base = (void *) ((unsigned long) i & ~(PAGE_SIZE - 1)); |
... | ... | @@ -347,7 +347,7 @@ |
347 | 347 | continue_at(cl, btree_write_done, NULL); |
348 | 348 | } else { |
349 | 349 | b->bio->bi_vcnt = 0; |
350 | - bio_map(b->bio, i); | |
350 | + bch_bio_map(b->bio, i); | |
351 | 351 | |
352 | 352 | trace_bcache_btree_write(b->bio); |
353 | 353 | bch_submit_bbio(b->bio, b->c, &k.key, 0); |
... | ... | @@ -815,7 +815,7 @@ |
815 | 815 | void bch_cannibalize_unlock(struct cache_set *c, struct closure *cl) |
816 | 816 | { |
817 | 817 | if (c->try_harder == cl) { |
818 | - time_stats_update(&c->try_harder_time, c->try_harder_start); | |
818 | + bch_time_stats_update(&c->try_harder_time, c->try_harder_start); | |
819 | 819 | c->try_harder = NULL; |
820 | 820 | __closure_wake_up(&c->try_wait); |
821 | 821 | } |
... | ... | @@ -1536,7 +1536,7 @@ |
1536 | 1536 | |
1537 | 1537 | available = bch_btree_gc_finish(c); |
1538 | 1538 | |
1539 | - time_stats_update(&c->btree_gc_time, start_time); | |
1539 | + bch_time_stats_update(&c->btree_gc_time, start_time); | |
1540 | 1540 | |
1541 | 1541 | stats.key_bytes *= sizeof(uint64_t); |
1542 | 1542 | stats.dirty <<= 9; |
... | ... | @@ -2007,7 +2007,7 @@ |
2007 | 2007 | rw_unlock(true, n1); |
2008 | 2008 | btree_node_free(b, op); |
2009 | 2009 | |
2010 | - time_stats_update(&b->c->btree_split_time, start_time); | |
2010 | + bch_time_stats_update(&b->c->btree_split_time, start_time); | |
2011 | 2011 | |
2012 | 2012 | return 0; |
2013 | 2013 | err_free2: |
drivers/md/bcache/debug.c
drivers/md/bcache/journal.c
... | ... | @@ -54,7 +54,7 @@ |
54 | 54 | |
55 | 55 | bio->bi_end_io = journal_read_endio; |
56 | 56 | bio->bi_private = &op->cl; |
57 | - bio_map(bio, data); | |
57 | + bch_bio_map(bio, data); | |
58 | 58 | |
59 | 59 | closure_bio_submit(bio, &op->cl, ca); |
60 | 60 | closure_sync(&op->cl); |
... | ... | @@ -621,7 +621,7 @@ |
621 | 621 | |
622 | 622 | bio->bi_end_io = journal_write_endio; |
623 | 623 | bio->bi_private = w; |
624 | - bio_map(bio, w->data); | |
624 | + bch_bio_map(bio, w->data); | |
625 | 625 | |
626 | 626 | trace_bcache_journal_write(bio); |
627 | 627 | bio_list_add(&list, bio); |
drivers/md/bcache/movinggc.c
... | ... | @@ -85,7 +85,7 @@ |
85 | 85 | PAGE_SECTORS); |
86 | 86 | bio->bi_private = &io->s.cl; |
87 | 87 | bio->bi_io_vec = bio->bi_inline_vecs; |
88 | - bio_map(bio, NULL); | |
88 | + bch_bio_map(bio, NULL); | |
89 | 89 | } |
90 | 90 | |
91 | 91 | static void write_moving(struct closure *cl) |
... | ... | @@ -159,7 +159,7 @@ |
159 | 159 | bio->bi_rw = READ; |
160 | 160 | bio->bi_end_io = read_moving_endio; |
161 | 161 | |
162 | - if (bio_alloc_pages(bio, GFP_KERNEL)) | |
162 | + if (bch_bio_alloc_pages(bio, GFP_KERNEL)) | |
163 | 163 | goto err; |
164 | 164 | |
165 | 165 | pr_debug("%s", pkey(&w->key)); |
drivers/md/bcache/request.c
... | ... | @@ -58,8 +58,8 @@ |
58 | 58 | char __user *buf, size_t nbytes, loff_t *ppos) |
59 | 59 | { |
60 | 60 | char tmp[1024]; |
61 | - int len = snprint_string_list(tmp, PAGE_SIZE, bch_cache_modes, | |
62 | - cgroup_to_bcache(cgrp)->cache_mode + 1); | |
61 | + int len = bch_snprint_string_list(tmp, PAGE_SIZE, bch_cache_modes, | |
62 | + cgroup_to_bcache(cgrp)->cache_mode + 1); | |
63 | 63 | |
64 | 64 | if (len < 0) |
65 | 65 | return len; |
... | ... | @@ -70,7 +70,7 @@ |
70 | 70 | static int cache_mode_write(struct cgroup *cgrp, struct cftype *cft, |
71 | 71 | const char *buf) |
72 | 72 | { |
73 | - int v = read_string_list(buf, bch_cache_modes); | |
73 | + int v = bch_read_string_list(buf, bch_cache_modes); | |
74 | 74 | if (v < 0) |
75 | 75 | return v; |
76 | 76 | |
... | ... | @@ -205,7 +205,7 @@ |
205 | 205 | |
206 | 206 | bio_for_each_segment(bv, bio, i) { |
207 | 207 | void *d = kmap(bv->bv_page) + bv->bv_offset; |
208 | - csum = crc64_update(csum, d, bv->bv_len); | |
208 | + csum = bch_crc64_update(csum, d, bv->bv_len); | |
209 | 209 | kunmap(bv->bv_page); |
210 | 210 | } |
211 | 211 | |
... | ... | @@ -835,7 +835,7 @@ |
835 | 835 | s->op.cache_bio->bi_sector = s->cache_miss->bi_sector; |
836 | 836 | s->op.cache_bio->bi_bdev = s->cache_miss->bi_bdev; |
837 | 837 | s->op.cache_bio->bi_size = s->cache_bio_sectors << 9; |
838 | - bio_map(s->op.cache_bio, NULL); | |
838 | + bch_bio_map(s->op.cache_bio, NULL); | |
839 | 839 | |
840 | 840 | src = bio_iovec(s->op.cache_bio); |
841 | 841 | dst = bio_iovec(s->cache_miss); |
... | ... | @@ -962,8 +962,8 @@ |
962 | 962 | if (!bch_btree_insert_check_key(b, &s->op, s->op.cache_bio)) |
963 | 963 | goto out_put; |
964 | 964 | |
965 | - bio_map(s->op.cache_bio, NULL); | |
966 | - if (bio_alloc_pages(s->op.cache_bio, __GFP_NOWARN|GFP_NOIO)) | |
965 | + bch_bio_map(s->op.cache_bio, NULL); | |
966 | + if (bch_bio_alloc_pages(s->op.cache_bio, __GFP_NOWARN|GFP_NOIO)) | |
967 | 967 | goto out_put; |
968 | 968 | |
969 | 969 | s->cache_miss = miss; |
drivers/md/bcache/super.c
... | ... | @@ -142,7 +142,7 @@ |
142 | 142 | goto err; |
143 | 143 | |
144 | 144 | err = "Bad UUID"; |
145 | - if (is_zero(sb->uuid, 16)) | |
145 | + if (bch_is_zero(sb->uuid, 16)) | |
146 | 146 | goto err; |
147 | 147 | |
148 | 148 | err = "Unsupported superblock version"; |
... | ... | @@ -170,7 +170,7 @@ |
170 | 170 | goto out; |
171 | 171 | |
172 | 172 | err = "Bad UUID"; |
173 | - if (is_zero(sb->set_uuid, 16)) | |
173 | + if (bch_is_zero(sb->set_uuid, 16)) | |
174 | 174 | goto err; |
175 | 175 | |
176 | 176 | err = "Bad cache device number in set"; |
... | ... | @@ -218,7 +218,7 @@ |
218 | 218 | bio->bi_sector = SB_SECTOR; |
219 | 219 | bio->bi_rw = REQ_SYNC|REQ_META; |
220 | 220 | bio->bi_size = SB_SIZE; |
221 | - bio_map(bio, NULL); | |
221 | + bch_bio_map(bio, NULL); | |
222 | 222 | |
223 | 223 | out->offset = cpu_to_le64(sb->offset); |
224 | 224 | out->version = cpu_to_le64(sb->version); |
... | ... | @@ -332,7 +332,7 @@ |
332 | 332 | |
333 | 333 | bio->bi_end_io = uuid_endio; |
334 | 334 | bio->bi_private = cl; |
335 | - bio_map(bio, c->uuids); | |
335 | + bch_bio_map(bio, c->uuids); | |
336 | 336 | |
337 | 337 | bch_submit_bbio(bio, c, k, i); |
338 | 338 | |
... | ... | @@ -344,7 +344,7 @@ |
344 | 344 | pkey(&c->uuid_bucket)); |
345 | 345 | |
346 | 346 | for (u = c->uuids; u < c->uuids + c->nr_uuids; u++) |
347 | - if (!is_zero(u->uuid, 16)) | |
347 | + if (!bch_is_zero(u->uuid, 16)) | |
348 | 348 | pr_debug("Slot %zi: %pU: %s: 1st: %u last: %u inv: %u", |
349 | 349 | u - c->uuids, u->uuid, u->label, |
350 | 350 | u->first_reg, u->last_reg, u->invalidated); |
... | ... | @@ -491,7 +491,7 @@ |
491 | 491 | |
492 | 492 | bio->bi_end_io = prio_endio; |
493 | 493 | bio->bi_private = ca; |
494 | - bio_map(bio, ca->disk_buckets); | |
494 | + bch_bio_map(bio, ca->disk_buckets); | |
495 | 495 | |
496 | 496 | closure_bio_submit(bio, &ca->prio, ca); |
497 | 497 | closure_sync(cl); |
... | ... | @@ -538,7 +538,7 @@ |
538 | 538 | |
539 | 539 | p->next_bucket = ca->prio_buckets[i + 1]; |
540 | 540 | p->magic = pset_magic(ca); |
541 | - p->csum = crc64(&p->magic, bucket_bytes(ca) - 8); | |
541 | + p->csum = bch_crc64(&p->magic, bucket_bytes(ca) - 8); | |
542 | 542 | |
543 | 543 | bucket = bch_bucket_alloc(ca, WATERMARK_PRIO, &cl); |
544 | 544 | BUG_ON(bucket == -1); |
... | ... | @@ -585,7 +585,7 @@ |
585 | 585 | |
586 | 586 | prio_io(ca, bucket, READ_SYNC); |
587 | 587 | |
588 | - if (p->csum != crc64(&p->magic, bucket_bytes(ca) - 8)) | |
588 | + if (p->csum != bch_crc64(&p->magic, bucket_bytes(ca) - 8)) | |
589 | 589 | pr_warn("bad csum reading priorities"); |
590 | 590 | |
591 | 591 | if (p->magic != pset_magic(ca)) |
... | ... | @@ -898,7 +898,7 @@ |
898 | 898 | sysfs_remove_file(&dc->kobj, &sysfs_attach); |
899 | 899 | */ |
900 | 900 | |
901 | - if (is_zero(u->uuid, 16)) { | |
901 | + if (bch_is_zero(u->uuid, 16)) { | |
902 | 902 | struct closure cl; |
903 | 903 | closure_init_stack(&cl); |
904 | 904 |
drivers/md/bcache/sysfs.c
... | ... | @@ -105,9 +105,9 @@ |
105 | 105 | #define var(stat) (dc->stat) |
106 | 106 | |
107 | 107 | if (attr == &sysfs_cache_mode) |
108 | - return snprint_string_list(buf, PAGE_SIZE, | |
109 | - bch_cache_modes + 1, | |
110 | - BDEV_CACHE_MODE(&dc->sb)); | |
108 | + return bch_snprint_string_list(buf, PAGE_SIZE, | |
109 | + bch_cache_modes + 1, | |
110 | + BDEV_CACHE_MODE(&dc->sb)); | |
111 | 111 | |
112 | 112 | sysfs_printf(data_csum, "%i", dc->disk.data_csum); |
113 | 113 | var_printf(verify, "%i"); |
114 | 114 | |
... | ... | @@ -126,10 +126,10 @@ |
126 | 126 | char dirty[20]; |
127 | 127 | char derivative[20]; |
128 | 128 | char target[20]; |
129 | - hprint(dirty, | |
129 | + bch_hprint(dirty, | |
130 | 130 | atomic_long_read(&dc->disk.sectors_dirty) << 9); |
131 | - hprint(derivative, dc->writeback_rate_derivative << 9); | |
132 | - hprint(target, dc->writeback_rate_target << 9); | |
131 | + bch_hprint(derivative, dc->writeback_rate_derivative << 9); | |
132 | + bch_hprint(target, dc->writeback_rate_target << 9); | |
133 | 133 | |
134 | 134 | return sprintf(buf, |
135 | 135 | "rate:\t\t%u\n" |
... | ... | @@ -202,7 +202,7 @@ |
202 | 202 | bch_cached_dev_run(dc); |
203 | 203 | |
204 | 204 | if (attr == &sysfs_cache_mode) { |
205 | - ssize_t v = read_string_list(buf, bch_cache_modes + 1); | |
205 | + ssize_t v = bch_read_string_list(buf, bch_cache_modes + 1); | |
206 | 206 | |
207 | 207 | if (v < 0) |
208 | 208 | return v; |
... | ... | @@ -224,7 +224,7 @@ |
224 | 224 | } |
225 | 225 | |
226 | 226 | if (attr == &sysfs_attach) { |
227 | - if (parse_uuid(buf, dc->sb.set_uuid) < 16) | |
227 | + if (bch_parse_uuid(buf, dc->sb.set_uuid) < 16) | |
228 | 228 | return -EINVAL; |
229 | 229 | |
230 | 230 | list_for_each_entry(c, &bch_cache_sets, list) { |
... | ... | @@ -657,9 +657,9 @@ |
657 | 657 | ((size_t) ca->sb.nbuckets)); |
658 | 658 | |
659 | 659 | if (attr == &sysfs_cache_replacement_policy) |
660 | - return snprint_string_list(buf, PAGE_SIZE, | |
661 | - cache_replacement_policies, | |
662 | - CACHE_REPLACEMENT(&ca->sb)); | |
660 | + return bch_snprint_string_list(buf, PAGE_SIZE, | |
661 | + cache_replacement_policies, | |
662 | + CACHE_REPLACEMENT(&ca->sb)); | |
663 | 663 | |
664 | 664 | if (attr == &sysfs_priority_stats) { |
665 | 665 | int cmp(const void *l, const void *r) |
... | ... | @@ -747,7 +747,7 @@ |
747 | 747 | } |
748 | 748 | |
749 | 749 | if (attr == &sysfs_cache_replacement_policy) { |
750 | - ssize_t v = read_string_list(buf, cache_replacement_policies); | |
750 | + ssize_t v = bch_read_string_list(buf, cache_replacement_policies); | |
751 | 751 | |
752 | 752 | if (v < 0) |
753 | 753 | return v; |
drivers/md/bcache/sysfs.h
drivers/md/bcache/util.c
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | #define simple_strtouint(c, end, base) simple_strtoul(c, end, base) |
20 | 20 | |
21 | 21 | #define STRTO_H(name, type) \ |
22 | -int name ## _h(const char *cp, type *res) \ | |
22 | +int bch_ ## name ## _h(const char *cp, type *res) \ | |
23 | 23 | { \ |
24 | 24 | int u = 0; \ |
25 | 25 | char *e; \ |
26 | 26 | |
... | ... | @@ -67,14 +67,13 @@ |
67 | 67 | *res = i; \ |
68 | 68 | return 0; \ |
69 | 69 | } \ |
70 | -EXPORT_SYMBOL_GPL(name ## _h); | |
71 | 70 | |
72 | 71 | STRTO_H(strtoint, int) |
73 | 72 | STRTO_H(strtouint, unsigned int) |
74 | 73 | STRTO_H(strtoll, long long) |
75 | 74 | STRTO_H(strtoull, unsigned long long) |
76 | 75 | |
77 | -ssize_t hprint(char *buf, int64_t v) | |
76 | +ssize_t bch_hprint(char *buf, int64_t v) | |
78 | 77 | { |
79 | 78 | static const char units[] = "?kMGTPEZY"; |
80 | 79 | char dec[3] = ""; |
81 | 80 | |
... | ... | @@ -93,9 +92,8 @@ |
93 | 92 | |
94 | 93 | return sprintf(buf, "%lli%s%c", v, dec, units[u]); |
95 | 94 | } |
96 | -EXPORT_SYMBOL_GPL(hprint); | |
97 | 95 | |
98 | -ssize_t snprint_string_list(char *buf, size_t size, const char * const list[], | |
96 | +ssize_t bch_snprint_string_list(char *buf, size_t size, const char * const list[], | |
99 | 97 | size_t selected) |
100 | 98 | { |
101 | 99 | char *out = buf; |
102 | 100 | |
... | ... | @@ -108,9 +106,8 @@ |
108 | 106 | out[-1] = '\n'; |
109 | 107 | return out - buf; |
110 | 108 | } |
111 | -EXPORT_SYMBOL_GPL(snprint_string_list); | |
112 | 109 | |
113 | -ssize_t read_string_list(const char *buf, const char * const list[]) | |
110 | +ssize_t bch_read_string_list(const char *buf, const char * const list[]) | |
114 | 111 | { |
115 | 112 | size_t i; |
116 | 113 | char *s, *d = kstrndup(buf, PAGE_SIZE - 1, GFP_KERNEL); |
117 | 114 | |
... | ... | @@ -130,9 +127,8 @@ |
130 | 127 | |
131 | 128 | return i; |
132 | 129 | } |
133 | -EXPORT_SYMBOL_GPL(read_string_list); | |
134 | 130 | |
135 | -bool is_zero(const char *p, size_t n) | |
131 | +bool bch_is_zero(const char *p, size_t n) | |
136 | 132 | { |
137 | 133 | size_t i; |
138 | 134 | |
139 | 135 | |
... | ... | @@ -141,9 +137,8 @@ |
141 | 137 | return false; |
142 | 138 | return true; |
143 | 139 | } |
144 | -EXPORT_SYMBOL_GPL(is_zero); | |
145 | 140 | |
146 | -int parse_uuid(const char *s, char *uuid) | |
141 | +int bch_parse_uuid(const char *s, char *uuid) | |
147 | 142 | { |
148 | 143 | size_t i, j, x; |
149 | 144 | memset(uuid, 0, 16); |
150 | 145 | |
... | ... | @@ -170,9 +165,8 @@ |
170 | 165 | } |
171 | 166 | return i; |
172 | 167 | } |
173 | -EXPORT_SYMBOL_GPL(parse_uuid); | |
174 | 168 | |
175 | -void time_stats_update(struct time_stats *stats, uint64_t start_time) | |
169 | +void bch_time_stats_update(struct time_stats *stats, uint64_t start_time) | |
176 | 170 | { |
177 | 171 | uint64_t now = local_clock(); |
178 | 172 | uint64_t duration = time_after64(now, start_time) |
179 | 173 | |
... | ... | @@ -195,9 +189,8 @@ |
195 | 189 | |
196 | 190 | stats->last = now ?: 1; |
197 | 191 | } |
198 | -EXPORT_SYMBOL_GPL(time_stats_update); | |
199 | 192 | |
200 | -unsigned next_delay(struct ratelimit *d, uint64_t done) | |
193 | +unsigned bch_next_delay(struct ratelimit *d, uint64_t done) | |
201 | 194 | { |
202 | 195 | uint64_t now = local_clock(); |
203 | 196 | |
204 | 197 | |
... | ... | @@ -207,9 +200,8 @@ |
207 | 200 | ? div_u64(d->next - now, NSEC_PER_SEC / HZ) |
208 | 201 | : 0; |
209 | 202 | } |
210 | -EXPORT_SYMBOL_GPL(next_delay); | |
211 | 203 | |
212 | -void bio_map(struct bio *bio, void *base) | |
204 | +void bch_bio_map(struct bio *bio, void *base) | |
213 | 205 | { |
214 | 206 | size_t size = bio->bi_size; |
215 | 207 | struct bio_vec *bv = bio->bi_io_vec; |
216 | 208 | |
... | ... | @@ -235,9 +227,8 @@ |
235 | 227 | size -= bv->bv_len; |
236 | 228 | } |
237 | 229 | } |
238 | -EXPORT_SYMBOL_GPL(bio_map); | |
239 | 230 | |
240 | -int bio_alloc_pages(struct bio *bio, gfp_t gfp) | |
231 | +int bch_bio_alloc_pages(struct bio *bio, gfp_t gfp) | |
241 | 232 | { |
242 | 233 | int i; |
243 | 234 | struct bio_vec *bv; |
... | ... | @@ -253,7 +244,6 @@ |
253 | 244 | |
254 | 245 | return 0; |
255 | 246 | } |
256 | -EXPORT_SYMBOL_GPL(bio_alloc_pages); | |
257 | 247 | |
258 | 248 | /* |
259 | 249 | * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group (Any |
... | ... | @@ -365,7 +355,7 @@ |
365 | 355 | 0x9AFCE626CE85B507 |
366 | 356 | }; |
367 | 357 | |
368 | -uint64_t crc64_update(uint64_t crc, const void *_data, size_t len) | |
358 | +uint64_t bch_crc64_update(uint64_t crc, const void *_data, size_t len) | |
369 | 359 | { |
370 | 360 | const unsigned char *data = _data; |
371 | 361 | |
372 | 362 | |
373 | 363 | |
374 | 364 | |
... | ... | @@ -376,15 +366,13 @@ |
376 | 366 | |
377 | 367 | return crc; |
378 | 368 | } |
379 | -EXPORT_SYMBOL(crc64_update); | |
380 | 369 | |
381 | -uint64_t crc64(const void *data, size_t len) | |
370 | +uint64_t bch_crc64(const void *data, size_t len) | |
382 | 371 | { |
383 | 372 | uint64_t crc = 0xffffffffffffffff; |
384 | 373 | |
385 | - crc = crc64_update(crc, data, len); | |
374 | + crc = bch_crc64_update(crc, data, len); | |
386 | 375 | |
387 | 376 | return crc ^ 0xffffffffffffffff; |
388 | 377 | } |
389 | -EXPORT_SYMBOL(crc64); |
drivers/md/bcache/util.h
... | ... | @@ -307,42 +307,42 @@ |
307 | 307 | #define ANYSINT_MAX(t) \ |
308 | 308 | ((((t) 1 << (sizeof(t) * 8 - 2)) - (t) 1) * (t) 2 + (t) 1) |
309 | 309 | |
310 | -int strtoint_h(const char *, int *); | |
311 | -int strtouint_h(const char *, unsigned int *); | |
312 | -int strtoll_h(const char *, long long *); | |
313 | -int strtoull_h(const char *, unsigned long long *); | |
310 | +int bch_strtoint_h(const char *, int *); | |
311 | +int bch_strtouint_h(const char *, unsigned int *); | |
312 | +int bch_strtoll_h(const char *, long long *); | |
313 | +int bch_strtoull_h(const char *, unsigned long long *); | |
314 | 314 | |
315 | -static inline int strtol_h(const char *cp, long *res) | |
315 | +static inline int bch_strtol_h(const char *cp, long *res) | |
316 | 316 | { |
317 | 317 | #if BITS_PER_LONG == 32 |
318 | - return strtoint_h(cp, (int *) res); | |
318 | + return bch_strtoint_h(cp, (int *) res); | |
319 | 319 | #else |
320 | - return strtoll_h(cp, (long long *) res); | |
320 | + return bch_strtoll_h(cp, (long long *) res); | |
321 | 321 | #endif |
322 | 322 | } |
323 | 323 | |
324 | -static inline int strtoul_h(const char *cp, long *res) | |
324 | +static inline int bch_strtoul_h(const char *cp, long *res) | |
325 | 325 | { |
326 | 326 | #if BITS_PER_LONG == 32 |
327 | - return strtouint_h(cp, (unsigned int *) res); | |
327 | + return bch_strtouint_h(cp, (unsigned int *) res); | |
328 | 328 | #else |
329 | - return strtoull_h(cp, (unsigned long long *) res); | |
329 | + return bch_strtoull_h(cp, (unsigned long long *) res); | |
330 | 330 | #endif |
331 | 331 | } |
332 | 332 | |
333 | 333 | #define strtoi_h(cp, res) \ |
334 | 334 | (__builtin_types_compatible_p(typeof(*res), int) \ |
335 | - ? strtoint_h(cp, (void *) res) \ | |
335 | + ? bch_strtoint_h(cp, (void *) res) \ | |
336 | 336 | : __builtin_types_compatible_p(typeof(*res), long) \ |
337 | - ? strtol_h(cp, (void *) res) \ | |
337 | + ? bch_strtol_h(cp, (void *) res) \ | |
338 | 338 | : __builtin_types_compatible_p(typeof(*res), long long) \ |
339 | - ? strtoll_h(cp, (void *) res) \ | |
339 | + ? bch_strtoll_h(cp, (void *) res) \ | |
340 | 340 | : __builtin_types_compatible_p(typeof(*res), unsigned int) \ |
341 | - ? strtouint_h(cp, (void *) res) \ | |
341 | + ? bch_strtouint_h(cp, (void *) res) \ | |
342 | 342 | : __builtin_types_compatible_p(typeof(*res), unsigned long) \ |
343 | - ? strtoul_h(cp, (void *) res) \ | |
343 | + ? bch_strtoul_h(cp, (void *) res) \ | |
344 | 344 | : __builtin_types_compatible_p(typeof(*res), unsigned long long)\ |
345 | - ? strtoull_h(cp, (void *) res) : -EINVAL) | |
345 | + ? bch_strtoull_h(cp, (void *) res) : -EINVAL) | |
346 | 346 | |
347 | 347 | #define strtoul_safe(cp, var) \ |
348 | 348 | ({ \ |
349 | 349 | |
350 | 350 | |
351 | 351 | |
... | ... | @@ -379,15 +379,15 @@ |
379 | 379 | __builtin_types_compatible_p(typeof(var), const char *) \ |
380 | 380 | ? "%s\n" : "%i\n", var) |
381 | 381 | |
382 | -ssize_t hprint(char *buf, int64_t v); | |
382 | +ssize_t bch_hprint(char *buf, int64_t v); | |
383 | 383 | |
384 | -bool is_zero(const char *p, size_t n); | |
385 | -int parse_uuid(const char *s, char *uuid); | |
384 | +bool bch_is_zero(const char *p, size_t n); | |
385 | +int bch_parse_uuid(const char *s, char *uuid); | |
386 | 386 | |
387 | -ssize_t snprint_string_list(char *buf, size_t size, const char * const list[], | |
387 | +ssize_t bch_snprint_string_list(char *buf, size_t size, const char * const list[], | |
388 | 388 | size_t selected); |
389 | 389 | |
390 | -ssize_t read_string_list(const char *buf, const char * const list[]); | |
390 | +ssize_t bch_read_string_list(const char *buf, const char * const list[]); | |
391 | 391 | |
392 | 392 | struct time_stats { |
393 | 393 | /* |
... | ... | @@ -400,7 +400,7 @@ |
400 | 400 | uint64_t last; |
401 | 401 | }; |
402 | 402 | |
403 | -void time_stats_update(struct time_stats *stats, uint64_t time); | |
403 | +void bch_time_stats_update(struct time_stats *stats, uint64_t time); | |
404 | 404 | |
405 | 405 | #define NSEC_PER_ns 1L |
406 | 406 | #define NSEC_PER_us NSEC_PER_USEC |
... | ... | @@ -462,7 +462,7 @@ |
462 | 462 | d->next = local_clock(); |
463 | 463 | } |
464 | 464 | |
465 | -unsigned next_delay(struct ratelimit *d, uint64_t done); | |
465 | +unsigned bch_next_delay(struct ratelimit *d, uint64_t done); | |
466 | 466 | |
467 | 467 | #define __DIV_SAFE(n, d, zero) \ |
468 | 468 | ({ \ |
469 | 469 | |
... | ... | @@ -568,9 +568,9 @@ |
568 | 568 | |
569 | 569 | #define bio_end(bio) ((bio)->bi_sector + bio_sectors(bio)) |
570 | 570 | |
571 | -void bio_map(struct bio *bio, void *base); | |
571 | +void bch_bio_map(struct bio *bio, void *base); | |
572 | 572 | |
573 | -int bio_alloc_pages(struct bio *bio, gfp_t gfp); | |
573 | +int bch_bio_alloc_pages(struct bio *bio, gfp_t gfp); | |
574 | 574 | |
575 | 575 | static inline sector_t bdev_sectors(struct block_device *bdev) |
576 | 576 | { |
... | ... | @@ -583,8 +583,8 @@ |
583 | 583 | bch_generic_make_request(bio, &(dev)->bio_split_hook); \ |
584 | 584 | } while (0) |
585 | 585 | |
586 | -uint64_t crc64_update(uint64_t, const void *, size_t); | |
587 | -uint64_t crc64(const void *, size_t); | |
586 | +uint64_t bch_crc64_update(uint64_t, const void *, size_t); | |
587 | +uint64_t bch_crc64(const void *, size_t); | |
588 | 588 | |
589 | 589 | #endif /* _BCACHE_UTIL_H */ |
drivers/md/bcache/writeback.c
... | ... | @@ -95,7 +95,7 @@ |
95 | 95 | !dc->writeback_percent) |
96 | 96 | return 0; |
97 | 97 | |
98 | - return next_delay(&dc->writeback_rate, sectors * 10000000ULL); | |
98 | + return bch_next_delay(&dc->writeback_rate, sectors * 10000000ULL); | |
99 | 99 | } |
100 | 100 | |
101 | 101 | /* Background writeback */ |
... | ... | @@ -118,7 +118,7 @@ |
118 | 118 | bio->bi_max_vecs = DIV_ROUND_UP(KEY_SIZE(&w->key), PAGE_SECTORS); |
119 | 119 | bio->bi_private = w; |
120 | 120 | bio->bi_io_vec = bio->bi_inline_vecs; |
121 | - bio_map(bio, NULL); | |
121 | + bch_bio_map(bio, NULL); | |
122 | 122 | } |
123 | 123 | |
124 | 124 | static void refill_dirty(struct closure *cl) |
... | ... | @@ -349,7 +349,7 @@ |
349 | 349 | io->bio.bi_rw = READ; |
350 | 350 | io->bio.bi_end_io = read_dirty_endio; |
351 | 351 | |
352 | - if (bio_alloc_pages(&io->bio, GFP_KERNEL)) | |
352 | + if (bch_bio_alloc_pages(&io->bio, GFP_KERNEL)) | |
353 | 353 | goto err_free; |
354 | 354 | |
355 | 355 | pr_debug("%s", pkey(&w->key)); |