This patch set introduce many conflicts while backporting mainline bcache patches, revert it temporarily.
Zheng Zengkai (8): Revert "bcache: always record start time of a sample" Revert "bcache: do not collect data insert info created by write_moving" Revert "bcache: Rewrite patch to delay to invalidate cache data" Revert "bcache: Add a sample of userspace prefetch client" Revert "bcache: Delay to invalidate cache data in writearound write" Revert "bcache: inflight prefetch requests block overlapped normal requests" Revert "bcache: provide a switch to bypass all IO requests" Revert "bcache: add a framework to perform prefetch"
Documentation/admin-guide/bcache.rst | 4 - drivers/md/bcache/Makefile | 2 +- drivers/md/bcache/acache.c | 586 --------------------------- drivers/md/bcache/acache.h | 79 ---- drivers/md/bcache/bcache.h | 3 - drivers/md/bcache/btree.c | 4 +- drivers/md/bcache/request.c | 161 +++----- drivers/md/bcache/request.h | 45 -- drivers/md/bcache/stats.c | 13 - drivers/md/bcache/stats.h | 3 - drivers/md/bcache/super.c | 6 - drivers/md/bcache/sysfs.c | 12 - include/trace/events/bcache.h | 22 - samples/acache_client/Makefile | 13 - samples/acache_client/connect.c | 144 ------- samples/acache_client/connect.h | 74 ---- samples/acache_client/main.c | 133 ------ 17 files changed, 59 insertions(+), 1245 deletions(-) delete mode 100644 drivers/md/bcache/acache.c delete mode 100644 drivers/md/bcache/acache.h delete mode 100644 samples/acache_client/Makefile delete mode 100644 samples/acache_client/connect.c delete mode 100644 samples/acache_client/connect.h delete mode 100644 samples/acache_client/main.c
euleros/rtos inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4LOJ6 CVE: NA
--------------------------------
This patch set introduce many conflicts while backporting mainline bcache patches, revert it temporarily.
This reverts commit 4c16a43925eb20c4e450fa57cea46fd47042eb36.
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/md/bcache/request.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index d0999a56bcae..66605e7dcc42 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -1252,13 +1252,14 @@ blk_qc_t cached_dev_submit_bio(struct bio *bio) } else { s->iop.bypass = check_should_bypass(dc, bio);
- s->smp.offset = bio->bi_iter.bi_sector - dc->sb.data_offset; - s->smp.length = bio->bi_iter.bi_size; - s->smp.type = rw; - s->smp.dev = dc->bdev->bd_dev; - s->smp.start_time = ktime_get_ns(); - if (!s->iop.bypass && bio->bi_iter.bi_size && !rw) + if (!s->iop.bypass && bio->bi_iter.bi_size && !rw) { + s->smp.offset = bio->bi_iter.bi_sector - dc->sb.data_offset; + s->smp.length = bio->bi_iter.bi_size; + s->smp.type = rw; + s->smp.dev = dc->bdev->bd_dev; + s->smp.start_time = ktime_get_ns(); save_circ_item(&s->smp); + }
if (rw) cached_dev_write(dc, s);
euleros/rtos inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4LOJ6 CVE: NA
--------------------------------
This patch set introduce many conflicts while backporting mainline bcache patches, revert it temporarily.
This reverts commit 6214e257723334168c1634bd34607b6fcd3f4f4f.
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/md/bcache/request.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 66605e7dcc42..bad70906e8a2 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -315,14 +315,12 @@ void bch_data_insert(struct closure *cl) trace_bcache_write(op->c, op->inode, op->bio, op->writeback, op->bypass);
- if (op->bio->bi_disk) { - msg.offset = op->bio->bi_iter.bi_sector; - msg.length = op->bio->bi_iter.bi_size; - msg.type = ACACHE_INFO_CACHE_INSERT; - msg.dev = bio_dev(op->bio); - msg.start_time = ktime_get_ns(); - save_circ_item(&msg); - } + msg.offset = op->bio->bi_iter.bi_sector; + msg.length = op->bio->bi_iter.bi_size; + msg.type = ACACHE_INFO_CACHE_INSERT; + msg.dev = bio_dev(op->bio); + msg.start_time = ktime_get_ns(); + save_circ_item(&msg);
bch_keylist_init(&op->insert_keys); bio_get(op->bio);
euleros/rtos inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4LOJ6 CVE: NA
--------------------------------
This patch set introduce many conflicts while backporting mainline bcache patches, revert it temporarily.
This reverts commit e8c75ee9914771ad5dcffaf4ff5716429440dfbc.
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/md/bcache/request.c | 15 ++++----------- drivers/md/bcache/request.h | 13 ------------- 2 files changed, 4 insertions(+), 24 deletions(-)
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index bad70906e8a2..04a779573fdd 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -735,8 +735,6 @@ struct search *search_alloc(struct bio *bio, /* Count on the bcache device */ s->start_time = part_start_io_acct(d->disk, &s->part, bio); s->prefetch = prefetch; - s->write_inval_data_putoff = false; - s->iop.c = d->c; s->iop.bio = NULL; s->iop.inode = d->id; @@ -757,10 +755,6 @@ static void cached_dev_bio_complete(struct closure *cl) struct search *s = container_of(cl, struct search, cl); struct cached_dev *dc = container_of(s->d, struct cached_dev, disk);
- /* eusure this lock is released after data_insert */ - if (s->write_inval_data_putoff) - up_read_non_owner(&dc->writeback_lock); - cached_dev_put(dc); search_free(cl); } @@ -999,10 +993,10 @@ static void cached_dev_write_complete(struct closure *cl) struct search *s = container_of(cl, struct search, cl); struct cached_dev *dc = container_of(s->d, struct cached_dev, disk);
- if (s->write_inval_data_putoff) + if (!s->iop.bypass) closure_call(&s->iop.cl, bch_data_insert, NULL, cl); - else - up_read_non_owner(&dc->writeback_lock); + + up_read_non_owner(&dc->writeback_lock); continue_at(cl, cached_dev_bio_complete, NULL); }
@@ -1054,7 +1048,6 @@ static void cached_dev_write(struct cached_dev *dc, struct search *s) bio->bi_end_io = backing_request_endio; closure_bio_submit(s->iop.c, bio, cl);
- s->write_inval_data_putoff = true; } else if (s->iop.writeback) { bch_writeback_add(dc); s->iop.bio = bio; @@ -1087,7 +1080,7 @@ static void cached_dev_write(struct cached_dev *dc, struct search *s) }
insert_data: - if (!s->write_inval_data_putoff) + if (!s->iop.bypass) closure_call(&s->iop.cl, bch_data_insert, NULL, cl); continue_at(cl, cached_dev_write_complete, NULL); } diff --git a/drivers/md/bcache/request.h b/drivers/md/bcache/request.h index 42bf280d4625..21678037d215 100644 --- a/drivers/md/bcache/request.h +++ b/drivers/md/bcache/request.h @@ -65,19 +65,6 @@ struct search { unsigned long start_time; /* for prefetch, we do not need copy data to bio */ bool prefetch; - /* - * The function bch_data_insert() is invoked asynchronously as the bio - * subbmited to backend block device, therefore there may be a read - * request subbmited after the bch_data_insert() done and ended before - * the backend bio is end. This read request will read data from the - * backend block device, and insert dirty data to cache device. However - * by writearound cache mode, bcache will not invalidate data again, - * so that read request after will read dirty data from the cache, - * causing a data corruption. - * So that we should put off this invalidation. This switch is for this - * put off. - */ - bool write_inval_data_putoff; struct list_head list_node; wait_queue_head_t wqh; struct acache_info smp;
euleros/rtos inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4LOJ6 CVE: NA
--------------------------------
This patch set introduce many conflicts while backporting mainline bcache patches, revert it temporarily.
This reverts commit 87f258f0f1983009fc04390ab9bb5b0657dc16eb.
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- samples/acache_client/Makefile | 13 --- samples/acache_client/connect.c | 144 -------------------------------- samples/acache_client/connect.h | 74 ---------------- samples/acache_client/main.c | 133 ----------------------------- 4 files changed, 364 deletions(-) delete mode 100644 samples/acache_client/Makefile delete mode 100644 samples/acache_client/connect.c delete mode 100644 samples/acache_client/connect.h delete mode 100644 samples/acache_client/main.c
diff --git a/samples/acache_client/Makefile b/samples/acache_client/Makefile deleted file mode 100644 index 13e5485b3d2f..000000000000 --- a/samples/acache_client/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -.PHONY: client clean - -CC = $(CROSS_COMPILE)gcc -CFLAGS = -Wall -g - - -OBJ = main.o connect.o -client: ${OBJ} - $(CC) $(CFLAGS) $^ -o acache_client -.c.o: - $(CC) $(CFLAGS) -c $< -o $@ -clean: - rm -f *.o acache_client diff --git a/samples/acache_client/connect.c b/samples/acache_client/connect.c deleted file mode 100644 index 2dd442415ee2..000000000000 --- a/samples/acache_client/connect.c +++ /dev/null @@ -1,144 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <fcntl.h> -#include <sys/mman.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <unistd.h> -#include <errno.h> - -#include "connect.h" - -static int ACACHE_READWRITE_CAPACITY = 4096; -static struct connection readwrite_conn; -static struct readwrite_conn_metadata { - int initialized; - int fd; -} private; - -void *initialize(struct connection *self) -{ - long ret; - - private.fd = open(acache_path, O_RDWR | O_SYNC); - if (private.fd == -1) { - fprintf(stderr, "error opening device: %s\n", strerror(errno)); - exit(-1); - } - - struct acache_metadata { - uint32_t magic; - uint32_t conntype; - uint32_t devsize; - } acache_metadata; -#define ACACHE_GET_METADATA _IOR('a', 1, struct acache_metadata) - ret = ioctl(private.fd, ACACHE_GET_METADATA, &acache_metadata); - if (ret) { - fprintf(stderr, "error getting device memory length: %s\n", strerror(errno)); - exit(-1); - } - if (acache_metadata.magic != ACACHE_MAGIC) { - fprintf(stderr, "version not match; client: %u kernel: %u\n", - ACACHE_MAGIC, acache_metadata.magic); - exit(-1); - } - if (acache_metadata.conntype != ACACHE_READWRITE_CONN) { - fprintf(stderr, "connect type not match; client: %u kernel: %u\n", - ACACHE_READWRITE_CONN, acache_metadata.conntype); - exit(-1); - } - printf("got dev size %u\n", acache_metadata.devsize); - private.initialized = 1; - - return (void *)&private; -} - -struct readwrite_conn_metadata* get_metadata(struct connection *self) -{ - struct readwrite_conn_metadata *metadata; - - if (self == NULL) { - fprintf(stderr, "connenction uninitailized\n"); - return NULL; - } - - metadata = (struct readwrite_conn_metadata *)self->private; - - if (metadata->initialized == 0) { - fprintf(stderr, "connenction uninitailized\n"); - return NULL; - } - return metadata; -} - -int send_items(struct connection *self, struct acache_info *infos, - size_t count) -{ - long ret; - struct readwrite_conn_metadata *metadata = get_metadata(self); - - if (!metadata) { - return 0; - } - ret = write(metadata->fd, (void*)infos, count * sizeof(struct acache_info)); - if (ret < 0) { - fprintf(stderr, "error writing data: %ld\n", ret); - return 0; - } - if (ret % sizeof(struct acache_info)) { - fprintf(stderr, "error writing data: data length is not multiple of sizeof(struct acache_info): %ld %ld\n", - ret, sizeof(struct acache_info)); - return 0; - } - return ret / sizeof(struct acache_info); -} - -int fetch_items(struct connection *self, struct acache_info *infos, - size_t count) -{ - long ret; - struct readwrite_conn_metadata *metadata = get_metadata(self); - - if (!metadata) { - return 0; - } - ret = read(metadata->fd, (void*)infos, count * sizeof(struct acache_info)); - if (ret < 0) { - fprintf(stderr, "error reading data: %ld\n", ret); - return 0; - } - if (ret % sizeof(struct acache_info)) { - fprintf(stderr, "error reading data: data length is not multiple of sizeof(struct acache_info): %ld %ld\n", - ret, sizeof(struct acache_info)); - return 0; - } - return ret / sizeof(struct acache_info); -} - -int get_capacity() { - return ACACHE_READWRITE_CAPACITY; -} - -int close_conn(struct connection *self) -{ - struct readwrite_conn_metadata *metadata = get_metadata(self); - - if (!metadata) { - return 0; - } - close(metadata->fd); - return 0; - -} - -struct connection *initialize_conn_rw(void) -{ - readwrite_conn.ops.close = close_conn; - readwrite_conn.ops.initialize = initialize; - readwrite_conn.ops.send_items = send_items; - readwrite_conn.ops.fetch_items = fetch_items; - readwrite_conn.ops.get_capacity = get_capacity; - readwrite_conn.private = initialize(&readwrite_conn); - return &readwrite_conn; -} diff --git a/samples/acache_client/connect.h b/samples/acache_client/connect.h deleted file mode 100644 index b0357c78c8c4..000000000000 --- a/samples/acache_client/connect.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef ACACHE_CONNENECT_H -#define ACACHE_CONNENECT_H -#include <stdint.h> - -#define ACACHE_MAGIC 2 -enum acache_conn_types { - ACACHE_NO_CONN = 0, - ACACHE_RINGBUFFER_CONN, - ACACHE_READWRITE_CONN, -}; -#define acache_path "/dev/acache" - -struct acache_info { - uint64_t length; - uint64_t offset; - uint64_t start_time; - uint32_t dev; - int opcode; -}; - -struct connection; -struct connection_operations { - - /* - * initialize connnection - * parameters: none - * return values: - * - void *: private data for connection - */ - void *(*initialize)(struct connection *self); - /* - * send_items send items to peer side - * parameters: - * - infos: data to send - * - count: data length - * return values: - * - number of sent items - */ - int (*send_items)(struct connection *self, struct acache_info *infos, - size_t count); - /* - * send_items recieve items from peer side - * paremeters: - * - infos: buffer to place recieved items - * - count: length of buffer - * return values: - * - number of recieved items - */ - int (*fetch_items)(struct connection *self, struct acache_info *infos, - size_t count); - /* - * close closes the connection - */ - int (*close)(struct connection *self); - - /* - * get_capacity return the capacity of items that can send and revice at once - */ - int (*get_capacity)(struct connection *self); - -}; - -struct connection { - /* - * private data for specific connnetion - */ - void *private; - struct connection_operations ops; -}; - -struct connection *initialize_conn_rw(void); - -#endif - diff --git a/samples/acache_client/main.c b/samples/acache_client/main.c deleted file mode 100644 index 929c70798cfb..000000000000 --- a/samples/acache_client/main.c +++ /dev/null @@ -1,133 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <fcntl.h> -#include <sys/mman.h> -#include <sys/stat.h> -#include <signal.h> -#include <unistd.h> -#include <errno.h> - -#include "connect.h" - -/* - * dev_t in userspace is 8-bytes long but 4-byte long in kernel - * work around this - */ -#define MINORBITS 20 -#define MINORMASK ((1U << MINORBITS) - 1) -#define MKDEV(ma, mi) ((ma)<<MINORBITS | (mi)) -#define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS)) -#define MINOR(dev) ((unsigned int) ((dev) & MINORMASK)) - -struct acache_info *inbuf, *outbuf; -struct connection *conn; - -void print_infos(const char *prefix, struct acache_info *infos, size_t length) -{ - size_t i; - struct acache_info *info; - - for (i = 0; i < length; i++) { - info = infos + i; - - printf("%4s,%20lu,%8u,%8u,%15lu,%12lu\n", - prefix, info->start_time, MAJOR(info->dev), - MINOR(info->dev), info->offset, info->length); - } -} - -int malloc_buffers(struct acache_info **inbuf, struct acache_info **outbuf, - size_t capacity) -{ - /* prepare buffers to store incoming or outgoing items */ - *inbuf = (struct acache_info *)malloc(sizeof(struct acache_info) * capacity); - *outbuf = (struct acache_info *)malloc(sizeof(struct acache_info) * capacity); - - if (!*inbuf || !*outbuf) { - fprintf(stderr, "error malloc memory: %s\n, size: %lu, %lu\n", - strerror(errno), - sizeof(struct acache_info) * capacity, - sizeof(struct acache_info) * capacity); - return -errno; - } - return 0; -} - -void free_buffer(struct acache_info **buf) -{ - if (buf && *buf) { - free(*buf); - *buf = NULL; - } -} - -void elegant_exit(int sig) { - printf("exiting..."); - free_buffer(&inbuf); - free_buffer(&outbuf); - conn->ops.close(conn); - exit(0); -} - -int main(int argc, char **argv) -{ - int debug = 0; - int ret; - int outbuf_tail; - size_t capacity; - - conn = initialize_conn_rw(); - - if (conn == NULL) { - fprintf(stderr, "error initialzied connnection\n"); - return -1; - } - - if (argc > 1 && strcmp("-d", argv[1]) == 0) - debug = 1; - - /* prepare buffers to store incoming or outgoing items */ - capacity = conn->ops.get_capacity(conn); - ret = malloc_buffers(&inbuf, &outbuf, capacity); - - if (ret < 0) - return ret; - - if (debug) { - printf("%4s,%20s,%8s,%8s,%15s,%12s\n", - "op","time(ns)","majorDev","minorDev","offset(B)","length(B)"); - } - /* main loop */ - if (signal(SIGINT, elegant_exit) == SIG_ERR) { - fprintf(stderr, "error handling SIGINT: %s\n", strerror(errno)); - } - if (signal(SIGTERM, elegant_exit) == SIG_ERR) { - fprintf(stderr, "error handling SIGTERM: %s\n", strerror(errno)); - } - while (1) { - unsigned int i, inlen; - - inlen = conn->ops.fetch_items(conn, inbuf, capacity); - if (!inlen) { - usleep(100); - continue; - } - - outbuf_tail = 0; - for (i = 0; i < inlen; i++) { - /* customize prefetch strategy here */ - memcpy(outbuf + outbuf_tail, inbuf + i, sizeof(struct acache_info)); - outbuf[outbuf_tail].offset += outbuf[outbuf_tail].length >> 9; - outbuf_tail++; - } - if (debug) { - print_infos("R", inbuf, inlen); - print_infos("P", outbuf, outbuf_tail); - } - if (outbuf_tail) { - conn->ops.send_items(conn, outbuf, outbuf_tail); - } - } - return 0; -}
euleros/rtos inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4LOJ6 CVE: NA
--------------------------------
This patch set introduce many conflicts while backporting mainline bcache patches, revert it temporarily.
This reverts commit 1751c6ad813499c5f5cd2e0c36c27329b8203366.
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/md/bcache/request.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 04a779573fdd..fd381da32464 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -993,11 +993,8 @@ static void cached_dev_write_complete(struct closure *cl) struct search *s = container_of(cl, struct search, cl); struct cached_dev *dc = container_of(s->d, struct cached_dev, disk);
- if (!s->iop.bypass) - closure_call(&s->iop.cl, bch_data_insert, NULL, cl); - up_read_non_owner(&dc->writeback_lock); - continue_at(cl, cached_dev_bio_complete, NULL); + cached_dev_bio_complete(cl); }
static void cached_dev_write(struct cached_dev *dc, struct search *s) @@ -1080,8 +1077,7 @@ static void cached_dev_write(struct cached_dev *dc, struct search *s) }
insert_data: - if (!s->iop.bypass) - closure_call(&s->iop.cl, bch_data_insert, NULL, cl); + closure_call(&s->iop.cl, bch_data_insert, NULL, cl); continue_at(cl, cached_dev_write_complete, NULL); }
euleros/rtos inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4LOJ6 CVE: NA
--------------------------------
This patch set introduce many conflicts while backporting mainline bcache patches, revert it temporarily.
This reverts commit 08a3ac0e611200cfab035bfd6a8f3f5856b61af7.
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/md/bcache/acache.c | 113 ---------------------------------- drivers/md/bcache/acache.h | 10 --- drivers/md/bcache/bcache.h | 1 - drivers/md/bcache/request.c | 8 --- drivers/md/bcache/stats.c | 13 ---- drivers/md/bcache/stats.h | 3 - drivers/md/bcache/super.c | 1 - drivers/md/bcache/sysfs.c | 6 -- include/trace/events/bcache.h | 11 ---- 9 files changed, 166 deletions(-)
diff --git a/drivers/md/bcache/acache.c b/drivers/md/bcache/acache.c index a3f5c4f1ba7c..ff3e120d9619 100644 --- a/drivers/md/bcache/acache.c +++ b/drivers/md/bcache/acache.c @@ -31,12 +31,6 @@ int acache_prefetch_workers = 1000; module_param_named(prefetch_workers, acache_prefetch_workers, int, 0444); MODULE_PARM_DESC(prefetch_workers, "num of workers for processing prefetch requests");
-struct inflight_list_head { - struct list_head entry; - spinlock_t io_lock; - bool initialized; -}; - struct prefetch_worker { struct acache_info s; struct work_struct work; @@ -56,8 +50,6 @@ struct acache_device {
struct acache_circ *acache_info_circ;
- struct inflight_list_head inflight_list; - struct workqueue_struct *wq; struct prefetch_worker *prefetch_workers; struct list_head prefetch_workers_free; @@ -303,7 +295,6 @@ int acache_dev_init(void) int major; struct device *dev;
- inflight_list_ops.init(); major = alloc_chrdev_region(&adev.devno, 0, ACACHE_NR_DEVS, DEV_NAME); if (major < 0) { pr_err("failed to allocate chrdev region: %d\n", major); @@ -386,7 +377,6 @@ int acache_dev_init(void) fail_class: unregister_chrdev_region(adev.devno, ACACHE_NR_DEVS); fail_allocdev: - inflight_list_ops.exit(); return ret; }
@@ -405,112 +395,9 @@ void acache_dev_exit(void) kfree(adev.mem_regionp); unregister_chrdev_region(adev.devno, ACACHE_NR_DEVS); class_destroy(adev.class); - inflight_list_ops.exit(); kfree(adev.prefetch_workers); }
-static struct search *__inflight_list_lookup_locked(struct search *s) -{ - struct search *iter; - struct bio *bio, *sbio; - - if (!adev.inflight_list.initialized) - return NULL; - sbio = &s->bio.bio; - list_for_each_entry(iter, &adev.inflight_list.entry, list_node) { - bio = &iter->bio.bio; - if (sbio->bi_disk == bio->bi_disk && - sbio->bi_iter.bi_sector < bio_end_sector(bio) && - bio_end_sector(sbio) > bio->bi_iter.bi_sector) { - return iter; - } - } - return NULL; -} - -static void inflight_list_init(void) -{ - INIT_LIST_HEAD(&adev.inflight_list.entry); - spin_lock_init(&adev.inflight_list.io_lock); - adev.inflight_list.initialized = true; -} - -static void inflight_list_exit(void) -{ - if (!list_empty(&adev.inflight_list.entry)) - pr_err("existing with inflight list not empty\n"); -} - -static int inflight_list_insert(struct search *s) -{ - if (!adev.inflight_list.initialized) - return -1; - - init_waitqueue_head(&s->wqh); - spin_lock(&adev.inflight_list.io_lock); - list_add_tail(&s->list_node, &adev.inflight_list.entry); - spin_unlock(&adev.inflight_list.io_lock); - - trace_bcache_inflight_list_insert(s->d, s->orig_bio); - return 0; -} - -static int inflight_list_remove(struct search *s) -{ - if (!adev.inflight_list.initialized) - return -1; - - spin_lock(&adev.inflight_list.io_lock); - list_del_init(&s->list_node); - spin_unlock(&adev.inflight_list.io_lock); - - wake_up_interruptible_all(&s->wqh); - - trace_bcache_inflight_list_remove(s->d, s->orig_bio); - return 0; -} - -static bool inflight_list_wait(struct search *s) -{ - struct search *pfs = NULL; - struct cached_dev *dc; - DEFINE_WAIT(wqe); - - if (!adev.inflight_list.initialized) - return false; - - spin_lock(&adev.inflight_list.io_lock); - pfs = __inflight_list_lookup_locked(s); - if (pfs == NULL) { - spin_unlock(&adev.inflight_list.io_lock); - return false; - } - - dc = container_of(pfs->d, struct cached_dev, disk); - if (!dc->inflight_block_enable) { - spin_unlock(&adev.inflight_list.io_lock); - return true; - } - - prepare_to_wait(&pfs->wqh, &wqe, TASK_INTERRUPTIBLE); - - /* unlock here to ensure pfs not changed. */ - spin_unlock(&adev.inflight_list.io_lock); - schedule(); - - finish_wait(&pfs->wqh, &wqe); - - return true; -} - -const struct inflight_queue_ops inflight_list_ops = { - .init = inflight_list_init, - .exit = inflight_list_exit, - .insert = inflight_list_insert, - .remove = inflight_list_remove, - .wait = inflight_list_wait, -}; - struct cached_dev *get_cached_device_by_dev(dev_t dev) { struct cache_set *c, *tc; diff --git a/drivers/md/bcache/acache.h b/drivers/md/bcache/acache.h index 3c6453d0c4da..dea6e8cb0a05 100644 --- a/drivers/md/bcache/acache.h +++ b/drivers/md/bcache/acache.h @@ -66,14 +66,4 @@ void acache_dev_exit(void); struct acache_info *fetch_circ_item(struct acache_circ *circ); void save_circ_item(struct acache_info *data);
-struct inflight_queue_ops { - void (*init)(void); - void (*exit)(void); - - int (*insert)(struct search *s); - int (*remove)(struct search *s); - bool (*wait)(struct search *s); -}; -extern const struct inflight_queue_ops inflight_list_ops; - #endif diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 53e07c958924..8b10bd5df364 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -376,7 +376,6 @@ struct cached_dev { unsigned char writeback_percent; unsigned int writeback_delay;
- unsigned int inflight_block_enable; unsigned int read_bypass;
uint64_t writeback_rate_target; diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index fd381da32464..2e9ff76b877b 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -706,9 +706,6 @@ void search_free(struct closure *cl) if (s->iop.bio) bio_put(s->iop.bio);
- if (s->prefetch) - inflight_list_ops.remove(s); - bio_complete(s); closure_debug_destroy(cl); mempool_free(s, &s->iop.c->search); @@ -977,11 +974,6 @@ void cached_dev_read(struct cached_dev *dc, struct search *s) { struct closure *cl = &s->cl;
- if (s->prefetch) - inflight_list_ops.insert(s); - else if (inflight_list_ops.wait(s)) - bch_mark_cache_prefetch_fake_hit(s->iop.c, s->d); - closure_call(&s->iop.cl, cache_lookup, NULL, cl); continue_at(cl, cached_dev_read_done_bh, NULL); } diff --git a/drivers/md/bcache/stats.c b/drivers/md/bcache/stats.c index c7a6c93aa9e9..503aafe188dc 100644 --- a/drivers/md/bcache/stats.c +++ b/drivers/md/bcache/stats.c @@ -48,7 +48,6 @@ read_attribute(cache_bypass_misses); read_attribute(cache_hit_ratio); read_attribute(cache_readaheads); read_attribute(cache_miss_collisions); -read_attribute(cache_prefetch_fake_hits); read_attribute(bypassed);
SHOW(bch_stats) @@ -67,7 +66,6 @@ SHOW(bch_stats)
var_print(cache_readaheads); var_print(cache_miss_collisions); - var_print(cache_prefetch_fake_hits); sysfs_hprint(bypassed, var(sectors_bypassed) << 9); #undef var return 0; @@ -90,7 +88,6 @@ static struct attribute *bch_stats_files[] = { &sysfs_cache_hit_ratio, &sysfs_cache_readaheads, &sysfs_cache_miss_collisions, - &sysfs_cache_prefetch_fake_hits, &sysfs_bypassed, NULL }; @@ -150,7 +147,6 @@ static void scale_stats(struct cache_stats *stats, unsigned long rescale_at) scale_stat(&stats->cache_bypass_misses); scale_stat(&stats->cache_readaheads); scale_stat(&stats->cache_miss_collisions); - scale_stat(&stats->cache_prefetch_fake_hits); scale_stat(&stats->sectors_bypassed); } } @@ -174,7 +170,6 @@ static void scale_accounting(struct timer_list *t) move_stat(cache_bypass_misses); move_stat(cache_readaheads); move_stat(cache_miss_collisions); - move_stat(cache_prefetch_fake_hits); move_stat(sectors_bypassed);
scale_stats(&acc->total, 0); @@ -230,14 +225,6 @@ void bch_mark_cache_miss_collision(struct cache_set *c, struct bcache_device *d) atomic_inc(&c->accounting.collector.cache_miss_collisions); }
-void bch_mark_cache_prefetch_fake_hit(struct cache_set *c, struct bcache_device *d) -{ - struct cached_dev *dc = container_of(d, struct cached_dev, disk); - - atomic_inc(&dc->accounting.collector.cache_prefetch_fake_hits); - atomic_inc(&c->accounting.collector.cache_prefetch_fake_hits); -} - void bch_mark_sectors_bypassed(struct cache_set *c, struct cached_dev *dc, int sectors) { diff --git a/drivers/md/bcache/stats.h b/drivers/md/bcache/stats.h index 302b76e982b4..abfaabf7e7fc 100644 --- a/drivers/md/bcache/stats.h +++ b/drivers/md/bcache/stats.h @@ -9,7 +9,6 @@ struct cache_stat_collector { atomic_t cache_bypass_misses; atomic_t cache_readaheads; atomic_t cache_miss_collisions; - atomic_t cache_prefetch_fake_hits; atomic_t sectors_bypassed; };
@@ -22,7 +21,6 @@ struct cache_stats { unsigned long cache_bypass_misses; unsigned long cache_readaheads; unsigned long cache_miss_collisions; - unsigned long cache_prefetch_fake_hits; unsigned long sectors_bypassed;
unsigned int rescale; @@ -60,7 +58,6 @@ void bch_mark_cache_accounting(struct cache_set *c, struct bcache_device *d, void bch_mark_cache_readahead(struct cache_set *c, struct bcache_device *d); void bch_mark_cache_miss_collision(struct cache_set *c, struct bcache_device *d); -void bch_mark_cache_prefetch_fake_hit(struct cache_set *c, struct bcache_device *d); void bch_mark_sectors_bypassed(struct cache_set *c, struct cached_dev *dc, int sectors); diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 38afb2a58f14..e96174ca10d1 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1439,7 +1439,6 @@ static int cached_dev_init(struct cached_dev *dc, unsigned int block_size) bch_cache_accounting_init(&dc->accounting, &dc->disk.cl);
dc->sequential_cutoff = 4 << 20; - dc->inflight_block_enable = 1; dc->read_bypass = 0;
for (io = dc->io; io < dc->io + RECENT_IO; io++) { diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index 515539520428..39c1e7a544e5 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -109,7 +109,6 @@ rw_attribute(congested_write_threshold_us);
rw_attribute(sequential_cutoff); rw_attribute(read_bypass); -rw_attribute(inflight_block_enable); rw_attribute(data_csum); rw_attribute(cache_mode); rw_attribute(readahead_cache_policy); @@ -254,7 +253,6 @@ SHOW(__bch_cached_dev) var_printf(partial_stripes_expensive, "%u");
var_hprint(sequential_cutoff); - var_print(inflight_block_enable); var_print(read_bypass); var_hprint(readahead);
@@ -353,9 +351,6 @@ STORE(__cached_dev) sysfs_strtoul_clamp(read_bypass, dc->read_bypass, 0, 1); - sysfs_strtoul_clamp(inflight_block_enable, - dc->inflight_block_enable, - 0, 1); d_strtoi_h(readahead);
if (attr == &sysfs_clear_stats) @@ -522,7 +517,6 @@ static struct attribute *bch_cached_dev_files[] = { &sysfs_partial_stripes_expensive, &sysfs_sequential_cutoff, &sysfs_read_bypass, - &sysfs_inflight_block_enable, &sysfs_clear_stats, &sysfs_running, &sysfs_state, diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h index 38986cdf52cc..f7be8c6e7cff 100644 --- a/include/trace/events/bcache.h +++ b/include/trace/events/bcache.h @@ -81,17 +81,6 @@ DEFINE_EVENT(bcache_request, bcache_prefetch_request, TP_ARGS(d, bio) );
-/* interface.c */ -DEFINE_EVENT(bcache_request, bcache_inflight_list_insert, - TP_PROTO(struct bcache_device *d, struct bio *bio), - TP_ARGS(d, bio) -); - -DEFINE_EVENT(bcache_request, bcache_inflight_list_remove, - TP_PROTO(struct bcache_device *d, struct bio *bio), - TP_ARGS(d, bio) -); - /* request.c */
DEFINE_EVENT(bcache_request, bcache_request_start,
euleros/rtos inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4LOJ6 CVE: NA
--------------------------------
This patch set introduce many conflicts while backporting mainline bcache patches, revert it temporarily.
This reverts commit 30dc9d9c91a1bd4520265a7def8f212fcabc89b3.
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- Documentation/admin-guide/bcache.rst | 4 ---- drivers/md/bcache/bcache.h | 2 -- drivers/md/bcache/request.c | 6 ++---- drivers/md/bcache/super.c | 1 - drivers/md/bcache/sysfs.c | 6 ------ 5 files changed, 2 insertions(+), 17 deletions(-)
diff --git a/Documentation/admin-guide/bcache.rst b/Documentation/admin-guide/bcache.rst index c75aebf5821a..8d3a2d045c0a 100644 --- a/Documentation/admin-guide/bcache.rst +++ b/Documentation/admin-guide/bcache.rst @@ -441,10 +441,6 @@ sequential_cutoff most recent 128 IOs are tracked so sequential IO can be detected even when it isn't all done at once.
-read_bypass - If enbale, all IO will bypass the cache. This option could be useful when we - enable userspace prefetch and the cache device is low capacity. - sequential_merge If non zero, bcache keeps a list of the last 128 requests submitted to compare against all new requests to determine which new requests are sequential diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h index 8b10bd5df364..e8bf4f752e8b 100644 --- a/drivers/md/bcache/bcache.h +++ b/drivers/md/bcache/bcache.h @@ -376,8 +376,6 @@ struct cached_dev { unsigned char writeback_percent; unsigned int writeback_delay;
- unsigned int read_bypass; - uint64_t writeback_rate_target; int64_t writeback_rate_proportional; int64_t writeback_rate_integral; diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 2e9ff76b877b..5a64afd56b97 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -852,7 +852,7 @@ static void cached_dev_read_done(struct closure *cl) if (!s->prefetch) bio_complete(s);
- if (s->iop.bio && (!dc->read_bypass || s->prefetch) && + if (s->iop.bio && !test_bit(CACHE_SET_STOPPING, &s->iop.c->flags)) { BUG_ON(!s->iop.replace); closure_call(&s->iop.cl, bch_data_insert, NULL, cl); @@ -897,14 +897,12 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s,
s->cache_missed = 1;
- if (s->cache_miss || s->iop.bypass || - (dc->read_bypass && !s->prefetch)) { + if (s->cache_miss || s->iop.bypass) { miss = bio_next_split(bio, sectors, GFP_NOIO, &s->d->bio_split); ret = miss == bio ? MAP_DONE : MAP_CONTINUE; goto out_submit; }
- /* if called form do_readahead, no need to do this */ if (!(bio->bi_opf & REQ_RAHEAD) && !(bio->bi_opf & (REQ_META|REQ_PRIO) ) && s->iop.c->gc_stats.in_use < CUTOFF_CACHE_READA && diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index e96174ca10d1..a849fc51cd88 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -1439,7 +1439,6 @@ static int cached_dev_init(struct cached_dev *dc, unsigned int block_size) bch_cache_accounting_init(&dc->accounting, &dc->disk.cl);
dc->sequential_cutoff = 4 << 20; - dc->read_bypass = 0;
for (io = dc->io; io < dc->io + RECENT_IO; io++) { list_add(&io->lru, &dc->io_lru); diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c index 39c1e7a544e5..554e3afc9b68 100644 --- a/drivers/md/bcache/sysfs.c +++ b/drivers/md/bcache/sysfs.c @@ -108,7 +108,6 @@ rw_attribute(congested_read_threshold_us); rw_attribute(congested_write_threshold_us);
rw_attribute(sequential_cutoff); -rw_attribute(read_bypass); rw_attribute(data_csum); rw_attribute(cache_mode); rw_attribute(readahead_cache_policy); @@ -253,7 +252,6 @@ SHOW(__bch_cached_dev) var_printf(partial_stripes_expensive, "%u");
var_hprint(sequential_cutoff); - var_print(read_bypass); var_hprint(readahead);
sysfs_print(running, atomic_read(&dc->running)); @@ -348,9 +346,6 @@ STORE(__cached_dev) sysfs_strtoul_clamp(sequential_cutoff, dc->sequential_cutoff, 0, UINT_MAX); - sysfs_strtoul_clamp(read_bypass, - dc->read_bypass, - 0, 1); d_strtoi_h(readahead);
if (attr == &sysfs_clear_stats) @@ -516,7 +511,6 @@ static struct attribute *bch_cached_dev_files[] = { &sysfs_stripe_size, &sysfs_partial_stripes_expensive, &sysfs_sequential_cutoff, - &sysfs_read_bypass, &sysfs_clear_stats, &sysfs_running, &sysfs_state,
euleros/rtos inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4LOJ6 CVE: NA
--------------------------------
This patch set introduce many conflicts while backporting mainline bcache patches, revert it temporarily.
This reverts commit a460ae1132037a0d811f00fef2589f349ec92cdd.
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/md/bcache/Makefile | 2 +- drivers/md/bcache/acache.c | 473 ---------------------------------- drivers/md/bcache/acache.h | 69 ----- drivers/md/bcache/btree.c | 4 +- drivers/md/bcache/request.c | 129 ++++------ drivers/md/bcache/request.h | 32 --- drivers/md/bcache/super.c | 4 - include/trace/events/bcache.h | 11 - 8 files changed, 54 insertions(+), 670 deletions(-) delete mode 100644 drivers/md/bcache/acache.c delete mode 100644 drivers/md/bcache/acache.h
diff --git a/drivers/md/bcache/Makefile b/drivers/md/bcache/Makefile index 28f5294dd6cf..5b87e59676b8 100644 --- a/drivers/md/bcache/Makefile +++ b/drivers/md/bcache/Makefile @@ -3,5 +3,5 @@ obj-$(CONFIG_BCACHE) += bcache.o
bcache-y := alloc.o bset.o btree.o closure.o debug.o extents.o\ - io.o journal.o movinggc.o request.o stats.o acache.o super.o sysfs.o trace.o\ + io.o journal.o movinggc.o request.o stats.o super.o sysfs.o trace.o\ util.o writeback.o features.o diff --git a/drivers/md/bcache/acache.c b/drivers/md/bcache/acache.c deleted file mode 100644 index ff3e120d9619..000000000000 --- a/drivers/md/bcache/acache.c +++ /dev/null @@ -1,473 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#include "acache.h" -#include "request.h" - -#include <linux/module.h> -#include <linux/types.h> -#include <linux/fs.h> -#include <linux/errno.h> -#include <linux/mm.h> -#include <linux/sched.h> -#include <linux/init.h> -#include <linux/cdev.h> -#include <linux/io.h> -#include <linux/slab.h> -#include <linux/uaccess.h> -#include <linux/circ_buf.h> -#include <linux/list.h> - -#include <trace/events/bcache.h> - -#define DEV_NAME "acache" - -int acache_dev_size = (1024 * 4096 + 4096); - -module_param_named(acache_size, acache_dev_size, int, 0444); -MODULE_PARM_DESC(acache_size, "size of ring buffer for size in byte"); - -int acache_prefetch_workers = 1000; - -module_param_named(prefetch_workers, acache_prefetch_workers, int, 0444); -MODULE_PARM_DESC(prefetch_workers, "num of workers for processing prefetch requests"); - -struct prefetch_worker { - struct acache_info s; - struct work_struct work; - struct list_head list; -}; - -struct acache_device { - bool initialized; - - dev_t devno; - struct cdev cdev; - struct class *class; - struct mem_reg *mem_regionp; - - struct acache_info *readbuf; - struct acache_info *writebuf; - - struct acache_circ *acache_info_circ; - - struct workqueue_struct *wq; - struct prefetch_worker *prefetch_workers; - struct list_head prefetch_workers_free; - spinlock_t prefetch_workers_free_list_lock; -} adev; - -#define MAX_TRANSFER_SIZE (1024 * 1024) - -static atomic_t acache_opened_dev = ATOMIC_INIT(0); -static struct acache_metadata metadata; - - -int acache_open(struct inode *inode, struct file *filp) -{ - struct mem_reg *dev; - - int minor = MINOR(inode->i_rdev); - - if (minor >= ACACHE_NR_DEVS) - return -ENODEV; - if (atomic_xchg(&acache_opened_dev, 1)) - return -EPERM; - - dev = &adev.mem_regionp[minor]; - - filp->private_data = dev; - - return 0; -} - -int acache_release(struct inode *inode, struct file *filp) -{ - atomic_dec(&acache_opened_dev); - return 0; -} - -ssize_t read_circ_slice(struct acache_circ *circ, struct acache_info *buf, - size_t size) -{ - unsigned long first, todo, flags; - - spin_lock_irqsave(&circ->lock, flags); - - todo = CIRC_CNT(circ->head, circ->tail, circ->size); - if (todo == 0) { - spin_unlock_irqrestore(&circ->lock, flags); - return 0; - } - if (todo > size / sizeof(struct acache_info)) - todo = size / sizeof(struct acache_info); - - first = CIRC_CNT_TO_END(circ->head, circ->tail, circ->size); - if (first > todo) - first = todo; - - memcpy(buf, circ->data + circ->tail, first * sizeof(struct acache_info)); - if (first < todo) - memcpy(buf + first, circ->data, - (todo - first) * sizeof(struct acache_info)); - circ->tail = (circ->tail + todo) & (circ->size - 1); - - spin_unlock_irqrestore(&circ->lock, flags); - return todo * sizeof(struct acache_info); -} - -static ssize_t acache_read(struct file *filp, char __user *buf, - size_t size, loff_t *ppos) -{ - long ret, cut; - - if (metadata.conntype != ACACHE_READWRITE_CONN) - return -EINVAL; - - if (size > MAX_TRANSFER_SIZE) - size = MAX_TRANSFER_SIZE; - - ret = read_circ_slice(adev.acache_info_circ, adev.readbuf, size); - if (ret <= 0) - return ret; - - cut = copy_to_user(buf, adev.readbuf, size); - return ret - cut; -} - -int process_one_request(struct acache_info *item); -static void prefetch_worker_func(struct work_struct *work) -{ - struct prefetch_worker *sw = - container_of(work, struct prefetch_worker, work); - - process_one_request(&sw->s); - spin_lock(&adev.prefetch_workers_free_list_lock); - list_add_tail(&sw->list, &adev.prefetch_workers_free); - spin_unlock(&adev.prefetch_workers_free_list_lock); -} - -static int queue_prefetch_item(struct acache_info *s) -{ - struct prefetch_worker *sw; - - spin_lock(&adev.prefetch_workers_free_list_lock); - sw = list_first_entry_or_null(&adev.prefetch_workers_free, - struct prefetch_worker, list); - if (!sw) { - spin_unlock(&adev.prefetch_workers_free_list_lock); - return -1; - } - list_del_init(&sw->list); - spin_unlock(&adev.prefetch_workers_free_list_lock); - - memcpy(&sw->s, s, sizeof(struct acache_info)); - INIT_WORK(&sw->work, prefetch_worker_func); - queue_work(adev.wq, &sw->work); - return 0; -} - -static ssize_t acache_write(struct file *filp, const char __user *buf, - size_t size, loff_t *ppos) -{ - long cut; - int i; - - if (metadata.conntype != ACACHE_READWRITE_CONN) - return -EINVAL; - - if (size > MAX_TRANSFER_SIZE) - size = MAX_TRANSFER_SIZE; - - cut = copy_from_user(adev.writebuf, buf, size); - for (i = 0; i < (size - cut) / sizeof(struct acache_info); i++) { - if (queue_prefetch_item(adev.writebuf + i)) - break; - } - return i * sizeof(struct acache_info); -} - -static long acache_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) -{ - switch (cmd) { - case ACACHE_GET_METADATA: - return copy_to_user((struct acache_metadata __user *)arg, - &metadata, sizeof(struct acache_metadata)); - default: - return -EINVAL; - } -} - -static const struct file_operations acache_fops = { - .owner = THIS_MODULE, - .read = acache_read, - .write = acache_write, - .open = acache_open, - .release = acache_release, - .unlocked_ioctl = acache_ioctl, -}; - -void save_circ_item(struct acache_info *data) -{ - unsigned long flags; - struct acache_circ *circ = adev.acache_info_circ; - - spin_lock_irqsave(&circ->lock, flags); - if (CIRC_SPACE(circ->head, circ->tail, circ->size) >= 1) { - memcpy(&circ->data[circ->head], data, sizeof(struct acache_info)); - circ->head = (circ->head + 1) & (circ->size - 1); - } else { - pr_debug("ringbuffer is full; discard new request.\n"); - } - spin_unlock_irqrestore(&circ->lock, flags); -} - -void init_acache_circ(struct acache_circ **circ, void *startaddr) -{ - *circ = (struct acache_circ *)startaddr; - (*circ)->head = 0; - (*circ)->tail = 0; - (*circ)->size = ACACHE_CIRC_SIZE; - spin_lock_init(&(*circ)->lock); -} - -static void acache_free_mem(void) -{ - int i; - - for (i = 0; i < ACACHE_NR_DEVS; i++) - vfree(adev.mem_regionp[i].data); - - if (adev.readbuf) { - vfree(adev.readbuf); - adev.readbuf = NULL; - } - if (adev.writebuf) { - vfree(adev.writebuf); - adev.writebuf = NULL; - } - - kfree(adev.prefetch_workers); - adev.prefetch_workers = NULL; -} - -int acache_prefetch_init(struct acache_device *adev) -{ - int i; - - if (acache_prefetch_workers <= 0) { - pr_err("acache_dev_size should not be less than zero\n"); - return -1; - } - adev->prefetch_workers = kmalloc_array(acache_prefetch_workers, - sizeof(struct prefetch_worker), - GFP_KERNEL); - if (!adev->prefetch_workers) - goto fail_prefetch_workers_alloc; - - INIT_LIST_HEAD(&adev->prefetch_workers_free); - spin_lock_init(&adev->prefetch_workers_free_list_lock); - for (i = 0; i < acache_prefetch_workers; i++) { - spin_lock(&adev->prefetch_workers_free_list_lock); - list_add_tail(&adev->prefetch_workers[i].list, - &adev->prefetch_workers_free); - spin_unlock(&adev->prefetch_workers_free_list_lock); - } - - adev->wq = alloc_workqueue("acache_prefetch", WQ_MEM_RECLAIM, 0); - if (!adev->wq) - goto fail_workqueue_alloc; - - return 0; - -fail_workqueue_alloc: - kfree(adev->prefetch_workers); - adev->prefetch_workers = NULL; -fail_prefetch_workers_alloc: - if (adev->wq) - destroy_workqueue(adev->wq); - return -1; -} - -int acache_dev_init(void) -{ - int ret; - int i; - int major; - struct device *dev; - - major = alloc_chrdev_region(&adev.devno, 0, ACACHE_NR_DEVS, DEV_NAME); - if (major < 0) { - pr_err("failed to allocate chrdev region: %d\n", major); - return major; - goto fail_allocdev; - } - - adev.class = class_create(THIS_MODULE, DEV_NAME); - if (IS_ERR(adev.class)) { - pr_err("failed to create acache class\n"); - ret = -1; - goto fail_class; - } - - if (acache_dev_size < PAGE_SIZE) { - pr_err("acache_dev_size should not be less than PAGE_SIZE\n"); - ret = -1; - goto fail_dev_add; - } - metadata.devsize = acache_dev_size; - metadata.magic = ACACHE_MAGIC; - metadata.conntype = ACACHE_READWRITE_CONN; - cdev_init(&adev.cdev, &acache_fops); - adev.cdev.owner = THIS_MODULE; - - ret = cdev_add(&adev.cdev, adev.devno, ACACHE_NR_DEVS); - if (ret < 0) { - pr_err("failed to add cdev\n"); - goto fail_dev_add; - } - - dev = device_create(adev.class, NULL, adev.devno, NULL, DEV_NAME); - if (IS_ERR(dev)) { - pr_err("Could not create device\n"); - ret = -1; - goto fail_device; - } - - adev.readbuf = vmalloc(MAX_TRANSFER_SIZE); - adev.writebuf = vmalloc(MAX_TRANSFER_SIZE); - if (!adev.readbuf || !adev.writebuf) { - ret = -ENOMEM; - goto fail_malloc; - } - - adev.initialized = true; - adev.mem_regionp = - kmalloc_array(ACACHE_NR_DEVS, sizeof(struct mem_reg), GFP_KERNEL); - if (!adev.mem_regionp) { - ret = -ENOMEM; - goto fail_malloc; - } - memset(adev.mem_regionp, 0, sizeof(struct mem_reg) * ACACHE_NR_DEVS); - - for (i = 0; i < ACACHE_NR_DEVS; i++) { - adev.mem_regionp[i].size = ACACHE_DEV_SIZE; - adev.mem_regionp[i].data = vmalloc(ACACHE_DEV_SIZE); - if (!adev.mem_regionp[i].data) { - ret = -ENOMEM; - goto fail_memregion_data_malloc; - } - memset(adev.mem_regionp[i].data, 0, ACACHE_DEV_SIZE); - } - - init_acache_circ(&adev.acache_info_circ, adev.mem_regionp[0].data); - if (acache_prefetch_init(&adev)) - goto fail_prefetch_init; - - return 0; - -fail_prefetch_init: -fail_memregion_data_malloc: - acache_free_mem(); -fail_malloc: - device_destroy(adev.class, adev.devno); -fail_device: - cdev_del(&adev.cdev); -fail_dev_add: - class_destroy(adev.class); -fail_class: - unregister_chrdev_region(adev.devno, ACACHE_NR_DEVS); -fail_allocdev: - return ret; -} - -void acache_dev_exit(void) -{ - if (!adev.initialized) - return; - - if (adev.wq) { - flush_workqueue(adev.wq); - destroy_workqueue(adev.wq); - } - device_destroy(adev.class, adev.devno); - cdev_del(&adev.cdev); - acache_free_mem(); - kfree(adev.mem_regionp); - unregister_chrdev_region(adev.devno, ACACHE_NR_DEVS); - class_destroy(adev.class); - kfree(adev.prefetch_workers); -} - -struct cached_dev *get_cached_device_by_dev(dev_t dev) -{ - struct cache_set *c, *tc; - struct cached_dev *dc, *t; - - list_for_each_entry_safe(c, tc, &bch_cache_sets, list) - list_for_each_entry_safe(dc, t, &c->cached_devs, list) - if (dc->bdev->bd_dev == dev && cached_dev_get(dc)) - return dc; - - return NULL; -} - -struct bio *get_bio_by_item(struct cached_dev *dc, struct acache_info *item) -{ - struct bio *bio; - uint64_t offset = item->offset + dc->sb.data_offset; - - if (get_capacity(dc->bdev->bd_disk) < offset + (item->length >> 9)) { - pr_err("prefetch area exceeds the capacity of disk(%d:%d), end: %llx, capacity: %llx\n", - MAJOR(dc->bdev->bd_dev), MINOR(dc->bdev->bd_dev), - offset + (item->length >> 9), - get_capacity(dc->bdev->bd_disk)); - return NULL; - } - - bio = bio_alloc_bioset(GFP_NOWAIT, DIV_ROUND_UP(item->length >> 9, PAGE_SECTORS), &dc->disk.bio_split); - if (!bio) { - bio = bio_alloc_bioset(GFP_NOWAIT, DIV_ROUND_UP(item->length >> 9, PAGE_SECTORS), NULL); - if (!bio) - return NULL; - } - - bio_set_dev(bio, dc->bdev); - bio->bi_iter.bi_sector = item->offset + dc->sb.data_offset; - bio->bi_iter.bi_size = (item->length >> 9) << 9; - - bch_bio_map(bio, NULL); - if (bch_bio_alloc_pages(bio, __GFP_NOWARN | GFP_NOIO)) - goto out_put; - - return bio; -out_put: - bio_put(bio); - return NULL; -} - -int process_one_request(struct acache_info *item) -{ - struct cached_dev *dc; - struct bio *cache_bio; - struct search *s; - - dc = get_cached_device_by_dev(item->dev); - if (dc == NULL) - return -1; - cache_bio = get_bio_by_item(dc, item); - if (cache_bio == NULL) { - pr_err("acache: failed to alloc bio for prefetch\n"); - goto put_dev; - } - - s = search_alloc(cache_bio, &dc->disk, true); - - trace_bcache_prefetch_request(&dc->disk, cache_bio); - cached_dev_read(dc, s); - return 0; - -put_dev: - cached_dev_put(dc); - return -1; -} - diff --git a/drivers/md/bcache/acache.h b/drivers/md/bcache/acache.h deleted file mode 100644 index dea6e8cb0a05..000000000000 --- a/drivers/md/bcache/acache.h +++ /dev/null @@ -1,69 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#ifndef _ACHACHE_INTERFACE_H_ -#define _ACHACHE_INTERFACE_H_ - -#define ACACHE_NR_DEVS 1 - -#define RING_SIZE - -#include "bcache.h" - -struct mem_reg { - char *data; - unsigned long size; -}; - -struct acache_info { - uint64_t length; - uint64_t offset; - uint64_t start_time; - dev_t dev; - int type; -}; - -enum acache_info_type { - ACACHE_INFO_READ = 0, - ACACHE_INFO_WRITE, - ACACHE_INFO_CACHE_INSERT, - ACACHE_INFO_LATENCY, -}; - -struct acache_circ { - spinlock_t lock; - int tail; - int head; - int size; - int item_size; - struct acache_info data[0]; -}; - -struct acache_metadata { - uint32_t magic; - uint32_t conntype; - uint32_t devsize; -}; - -#define ACACHE_DEV_SIZE acache_dev_size -#define ACACHE_MAGIC 2 - -enum acache_conn_types { - ACACHE_NO_CONN = 0, - ACACHE_READWRITE_CONN = 2, -}; - -#define ACACHE_CIRC_SIZE \ - ({int i = (ACACHE_DEV_SIZE - sizeof(struct acache_circ))/sizeof(struct acache_info); \ - int bits = 0; \ - while (i > 0) {i >>= 1; bits++; } \ - 1 << (bits - 1); }) - - -#define ACACHE_GET_METADATA _IOR('a', 1, struct acache_metadata) - -int acache_dev_init(void); -void acache_dev_exit(void); -struct acache_info *fetch_circ_item(struct acache_circ *circ); -void save_circ_item(struct acache_info *data); - -#endif diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 96951e638f17..fe6dce125aba 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -2122,12 +2122,12 @@ static bool btree_insert_key(struct btree *b, struct bkey *k, BUG_ON(bkey_cmp(k, &b->key) > 0);
status = bch_btree_insert_key(&b->keys, k, replace_key); - trace_bcache_btree_insert_key(b, k, replace_key != NULL, - status); if (status != BTREE_INSERT_STATUS_NO_INSERT) { bch_check_keys(&b->keys, "%u for %s", status, replace_key ? "replace" : "insert");
+ trace_bcache_btree_insert_key(b, k, replace_key != NULL, + status); return true; } else return false; diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 5a64afd56b97..214326383145 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -8,13 +8,11 @@ */
#include "bcache.h" -#include "acache.h" #include "btree.h" #include "debug.h" #include "request.h" #include "writeback.h"
-#include <linux/time.h> #include <linux/module.h> #include <linux/hash.h> #include <linux/random.h> @@ -310,18 +308,10 @@ static void bch_data_insert_start(struct closure *cl) void bch_data_insert(struct closure *cl) { struct data_insert_op *op = container_of(cl, struct data_insert_op, cl); - struct acache_info msg;
trace_bcache_write(op->c, op->inode, op->bio, op->writeback, op->bypass);
- msg.offset = op->bio->bi_iter.bi_sector; - msg.length = op->bio->bi_iter.bi_size; - msg.type = ACACHE_INFO_CACHE_INSERT; - msg.dev = bio_dev(op->bio); - msg.start_time = ktime_get_ns(); - save_circ_item(&msg); - bch_keylist_init(&op->insert_keys); bio_get(op->bio); bch_data_insert_start(cl); @@ -470,6 +460,28 @@ static bool check_should_bypass(struct cached_dev *dc, struct bio *bio)
/* Cache lookup */
+struct search { + /* Stack frame for bio_complete */ + struct closure cl; + + struct bbio bio; + struct bio *orig_bio; + struct bio *cache_miss; + struct bcache_device *d; + + unsigned int insert_bio_sectors; + unsigned int recoverable:1; + unsigned int write:1; + unsigned int read_dirty_data:1; + unsigned int cache_missed:1; + + struct hd_struct *part; + unsigned long start_time; + + struct btree_op op; + struct data_insert_op iop; +}; + static void bch_cache_read_endio(struct bio *bio) { struct bbio *b = container_of(bio, struct bbio, bio); @@ -528,7 +540,6 @@ static int cache_lookup_fn(struct btree_op *op, struct btree *b, struct bkey *k) return MAP_CONTINUE;
/* XXX: figure out best pointer - for multiple cache devices */ - ptr = 0;
PTR_BUCKET(b->c, k, ptr)->prio = INITIAL_PRIO; @@ -546,25 +557,21 @@ static int cache_lookup_fn(struct btree_op *op, struct btree *b, struct bkey *k) bch_cut_front(&KEY(s->iop.inode, n->bi_iter.bi_sector, 0), bio_key); bch_cut_back(&KEY(s->iop.inode, bio_end_sector(n), 0), bio_key);
- if (!s->prefetch) { - n->bi_end_io = bch_cache_read_endio; - n->bi_private = &s->cl; + n->bi_end_io = bch_cache_read_endio; + n->bi_private = &s->cl;
- /* - * The bucket we're reading from might be reused while our bio - * is in flight, and we could then end up reading the wrong - * data. - * - * We guard against this by checking (in cache_read_endio()) if - * the pointer is stale again; if so, we treat it as an error - * and reread from the backing device (but we don't pass that - * error up anywhere). - */ + /* + * The bucket we're reading from might be reused while our bio + * is in flight, and we could then end up reading the wrong + * data. + * + * We guard against this by checking (in cache_read_endio()) if + * the pointer is stale again; if so, we treat it as an error + * and reread from the backing device (but we don't pass that + * error up anywhere). + */
- __bch_submit_bbio(n, b->c); - } else { - bio_put(n); - } + __bch_submit_bbio(n, b->c); return n == bio ? MAP_DONE : MAP_CONTINUE; }
@@ -667,12 +674,7 @@ static void bio_complete(struct search *s)
trace_bcache_request_end(s->d, s->orig_bio); s->orig_bio->bi_status = s->iop.status; - if (s->prefetch) { - bio_free_pages(s->orig_bio); - bio_put(s->orig_bio); - } else { - bio_endio(s->orig_bio); - } + bio_endio(s->orig_bio); s->orig_bio = NULL; } } @@ -697,7 +699,7 @@ static void do_bio_hook(struct search *s, bio_cnt_set(bio, 3); }
-void search_free(struct closure *cl) +static void search_free(struct closure *cl) { struct search *s = container_of(cl, struct search, cl);
@@ -711,8 +713,8 @@ void search_free(struct closure *cl) mempool_free(s, &s->iop.c->search); }
-struct search *search_alloc(struct bio *bio, - struct bcache_device *d, bool prefetch) +static inline struct search *search_alloc(struct bio *bio, + struct bcache_device *d) { struct search *s;
@@ -731,7 +733,6 @@ struct search *search_alloc(struct bio *bio, s->read_dirty_data = 0; /* Count on the bcache device */ s->start_time = part_start_io_acct(d->disk, &s->part, bio); - s->prefetch = prefetch; s->iop.c = d->c; s->iop.bio = NULL; s->iop.inode = d->id; @@ -835,22 +836,17 @@ static void cached_dev_read_done(struct closure *cl) s->iop.bio->bi_iter.bi_size = s->insert_bio_sectors << 9; bch_bio_map(s->iop.bio, NULL);
- if (!s->prefetch) - bio_copy_data(s->cache_miss, s->iop.bio); - else - trace_bcache_prefetch_cache_miss(s->iop.bio); + bio_copy_data(s->cache_miss, s->iop.bio);
bio_put(s->cache_miss); s->cache_miss = NULL; - }
if (verify(dc) && s->recoverable && !s->read_dirty_data) bch_data_verify(dc, s->orig_bio);
closure_get(&dc->disk.cl); - if (!s->prefetch) - bio_complete(s); + bio_complete(s);
if (s->iop.bio && !test_bit(CACHE_SET_STOPPING, &s->iop.c->flags)) { @@ -866,19 +862,10 @@ static void cached_dev_read_done_bh(struct closure *cl) struct search *s = container_of(cl, struct search, cl); struct cached_dev *dc = container_of(s->d, struct cached_dev, disk);
- if (s->prefetch) - pr_debug("prefetch request; do not count cache_missed"); - else - bch_mark_cache_accounting(s->iop.c, s->d, + bch_mark_cache_accounting(s->iop.c, s->d, !s->cache_missed, s->iop.bypass); trace_bcache_read(s->orig_bio, !s->cache_missed, s->iop.bypass);
- if (!s->prefetch && !s->iop.status) { - s->smp.type = ACACHE_INFO_LATENCY; - s->smp.start_time = ktime_get_ns() - s->smp.start_time; - save_circ_item(&s->smp); - } - if (s->iop.status) continue_at_nobarrier(cl, cached_dev_read_error, bcache_wq); else if (s->iop.bio || verify(dc)) @@ -904,9 +891,8 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, }
if (!(bio->bi_opf & REQ_RAHEAD) && - !(bio->bi_opf & (REQ_META|REQ_PRIO) ) && - s->iop.c->gc_stats.in_use < CUTOFF_CACHE_READA && - !s->prefetch) + !(bio->bi_opf & (REQ_META|REQ_PRIO)) && + s->iop.c->gc_stats.in_use < CUTOFF_CACHE_READA) reada = min_t(sector_t, dc->readahead >> 9, get_capacity(bio->bi_disk) - bio_end_sector(bio));
@@ -957,18 +943,14 @@ static int cached_dev_cache_miss(struct btree *b, struct search *s, out_put: bio_put(cache_bio); out_submit: - if (!s->prefetch) { - miss->bi_end_io = backing_request_endio; - miss->bi_private = &s->cl; - /* I/O request sent to backing device */ - closure_bio_submit(s->iop.c, miss, &s->cl); - } else { - bio_put(miss); - } + miss->bi_end_io = backing_request_endio; + miss->bi_private = &s->cl; + /* I/O request sent to backing device */ + closure_bio_submit(s->iop.c, miss, &s->cl); return ret; }
-void cached_dev_read(struct cached_dev *dc, struct search *s) +static void cached_dev_read(struct cached_dev *dc, struct search *s) { struct closure *cl = &s->cl;
@@ -1215,7 +1197,7 @@ blk_qc_t cached_dev_submit_bio(struct bio *bio) bio->bi_iter.bi_sector += dc->sb.data_offset;
if (cached_dev_get(dc)) { - s = search_alloc(bio, d, false); + s = search_alloc(bio, d); trace_bcache_request_start(s->d, bio);
if (!bio->bi_iter.bi_size) { @@ -1229,15 +1211,6 @@ blk_qc_t cached_dev_submit_bio(struct bio *bio) } else { s->iop.bypass = check_should_bypass(dc, bio);
- if (!s->iop.bypass && bio->bi_iter.bi_size && !rw) { - s->smp.offset = bio->bi_iter.bi_sector - dc->sb.data_offset; - s->smp.length = bio->bi_iter.bi_size; - s->smp.type = rw; - s->smp.dev = dc->bdev->bd_dev; - s->smp.start_time = ktime_get_ns(); - save_circ_item(&s->smp); - } - if (rw) cached_dev_write(dc, s); else @@ -1308,7 +1281,7 @@ blk_qc_t flash_dev_submit_bio(struct bio *bio) return BLK_QC_T_NONE; }
- s = search_alloc(bio, d, false); + s = search_alloc(bio, d); cl = &s->cl; bio = &s->bio.bio;
diff --git a/drivers/md/bcache/request.h b/drivers/md/bcache/request.h index 21678037d215..82b38366a95d 100644 --- a/drivers/md/bcache/request.h +++ b/drivers/md/bcache/request.h @@ -1,8 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ #ifndef _BCACHE_REQUEST_H_ #define _BCACHE_REQUEST_H_ -#include "btree.h" -#include "acache.h"
struct data_insert_op { struct closure cl; @@ -46,34 +44,4 @@ blk_qc_t flash_dev_submit_bio(struct bio *bio);
extern struct kmem_cache *bch_search_cache;
-struct search { - /* Stack frame for bio_complete */ - struct closure cl; - - struct bbio bio; - struct bio *orig_bio; - struct bio *cache_miss; - struct bcache_device *d; - - unsigned int insert_bio_sectors; - unsigned int recoverable:1; - unsigned int write:1; - unsigned int read_dirty_data:1; - unsigned int cache_missed:1; - - struct hd_struct *part; - unsigned long start_time; - /* for prefetch, we do not need copy data to bio */ - bool prefetch; - struct list_head list_node; - wait_queue_head_t wqh; - struct acache_info smp; - - struct btree_op op; - struct data_insert_op iop; -}; - -void search_free(struct closure *cl); -struct search *search_alloc(struct bio *bio, struct bcache_device *d, bool prefetch); -void cached_dev_read(struct cached_dev *dc, struct search *s); #endif /* _BCACHE_REQUEST_H_ */ diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index a849fc51cd88..81f1cc5b3499 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -8,7 +8,6 @@ */
#include "bcache.h" -#include "acache.h" #include "btree.h" #include "debug.h" #include "extents.h" @@ -2847,7 +2846,6 @@ static void bcache_exit(void)
if (bcache_major) unregister_blkdev(bcache_major, "bcache"); - acache_dev_exit(); unregister_reboot_notifier(&reboot); mutex_destroy(&bch_register_lock); } @@ -2934,8 +2932,6 @@ static int __init bcache_init(void)
bch_debug_init(); closure_debug_init(); - if (acache_dev_init()) - goto err;
bcache_is_reboot = false;
diff --git a/include/trace/events/bcache.h b/include/trace/events/bcache.h index f7be8c6e7cff..e41c611d6d3b 100644 --- a/include/trace/events/bcache.h +++ b/include/trace/events/bcache.h @@ -75,12 +75,6 @@ DECLARE_EVENT_CLASS(btree_node, TP_printk("bucket %zu", __entry->bucket) );
-/* acache.c */ -DEFINE_EVENT(bcache_request, bcache_prefetch_request, - TP_PROTO(struct bcache_device *d, struct bio *bio), - TP_ARGS(d, bio) -); - /* request.c */
DEFINE_EVENT(bcache_request, bcache_request_start, @@ -126,11 +120,6 @@ DEFINE_EVENT(bcache_bio, bcache_bypass_congested, TP_ARGS(bio) );
-DEFINE_EVENT(bcache_bio, bcache_prefetch_cache_miss, - TP_PROTO(struct bio *bio), - TP_ARGS(bio) -); - TRACE_EVENT(bcache_read, TP_PROTO(struct bio *bio, bool hit, bool bypass), TP_ARGS(bio, hit, bypass),
For this series, Acked-by: Xie XiuQi xiexiuqi@huawei.com
On 2022/1/12 10:26, Zheng Zengkai wrote:
This patch set introduce many conflicts while backporting mainline bcache patches, revert it temporarily.
Zheng Zengkai (8): Revert "bcache: always record start time of a sample" Revert "bcache: do not collect data insert info created by write_moving" Revert "bcache: Rewrite patch to delay to invalidate cache data" Revert "bcache: Add a sample of userspace prefetch client" Revert "bcache: Delay to invalidate cache data in writearound write" Revert "bcache: inflight prefetch requests block overlapped normal requests" Revert "bcache: provide a switch to bypass all IO requests" Revert "bcache: add a framework to perform prefetch"
Documentation/admin-guide/bcache.rst | 4 - drivers/md/bcache/Makefile | 2 +- drivers/md/bcache/acache.c | 586 --------------------------- drivers/md/bcache/acache.h | 79 ---- drivers/md/bcache/bcache.h | 3 - drivers/md/bcache/btree.c | 4 +- drivers/md/bcache/request.c | 161 +++----- drivers/md/bcache/request.h | 45 -- drivers/md/bcache/stats.c | 13 - drivers/md/bcache/stats.h | 3 - drivers/md/bcache/super.c | 6 - drivers/md/bcache/sysfs.c | 12 - include/trace/events/bcache.h | 22 - samples/acache_client/Makefile | 13 - samples/acache_client/connect.c | 144 ------- samples/acache_client/connect.h | 74 ---- samples/acache_client/main.c | 133 ------ 17 files changed, 59 insertions(+), 1245 deletions(-) delete mode 100644 drivers/md/bcache/acache.c delete mode 100644 drivers/md/bcache/acache.h delete mode 100644 samples/acache_client/Makefile delete mode 100644 samples/acache_client/connect.c delete mode 100644 samples/acache_client/connect.h delete mode 100644 samples/acache_client/main.c