]>
Commit | Line | Data |
---|---|---|
959ef981 DC |
1 | // SPDX-License-Identifier: GPL-2.0 |
2 | ||
cb5b3ef4 MV |
3 | #ifndef _XFS_REPAIR_PREFETCH_H |
4 | #define _XFS_REPAIR_PREFETCH_H | |
5 | ||
2556c98b BN |
6 | #include <semaphore.h> |
7 | #include "incore.h" | |
2556c98b | 8 | |
62843f36 | 9 | struct workqueue; |
2556c98b BN |
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]; | |
bb34c934 | 19 | struct btree_root *io_queue; |
2556c98b BN |
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 | ||
1164bde5 DC |
46 | void |
47 | do_inode_prefetch( | |
48 | struct xfs_mount *mp, | |
49 | int stride, | |
62843f36 | 50 | void (*func)(struct workqueue *, |
1164bde5 DC |
51 | xfs_agnumber_t, void *), |
52 | bool check_cache, | |
53 | bool dirs_only); | |
54 | ||
2556c98b BN |
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 | |
4c0a98ae BN |
65 | void pftrace_init(void); |
66 | void pftrace_done(void); | |
67 | ||
2556c98b BN |
68 | #define pftrace(msg...) _pftrace(__FUNCTION__, ## msg) |
69 | void _pftrace(const char *, const char *, ...); | |
4c0a98ae BN |
70 | #else |
71 | static inline void pftrace_init(void) { }; | |
72 | static inline void pftrace_done(void) { }; | |
73 | static inline void pftrace(const char *msg, ...) { }; | |
2556c98b | 74 | #endif |
cb5b3ef4 MV |
75 | |
76 | #endif /* _XFS_REPAIR_PREFETCH_H */ |