Home | History | Annotate | Line # | Download | only in lfs_cleanerd
      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.15  dholland 		lfs_dobyteswap : 1,
     25  1.15  dholland 		lfs_hasolddirfmt : 1;
     26   1.1  perseant 
     27   1.1  perseant 	/* Ifile */
     28   1.1  perseant 	int clfs_ifilefd;	   /* Ifile file descriptor */
     29   1.1  perseant 	struct uvnode *lfs_ivnode; /* Ifile vnode */
     30   1.4    martin 	struct lfs_fhandle clfs_ifilefh;	   /* Ifile file handle */
     31   1.1  perseant 
     32   1.1  perseant 	/* Device */
     33   1.1  perseant 	int clfs_devfd;		   /* Device file descriptor */
     34   1.1  perseant 	struct uvnode *clfs_devvp; /* Device vnode */
     35   1.1  perseant 	char *clfs_dev;		   /* Name of device */
     36   1.1  perseant 
     37   1.1  perseant 	/* Cache of segment status */
     38   1.1  perseant 	struct clfs_seguse  *clfs_segtab;  /* Abbreviated seguse table */
     39   1.1  perseant 	struct clfs_seguse **clfs_segtabp; /* pointers to same */
     40   1.1  perseant 
     41   1.1  perseant 	/* Progress status */
     42   1.1  perseant 	int clfs_nactive;	   /* How many segments' blocks we have */
     43   1.1  perseant 	int clfs_onhold;	   /* If cleaning this fs is on hold */
     44   1.1  perseant };
     45   1.1  perseant 
     46   1.1  perseant /*
     47   1.9  dholland  * Get lfs accessors that use struct clfs. This must come after the
     48   1.9  dholland  * definition of struct clfs. (blah)
     49   1.8  dholland  */
     50   1.9  dholland #define STRUCT_LFS struct clfs
     51   1.9  dholland #include <ufs/lfs/lfs_accessors.h>
     52   1.8  dholland 
     53   1.8  dholland /*
     54   1.1  perseant  * Fraction of the could-be-clean segments required to be clean.
     55   1.1  perseant  */
     56   1.1  perseant #define BUSY_LIM 0.5
     57   1.1  perseant #define IDLE_LIM 0.9
     58   1.1  perseant 
     59   1.1  perseant __BEGIN_DECLS
     60   1.1  perseant 
     61   1.1  perseant /* lfs_cleanerd.c */
     62   1.1  perseant void pwarn(const char *, ...);
     63   1.1  perseant void calc_cb(struct clfs *, int, struct clfs_seguse *);
     64   1.5     lukem void dlog(const char *, ...);
     65   1.1  perseant void handle_error(struct clfs **, int);
     66   1.1  perseant int init_fs(struct clfs *, char *);
     67   1.1  perseant int invalidate_segment(struct clfs *, int);
     68   1.1  perseant void lfs_ientry(IFILE **, struct clfs *, ino_t, struct ubuf **);
     69   1.1  perseant int load_segment(struct clfs *, int, BLOCK_INFO **, int *);
     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