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 ocf_queue_t cleaner_queue; 23 pthread_mutex_t lock; 24 env_atomic refcnt; 25 }; 26 27 void vbdev_ocf_cache_ctx_put(struct vbdev_ocf_cache_ctx *ctx); 28 void vbdev_ocf_cache_ctx_get(struct vbdev_ocf_cache_ctx *ctx); 29 30 int vbdev_ocf_ctx_init(void); 31 void vbdev_ocf_ctx_cleanup(void); 32 33 /* Thread safe queue creation and deletion 34 * These are wrappers for original ocf_queue_create() and ocf_queue_put() */ 35 int vbdev_ocf_queue_create(ocf_cache_t cache, ocf_queue_t *queue, const struct ocf_queue_ops *ops); 36 void vbdev_ocf_queue_put(ocf_queue_t queue); 37 38 #endif 39