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