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. */
15struct 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
26struct flusher;
27
28int __must_check vdo_make_flusher(struct vdo *vdo);
29
30void vdo_free_flusher(struct flusher *flusher);
31
32thread_id_t __must_check vdo_get_flusher_thread_id(struct flusher *flusher);
33
34void vdo_complete_flushes(struct flusher *flusher);
35
36void vdo_dump_flusher(const struct flusher *flusher);
37
38void vdo_launch_flush(struct vdo *vdo, struct bio *bio);
39
40void vdo_drain_flusher(struct flusher *flusher, struct vdo_completion *completion);
41
42void vdo_resume_flusher(struct flusher *flusher, struct vdo_completion *parent);
43
44#endif /* VDO_FLUSH_H */
45