cleaner.h revision 1.11 1 #ifndef CLEANER_H_
2 #define CLEANER_H_
3
4 /*
5 * An abbreviated version of the SEGUSE data structure.
6 */
7 struct clfs_seguse {
8 u_int32_t nbytes;
9 u_int32_t nsums;
10 u_int32_t flags;
11 u_int64_t lastmod;
12 u_int64_t priority;
13 };
14
15 /*
16 * The cleaner's view of the superblock data structure.
17 */
18 struct clfs {
19 union {
20 struct dlfs u_32;
21 struct dlfs64 u_64;
22 } lfs_dlfs_u;
23 unsigned lfs_is64 : 1;
24
25 /* Ifile */
26 int clfs_ifilefd; /* Ifile file descriptor */
27 struct uvnode *lfs_ivnode; /* Ifile vnode */
28 struct lfs_fhandle clfs_ifilefh; /* Ifile file handle */
29
30 /* Device */
31 int clfs_devfd; /* Device file descriptor */
32 struct uvnode *clfs_devvp; /* Device vnode */
33 char *clfs_dev; /* Name of device */
34
35 /* Cache of segment status */
36 struct clfs_seguse *clfs_segtab; /* Abbreviated seguse table */
37 struct clfs_seguse **clfs_segtabp; /* pointers to same */
38
39 /* Progress status */
40 int clfs_nactive; /* How many segments' blocks we have */
41 int clfs_onhold; /* If cleaning this fs is on hold */
42 };
43
44 /*
45 * Get lfs accessors that use struct clfs. This must come after the
46 * definition of struct clfs. (blah)
47 */
48 #define STRUCT_LFS struct clfs
49 #include <ufs/lfs/lfs_accessors.h>
50
51 /*
52 * Fraction of the could-be-clean segments required to be clean.
53 */
54 #define BUSY_LIM 0.5
55 #define IDLE_LIM 0.9
56
57 __BEGIN_DECLS
58
59 /* lfs_cleanerd.c */
60 void pwarn(const char *, ...);
61 void calc_cb(struct clfs *, int, struct clfs_seguse *);
62 int clean_fs(struct clfs *, CLEANERINFO *);
63 void dlog(const char *, ...);
64 void handle_error(struct clfs **, int);
65 int init_fs(struct clfs *, char *);
66 int invalidate_segment(struct clfs *, int);
67 void lfs_ientry(IFILE **, struct clfs *, ino_t, struct ubuf **);
68 int load_segment(struct clfs *, int, BLOCK_INFO **, int *);
69 int needs_cleaning(struct clfs *, CLEANERINFO *);
70 int reinit_fs(struct clfs *);
71 void reload_ifile(struct clfs *);
72 void toss_old_blocks(struct clfs *, BLOCK_INFO **, int *, int *);
73
74 /* cleansrv.c */
75 void check_control_socket(void);
76 void try_to_become_master(int, char **);
77
78 /* coalesce.c */
79 int log2int(int);
80 int clean_all_inodes(struct clfs *);
81 int fork_coalesce(struct clfs *);
82
83 __END_DECLS
84
85 #endif /* CLEANER_H_ */
86