]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - repair/prefetch.h
libxfs: refactor manage_zones()
[thirdparty/xfsprogs-dev.git] / repair / prefetch.h
1 // SPDX-License-Identifier: GPL-2.0
2
3 #ifndef _XFS_REPAIR_PREFETCH_H
4 #define _XFS_REPAIR_PREFETCH_H
5
6 #include <semaphore.h>
7 #include "incore.h"
8
9 struct workqueue;
10
11 extern int do_prefetch;
12
13 #define PF_THREAD_COUNT 4
14
15 typedef struct prefetch_args {
16 pthread_mutex_t lock;
17 pthread_t queuing_thread;
18 pthread_t io_threads[PF_THREAD_COUNT];
19 struct btree_root *io_queue;
20 pthread_cond_t start_reading;
21 pthread_cond_t start_processing;
22 int agno;
23 int dirs_only;
24 volatile int can_start_reading;
25 volatile int can_start_processing;
26 volatile int prefetch_done;
27 volatile int queuing_done;
28 volatile int inode_bufs_queued;
29 volatile xfs_fsblock_t last_bno_read;
30 sem_t ra_count;
31 struct prefetch_args *next_args;
32 } prefetch_args_t;
33
34
35
36 void
37 init_prefetch(
38 xfs_mount_t *pmp);
39
40 prefetch_args_t *
41 start_inode_prefetch(
42 xfs_agnumber_t agno,
43 int dirs_only,
44 prefetch_args_t *prev_args);
45
46 void
47 do_inode_prefetch(
48 struct xfs_mount *mp,
49 int stride,
50 void (*func)(struct workqueue *,
51 xfs_agnumber_t, void *),
52 bool check_cache,
53 bool dirs_only);
54
55 void
56 wait_for_inode_prefetch(
57 prefetch_args_t *args);
58
59 void
60 cleanup_inode_prefetch(
61 prefetch_args_t *args);
62
63
64 #ifdef XR_PF_TRACE
65 void pftrace_init(void);
66 void pftrace_done(void);
67
68 #define pftrace(msg...) _pftrace(__FUNCTION__, ## msg)
69 void _pftrace(const char *, const char *, ...);
70 #else
71 static inline void pftrace_init(void) { };
72 static inline void pftrace_done(void) { };
73 static inline void pftrace(const char *msg, ...) { };
74 #endif
75
76 #endif /* _XFS_REPAIR_PREFETCH_H */