xref: /linux/drivers/md/dm-vdo/flush.h (revision a36e9f5cfe9eb3a1dce8769c7058251c42705357)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright 2023 Red Hat
4  */
5 
6 #ifndef VDO_FLUSH_H
7 #define VDO_FLUSH_H
8 
9 #include "funnel-workqueue.h"
10 #include "types.h"
11 #include "vio.h"
12 #include "wait-queue.h"
13 
14 /* A marker for tracking which journal entries are affected by a flush request. */
15 struct vdo_flush {
16 	/* The completion for enqueueing this flush request. */
17 	struct vdo_completion completion;
18 	/* The flush bios covered by this request */
19 	struct bio_list bios;
20 	/* The wait queue entry for this flush */
21 	struct vdo_waiter waiter;
22 	/* Which flush this struct represents */
23 	sequence_number_t flush_generation;
24 };
25 
26 struct flusher;
27 
28 int __must_check vdo_make_flusher(struct vdo *vdo);
29 
30 void vdo_free_flusher(struct flusher *flusher);
31 
32 thread_id_t __must_check vdo_get_flusher_thread_id(struct flusher *flusher);
33 
34 void vdo_complete_flushes(struct flusher *flusher);
35 
36 void vdo_dump_flusher(const struct flusher *flusher);
37 
38 void vdo_launch_flush(struct vdo *vdo, struct bio *bio);
39 
40 void vdo_drain_flusher(struct flusher *flusher, struct vdo_completion *completion);
41 
42 void vdo_resume_flusher(struct flusher *flusher, struct vdo_completion *parent);
43 
44 #endif /* VDO_FLUSH_H */
45