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