version 3.6 master
authorroot <root@rcn1.VSOFS1.COM>
Thu, 23 Jul 2009 22:47:45 +0000 (08:47 +1000)
committerroot <root@rcn1.VSOFS1.COM>
Thu, 23 Jul 2009 22:47:45 +0000 (08:47 +1000)
12 files changed:
Makefile.in [changed mode: 0755->0644]
doc/remote-cache-clean.8 [deleted file]
doc/remote-cache-clean.8.html [deleted file]
doc/remote-cache-clean.8.xml [deleted file]
doc/remote-cache.1 [new file with mode: 0644]
doc/remote-cache.1.html [moved from doc/remote-cache.8.html with 77% similarity]
doc/remote-cache.1.xml [moved from doc/remote-cache.8.xml with 88% similarity]
doc/remote-cache.8 [deleted file]
lib/replace/autoconf-2.60.m4
migrate/remote-cache-clean.py [deleted file]
packaging/RPM/makerpms.sh
packaging/RPM/remote-cache.spec

old mode 100755 (executable)
new mode 100644 (file)
index 9e73500..a093607
@@ -65,28 +65,18 @@ bin/remote-cache: migrate/remote-cache.o migrate/remote-cached.o
        @echo Linking $@
        @$(CC) $(CFLAGS) -o $@ $(CLIENT_OBJ) $(LIB_FLAGS) $(FUSE_LIBS)
 
-doc/remote-cache.8.html: doc/remote-cache.8.xml
+doc/remote-cache.1.html: doc/remote-cache.1.xml
        -test -z "$(XSLTPROC)" || $(XSLTPROC) -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $<
 
-doc/remote-cache.8: doc/remote-cache.8.xml
+doc/remote-cache.1: doc/remote-cache.1.xml
        -test -z "$(XSLTPROC)" || $(XSLTPROC) -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
 
-doc/remote-cache-clean.8.html: doc/remote-cache-clean.8.xml
-       -test -z "$(XSLTPROC)" || $(XSLTPROC) -o $@ http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl $<
-
-doc/remote-cache-clean.8: doc/remote-cache-clean.8.xml
-       -test -z "$(XSLTPROC)" || $(XSLTPROC) -o $@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
-
-doc: doc/remote-cache.8 doc/remote-cache.8.html \
-       doc/remote-cache-clean.8 doc/remote-cache-clean.8.html
+doc: doc/remote-cache.1 doc/remote-cache.1.html
 
 install: $(BINS)
-       ${INSTALLCMD} -m 755 bin/remote-cache $(DESTDIR)$(sbindir)
-       ${INSTALLCMD} -m 755 migrate/remote-cache-clean.py $(DESTDIR)$(sbindir)/remote-cache-clean
-       if [ -f doc/remote-cache.8 ];then ${INSTALLCMD} -d $(DESTDIR)$(mandir)/man8; fi
-       if [ -f doc/remote-cache.8 ];then ${INSTALLCMD} -m 644 doc/remote-cache.8 $(DESTDIR)$(mandir)/man8; fi
-       if [ -f doc/remote-cache-clean.8 ];then ${INSTALLCMD} -d $(DESTDIR)$(mandir)/man8; fi
-       if [ -f doc/remote-cache-clean.8 ];then ${INSTALLCMD} -m 644 doc/remote-cache-clean.8 $(DESTDIR)$(mandir)/man8; fi
+       ${INSTALLCMD} -m 755 bin/remote-cache $(DESTDIR)$(bindir)
+       if [ -f doc/remote-cache.1 ];then ${INSTALLCMD} -d $(DESTDIR)$(mandir)/man1; fi
+       if [ -f doc/remote-cache.1 ];then ${INSTALLCMD} -m 644 doc/remote-cache.1 $(DESTDIR)$(mandir)/man1; fi
 
 clean:
        rm -f *.o */*.o */*/*.o */*~
diff --git a/doc/remote-cache-clean.8 b/doc/remote-cache-clean.8
deleted file mode 100644 (file)
index 88b26b8..0000000
+++ /dev/null
@@ -1,208 +0,0 @@
-'\" t
-.\"     Title: remote-cache-clean
-.\"    Author: Martin Schwenke
-.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
-.\"      Date: 07/23/2009
-.\"    Manual: System administration commands
-.\"    Source: Remote Cache
-.\"  Language: English
-.\"
-.TH "REMOTE\-CACHE\-CLEAN" "8" "07/23/2009" "Remote Cache" "System administration commands"
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-remote-cache-clean \- Clean up a remote\-cache local cache directory
-.SH "SYNOPSIS"
-.HP \w'\fBremote\-cache\-clean\fR\ 'u
-\fBremote\-cache\-clean\fR [\-v | \-\-verbose] [\-l\ \fIfile\fR | \-\-log\-file=\fIfile\fR] [\-n | \-\-dry\-run] [\-\-trim\-old=\fIhours\fR] [\-\-trim\-unused=\fIhours\fR] [\-\-no\-lru] {\fIcache\-root\fR} {\fIhigh\-water\fR} {\fIlow\-water\fR}
-.SH "DESCRIPTION"
-.PP
-remote\-cache\-clean is a script that uses a least recently used algorithm to clean up a local cache directory that is used by remote\-cache\&. The root directory for the cache must be specified via
-\fIcache\-root\fR\&. If the files in
-\fIcache\-root\fR
-consume more than
-\fIhigh\-water\fR
-KB of space then files will be removed from
-\fIcache\-root\fR
-until the space consumed is less than
-\fIlow\-water\fR
-KB\&.
-.PP
-A final pass is done to remove any empty directories\&. No specific attention is paid to metadata files that may appear in each directory\&. The file\-based cleanups treat the metadata files like any other files, removing them if they fit the given criteria\&. Therefore, empty directories are those from which metadata files have also been removed\&.
-.SS "Options"
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB-v, --verbose\fR
-.RS 4
-.PP
-Print information and actions taken to standard output\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB-l <file>, --log-file=<file>\fR
-.RS 4
-.PP
-Append information and actions taken to log <file>\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB-n, --dry-run\fR
-.RS 4
-.PP
-Do not actually delete any files\&. When used with \-v (or \-\-verbose) or \-l (or \-\-log\-file) this can be useful to see what would have been done\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--trim-old=<hours>\fR
-.RS 4
-.PP
-Do an initial pass (before the LRU pass) that removes all files that have been in the cache for longer than <hours>\&. This may not be run if the cache size is below
-\fIlow\-water\fR
-KB\&. However, when it runs it removes all relevant files, so may result in a cache size much smaller than
-\fIlow\-water\fR
-KB\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--trim-unused=<hours>\fR
-.RS 4
-.PP
-Do an initial pass (before the LRU pass) that removes all files that have not been accessed for longer than <hours>\&. This may not be run if the cache size is below
-\fIlow\-water\fR
-KB\&. However, when it runs it removes all relevant files, so may result in a cache size much smaller than
-\fIlow\-water\fR
-KB\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--no-lru\fR
-.RS 4
-.PP
-Do not run the pass that employs the least recently used algorithm\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB-h, --help\fR
-.RS 4
-.PP
-Show a short usage guide\&.
-.RE
-.SH "EXAMPLES"
-.PP
-If /var/cache/remote\-cache contains more than 20MB of file data then remove the most recently used files until it the file usage is below 15MB\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-       remote\-cache\-clean /var/cache/remote\-cache 20000 15000
-      
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-As above, but also logs actions to /var/log/remote\-cache\-clean\&.log and also to the screen\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-       remote\-cache\-clean \-v \-l /var/log/remote\-cache\-clean\&.log  \e
-               /var/cache/remote\-cache 20000 15000
-      
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-Like the first example, but first removes all files that have been in the cache for more than 3 days, if the cache size is over 20MB\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-       remote\-cache\-clean \-\-trim\-old=72 \e
-               /var/cache/remote\-cache 20000 15000
-      
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.SH "SEE ALSO"
-.PP
-remote\-cache(8)
-.SH "BUGS"
-.PP
-remote\-cache\-clean builds a file list at the start of processing and does not recheck file space usage\&. Therefore, if the cache is in use during clean\-up then, upon completion, files may consume more space than the specified low water mark\&.
-.PP
-remote\-cache\-clean does not take into account space used by directories or inodes\&. It concentrates only on file space\&. Therefore, running du(1) on the cache\-root will indicate extra space usage\&. A future version of remote\-cache clean will remove empty directories to mitigate this by some amount\&.
-.SH "COPYRIGHT/LICENSE"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-remote\-cache\-clean is Copyright (C) Martin Schwenke 2009
-
-remote\-cache is Copyright (C) Ronnie Sahlberg 2008
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at
-your option) any later version\&.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\&.  See the GNU
-General Public License for more details\&.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, see http://www\&.gnu\&.org/licenses/\&.
-.fi
-.if n \{\
-.RE
-.\}
-.SH "AUTHOR"
-.PP
-\fBMartin Schwenke\fR
-.RS 4
-Wrote remote\-cache\-clean and this documentation
-.RE
diff --git a/doc/remote-cache-clean.8.html b/doc/remote-cache-clean.8.html
deleted file mode 100644 (file)
index c1f7f4e..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>remote-cache-clean</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" title="remote-cache-clean"><a name="remote-cache-clean.1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>remote-cache-clean &#8212; Clean up a remote-cache local cache directory</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">remote-cache-clean</code>  [ -v  |   --verbose ] [ -l <em class="replaceable"><code>file</code></em>  |   --log-file=<em class="replaceable"><code>file</code></em> ] [ -n  |   --dry-run ] [--trim-old=<em class="replaceable"><code>hours</code></em>] [--trim-unused=<em class="replaceable"><code>hours</code></em>] [--no-lru] {<em class="replaceable"><code>cache-root</code></em>} {<em class="replaceable"><code>high-water</code></em>} {<em class="replaceable"><code>low-water</code></em>}</p></div></div><div class="refsect1" title="DESCRIPTION"><a name="id2620559"></a><h2>DESCRIPTION</h2><p>
-      remote-cache-clean is a script that uses a least recently used
-      algorithm to clean up a local cache directory that is used by
-      remote-cache.  The root directory for the cache must be
-      specified via <em class="replaceable"><code>cache-root</code></em>.  If the
-      files in <em class="replaceable"><code>cache-root</code></em> consume more than
-      <em class="replaceable"><code>high-water</code></em> KB of space then files
-      will be removed from <em class="replaceable"><code>cache-root</code></em> until
-      the space consumed is less than
-      <em class="replaceable"><code>low-water</code></em> KB.
-    </p><p>
-      A final pass is done to remove any empty directories.  No
-      specific attention is paid to metadata files that may appear in
-      each directory.  The file-based cleanups treat the metadata
-      files like any other files, removing them if they fit the given
-      criteria.  Therefore, empty directories are those from which
-      metadata files have also been removed.
-    </p><div class="refsect2" title="Options"><a name="id2620601"></a><h3>Options</h3><div class="refsect3" title="-v, --verbose"><a name="id2620607"></a><h4>-v, --verbose</h4><p>
-         Print information and actions taken to standard output.
-       </p></div><div class="refsect3" title="-l &lt;file&gt;, --log-file=&lt;file&gt;"><a name="id2620618"></a><h4>-l &lt;file&gt;, --log-file=&lt;file&gt;</h4><p>
-         Append information and actions taken to log &lt;file&gt;.
-       </p></div><div class="refsect3" title="-n, --dry-run"><a name="id2620630"></a><h4>-n, --dry-run</h4><p>
-         Do not actually delete any files.  When used with -v (or
-         --verbose) or -l (or --log-file) this can be useful to see
-         what would have been done.
-       </p></div><div class="refsect3" title="--trim-old=&lt;hours&gt;"><a name="id2620643"></a><h4>--trim-old=&lt;hours&gt;</h4><p>
-         Do an initial pass (before the LRU pass) that removes all
-         files that have been in the cache for longer than
-         &lt;hours&gt;.  This may not be run if the cache size is
-         below <em class="replaceable"><code>low-water</code></em> KB.  However,
-         when it runs it removes all relevant files, so may result in
-         a cache size much smaller than
-         <em class="replaceable"><code>low-water</code></em> KB.
-       </p></div><div class="refsect3" title="--trim-unused=&lt;hours&gt;"><a name="id2620667"></a><h4>--trim-unused=&lt;hours&gt;</h4><p>
-         Do an initial pass (before the LRU pass) that removes all
-         files that have not been accessed for longer than
-         &lt;hours&gt;.  This may not be run if the cache size is
-         below <em class="replaceable"><code>low-water</code></em> KB.  However,
-         when it runs it removes all relevant files, so may result in
-         a cache size much smaller than
-         <em class="replaceable"><code>low-water</code></em> KB.
-       </p></div><div class="refsect3" title="--no-lru"><a name="id2620690"></a><h4>--no-lru</h4><p>
-         Do not run the pass that employs the least recently used
-         algorithm.
-       </p></div><div class="refsect3" title="-h, --help"><a name="id2620702"></a><h4>-h, --help</h4><p>
-         Show a short usage guide.
-       </p></div></div></div><div class="refsect1" title="EXAMPLES"><a name="id2620714"></a><h2>EXAMPLES</h2><p>
-      If /var/cache/remote-cache contains more than 20MB of file data
-      then remove the most recently used files until it the file usage
-      is below 15MB.
-      </p><pre class="screen">
-       remote-cache-clean /var/cache/remote-cache 20000 15000
-      </pre><p>    
-    </p><p>
-      As above, but also logs actions to
-      /var/log/remote-cache-clean.log and also to the screen.
-      </p><pre class="screen">
-       remote-cache-clean -v -l /var/log/remote-cache-clean.log  \
-               /var/cache/remote-cache 20000 15000
-      </pre><p>    
-    </p><p>
-      Like the first example, but first removes all files that have
-      been in the cache for more than 3 days, if the cache size is
-      over 20MB.
-      </p><pre class="screen">
-       remote-cache-clean --trim-old=72 \
-               /var/cache/remote-cache 20000 15000
-      </pre><p>    
-    </p></div><div class="refsect1" title="SEE ALSO"><a name="id2620758"></a><h2>SEE ALSO</h2><p>
-      remote-cache(8)
-    </p></div><div class="refsect1" title="BUGS"><a name="id2620767"></a><h2>BUGS</h2><p>
-      remote-cache-clean builds a file list at the start of processing
-      and does not recheck file space usage.  Therefore, if the cache
-      is in use during clean-up then, upon completion, files may
-      consume more space than the specified low water mark.
-    </p><p>
-      remote-cache-clean does not take into account space used by
-      directories or inodes.  It concentrates only on file space.
-      Therefore, running du(1) on the cache-root will indicate extra
-      space usage.  A future version of remote-cache clean will remove
-      empty directories to mitigate this by some amount.
-    </p></div><div class="refsect1" title="COPYRIGHT/LICENSE"><a name="id2669303"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
-remote-cache-clean is Copyright (C) Martin Schwenke 2009<br>
-<br>
-remote-cache is Copyright (C) Ronnie Sahlberg 2008<br>
-<br>
-This program is free software; you can redistribute it and/or modify<br>
-it under the terms of the GNU General Public License as published by<br>
-the Free Software Foundation; either version 3 of the License, or (at<br>
-your option) any later version.<br>
-<br>
-This program is distributed in the hope that it will be useful, but<br>
-WITHOUT ANY WARRANTY; without even the implied warranty of<br>
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU<br>
-General Public License for more details.<br>
-<br>
-You should have received a copy of the GNU General Public License<br>
-along with this program; if not, see http://www.gnu.org/licenses/.<br>
-</p></div></div></div></body></html>
diff --git a/doc/remote-cache-clean.8.xml b/doc/remote-cache-clean.8.xml
deleted file mode 100644 (file)
index 51c1d91..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
-<refentry id="remote-cache-clean.1">
-  
-  <refmeta>
-    <refentrytitle>remote-cache-clean</refentrytitle>
-    <manvolnum>8</manvolnum>
-    <refmiscinfo class="source">Remote Cache</refmiscinfo>
-    <refmiscinfo class="manual">System administration commands</refmiscinfo>
-  
-  </refmeta>
-
-  <info>
-    <author>
-      <personname>Martin Schwenke</personname>
-      <contrib>Wrote remote-cache-clean and this documentation</contrib>
-    </author>
-  </info>
-
-  <refnamediv>
-    <refname>remote-cache-clean</refname>
-    <refpurpose>Clean up a remote-cache local cache directory</refpurpose>
-  </refnamediv>
-  
-  <refsynopsisdiv>
-    <cmdsynopsis>
-      <command>remote-cache-clean</command>
-      <group>
-       <arg choice="plain">-v</arg>
-       <arg choice="plain">--verbose</arg>
-      </group>
-      <group>
-       <arg choice="plain">-l <replaceable>file</replaceable></arg>
-       <arg choice="plain">--log-file=<replaceable>file</replaceable></arg>
-      </group>
-      <group>
-       <arg choice="plain">-n</arg>
-       <arg choice="plain">--dry-run</arg>
-      </group>
-      <arg choice="opt">--trim-old=<replaceable>hours</replaceable></arg>
-      <arg choice="opt">--trim-unused=<replaceable>hours</replaceable></arg>
-      <arg choice="opt">--no-lru</arg>
-      <arg choice="req"><replaceable>cache-root</replaceable></arg>
-      <arg choice="req"><replaceable>high-water</replaceable></arg>
-      <arg choice="req"><replaceable>low-water</replaceable></arg>
-    </cmdsynopsis>
-  </refsynopsisdiv>
-  
-  <refsect1>
-    <title>DESCRIPTION</title>
-    <para>
-      remote-cache-clean is a script that uses a least recently used
-      algorithm to clean up a local cache directory that is used by
-      remote-cache.  The root directory for the cache must be
-      specified via <replaceable>cache-root</replaceable>.  If the
-      files in <replaceable>cache-root</replaceable> consume more than
-      <replaceable>high-water</replaceable> KB of space then files
-      will be removed from <replaceable>cache-root</replaceable> until
-      the space consumed is less than
-      <replaceable>low-water</replaceable> KB.
-    </para>
-
-    <para>
-      A final pass is done to remove any empty directories.  No
-      specific attention is paid to metadata files that may appear in
-      each directory.  The file-based cleanups treat the metadata
-      files like any other files, removing them if they fit the given
-      criteria.  Therefore, empty directories are those from which
-      metadata files have also been removed.
-    </para>
-
-    <refsect2>
-      <title>Options</title>
-
-      <refsect3>
-       <title>-v, --verbose</title>
-       <para>
-         Print information and actions taken to standard output.
-       </para>
-      </refsect3>
-
-      <refsect3>
-       <title>-l &lt;file&gt;, --log-file=&lt;file&gt;</title>
-       <para>
-         Append information and actions taken to log &lt;file&gt;.
-       </para>
-      </refsect3>
-
-      <refsect3>
-       <title>-n, --dry-run</title>
-       <para>
-         Do not actually delete any files.  When used with -v (or
-         --verbose) or -l (or --log-file) this can be useful to see
-         what would have been done.
-       </para>
-      </refsect3>
-
-      <refsect3>
-       <title>--trim-old=&lt;hours&gt;</title>
-       <para>
-         Do an initial pass (before the LRU pass) that removes all
-         files that have been in the cache for longer than
-         &lt;hours&gt;.  This may not be run if the cache size is
-         below <replaceable>low-water</replaceable> KB.  However,
-         when it runs it removes all relevant files, so may result in
-         a cache size much smaller than
-         <replaceable>low-water</replaceable> KB.
-       </para>
-      </refsect3>
-
-      <refsect3>
-       <title>--trim-unused=&lt;hours&gt;</title>
-       <para>
-         Do an initial pass (before the LRU pass) that removes all
-         files that have not been accessed for longer than
-         &lt;hours&gt;.  This may not be run if the cache size is
-         below <replaceable>low-water</replaceable> KB.  However,
-         when it runs it removes all relevant files, so may result in
-         a cache size much smaller than
-         <replaceable>low-water</replaceable> KB.
-       </para>
-      </refsect3>
-
-      <refsect3>
-       <title>--no-lru</title>
-       <para>
-         Do not run the pass that employs the least recently used
-         algorithm.
-       </para>
-      </refsect3>
-
-      <refsect3>
-       <title>-h, --help</title>
-       <para>
-         Show a short usage guide.
-       </para>
-      </refsect3>
-
-    </refsect2>
-  </refsect1>
-
-  <refsect1><title>EXAMPLES</title>
-    <para>
-      If /var/cache/remote-cache contains more than 20MB of file data
-      then remove the most recently used files until it the file usage
-      is below 15MB.
-      <screen format="linespecific">
-       remote-cache-clean /var/cache/remote-cache 20000 15000
-      </screen>    
-    </para>
-
-    <para>
-      As above, but also logs actions to
-      /var/log/remote-cache-clean.log and also to the screen.
-      <screen format="linespecific">
-       remote-cache-clean -v -l /var/log/remote-cache-clean.log  \
-               /var/cache/remote-cache 20000 15000
-      </screen>    
-    </para>
-
-    <para>
-      Like the first example, but first removes all files that have
-      been in the cache for more than 3 days, if the cache size is
-      over 20MB.
-      <screen format="linespecific">
-       remote-cache-clean --trim-old=72 \
-               /var/cache/remote-cache 20000 15000
-      </screen>    
-    </para>
-
-  </refsect1>
-
-  <refsect1><title>SEE ALSO</title>
-    <para>
-      remote-cache(8)
-    </para>
-  </refsect1>
-
-  <refsect1><title>BUGS</title>
-    <para>
-      remote-cache-clean builds a file list at the start of processing
-      and does not recheck file space usage.  Therefore, if the cache
-      is in use during clean-up then, upon completion, files may
-      consume more space than the specified low water mark.
-    </para>
-
-    <para>
-      remote-cache-clean does not take into account space used by
-      directories or inodes.  It concentrates only on file space.
-      Therefore, running du(1) on the cache-root will indicate extra
-      space usage.  A future version of remote-cache clean will remove
-      empty directories to mitigate this by some amount.
-    </para>
-
-  </refsect1>
-
-  <refsect1><title>COPYRIGHT/LICENSE</title>
-<literallayout>
-remote-cache-clean is Copyright (C) Martin Schwenke 2009
-
-remote-cache is Copyright (C) Ronnie Sahlberg 2008
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at
-your option) any later version.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, see http://www.gnu.org/licenses/.
-</literallayout>
-  </refsect1>
-</refentry>
diff --git a/doc/remote-cache.1 b/doc/remote-cache.1
new file mode 100644 (file)
index 0000000..5c49dd2
--- /dev/null
@@ -0,0 +1,235 @@
+.\"     Title: remote-cache
+.\"    Author: 
+.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
+.\"      Date: 04/07/2009
+.\"    Manual: 
+.\"    Source: 
+.\"
+.TH "REMOTE\-CACHE" "1" "04/07/2009" "" ""
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.SH "NAME"
+remote-cache - Read-Mostly caching daemon for re-exporting remote NFS shares
+.SH "SYNOPSIS"
+.HP 282
+\fBremote\-cache \-\-export=DIR \-\-cache=DIR \-\-remote=DIR [\-\-max\-dir\-cache=TIMEOUT] [\-\-dir\-min\-inodes=INTEGER] [\-\-dir\-min\-blocks=INTEGER] [\-\-file\-min\-inodes=INTEGER] [\-\-file\-min\-blocks=INTEGER] [\-\-file\-max\-size=MB] [\-\-file\-check\-parent\-mtime] [\-\-file\-min\-mtime\-age=SECONDS] [\-\-read\-write]
+               \fR\fBremote\-cache \-\-unexport=DIR
+               \fR
+.SH "DESCRIPTION"
+.PP
+Remote\-cache is a fuse module that is used to create a local read\-mostly cached copy of a remote NFS share\. The purpose of this is to provide a local cache of a remote NFS share in order to provide access to the data\. NFS is VERY painful and slow to use across >100ms links\.
+.PP
+The default is to provide a read\-only cached copy of the filesystem but read\-write can be provided using the \-\-read\-write option\. In read\-write mode any writes or metadata changes will be passed\-through to the remote site as well as the local cache for the file and or directory will be flushed\. Write performance is thus slow\.
+.PP
+Eventhough read\-write is supported, write is veryu slow so remote\-cache should only be used in read\-mostly environments\.
+.SS "\-\-remote"
+.PP
+This specifies the mountpoint where the remote NFS server is mounted\. This is the remote share we will "wan\-accelerate" using remote\-cache\.
+.PP
+This share should be mounted using soft and intr\.
+.PP
+A good choice of options to mount the remote share with are :
+.sp
+.RS 4
+.nf
+      mount \-o soft,intr,actimeo=600 REMOTE\-SERVER:/share /mnt/remote\-share
+      
+.fi
+.RE
+.sp
+.SS "\-\-cache"
+.PP
+This controls which local directory to store the cached copies of the files/data from the share\.
+.PP
+Mtime of the objects are used to track whether an object in the cache is up to data or needs to be remigrated\.
+.SS "\-\-export"
+.PP
+This specifies the mountpoint where this fuse module will attach\. When accessing data through this mountpoint, the fuse module will either return data from the local cache, or if the local cache does not contain an up to date copy of that object, it will instead pass through the request to the remote site\.
+.PP
+This directory can be re\-exported read\-only or read\-write by the local NFS server to clients on the local site\.
+.SS "\-\-unexport"
+.PP
+This command will unexport a remote\-cache exported filesystem and shut down all associated background daemons\.
+.SS "\-\-max\-dir\-cache"
+.PP
+Directory content is cached for each directory containing the list of object names that are stored in the directory and also the full stat() information for the objects\.
+.PP
+This parameter controls how long a directory will be cached before it is flushed and re\-read from the remote site\.
+.PP
+This parameter defaults to 0, meaning that once a directory has been cached, it will remain cached forever, or until the mtime of the directory on the remote site changes\.
+.PP
+This means that a directory once cached will remain cached forever until its mtime has changed\. I\.e\. when entries have been added/deleted to the directory\. But since we also cache all the attributes for the child objects in this cache it also means that we will not detect changes to actual child files\. I\.e\. we will not detect if a file has been written to/modified since this does not cause the mtime of the parent directory to change which in turn means we will not flush our cache\. This is by design\.
+.SS "\-\-dir\-min\-inodes"
+.PP
+This parameter defaults to 100\.
+.PP
+When there are less than this number of free inodes in the cache file system remote\-cache will no longer add new directories to the directory structure cache\. When this happens, clients will still be able to access/list these directories but it will be slow since the directories will not be cached and all access will be passed through to the remote site\.
+.PP
+This will be logged with an entry similar to
+.sp
+.RS 4
+.nf
+    2008/06/10 12:24:41\.582921 [ 1605]: Cache is full\. Only 74 inodes left in /gpfs/cache\. Can not build local cache of directory /mnt/nfs/export
+    
+.fi
+.RE
+.sp
+.SS "\-\-dir\-min\-blocks"
+.PP
+This parameter defaults to 1000\.
+.PP
+When there are less than this number of free blocks in the cache file system remote\-cache will no longer add new directories to the directory structure cache\. When this happens, clients will still be able to access/list these directories but it will be slow since the directories will not be cached and all access will be passed through to the remote site\.
+.PP
+This will be logged with an entry similar to
+.sp
+.RS 4
+.nf
+    2008/06/10 12:24:41\.582921 [ 1605]: Cache is full\. Only 237 blocks left in /gpfs/cache\. Can not build local cache of directory /mnt/nfs/export
+    
+.fi
+.RE
+.sp
+.SS "\-\-file\-min\-inodes"
+.PP
+This parameter defaults to 100\.
+.PP
+When there are less than this number of free inodes in the cache file system remote\-cache will no longer add more files to the cache\. When this happens, clients will still be able to access/read these files but it will be slow since all reads will be passed through to the remote site\.
+.PP
+This will be logged with an entry similar to
+.sp
+.RS 4
+.nf
+    2008/06/10 12:24:41\.582921 [ 1605]: Cache is full\. Only 74 inodes left in /gpfs/cache\. Can not build add file /mnt/nfs/export/foo to the cache
+    
+.fi
+.RE
+.sp
+.SS "\-\-file\-min\-blocks"
+.PP
+This parameter defaults to 10000\.
+.PP
+When there are less than this number of free blocks in the cache file system remote\-cache will no longer add more files to the cache\. When this happens, clients will still be able to access/read these files but it will be slow since all i/o will be passed through to the remote site\.
+.PP
+This will be logged with an entry similar to
+.sp
+.RS 4
+.nf
+    2008/06/10 12:24:41\.582921 [ 1605]: Cache is full\. Only 237 blocks left in /gpfs/cache\. Can not build add file /mnt/nfs/export/foo to the cache
+    
+.fi
+.RE
+.sp
+.SS "\-\-file\-max\-size"
+.PP
+This parameter defaults to 0\.
+.PP
+Maximum size in MB of files to cache\. Files larger than this will not be copied to the local cache\.
+.PP
+When set to 0 there will be no size limitation of files to cache\.
+.SS "\-\-file\-migrate\-max\-concurrent"
+.PP
+This parameter defaults to 1000\.
+.PP
+Maximum number of concurrent migrations of files we allow before we start failing the migration\. Note that failing a migration is not a severe issue, it just means that the file will be migrate a little while later instead next time it is accessed\.
+.SS "\-\-file\-check\-parent\-mtime"
+.PP
+This paranter can only be used in environments where files are created/deleted but where files are never modified after being created\. Never use this option unless this is true for the i/o patterns of the environment\.
+.PP
+If the environment is an archive server or similar where files, once they have been created are never changed\. Then it is possible to use a more aggressive caching strategy for attributes and instead look at the mtime of the parent directory and the cached directory entries to determine whether the cached file is up to date\. This greatly reduces the amount of GETATTR calls that are issued to the remote site and also greatly reduses the stress on the local nfs clients attribute cache since we only cache the attributes for the directories and never for the leaf objects/files\.
+.PP
+The process works as follows : First get the attributes for the parent directory on the remote site (which most of the time will come out of the nfs clients attribute cache), then compare the mtime with the mtime of the parent directory in the cache directory\. If the directory mtime\'s are the same, then we read the attributes for the file from the local cached copy and return to the client instead of the attributes off the remote server\.
+.SS "\-\-file\-min\-mtime\-age=SECONDS"
+.PP
+Do not migrate the file to the cache if it was changed (based on mtime) less than this many seconds ago\.
+.PP
+This parameter defaults to 120 seconds\.
+.SS "\-\-read\-write"
+.PP
+EXPERIMENTAL\.
+.PP
+This allows the filesystem to be exported read\-write\. All data or metadata changing operations are passed through to the master server and the local cache is invalidated\. Do NOT use this option together with \-\-file\-check\-parent\-mtime\.
+.PP
+Since in this mode all writes are pass\-through, writes will be slow\.
+.SH "EXAMPLES"
+.PP
+Mount the remote server/share on a local mountpoint\.
+.sp
+.RS 4
+.nf
+    mount \-o ro,soft,intr,actimeo=600 REMOTE\-SERVER:/remote\-share /mnt/remote\-share
+    
+.fi
+.RE
+.PP
+Create a local export and cache directory
+.sp
+.RS 4
+.nf
+    mkdir /export/data
+    mkdir /export/cache
+    
+.fi
+.RE
+.PP
+Startup remote\-cache
+.sp
+.RS 4
+.nf
+    remote\-cache \-\-export=/export/data \-\-cache=/export/cache \-\-remote=/mnt/remote\-share
+    
+.fi
+.RE
+.PP
+You can now access the share through /export/data which should be much much faster than accessing it through /mnt/remote\-share if the remote server is more than 10ms away\. Also look in the /export/cache directory to see when/which files are currently cached locally\.
+.SH "CACHE CLEANUP"
+.PP
+Removing data from the cache to reclaim space is easy\.
+.PP
+For files you can just delete them with "rm"\.
+.PP
+If you want to remove an entire directory tree from the cache it is more complex\. For this you must first rename (mv) the directory to something else and then you can "rm \-rf" that renamed directory tree\.
+.SH "LOGGING"
+.PP
+All debug and error messages are logged to /var/log/log\.remote\-cache\.
+.PP
+The log level can be controlled by the \-\-debug=X command line parameter\. The default is 0 : ERROR\.
+.PP
+Possible debuglevels are :
+.sp
+.RS 4
+.nf
+        0: ERROR
+        1: WARNING
+        2: NOTICE
+        3: INFO
+        4: DEBUG
+    
+.fi
+.RE
+.sp
+.SH "SEE ALSO"
+.PP
+ctdbd(1), ctdb(1),
+\fI\%http://ctdb.samba.org/\fR
+.SH "COPYRIGHT/LICENSE"
+.sp
+.RS 4
+.nf
+Copyright (C) Ronnie Sahlberg 2008
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or (at
+your option) any later version\.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\.  See the GNU
+General Public License for more details\.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, see http://www\.gnu\.org/licenses/\.
+.fi
+.RE
similarity index 77%
rename from doc/remote-cache.8.html
rename to doc/remote-cache.1.html
index 266485298c3863d0be153556a5b7319abffb6eee..010825ff512700ac1d98f2f791fd5120899b955a 100644 (file)
@@ -1,6 +1,6 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>remote-cache</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" title="remote-cache"><a name="remote-cache.8"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>remote-cache &#8212; Read-Mostly caching daemon for re-exporting remote NFS shares</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">remote-cache</code>  --export=DIR --cache=DIR --remote=DIR [--max-dir-cache=TIMEOUT] [--dir-min-inodes=INTEGER] [--dir-min-blocks=INTEGER] [--file-min-inodes=INTEGER] [--file-min-blocks=INTEGER] [--file-max-size=MB] [--file-check-parent-mtime] [--file-min-mtime-age=SECONDS] [--read-write]
-       </p></div><div class="cmdsynopsis"><p><code class="command">remote-cache</code>  --unexport=DIR
-       </p></div></div><div class="refsect1" title="DESCRIPTION"><a name="id2897436"></a><h2>DESCRIPTION</h2><p>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>remote-cache</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en"><a name="onnode.1"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>remote-cache &#8212; Read-Mostly caching daemon for re-exporting remote NFS shares</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">remote-cache --export=DIR --cache=DIR --remote=DIR [--max-dir-cache=TIMEOUT] [--dir-min-inodes=INTEGER] [--dir-min-blocks=INTEGER] [--file-min-inodes=INTEGER] [--file-min-blocks=INTEGER] [--file-max-size=MB] [--file-check-parent-mtime] [--file-min-mtime-age=SECONDS] [--read-write]
+               </code> <br><code class="command">remote-cache --unexport=DIR
+               </code> </p></div></div><div class="refsect1" lang="en"><a name="id2478339"></a><h2>DESCRIPTION</h2><p>
     Remote-cache is a fuse module that is used to create a local read-mostly 
     cached copy of a remote NFS share. The purpose of this is to provide a
     local cache of a remote NFS share in order to provide access to the data.
@@ -13,7 +13,7 @@
       directory will be flushed. Write performance is thus slow.
     </p><p>
       Eventhough read-write is supported, write is veryu slow so remote-cache should only be used in read-mostly environments.
-    </p><div class="refsect2" title="Options"><a name="id2897463"></a><h3>Options</h3><div class="refsect3" title="--remote"><a name="id2897468"></a><h4>--remote</h4><p>
+    </p><div class="refsect2" lang="en"><a name="id2478367"></a><h3>--remote</h3><p>
     This specifies the mountpoint where the remote NFS server is mounted.
     This is the remote share we will "wan-accelerate" using remote-cache.
     </p><p>
       </p><pre class="screen">
       mount -o soft,intr,actimeo=600 REMOTE-SERVER:/share /mnt/remote-share
       </pre><p>
-    </p></div><div class="refsect3" title="--cache"><a name="id2896854"></a><h4>--cache</h4><p>
+    </p></div><div class="refsect2" lang="en"><a name="id2478392"></a><h3>--cache</h3><p>
     This controls which local directory to store the cached copies of the
     files/data from the share.
     </p><p>
     Mtime of the objects are used to track whether an object in the cache
     is up to data or needs to be remigrated.
-    </p></div><div class="refsect3" title="--export"><a name="id2896870"></a><h4>--export</h4><p>
+    </p></div><div class="refsect2" lang="en"><a name="id2478408"></a><h3>--export</h3><p>
     This specifies the mountpoint where this fuse module will attach.
     When accessing data through this mountpoint, the fuse module will either
     return data from the local cache, or if the local cache does not contain
     </p><p>
     This directory can be re-exported read-only or read-write by the local NFS server to
     clients on the local site.
-    </p></div><div class="refsect3" title="--unexport"><a name="id2896890"></a><h4>--unexport</h4><p>
+    </p></div><div class="refsect2" lang="en"><a name="id2478428"></a><h3>--unexport</h3><p>
       This command will unexport a remote-cache exported filesystem and shut
       down all associated background daemons.
-    </p></div><div class="refsect3" title="--max-dir-cache"><a name="id2896901"></a><h4>--max-dir-cache</h4><p>
+    </p></div><div class="refsect2" lang="en"><a name="id2479571"></a><h3>--max-dir-cache</h3><p>
     Directory content is cached for each directory containing the list of
     object names that are stored in the directory and also the full stat()
     information for the objects.
@@ -61,7 +61,7 @@
     I.e. we will not detect if a file has been written to/modified since
     this does not cause the mtime of the parent directory to change
     which in turn means we will not flush our cache. This is by design.
-    </p></div><div class="refsect3" title="--dir-min-inodes"><a name="id2896937"></a><h4>--dir-min-inodes</h4><p>
+    </p></div><div class="refsect2" lang="en"><a name="id2479608"></a><h3>--dir-min-inodes</h3><p>
     This parameter defaults to 100.
     </p><p>
     When there are less than this number of free inodes in the cache file system
@@ -74,7 +74,7 @@
     </p><pre class="screen">
     2008/06/10 12:24:41.582921 [ 1605]: Cache is full. Only 74 inodes left in /gpfs/cache. Can not build local cache of directory /mnt/nfs/export
     </pre><p>
-    </p></div><div class="refsect3" title="--dir-min-blocks"><a name="id2896968"></a><h4>--dir-min-blocks</h4><p>
+    </p></div><div class="refsect2" lang="en"><a name="id2479639"></a><h3>--dir-min-blocks</h3><p>
     This parameter defaults to 1000.
     </p><p>
     When there are less than this number of free blocks in the cache file system
@@ -87,7 +87,7 @@
     </p><pre class="screen">
     2008/06/10 12:24:41.582921 [ 1605]: Cache is full. Only 237 blocks left in /gpfs/cache. Can not build local cache of directory /mnt/nfs/export
     </pre><p>
-    </p></div><div class="refsect3" title="--file-min-inodes"><a name="id2897000"></a><h4>--file-min-inodes</h4><p>
+    </p></div><div class="refsect2" lang="en"><a name="id2479670"></a><h3>--file-min-inodes</h3><p>
     This parameter defaults to 100.
     </p><p>
     When there are less than this number of free inodes in the cache file system
     </p><pre class="screen">
     2008/06/10 12:24:41.582921 [ 1605]: Cache is full. Only 74 inodes left in /gpfs/cache. Can not build add file /mnt/nfs/export/foo to the cache
     </pre><p>
-    </p></div><div class="refsect3" title="--file-min-blocks"><a name="id2897031"></a><h4>--file-min-blocks</h4><p>
+    </p></div><div class="refsect2" lang="en"><a name="id2479700"></a><h3>--file-min-blocks</h3><p>
     This parameter defaults to 10000.
     </p><p>
     When there are less than this number of free blocks in the cache file system
     </p><pre class="screen">
     2008/06/10 12:24:41.582921 [ 1605]: Cache is full. Only 237 blocks left in /gpfs/cache. Can not build add file /mnt/nfs/export/foo to the cache
     </pre><p>
-    </p></div><div class="refsect3" title="--file-max-size"><a name="id2897062"></a><h4>--file-max-size</h4><p>
+    </p></div><div class="refsect2" lang="en"><a name="id2479731"></a><h3>--file-max-size</h3><p>
     This parameter defaults to 0.
     </p><p>
     Maximum size in MB of files to cache. Files larger than this will not be
     copied to the local cache.
     </p><p>
     When set to 0 there will be no size limitation of files to cache.
-    </p></div><div class="refsect3" title="--file-migrate-max-concurrent"><a name="id2897081"></a><h4>--file-migrate-max-concurrent</h4><p>
+    </p></div><div class="refsect2" lang="en"><a name="id2479751"></a><h3>--file-migrate-max-concurrent</h3><p>
     This parameter defaults to 1000.
     </p><p>
     Maximum number of concurrent migrations of files we allow before we start
 
     Note that failing a migration is not a severe issue, it just means that the
     file will be migrate a little while later instead next time it is accessed.
-    </p></div><div class="refsect3" title="--file-check-parent-mtime"><a name="id2897099"></a><h4>--file-check-parent-mtime</h4><p>
+    </p></div><div class="refsect2" lang="en"><a name="id2479768"></a><h3>--file-check-parent-mtime</h3><p>
     This paranter can only be used in environments where files are 
     created/deleted but where files are never modified after being created.
     Never use this option unless this is true for the i/o patterns of the
     are the same, then we read the attributes for the file from the local
     cached copy and return to the client instead of the attributes off the
     remote server.
-    </p></div><div class="refsect3" title="--file-min-mtime-age=SECONDS"><a name="id2949815"></a><h4>--file-min-mtime-age=SECONDS</h4><p>
+    </p></div><div class="refsect2" lang="en"><a name="id2479805"></a><h3>--file-min-mtime-age=SECONDS</h3><p>
     Do not migrate the file to the cache if it was changed (based on mtime)
     less than this many seconds ago.
     </p><p>
     This parameter defaults to 120 seconds.
-    </p></div><div class="refsect3" title="--read-write"><a name="id2949830"></a><h4>--read-write</h4><p>
+    </p></div><div class="refsect2" lang="en"><a name="id2479820"></a><h3>--read-write</h3><p>
     EXPERIMENTAL.
     </p><p>
     This allows the filesystem to be exported read-write. All data or metadata
     cache is invalidated. Do NOT use this option together with --file-check-parent-mtime.
     </p><p>
     Since in this mode all writes are pass-through, writes will be slow.
-    </p></div></div></div><div class="refsect1" title="EXAMPLES"><a name="id2949853"></a><h2>EXAMPLES</h2><p>
+    </p></div></div><div class="refsect1" lang="en"><a name="id2528489"></a><h2>EXAMPLES</h2><p>
     Mount the remote server/share on a local mountpoint.
     </p><pre class="screen">
     mount -o ro,soft,intr,actimeo=600 REMOTE-SERVER:/remote-share /mnt/remote-share
     You can now access the share through /export/data which should be much much 
     faster than accessing it through /mnt/remote-share if the remote server is more than 10ms away.
     Also look in the /export/cache directory to see when/which files are currently cached locally.
-    </p></div><div class="refsect1" title="CACHE CLEANUP"><a name="id2949899"></a><h2>CACHE CLEANUP</h2><p>
+    </p></div><div class="refsect1" lang="en"><a name="id2528536"></a><h2>CACHE CLEANUP</h2><p>
   Removing data from the cache to reclaim space is easy.
   </p><p>
   For files you can just delete them with "rm".
   If you want to remove an entire directory tree from the cache it is more
   complex. For this you must first rename (mv) the directory to something else
   and then you can "rm -rf" that renamed directory tree.
-  </p></div><div class="refsect1" title="LOGGING"><a name="id2949921"></a><h2>LOGGING</h2><p>
+  </p></div><div class="refsect1" lang="en"><a name="id2528557"></a><h2>LOGGING</h2><p>
     All debug and error messages are logged to /var/log/log.remote-cache.
     </p><p>
     The log level can be controlled by the --debug=X command line parameter.
         3: INFO
         4: DEBUG
     </pre><p>
-    </p></div><div class="refsect1" title="SEE ALSO"><a name="id2949947"></a><h2>SEE ALSO</h2><p>
+    </p></div><div class="refsect1" lang="en"><a name="id2528583"></a><h2>SEE ALSO</h2><p>
       ctdbd(1), ctdb(1), <a class="ulink" href="http://ctdb.samba.org/" target="_top">http://ctdb.samba.org/</a>
-    </p></div><div class="refsect1" title="COPYRIGHT/LICENSE"><a name="id2949960"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
+    </p></div><div class="refsect1" lang="en"><a name="id2528596"></a><h2>COPYRIGHT/LICENSE</h2><div class="literallayout"><p><br>
 Copyright (C) Ronnie Sahlberg 2008<br>
 <br>
 This program is free software; you can redistribute it and/or modify<br>
similarity index 88%
rename from doc/remote-cache.8.xml
rename to doc/remote-cache.1.xml
index e1f1d66ce3286b8f1d3ffacd107b5b91d1c5d09c..6abb1d1923f0c599f4597c9f966f02f751943d1b 100644 (file)
@@ -1,21 +1,12 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
-<refentry id="remote-cache.8">
+<refentry id="onnode.1">
 
 <refmeta>
        <refentrytitle>remote-cache</refentrytitle>
-       <manvolnum>8</manvolnum>
-       <refmiscinfo class="source">Remote Cache</refmiscinfo>
-       <refmiscinfo class="manual">System administration commands</refmiscinfo>
+       <manvolnum>1</manvolnum>
 </refmeta>
 
-  <info>
-    <author>
-      <personname>Ronnie Sahlberg</personname>
-      <contrib>Wrote remote-cache and this documentation</contrib>
-    </author>
-  </info>
-
 
 <refnamediv>
        <refname>remote-cache</refname>
 
 <refsynopsisdiv>
        <cmdsynopsis>
-               <command>remote-cache</command> --export=DIR --cache=DIR --remote=DIR [--max-dir-cache=TIMEOUT] [--dir-min-inodes=INTEGER] [--dir-min-blocks=INTEGER] [--file-min-inodes=INTEGER] [--file-min-blocks=INTEGER] [--file-max-size=MB] [--file-check-parent-mtime] [--file-min-mtime-age=SECONDS] [--read-write]
-       </cmdsynopsis>
-       <cmdsynopsis>
-               <command>remote-cache</command> --unexport=DIR
+               <command>remote-cache --export=DIR --cache=DIR --remote=DIR [--max-dir-cache=TIMEOUT] [--dir-min-inodes=INTEGER] [--dir-min-blocks=INTEGER] [--file-min-inodes=INTEGER] [--file-min-blocks=INTEGER] [--file-max-size=MB] [--file-check-parent-mtime] [--file-min-mtime-age=SECONDS] [--read-write]
+               </command>
+               <command>remote-cache --unexport=DIR
+               </command>
        </cmdsynopsis>
 </refsynopsisdiv>
 
@@ -49,8 +40,7 @@
       Eventhough read-write is supported, write is veryu slow so remote-cache should only be used in read-mostly environments.
     </para>
 
-    <refsect2><title>Options</title>
-    <refsect3><title>--remote</title>
+    <refsect2><title>--remote</title>
     <para>
     This specifies the mountpoint where the remote NFS server is mounted.
     This is the remote share we will "wan-accelerate" using remote-cache.
@@ -64,9 +54,9 @@
       mount -o soft,intr,actimeo=600 REMOTE-SERVER:/share /mnt/remote-share
       </screen>
     </para>
-    </refsect3>
+    </refsect2>
 
-    <refsect3><title>--cache</title>
+    <refsect2><title>--cache</title>
     <para>
     This controls which local directory to store the cached copies of the
     files/data from the share.
@@ -75,9 +65,9 @@
     Mtime of the objects are used to track whether an object in the cache
     is up to data or needs to be remigrated.
     </para>
-    </refsect3>
+    </refsect2>
 
-    <refsect3><title>--export</title>
+    <refsect2><title>--export</title>
     <para>
     This specifies the mountpoint where this fuse module will attach.
     When accessing data through this mountpoint, the fuse module will either
     This directory can be re-exported read-only or read-write by the local NFS server to
     clients on the local site.
     </para>
-    </refsect3>
+    </refsect2>
 
-    <refsect3><title>--unexport</title>
+    <refsect2><title>--unexport</title>
     <para>
       This command will unexport a remote-cache exported filesystem and shut
       down all associated background daemons.
     </para>
-    </refsect3>
+    </refsect2>
 
-    <refsect3><title>--max-dir-cache</title>
+    <refsect2><title>--max-dir-cache</title>
     <para>
     Directory content is cached for each directory containing the list of
     object names that are stored in the directory and also the full stat()
     which in turn means we will not flush our cache. This is by design.
     </para>
 
-    </refsect3>
+    </refsect2>
 
-    <refsect3><title>--dir-min-inodes</title>
+    <refsect2><title>--dir-min-inodes</title>
     <para>
     This parameter defaults to 100.
     </para>
     2008/06/10 12:24:41.582921 [ 1605]: Cache is full. Only 74 inodes left in /gpfs/cache. Can not build local cache of directory /mnt/nfs/export
     </screen>
     </para>
-    </refsect3>
+    </refsect2>
 
 
-    <refsect3><title>--dir-min-blocks</title>
+    <refsect2><title>--dir-min-blocks</title>
     <para>
     This parameter defaults to 1000.
     </para>
     2008/06/10 12:24:41.582921 [ 1605]: Cache is full. Only 237 blocks left in /gpfs/cache. Can not build local cache of directory /mnt/nfs/export
     </screen>
     </para>
-    </refsect3>
+    </refsect2>
 
-    <refsect3><title>--file-min-inodes</title>
+    <refsect2><title>--file-min-inodes</title>
     <para>
     This parameter defaults to 100.
     </para>
     2008/06/10 12:24:41.582921 [ 1605]: Cache is full. Only 74 inodes left in /gpfs/cache. Can not build add file /mnt/nfs/export/foo to the cache
     </screen>
     </para>
-    </refsect3>
+    </refsect2>
 
 
-    <refsect3><title>--file-min-blocks</title>
+    <refsect2><title>--file-min-blocks</title>
     <para>
     This parameter defaults to 10000.
     </para>
     2008/06/10 12:24:41.582921 [ 1605]: Cache is full. Only 237 blocks left in /gpfs/cache. Can not build add file /mnt/nfs/export/foo to the cache
     </screen>
     </para>
-    </refsect3>
+    </refsect2>
 
-    <refsect3><title>--file-max-size</title>
+    <refsect2><title>--file-max-size</title>
     <para>
     This parameter defaults to 0.
     </para>
     <para>
     When set to 0 there will be no size limitation of files to cache.
     </para>
-    </refsect3>
+    </refsect2>
 
 
-    <refsect3><title>--file-migrate-max-concurrent</title>
+    <refsect2><title>--file-migrate-max-concurrent</title>
     <para>
     This parameter defaults to 1000.
     </para>
     Note that failing a migration is not a severe issue, it just means that the
     file will be migrate a little while later instead next time it is accessed.
     </para>
-    </refsect3>
+    </refsect2>
 
 
 
-    <refsect3><title>--file-check-parent-mtime</title>
+    <refsect2><title>--file-check-parent-mtime</title>
     <para>
     This paranter can only be used in environments where files are 
     created/deleted but where files are never modified after being created.
     cached copy and return to the client instead of the attributes off the
     remote server.
     </para>    
-    </refsect3>
+    </refsect2>
 
-    <refsect3><title>--file-min-mtime-age=SECONDS</title>
+    <refsect2><title>--file-min-mtime-age=SECONDS</title>
     <para>
     Do not migrate the file to the cache if it was changed (based on mtime)
     less than this many seconds ago.
     <para>
     This parameter defaults to 120 seconds.
     </para>
-    </refsect3>
+    </refsect2>
 
-    <refsect3><title>--read-write</title>
+    <refsect2><title>--read-write</title>
     <para>
     EXPERIMENTAL.
     </para>
     <para>
     Since in this mode all writes are pass-through, writes will be slow.
     </para>
-    </refsect3>
     </refsect2>
   </refsect1>
 
diff --git a/doc/remote-cache.8 b/doc/remote-cache.8
deleted file mode 100644 (file)
index b008b74..0000000
+++ /dev/null
@@ -1,404 +0,0 @@
-'\" t
-.\"     Title: remote-cache
-.\"    Author: Ronnie Sahlberg
-.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
-.\"      Date: 07/21/2009
-.\"    Manual: System administration commands
-.\"    Source: Remote Cache
-.\"  Language: English
-.\"
-.TH "REMOTE\-CACHE" "8" "07/21/2009" "Remote Cache" "System administration commands"
-.\" -----------------------------------------------------------------
-.\" * set default formatting
-.\" -----------------------------------------------------------------
-.\" disable hyphenation
-.nh
-.\" disable justification (adjust text to left margin only)
-.ad l
-.\" -----------------------------------------------------------------
-.\" * MAIN CONTENT STARTS HERE *
-.\" -----------------------------------------------------------------
-.SH "NAME"
-remote-cache \- Read\-Mostly caching daemon for re\-exporting remote NFS shares
-.SH "SYNOPSIS"
-.HP \w'\fBremote\-cache\fR\ 'u
-\fBremote\-cache\fR \-\-export=DIR \-\-cache=DIR \-\-remote=DIR [\-\-max\-dir\-cache=TIMEOUT] [\-\-dir\-min\-inodes=INTEGER] [\-\-dir\-min\-blocks=INTEGER] [\-\-file\-min\-inodes=INTEGER] [\-\-file\-min\-blocks=INTEGER] [\-\-file\-max\-size=MB] [\-\-file\-check\-parent\-mtime] [\-\-file\-min\-mtime\-age=SECONDS] [\-\-read\-write]
-       
-.HP \w'\fBremote\-cache\fR\ 'u
-\fBremote\-cache\fR \-\-unexport=DIR
-       
-.SH "DESCRIPTION"
-.PP
-Remote\-cache is a fuse module that is used to create a local read\-mostly cached copy of a remote NFS share\&. The purpose of this is to provide a local cache of a remote NFS share in order to provide access to the data\&. NFS is VERY painful and slow to use across >100ms links\&.
-.PP
-The default is to provide a read\-only cached copy of the filesystem but read\-write can be provided using the \-\-read\-write option\&. In read\-write mode any writes or metadata changes will be passed\-through to the remote site as well as the local cache for the file and or directory will be flushed\&. Write performance is thus slow\&.
-.PP
-Eventhough read\-write is supported, write is veryu slow so remote\-cache should only be used in read\-mostly environments\&.
-.SS "Options"
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--remote\fR
-.RS 4
-.PP
-This specifies the mountpoint where the remote NFS server is mounted\&. This is the remote share we will "wan\-accelerate" using remote\-cache\&.
-.PP
-This share should be mounted using soft and intr\&.
-.PP
-A good choice of options to mount the remote share with are :
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-      mount \-o soft,intr,actimeo=600 REMOTE\-SERVER:/share /mnt/remote\-share
-      
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--cache\fR
-.RS 4
-.PP
-This controls which local directory to store the cached copies of the files/data from the share\&.
-.PP
-Mtime of the objects are used to track whether an object in the cache is up to data or needs to be remigrated\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--export\fR
-.RS 4
-.PP
-This specifies the mountpoint where this fuse module will attach\&. When accessing data through this mountpoint, the fuse module will either return data from the local cache, or if the local cache does not contain an up to date copy of that object, it will instead pass through the request to the remote site\&.
-.PP
-This directory can be re\-exported read\-only or read\-write by the local NFS server to clients on the local site\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--unexport\fR
-.RS 4
-.PP
-This command will unexport a remote\-cache exported filesystem and shut down all associated background daemons\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--max-dir-cache\fR
-.RS 4
-.PP
-Directory content is cached for each directory containing the list of object names that are stored in the directory and also the full stat() information for the objects\&.
-.PP
-This parameter controls how long a directory will be cached before it is flushed and re\-read from the remote site\&.
-.PP
-This parameter defaults to 0, meaning that once a directory has been cached, it will remain cached forever, or until the mtime of the directory on the remote site changes\&.
-.PP
-This means that a directory once cached will remain cached forever until its mtime has changed\&. I\&.e\&. when entries have been added/deleted to the directory\&. But since we also cache all the attributes for the child objects in this cache it also means that we will not detect changes to actual child files\&. I\&.e\&. we will not detect if a file has been written to/modified since this does not cause the mtime of the parent directory to change which in turn means we will not flush our cache\&. This is by design\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--dir-min-inodes\fR
-.RS 4
-.PP
-This parameter defaults to 100\&.
-.PP
-When there are less than this number of free inodes in the cache file system remote\-cache will no longer add new directories to the directory structure cache\&. When this happens, clients will still be able to access/list these directories but it will be slow since the directories will not be cached and all access will be passed through to the remote site\&.
-.PP
-This will be logged with an entry similar to
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-    2008/06/10 12:24:41\&.582921 [ 1605]: Cache is full\&. Only 74 inodes left in /gpfs/cache\&. Can not build local cache of directory /mnt/nfs/export
-    
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--dir-min-blocks\fR
-.RS 4
-.PP
-This parameter defaults to 1000\&.
-.PP
-When there are less than this number of free blocks in the cache file system remote\-cache will no longer add new directories to the directory structure cache\&. When this happens, clients will still be able to access/list these directories but it will be slow since the directories will not be cached and all access will be passed through to the remote site\&.
-.PP
-This will be logged with an entry similar to
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-    2008/06/10 12:24:41\&.582921 [ 1605]: Cache is full\&. Only 237 blocks left in /gpfs/cache\&. Can not build local cache of directory /mnt/nfs/export
-    
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--file-min-inodes\fR
-.RS 4
-.PP
-This parameter defaults to 100\&.
-.PP
-When there are less than this number of free inodes in the cache file system remote\-cache will no longer add more files to the cache\&. When this happens, clients will still be able to access/read these files but it will be slow since all reads will be passed through to the remote site\&.
-.PP
-This will be logged with an entry similar to
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-    2008/06/10 12:24:41\&.582921 [ 1605]: Cache is full\&. Only 74 inodes left in /gpfs/cache\&. Can not build add file /mnt/nfs/export/foo to the cache
-    
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--file-min-blocks\fR
-.RS 4
-.PP
-This parameter defaults to 10000\&.
-.PP
-When there are less than this number of free blocks in the cache file system remote\-cache will no longer add more files to the cache\&. When this happens, clients will still be able to access/read these files but it will be slow since all i/o will be passed through to the remote site\&.
-.PP
-This will be logged with an entry similar to
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-    2008/06/10 12:24:41\&.582921 [ 1605]: Cache is full\&. Only 237 blocks left in /gpfs/cache\&. Can not build add file /mnt/nfs/export/foo to the cache
-    
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--file-max-size\fR
-.RS 4
-.PP
-This parameter defaults to 0\&.
-.PP
-Maximum size in MB of files to cache\&. Files larger than this will not be copied to the local cache\&.
-.PP
-When set to 0 there will be no size limitation of files to cache\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--file-migrate-max-concurrent\fR
-.RS 4
-.PP
-This parameter defaults to 1000\&.
-.PP
-Maximum number of concurrent migrations of files we allow before we start failing the migration\&. Note that failing a migration is not a severe issue, it just means that the file will be migrate a little while later instead next time it is accessed\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--file-check-parent-mtime\fR
-.RS 4
-.PP
-This paranter can only be used in environments where files are created/deleted but where files are never modified after being created\&. Never use this option unless this is true for the i/o patterns of the environment\&.
-.PP
-If the environment is an archive server or similar where files, once they have been created are never changed\&. Then it is possible to use a more aggressive caching strategy for attributes and instead look at the mtime of the parent directory and the cached directory entries to determine whether the cached file is up to date\&. This greatly reduces the amount of GETATTR calls that are issued to the remote site and also greatly reduses the stress on the local nfs clients attribute cache since we only cache the attributes for the directories and never for the leaf objects/files\&.
-.PP
-The process works as follows : First get the attributes for the parent directory on the remote site (which most of the time will come out of the nfs clients attribute cache), then compare the mtime with the mtime of the parent directory in the cache directory\&. If the directory mtime\'s are the same, then we read the attributes for the file from the local cached copy and return to the client instead of the attributes off the remote server\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--file-min-mtime-age=SECONDS\fR
-.RS 4
-.PP
-Do not migrate the file to the cache if it was changed (based on mtime) less than this many seconds ago\&.
-.PP
-This parameter defaults to 120 seconds\&.
-.RE
-.sp
-.it 1 an-trap
-.nr an-no-space-flag 1
-.nr an-break-flag 1
-.br
-.ps +1
-\fB--read-write\fR
-.RS 4
-.PP
-EXPERIMENTAL\&.
-.PP
-This allows the filesystem to be exported read\-write\&. All data or metadata changing operations are passed through to the master server and the local cache is invalidated\&. Do NOT use this option together with \-\-file\-check\-parent\-mtime\&.
-.PP
-Since in this mode all writes are pass\-through, writes will be slow\&.
-.RE
-.SH "EXAMPLES"
-.PP
-Mount the remote server/share on a local mountpoint\&.
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-    mount \-o ro,soft,intr,actimeo=600 REMOTE\-SERVER:/remote\-share /mnt/remote\-share
-    
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-Create a local export and cache directory
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-    mkdir /export/data
-    mkdir /export/cache
-    
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-Startup remote\-cache
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-    remote\-cache \-\-export=/export/data \-\-cache=/export/cache \-\-remote=/mnt/remote\-share
-    
-.fi
-.if n \{\
-.RE
-.\}
-.PP
-You can now access the share through /export/data which should be much much faster than accessing it through /mnt/remote\-share if the remote server is more than 10ms away\&. Also look in the /export/cache directory to see when/which files are currently cached locally\&.
-.SH "CACHE CLEANUP"
-.PP
-Removing data from the cache to reclaim space is easy\&.
-.PP
-For files you can just delete them with "rm"\&.
-.PP
-If you want to remove an entire directory tree from the cache it is more complex\&. For this you must first rename (mv) the directory to something else and then you can "rm \-rf" that renamed directory tree\&.
-.SH "LOGGING"
-.PP
-All debug and error messages are logged to /var/log/log\&.remote\-cache\&.
-.PP
-The log level can be controlled by the \-\-debug=X command line parameter\&. The default is 0 : ERROR\&.
-.PP
-Possible debuglevels are :
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-        0: ERROR
-        1: WARNING
-        2: NOTICE
-        3: INFO
-        4: DEBUG
-    
-.fi
-.if n \{\
-.RE
-.\}
-.sp
-.SH "SEE ALSO"
-.PP
-ctdbd(1), ctdb(1),
-\m[blue]\fB\%http://ctdb.samba.org/\fR\m[]
-.SH "COPYRIGHT/LICENSE"
-.sp
-.if n \{\
-.RS 4
-.\}
-.nf
-Copyright (C) Ronnie Sahlberg 2008
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 3 of the License, or (at
-your option) any later version\&.
-
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\&.  See the GNU
-General Public License for more details\&.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, see http://www\&.gnu\&.org/licenses/\&.
-.fi
-.if n \{\
-.RE
-.\}
-.SH "AUTHOR"
-.PP
-\fBRonnie Sahlberg\fR
-.RS 4
-Wrote remote\-cache and this documentation
-.RE
index 2d5dbc16610a3b6107e69d6a699a68db4530a61c..acdcd38efe6165aebc8ef1cb2322044c7594e2f2 100644 (file)
@@ -179,7 +179,6 @@ AC_DEFUN([AC_PROG_CC_C99],
 # ------------------------
 # Enable extensions on systems that normally disable them,
 # typically due to standards-conformance issues.
-m4_ifndef([AC_USE_SYSTEM_EXTENSIONS],[
 AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
 [
   AC_BEFORE([$0], [AC_COMPILE_IFELSE])
@@ -209,4 +208,3 @@ AC_DEFUN([AC_USE_SYSTEM_EXTENSIONS],
     AC_DEFINE([__EXTENSIONS__])
   AC_DEFINE([_POSIX_PTHREAD_SEMANTICS])
 ])
-])
diff --git a/migrate/remote-cache-clean.py b/migrate/remote-cache-clean.py
deleted file mode 100755 (executable)
index 0f44b36..0000000
+++ /dev/null
@@ -1,303 +0,0 @@
-#!/usr/bin/env python
-
-# A simple LRU cache cleaning program.
-
-# Copyright Martin Schwenke 2009
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-
-import os
-import sys
-import logging
-from optparse import OptionParser
-from time import time
-
-class File(object):
-    def __init__(self, path):
-        self.path = path
-        s = os.lstat(self.path)
-        self.atime = s.st_atime
-        self.ctime = s.st_ctime
-        self.size = float(s.__getattribute__('st_blocks')) / 2 # 1KB units
-
-    def __str__(self):
-        return "(%d, %d, %s)" % (self.atime, self.size, self.path)
-
-    def remove(self):
-        """Remove the file if options.dry_run is not set.
-        Ignore any errors. """
-
-        global options
-
-        if not options.dry_run:
-            try:
-                os.remove(self.path)
-            except OSError:
-                pass
-
-
-class Cache(object):
-    def __init__(self, root):
-        self.size = 0.0
-        self.count = 0
-        self.files = None
-        self.root = root
-
-    def __str__(self):        
-        return ("Size: %d KB" % (self.size)) + \
-            "\n".join([ str(f) for f in self.files])
-
-    def _add_file(self, path):
-        """Add a file to the cache.  Don't worry if it fails."""
-        
-        try:
-            t = File(path)
-        except OSError:
-            return
-        self.size += t.size
-        self.count += 1
-        self.files.append(t)
-
-    def _trim(self, condition, log_func, stop_on_fail=False):
-        """Remove files from self.files for which condition(f) is
-        True.  If stop_on_fail is True then terminate when the
-        condition first fails.  self.files is processed in *reverse*
-        order.  Log message will contain log_func, which is usually
-        the name of the calling function."""
-
-        global logger
-
-        init_count = self.count
-        init_size = self.size
-
-        keep_files = []
-        while self.files:
-            f = self.files.pop()
-            if condition(f):
-                logger.info("%s: Removing %s", log_func, f.path)
-                f.remove()
-                self.size -= f.size
-                self.count -=1
-            else:
-                keep_files.append(f)
-                if stop_on_fail:
-                    break
-
-        # reverse() is fast.
-        keep_files.reverse()
-        self.files += keep_files
-
-        logger.info("%s: Removed %d files, recovered %d KB", log_func,
-                    init_count - self.count, init_size - self.size)
-
-    def scan(self):
-        """Gather information about files in the cache."""
-        self.files = []
-        for (root, dirs, files) in os.walk(self.root):
-            for f in files:
-                self._add_file(os.path.join(root, f))
-
-    def lru_clean(self, high_water, low_water):
-        """Remove the least recently used files until space usage for
-        the cache is below low_water.  Files are only removed if the
-        initial usage is above high_water.  All sizes are in 1KB
-        units."""
-
-        if self.files is None:
-            self.scan()
-
-        # Reverse sort: we want to process the list in reverse order
-        # because pop() is *much* more efficient than pop(0)
-        self.files.sort(key = lambda f: (f.atime, -f.size), reverse=True)
-
-        # Yes, this is a cache-global condition ignores the file!
-        under_water = lambda f: self.size > low_water
-        self._trim(under_water, "lru_clean", stop_on_fail=True)
-
-    def trim_unused(self, num_hours):
-        """Remove any files that haven't been accessed for more than num_hours.
-        This does not respect options.low_water."""
-
-        if self.files is None:
-            self.scan()
-
-        # Optimisation: precalculate atime_limit.
-        # Use Unix time, not the horribly verbose datetime/timedelta.
-        atime_limit = time() - num_hours * (60*60)
-        is_unused = lambda file: file.atime < atime_limit
-
-        self._trim(is_unused, "trim_unused")
-
-    def trim_old(self, num_hours):
-        """Remove any files that were probably created more than num_hours ago.
-        This does not respect options.low_water."""
-
-        if self.files is None:
-            self.scan()
-
-        # Optimisation: precalculate ctime_limit.
-        # Use Unix time, not the horribly verbose datetime/timedelta.
-        ctime_limit = time() - num_hours * (60*60)
-        is_old = lambda file: file.ctime < ctime_limit
-
-        self._trim(is_old, "trim_old")
-
-    def delete_empty_dirs(self):
-        """Remove empty directories in the cache."""
-
-        global logger, options
-
-        # Number of directories removed.
-        count=0
-
-        # key: directory path, value: number of subdirectories removed
-        removed_from = {}
-
-        for (root, dirs, files) in os.walk(self.root, topdown=False):
-            if (root != self.root) and \
-                    not files and (len(dirs) - removed_from.get(root, 0) == 0): 
-                logger.info("delete_empty_dirs: Removing  %s", root)
-                count += 1
-                b = os.path.dirname(root)
-                removed_from[b] = removed_from.get(b, 0) + 1
-                if not options.dry_run:
-                    try:
-                        os.rmdir(root)
-                    except OSError:
-                        pass
-
-        logger.info("remove_empty_dirs: Removed %d directories", count)
-
-def process_args():
-    usage = """usage: %prog [options] cache-root high-water low-water
-
-  cache-root: root directory of cache
-  high-water: maximum allowable cache size - no action if cache is smaller
-  low-water:  desired cache size - cache is reduced to this size
-
-  If multiple cleanup passes are used then processing stops after the
-  first pass that makes the cache smaller than low-water."""
-
-    parser = OptionParser(usage=usage)
-    parser.add_option("-v", "--verbose",
-                      action="store_true", dest="verbose", default=False,
-                      help="print information and actions taken to stdout")
-    parser.add_option("-l", "--log-file",
-                      action="store", dest="log_file", default=None,
-                      metavar="FILE",
-                      help="append information and actions taken to FILE")
-    parser.add_option("-n", "--dry-run",
-                      action="store_true", dest="dry_run", default=False,
-                      help="do not remove files, useful for testing with -v")
-    parser.add_option("--trim-old",
-                      action="store", type="int", dest="trim_old",
-                      default=None, metavar="HOURS",
-                      help="initial pass removes files more than HOURS old")
-    parser.add_option("--trim-unused",
-                      action="store", type="int", dest="trim_unused",
-                      default=None, metavar="HOURS",
-                      help="initial pass removes files unused for HOURS")
-    parser.add_option("--no-lru",
-                      action="store_false", dest="use_lru", default=True,
-                      help="do not do an LRU cleanup pass")
-    
-    (options, args) = parser.parse_args()
-
-    if len(args) != 3:
-        parser.error("not enough argumentss")
-
-    options.cache_root=args[0]
-    if not os.path.isdir(options.cache_root):
-        parser.error("no such directory \"%s\"" % options.cache_root)
-
-    try:
-        options.high_water = int(args[1]) 
-    except ValueError:
-        parser.error("high-water must be an integer specifying a " +
-                     "maximum size in KB")
-        
-    try:
-        options.low_water = int(args[2]) 
-    except ValueError:
-        parser.error("low-water must be an integer specifying a " +
-                     "desired cache size in KB")
-
-    return options
-
-def setup_logging():
-
-    global options
-
-    logger = logging.getLogger("remote-cache-clean")
-    logger.setLevel(logging.INFO)
-
-    # If neither -v nor -l is specified then we want to avoid messages
-    # about there being no logging handlers.  Note that NullHandler is
-    # only in Python >= 3.1 so don't try to use it.
-    class _NullHandler(logging.Handler):
-        def emit(self, record):
-            pass
-    logger.addHandler(_NullHandler())
-
-    # The formatting option %(funcName)s would be useful here but it
-    # only appeared in Python 2.5 and this script will be run on
-    # Python 2.4.
-
-    if options.verbose:
-        sh = logging.StreamHandler(sys.stdout)
-        sh.handleError = lambda x : (logging.shutdown(), sys.exit())
-        logger.addHandler(sh)
-
-    if options.log_file is not None:
-        fh = logging.FileHandler(options.log_file)
-        formatter = logging.Formatter(
-            "%(asctime)s - %(name)s - %(levelname)s - %(message)s")
-        fh.setFormatter(formatter)
-        logger.addHandler(fh)
-
-    return logger
-
-options = None
-logger = None
-
-def main():
-    global options, logger
-
-    options = process_args()
-    logger = setup_logging()
-
-    c = Cache(options.cache_root)
-    c.scan()
-
-    logger.info("main: Initial cache size is %d KB, %d files", c.size, c.count)
-
-    if c.size < options.high_water:
-        logger.info(
-            "main: Exiting - cache size is below high-water mark (%d KB)",
-            options.high_water)
-        return
-
-    if options.trim_old is not None and c.size > options.low_water:
-        c.trim_old(options.trim_old)
-    if options.trim_unused is not None and c.size > options.low_water:
-        c.trim_unused(options.trim_unused)
-    if options.use_lru and c.size > options.low_water:
-        c.lru_clean(options.high_water, options.low_water)
-    c.delete_empty_dirs()
-
-    logger.info("main: Final cache size is %d KB, %d files", c.size, c.count)
-    logging.shutdown()
-
-if __name__ == '__main__':
-    sys.exit(main())
index 47c450c3fbddc8a581766e3bdea92edf8b2b1bc6..5329f4f558005b825e680ef05f2e93774d6681c9 100755 (executable)
@@ -26,7 +26,7 @@ SRCDIR=`rpm --eval %_sourcedir`
 
 # At this point the SPECDIR and SRCDIR vaiables must have a value!
 
-VERSION='3.5'
+VERSION='3.6'
 REVISION=''
 SPECFILE="remote-cache.spec"
 RPMBUILD="rpmbuild"
index 1f9e39dcd31fe724f01cbe15b6f604949971792e..6a18ae413a0a0c66ce55d6105e8fed5ee3af72c2 100644 (file)
@@ -4,7 +4,7 @@ Summary: Remote Read-Only NFS cache
 Vendor: Ronnie Sahlberg
 Packager: Ronnie Sahlberg <ronniesahlberg@gmail.com>
 Name: remote-cache
-Version: 3.5
+Version: 3.6
 Release: 0
 Epoch: 0
 License: GNU GPL version 3
@@ -53,10 +53,10 @@ make
 rm -rf $RPM_BUILD_ROOT
 
 # Create the target build directory hierarchy
-mkdir -p $RPM_BUILD_ROOT%{_sbindir}
+mkdir -p $RPM_BUILD_ROOT%{_bindir}
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/init.d
-mkdir -p $RPM_BUILD_ROOT%{_mandir}/man8
+mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
 
 make DESTDIR=$RPM_BUILD_ROOT install
 
@@ -80,13 +80,13 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(-,root,root)
 
-%{_sbindir}/remote-cache
-%{_sbindir}/remote-cache-clean
-%{_mandir}/man8/remote-cache.8.gz
-%{_mandir}/man8/remote-cache-clean.8.gz
+%{_bindir}/remote-cache
+%{_mandir}/man1/remote-cache.1.gz
 
 %changelog
-* Wed Jul 15 2009 : Version 3.4
+* Fri Jul 24 2009 : Version 3.6
+ - Add a cleanup daemon/tool from martins
+* Wed Jul 15 2009 : Version 3.5
  - Internal cleanup of the code and removal of all uses of switching uid.
    Uids are instead checked explicitely in the code and i/o is always performed as the root user.
 * Tue Apr 7 2009 : Version 3.4