cleaner.h revision 1.14 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.14 dholland unsigned lfs_is64 : 1,
24 1.14 dholland lfs_dobyteswap : 1;
25 1.1 perseant
26 1.1 perseant /* Ifile */
27 1.1 perseant int clfs_ifilefd; /* Ifile file descriptor */
28 1.1 perseant struct uvnode *lfs_ivnode; /* Ifile vnode */
29 1.4 martin struct lfs_fhandle clfs_ifilefh; /* Ifile file handle */
30 1.1 perseant
31 1.1 perseant /* Device */
32 1.1 perseant int clfs_devfd; /* Device file descriptor */
33 1.1 perseant struct uvnode *clfs_devvp; /* Device vnode */
34 1.1 perseant char *clfs_dev; /* Name of device */
35 1.1 perseant
36 1.1 perseant /* Cache of segment status */
37 1.1 perseant struct clfs_seguse *clfs_segtab; /* Abbreviated seguse table */
38 1.1 perseant struct clfs_seguse **clfs_segtabp; /* pointers to same */
39 1.1 perseant
40 1.1 perseant /* Progress status */
41 1.1 perseant int clfs_nactive; /* How many segments' blocks we have */
42 1.1 perseant int clfs_onhold; /* If cleaning this fs is on hold */
43 1.1 perseant };
44 1.1 perseant
45 1.1 perseant /*
46 1.9 dholland * Get lfs accessors that use struct clfs. This must come after the
47 1.9 dholland * definition of struct clfs. (blah)
48 1.8 dholland */
49 1.9 dholland #define STRUCT_LFS struct clfs
50 1.9 dholland #include <ufs/lfs/lfs_accessors.h>
51 1.8 dholland
52 1.8 dholland /*
53 1.1 perseant * Fraction of the could-be-clean segments required to be clean.
54 1.1 perseant */
55 1.1 perseant #define BUSY_LIM 0.5
56 1.1 perseant #define IDLE_LIM 0.9
57 1.1 perseant
58 1.1 perseant __BEGIN_DECLS
59 1.1 perseant
60 1.1 perseant /* lfs_cleanerd.c */
61 1.1 perseant void pwarn(const char *, ...);
62 1.1 perseant void calc_cb(struct clfs *, int, struct clfs_seguse *);
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 reinit_fs(struct clfs *);
70 1.1 perseant void reload_ifile(struct clfs *);
71 1.12 dholland void toss_old_blocks(struct clfs *, BLOCK_INFO **, blkcnt_t *, int *);
72 1.1 perseant
73 1.1 perseant /* cleansrv.c */
74 1.1 perseant void check_control_socket(void);
75 1.1 perseant void try_to_become_master(int, char **);
76 1.1 perseant
77 1.1 perseant /* coalesce.c */
78 1.1 perseant int clean_all_inodes(struct clfs *);
79 1.1 perseant int fork_coalesce(struct clfs *);
80 1.1 perseant
81 1.1 perseant __END_DECLS
82 1.1 perseant
83 1.1 perseant #endif /* CLEANER_H_ */
84