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 struct dlfs lfs_dlfs; /* Leverage LFS lfs_* defines here */ 20 21 /* Ifile */ 22 int clfs_ifilefd; /* Ifile file descriptor */ 23 struct uvnode *lfs_ivnode; /* Ifile vnode */ 24 struct lfs_fhandle clfs_ifilefh; /* Ifile file handle */ 25 26 /* Device */ 27 int clfs_devfd; /* Device file descriptor */ 28 struct uvnode *clfs_devvp; /* Device vnode */ 29 char *clfs_dev; /* Name of device */ 30 31 /* Cache of segment status */ 32 struct clfs_seguse *clfs_segtab; /* Abbreviated seguse table */ 33 struct clfs_seguse **clfs_segtabp; /* pointers to same */ 34 35 /* Progress status */ 36 int clfs_nactive; /* How many segments' blocks we have */ 37 int clfs_onhold; /* If cleaning this fs is on hold */ 38 }; 39 40 /* 41 * Fraction of the could-be-clean segments required to be clean. 42 */ 43 #define BUSY_LIM 0.5 44 #define IDLE_LIM 0.9 45 46 __BEGIN_DECLS 47 48 /* lfs_cleanerd.c */ 49 void pwarn(const char *, ...); 50 void calc_cb(struct clfs *, int, struct clfs_seguse *); 51 int clean_fs(struct clfs *, CLEANERINFO *); 52 void dlog(const char *, ...); 53 void handle_error(struct clfs **, int); 54 int init_fs(struct clfs *, char *); 55 int invalidate_segment(struct clfs *, int); 56 void lfs_ientry(IFILE **, struct clfs *, ino_t, struct ubuf **); 57 int load_segment(struct clfs *, int, BLOCK_INFO **, int *); 58 int needs_cleaning(struct clfs *, CLEANERINFO *); 59 int32_t parse_pseg(struct clfs *, daddr_t, BLOCK_INFO **, int *); 60 int reinit_fs(struct clfs *); 61 void reload_ifile(struct clfs *); 62 void toss_old_blocks(struct clfs *, BLOCK_INFO **, int *, int *); 63 64 /* cleansrv.c */ 65 void check_control_socket(void); 66 void try_to_become_master(int, char **); 67 68 /* coalesce.c */ 69 int log2int(int); 70 int clean_all_inodes(struct clfs *); 71 int fork_coalesce(struct clfs *); 72 73 __END_DECLS 74 75 #endif /* CLEANER_H_ */ 76