Home | History | Annotate | Line # | Download | only in lfs_cleanerd
cleaner.h revision 1.10
      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;
     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  * Get lfs accessors that use struct clfs. This must come after the
     42  * definition of struct clfs. (blah)
     43  */
     44 #define STRUCT_LFS struct clfs
     45 #include <ufs/lfs/lfs_accessors.h>
     46 
     47 /*
     48  * Fraction of the could-be-clean segments required to be clean.
     49  */
     50 #define BUSY_LIM 0.5
     51 #define IDLE_LIM 0.9
     52 
     53 __BEGIN_DECLS
     54 
     55 /* lfs_cleanerd.c */
     56 void pwarn(const char *, ...);
     57 void calc_cb(struct clfs *, int, struct clfs_seguse *);
     58 int clean_fs(struct clfs *, CLEANERINFO *);
     59 void dlog(const char *, ...);
     60 void handle_error(struct clfs **, int);
     61 int init_fs(struct clfs *, char *);
     62 int invalidate_segment(struct clfs *, int);
     63 void lfs_ientry(IFILE **, struct clfs *, ino_t, struct ubuf **);
     64 int load_segment(struct clfs *, int, BLOCK_INFO **, int *);
     65 int needs_cleaning(struct clfs *, CLEANERINFO *);
     66 int reinit_fs(struct clfs *);
     67 void reload_ifile(struct clfs *);
     68 void toss_old_blocks(struct clfs *, BLOCK_INFO **, int *, int *);
     69 
     70 /* cleansrv.c */
     71 void check_control_socket(void);
     72 void try_to_become_master(int, char **);
     73 
     74 /* coalesce.c */
     75 int log2int(int);
     76 int clean_all_inodes(struct clfs *);
     77 int fork_coalesce(struct clfs *);
     78 
     79 __END_DECLS
     80 
     81 #endif /* CLEANER_H_ */
     82