[BACK]Return to cleaner.h CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / libexec / lfs_cleanerd

File: [cvs.NetBSD.org] / src / libexec / lfs_cleanerd / cleaner.h (download)

Revision 1.5, Mon Mar 16 00:08:10 2009 UTC (13 years, 8 months ago) by lukem
Branch: MAIN
CVS Tags: yamt-pagecache-tag8, yamt-pagecache-base9, yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, yamt-pagecache-base5, yamt-pagecache-base4, yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base, yamt-pagecache, tls-maxphys-base, tls-maxphys, tls-earlyentropy-base, tls-earlyentropy, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3, riastradh-drm2-base2, riastradh-drm2-base1, riastradh-drm2-base, riastradh-drm2, netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-nhusb, netbsd-7-base, netbsd-7-2-RELEASE, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1, netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0, netbsd-7, netbsd-6-base, netbsd-6-1-RELEASE, netbsd-6-1-RC4, netbsd-6-1-RC3, netbsd-6-1-RC2, netbsd-6-1-RC1, netbsd-6-1-5-RELEASE, netbsd-6-1-4-RELEASE, netbsd-6-1-3-RELEASE, netbsd-6-1-2-RELEASE, netbsd-6-1-1-RELEASE, netbsd-6-1, netbsd-6-0-RELEASE, netbsd-6-0-RC2, netbsd-6-0-RC1, netbsd-6-0-6-RELEASE, netbsd-6-0-5-RELEASE, netbsd-6-0-4-RELEASE, netbsd-6-0-3-RELEASE, netbsd-6-0-2-RELEASE, netbsd-6-0-1-RELEASE, netbsd-6-0, netbsd-6, matt-premerge-20091211, matt-nb6-plus-nbase, matt-nb6-plus-base, matt-nb6-plus, matt-mips64-premerge-20101231, jym-xensuspend-nbase, jym-xensuspend-base, cherry-xenmp-base, cherry-xenmp, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2, agc-symver-base, agc-symver
Changes since 1.4: +1 -1 lines

fix WARNS=3 issues;
* sprinkle const
* avoid tests < 0 on unsigned types
* test fwrite() returns nmemb not <0

#ifndef CLEANER_H_
#define CLEANER_H_

/*
 * An abbreviated version of the SEGUSE data structure.
 */
struct clfs_seguse {
	u_int32_t nbytes;
	u_int32_t nsums;
	u_int32_t flags;
	u_int64_t lastmod;
	u_int64_t priority;
};

/*
 * The cleaner's view of the superblock data structure.
 */
struct clfs {
	struct dlfs lfs_dlfs;	   /* Leverage LFS lfs_* defines here */

	/* Ifile */
	int clfs_ifilefd;	   /* Ifile file descriptor */
	struct uvnode *lfs_ivnode; /* Ifile vnode */
	struct lfs_fhandle clfs_ifilefh;	   /* Ifile file handle */

	/* Device */
	int clfs_devfd;		   /* Device file descriptor */
	struct uvnode *clfs_devvp; /* Device vnode */
	char *clfs_dev;		   /* Name of device */

	/* Cache of segment status */
	struct clfs_seguse  *clfs_segtab;  /* Abbreviated seguse table */
	struct clfs_seguse **clfs_segtabp; /* pointers to same */

	/* Progress status */
	int clfs_nactive;	   /* How many segments' blocks we have */
	int clfs_onhold;	   /* If cleaning this fs is on hold */
};

/*
 * Fraction of the could-be-clean segments required to be clean.
 */
#define BUSY_LIM 0.5
#define IDLE_LIM 0.9

__BEGIN_DECLS

/* lfs_cleanerd.c */
void pwarn(const char *, ...);
void calc_cb(struct clfs *, int, struct clfs_seguse *);
int clean_fs(struct clfs *, CLEANERINFO *);
void dlog(const char *, ...);
void handle_error(struct clfs **, int);
int init_fs(struct clfs *, char *);
int invalidate_segment(struct clfs *, int);
void lfs_ientry(IFILE **, struct clfs *, ino_t, struct ubuf **);
int load_segment(struct clfs *, int, BLOCK_INFO **, int *);
int needs_cleaning(struct clfs *, CLEANERINFO *);
int32_t parse_pseg(struct clfs *, daddr_t, BLOCK_INFO **, int *);
int reinit_fs(struct clfs *);
void reload_ifile(struct clfs *);
void toss_old_blocks(struct clfs *, BLOCK_INFO **, int *, int *);

/* cleansrv.c */
void check_control_socket(void);
void try_to_become_master(int, char **);

/* coalesce.c */
int log2int(int);
int clean_all_inodes(struct clfs *);
int fork_coalesce(struct clfs *);

__END_DECLS

#endif /* CLEANER_H_ */