]>
git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/ocf/inc/ocf_queue.h
2 * Copyright(c) 2012-2018 Intel Corporation
3 * SPDX-License-Identifier: BSD-3-Clause-Clear
11 * @brief OCF queues API
15 * @brief I/O queue operations
17 struct ocf_queue_ops
{
19 * @brief Kick I/O queue processing
21 * This function should inform worker, thread or any other queue
22 * processing mechanism, that there are new requests in queue to
23 * be processed. Processing requests synchronously in this function
26 * @param[in] q I/O queue to be kicked
28 void (*kick
)(ocf_queue_t q
);
31 * @brief Kick I/O queue processing
33 * This function should inform worker, thread or any other queue
34 * processing mechanism, that there are new requests in queue to
35 * be processed. Function kick_sync is allowed to process requests
36 * synchronously without delegating them to the worker.
38 * @param[in] q I/O queue to be kicked
40 void (*kick_sync
)(ocf_queue_t q
);
43 * @brief Stop I/O queue
45 * @param[in] q I/O queue beeing stopped
47 void (*stop
)(ocf_queue_t q
);
51 * @brief Allocate IO queue and add it to list in cache
53 * @param[in] cache Handle to cache instance
54 * @param[out] queue Handle to created queue
55 * @param[in] ops Queue operations
57 * @return Zero on success, otherwise error code
59 int ocf_queue_create(ocf_cache_t cache
, ocf_queue_t
*queue
,
60 const struct ocf_queue_ops
*ops
);
63 * @brief Increase reference counter in queue
65 * @param[in] queue Queue
68 void ocf_queue_get(ocf_queue_t queue
);
71 * @brief Decrease reference counter in queue
73 * @note If queue don't have any reference - deallocate it
75 * @param[in] queue Queue
78 void ocf_queue_put(ocf_queue_t queue
);
81 * @brief Process single request from queue
83 * @param[in] q Queue to run
85 void ocf_queue_run_single(ocf_queue_t q
);
88 * @brief Run queue processing
90 * @param[in] q Queue to run
92 void ocf_queue_run(ocf_queue_t q
);
95 * @brief Set queue private data
97 * @param[in] q I/O queue
98 * @param[in] priv Private data
100 void ocf_queue_set_priv(ocf_queue_t q
, void *priv
);
103 * @brief Get queue private data
105 * @param[in] q I/O queue
107 * @retval I/O queue private data
109 void *ocf_queue_get_priv(ocf_queue_t q
);
112 * @brief Get number of pending requests in I/O queue
114 * @param[in] q I/O queue
116 * @retval Number of pending requests in I/O queue
118 uint32_t ocf_queue_pending_io(ocf_queue_t q
);
121 * @brief Get cache instance to which I/O queue belongs
123 * @param[in] q I/O queue
125 * @retval Cache instance
127 ocf_cache_t
ocf_queue_get_cache(ocf_queue_t q
);