xref: /linux/drivers/md/dm-vdo/indexer/funnel-requestqueue.h (revision 0d21364c6e8dc1f62c34bbc49d49935c8b01844c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright 2023 Red Hat
4  */
5 
6 #ifndef UDS_REQUEST_QUEUE_H
7 #define UDS_REQUEST_QUEUE_H
8 
9 #include "indexer.h"
10 
11 /*
12  * A simple request queue which will handle new requests in the order in which they are received,
13  * and will attempt to handle requeued requests before new ones. However, the nature of the
14  * implementation means that it cannot guarantee this ordering; the prioritization is merely a
15  * hint.
16  */
17 
18 struct uds_request_queue;
19 
20 typedef void (*uds_request_queue_processor_fn)(struct uds_request *);
21 
22 int __must_check uds_make_request_queue(const char *queue_name,
23 					uds_request_queue_processor_fn processor,
24 					struct uds_request_queue **queue_ptr);
25 
26 void uds_request_queue_enqueue(struct uds_request_queue *queue,
27 			       struct uds_request *request);
28 
29 void uds_request_queue_finish(struct uds_request_queue *queue);
30 
31 #endif /* UDS_REQUEST_QUEUE_H */
32