aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2010-02-22 14:52:48 +0000
committerDavid Howells <dhowells@redhat.com>2010-02-22 14:59:35 +0000
commit677828e64e51c7e5770178e62dd4b9ccffa5d96b (patch)
treed8f8118c98efb8b0a1d05fb1d9b79c063b877996
parent1910715e9b5271c89d96913d04ca967581fc777a (diff)
downloadcachefilesd-677828e64e51c7e5770178e62dd4b9ccffa5d96b.tar.gz
cachefilesd historical revision 0.6v0.6
Mark __error() as attribute format printf Fix up format errors shown up
-rw-r--r--README36
-rw-r--r--cachefilesd.c23
-rw-r--r--cachefilesd.conf3
-rw-r--r--cachefilesd.conf.545
-rw-r--r--redhat/cachefilesd.spec22
5 files changed, 89 insertions, 40 deletions
diff --git a/README b/README
index c9875f2..c320aa7 100644
--- a/README
+++ b/README
@@ -77,9 +77,15 @@ set up cache ready for use. The following script commands are available:
(*) brun <N>%
(*) bcull <N>%
(*) bstop <N>%
+ (*) frun <N>%
+ (*) fcull <N>%
+ (*) fstop <N>%
Configure the culling limits. Optional. See the section on culling
- The defaults are 7%, 5% and 1% respectively.
+ The defaults are 7% (run), 5% (cull) and 1% (stop) respectively.
+
+ The commands beginning with a 'b' are file space (block) limits, those
+ beginning with an 'f' are file count limits.
(*) dir <path>
@@ -161,31 +167,37 @@ discarding objects from the cache that have been used less recently than
anything else. Culling is based on the access time of data objects. Empty
directories are culled if not in use.
-Cache culling is done on the basis of the percentage of blocks available in the
-underlying filesystem. There are three "limits":
+Cache culling is done on the basis of the percentage of blocks and the
+percentage of files available in the underlying filesystem. There are six
+"limits":
(*) brun
+ (*) frun
- If the amount of available space in the cache rises above this limit, then
- culling is turned off.
+ If the amount of free space and the number of available files in the cache
+ rises above both these limits, then culling is turned off.
(*) bcull
+ (*) fcull
- If the amount of available space in the cache falls below this limit, then
- culling is started.
+ If the amount of available space or the number of available files in the
+ cache falls below either of these limits, then culling is started.
(*) bstop
+ (*) fstop
- If the amount of available space in the cache falls below this limit, then
- no further allocation of disk space is permitted until culling has raised
- the amount above this limit again.
+ If the amount of available space or the number of available files in the
+ cache falls below either of these limits, then no further allocation of
+ disk space or files is permitted until culling has raised things above
+ these limits again.
These must be configured thusly:
0 <= bstop < bcull < brun < 100
+ 0 <= fstop < fcull < frun < 100
-Note that these are percentages of available space, and do _not_ appear as 100
-minus the percentage displayed by the "df" program.
+Note that these are percentages of available space and available files, and do
+_not_ appear as 100 minus the percentage displayed by the "df" program.
The userspace daemon scans the cache to build up a table of cullable objects.
These are then culled in least recently used order. A new scan of the cache is
diff --git a/cachefilesd.c b/cachefilesd.c
index 5331c1b..90d8f8c 100644
--- a/cachefilesd.c
+++ b/cachefilesd.c
@@ -16,6 +16,9 @@
* brun 10%
* bcull 7%
* bstop 3%
+ * frun 10%
+ * fcull 7%
+ * fstop 3%
*
* Only "dir" is mandatory
* Blank lines and lines beginning with a hash are comments
@@ -100,7 +103,7 @@ static char *cacheroot, *graveyardpath;
static int xdebug, xnolog, xopenedlog;
static int stop, reap, cull, statecheck;
static int graveyardfd;
-static unsigned long long brun, bcull, bstop;
+static unsigned long long brun, bcull, bstop, frun, fcull, fstop;
#define cachefd 3
@@ -122,7 +125,7 @@ static void help(void)
exit(2);
}
-static void __error(int excode, const char *fmt, ...) __attribute__((noreturn));
+static void __error(int excode, const char *fmt, ...) __attribute__((noreturn, format(printf,2,3)));
static void __error(int excode, const char *fmt, ...)
{
va_list va;
@@ -149,7 +152,7 @@ static void __error(int excode, const char *fmt, ...)
}
#define error(FMT,...) __error(3, "Internal error: "FMT"\n" ,##__VA_ARGS__)
-#define oserror(FMT,...) __error(1, FMT": errno %d (%m)\n" ,errno ,##__VA_ARGS__)
+#define oserror(FMT,...) __error(1, FMT": errno %d (%m)\n" ,##__VA_ARGS__ ,errno)
#define cfgerror(FMT,...) __error(2, "%s:%d:"FMT"\n", configfile, lineno ,##__VA_ARGS__)
#define opterror(FMT,...) __error(2, FMT"\n" ,##__VA_ARGS__)
@@ -692,6 +695,12 @@ static void read_cache_state(void)
bcull = strtoull(arg, NULL, 16);
else if (strcmp(tok, "bstop") == 0)
bstop = strtoull(arg, NULL, 16);
+ else if (strcmp(tok, "frun") == 0)
+ frun = strtoull(arg, NULL, 16);
+ else if (strcmp(tok, "fcull") == 0)
+ fcull = strtoull(arg, NULL, 16);
+ else if (strcmp(tok, "fstop") == 0)
+ fstop = strtoull(arg, NULL, 16);
} while ((tok = next));
@@ -1284,9 +1293,11 @@ static void decant_cull_table(void)
info("Decant (%d/%d to %d)", copy, avail, space);
- /* make a hole in the ready table and fill it */
+ /* make a hole in the ready table transfer "copy" elements from the end
+ * of cullbuild (oldest) to the beginning of cullready (youngest)
+ */
n = oldest_ready + 1;
- memmove(&cullready[space], &cullready[0], n * sizeof(cullready[0]));
+ memmove(&cullready[copy], &cullready[0], n * sizeof(cullready[0]));
oldest_ready += copy;
memcpy(&cullready[0], &cullbuild[leave], copy * sizeof(cullready[0]));
@@ -1294,7 +1305,7 @@ static void decant_cull_table(void)
oldest_build = leave - 1;
if (copy + leave > CULLTABLE_SIZE)
- error("Scan table exceeded (%d+%d)", copy + leave);
+ error("Scan table exceeded (%d+%d)", copy, leave);
check:
for (loop = 0; loop < oldest_ready; loop++)
diff --git a/cachefilesd.conf b/cachefilesd.conf
index 868630d..3796f5c 100644
--- a/cachefilesd.conf
+++ b/cachefilesd.conf
@@ -15,3 +15,6 @@ tag mycache
brun 10%
bcull 7%
bstop 3%
+frun 10%
+fcull 7%
+fstop 3%
diff --git a/cachefilesd.conf.5 b/cachefilesd.conf.5
index 692fc17..f3681ae 100644
--- a/cachefilesd.conf.5
+++ b/cachefilesd.conf.5
@@ -33,8 +33,18 @@ All the other commands are optional:
.B bcull <N>%
.TP
.B bstop <N>%
-These commands configure the culling limits. The defaults are 7%, 5% and 1%
-respectively. See the section on cache culling for more information.
+.TP
+.B frun <N>%
+.TP
+.B fcull <N>%
+.TP
+.B fstop <N>%
+These commands configure the culling limits. The defaults are 7% (run), 5%
+(cull) and 1% (stop) respectively. See the section on cache culling for more
+information.
+.IP
+The commands beginning with a 'b' are file space (block) limits, those
+beginning with an 'f' are file count limits.
.TP
.B tag <name>
This command specifies a tag to FS-Cache to use in distinguishing multiple
@@ -88,28 +98,37 @@ discarding objects from the cache that have been used less recently than
anything else. Culling is based on the access time of data objects. Empty
directories are culled if not in use.
.P
-Cache culling is done on the basis of the percentage of blocks available in the
-underlying filesystem. There are three "limits":
+Cache culling is done on the basis of the percentage of blocks and the
+percentage of files available in the underlying filesystem. There are six
+"limits":
.TP
.B brun
-If the amount of available space in the cache rises above this limit, then
-culling is turned off.
+.TP
+.B frun
+If the amount of free space and the number of available files in the cache
+rises above both these limits, then culling is turned off.
.TP
.B bcull
-If the amount of available space in the cache falls below this limit, then
-culling is started.
+.TP
+.B fcull
+If the amount of available space or the number of available files in the cache
+falls below either of these limits, then culling is started.
.TP
.B bstop
-If the amount of available space in the cache falls below this limit, then no
-further allocation of disk space is permitted until culling has raised the
-amount above this limit again.
+.TP
+.B fstop
+If the amount of available space or the number of available files in the cache
+falls below either of these limits, then no further allocation of disk space or
+files is permitted until culling has raised things above these limits again.
.P
These must be configured thusly:
.IP
0 <= bstop < bcull < brun < 100
+.br
+0 <= fstop < fcull < frun < 100
.P
-Note that these are percentages of available space, and do \fInot\fP appear as
-100 minus the percentage displayed by the \fBdf\fP program.
+Note that these are percentages of available space and available files, and do
+\fInot\fP appear as 100 minus the percentage displayed by the \fBdf\fP program.
.P
The userspace daemon scans the cache to build up a table of cullable objects.
These are then culled in least recently used order. A new scan of the cache is
diff --git a/redhat/cachefilesd.spec b/redhat/cachefilesd.spec
index a507d1d..d3f7032 100644
--- a/redhat/cachefilesd.spec
+++ b/redhat/cachefilesd.spec
@@ -1,11 +1,11 @@
Name: cachefilesd
-Version: 0.5
+Version: 0.6
Release: 1%{?dist}
Summary: CacheFiles userspace management daemon
Group: System Environment/Daemons
License: GPL
-URL: http://people.redhat.com/~dhowells/fscache/
-Source0: http://people.redhat.com/dhowells/fscache/cachefilesd-0.5.tar.bz2
+URL: http://people.redhat.com/~dhowells/fscache/
+Source0: http://people.redhat.com/dhowells/fscache/cachefilesd-0.6.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-root-%(%{__id_u} -n)
BuildRequires: automake, autoconf
@@ -14,7 +14,7 @@ Requires(preun): /sbin/chkconfig, /sbin/service
%description
The cachefilesd daemon manages the caching files and directory that are
-that are used by network filesystems such a AFS and NFS to
+that are used by network filesystems such a AFS and NFS to
do persistent caching to the local disk.
%prep
@@ -45,7 +45,7 @@ install -m 755 cachefilesd.initd %{buildroot}%{_sysconfdir}/rc.d/init.d/cachefil
%clean
rm -rf $RPM_BUILD_ROOT
-%post
+%post
/sbin/chkconfig --add %{name}
%preun
@@ -69,8 +69,13 @@ fi
%{_mandir}/*/*
%changelog
-* Fri Aug 11 2006 David Howells <dhowells@redhat.com> 0.5-1
-- Rerun the scan after a deferral period if the cache is empty for initial scan
+* Wed Aug 30 2006 David Howells <dhowells@redhat.com> 0.6-1
+- Mark __error() as attribute format printf
+- Fix up format errors shown up
+
+* Fri Aug 11 2006 Steve Dickson <steved@redhat.com> 0.5-1
+- Upgraded to 0.5 which fixed initial scan problem when
+ started on an empty cache (bz 202184)
* Tue Aug 8 2006 Steve Dickson <steved@redhat.com> 0.4-3
- Updated init.d script to look for cachefilesd in /sbin
@@ -88,7 +93,7 @@ fi
* Fri Jul 28 2006 Steve Dickson <steved@redhat.com> 0.3-2
- Added post and preun rules
-- Changed init.d script to up right before portmapper.
+- Changed init.d script to up right before portmapper.
* Fri Jun 9 2006 Steve Dickson <steved@redhat.com> 0.3-1
- Incorporated David Howells manual page updates
@@ -100,4 +105,3 @@ fi
* Sat Apr 22 2006 Steve Dickson <steved@redhat.com> 0.1-1
- Initial commit
-