1.\"	$NetBSD: lfs_cleanerd.8,v 1.12 2002/09/29 14:05:54 wiz Exp $
2.\"
3.\" Copyright (c) 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"	from: @(#)lfs_cleanerd.8	8.2 (Berkeley) 12/11/93
35.\"
36.Dd December 11, 1993
37.Dt LFS_CLEANERD 8
38.Os
39.Sh NAME
40.Nm lfs_cleanerd
41.Nd garbage collect a log-structured file system
42.Sh SYNOPSIS
43.Nm
44.Op Fl bcdfmqs
45.Op Fl l Ar load-threshhold
46.Op Fl n Ar number-of-segments
47.Op Fl r Ar report-frequency
48.Op Fl t Ar timeout
49.Pa node
50.Sh DESCRIPTION
51The
52.Nm
53command starts a daemon process which garbage-collects
54the log-structured file system residing at the point named by
55.Ar node
56in the global file system namespace.
57This command is normally executed by
58.Xr mount_lfs 8
59when the log-structured file system is mounted.
60The daemon will exit within a few minutes
61of when the file system it was cleaning is unmounted.
62.Pp
63Garbage collection on a log-structured file system is done by scanning
64the file system's segments for active, i.e. referenced, data and copying
65it to new segments.
66When all of the active data in a given segment has been copied to a new
67segment that segment can be marked as empty, thus reclaiming the space
68taken by the inactive data which was in it.
69.Pp
70The following options are available:
71.Bl -tag -width indent
72.It Fl b
73Use bytes written, rather than segments read, when determining how many
74segments to clean at once.
75.It Fl c
76Coalescing mode.
77For each live inode, check to see if it has too many
78blocks that are not contiguous, and if it does, rewrite it.
79After a single pass through the filesystem the cleaner will exit.
80.It Fl d
81Run in debug mode.
82Do not become a daemon process, and print debugging information.
83More
84.Fl d
85s give more detailed debugging information.
86.It Fl f
87Use filesystem idle time as the criterion for aggressive cleaning,
88instead of system load.
89.It Fl l Ar load-threshhold
90Clean more aggressively when the system load is below the given threshhold.
91The default threshhold is 0.2.
92.It Fl m
93Use mmap, rather than rereading the Ifile to update the cleaner's
94knowledge of the filesystem.
95Do not use this option.
96.It Fl n Ar number-of-segments
97Clean this number of segments at a time: that is, pass this many
98segments' blocks through a single call to lfs_markv, or, if
99.Fl b
100was also given, pass this many segments' worth of blocks through a
101single call to lfs_markv.
102.It Fl q
103Quit after cleaning once.
104.It Fl r Ar report-frequency
105Give an efficiency report after every
106.Ar report-frequency
107times through the main loop.
108.It Fl s
109When cleaning the file system,
110send only a few blocks through lfs_markv at a time.
111Don't use this option.
112.It Fl t Ar timeout
113Poll the filesystem every
114.Ar timeout
115seconds, looking for opportunities to clean.
116The default is 300, that is, five minutes.
117Note that
118.Nm
119will be automatically awakened when the filesystem is active,
120so it is not usually necessary to set
121.Ar timeout
122to a low value.
123.El
124.Sh SEE ALSO
125.Xr lfs_bmapv 2 ,
126.Xr lfs_markv 2 ,
127.Xr lfs_segwait 2 ,
128.Xr mount_lfs 8
129.Sh HISTORY
130The
131.Nm
132utility first appeared in
133.Bx 4.4 .
134