xref: /spdk/module/bdev/ocf/ctx.h (revision 318515b44ec8b67f83bcc9ca83f0c7d5ea919e62)
1 /*   SPDX-License-Identifier: BSD-3-Clause
2  *   Copyright (C) 2018 Intel Corporation.
3  *   All rights reserved.
4  */
5 
6 #ifndef VBDEV_OCF_CTX_H
7 #define VBDEV_OCF_CTX_H
8 
9 #include <ocf/ocf.h>
10 #include "ocf_env.h"
11 #include "spdk/thread.h"
12 
13 extern ocf_ctx_t vbdev_ocf_ctx;
14 
15 #define OCF_WRITE_FLUSH 11
16 
17 #define SPDK_OBJECT 1
18 
19 /* Context of cache instance */
20 struct vbdev_ocf_cache_ctx {
21 	ocf_queue_t                  mngt_queue;
22 	env_atomic                   refcnt;
23 };
24 
25 void vbdev_ocf_cache_ctx_put(struct vbdev_ocf_cache_ctx *ctx);
26 void vbdev_ocf_cache_ctx_get(struct vbdev_ocf_cache_ctx *ctx);
27 
28 int vbdev_ocf_ctx_init(void);
29 void vbdev_ocf_ctx_cleanup(void);
30 
31 /* Thread safe queue creation and deletion
32  * These are wrappers for original ocf_queue_create() and ocf_queue_put() */
33 int vbdev_ocf_queue_create(ocf_cache_t cache, ocf_queue_t *queue, const struct ocf_queue_ops *ops);
34 int vbdev_ocf_queue_create_mngt(ocf_cache_t cache, ocf_queue_t *queue,
35 				const struct ocf_queue_ops *ops);
36 void vbdev_ocf_queue_put(ocf_queue_t queue);
37 
38 #endif
39