INN commit: branches/2.5 (4 files)

INN Commit rra at isc.org
Mon Sep 7 09:06:42 UTC 2009


    Date: Monday, September 7, 2009 @ 02:06:42
  Author: iulius
Revision: 8626

Check that a CAF header contains at least 128 bytes for
the free bitmap header. Otherwise, increase the blocksize.

On 64-bit systems, a CAF header can exceed the size of the
default bitmap, which prevents timecaf from working.

Modified:
  branches/2.5/doc/pod/news.pod
  branches/2.5/storage/timecaf/caf.c
  branches/2.5/storage/timecaf/caf.h
  branches/2.5/storage/timecaf/timecaf.c

---------------------------+
 doc/pod/news.pod          |   10 ++++++++++
 storage/timecaf/caf.c     |   17 +++++++++++------
 storage/timecaf/caf.h     |    5 +++--
 storage/timecaf/timecaf.c |    2 +-
 4 files changed, 25 insertions(+), 9 deletions(-)

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2009-09-07 09:05:20 UTC (rev 8625)
+++ doc/pod/news.pod	2009-09-07 09:06:42 UTC (rev 8626)
@@ -54,6 +54,16 @@
 
 =item *
 
+When there is not enough space to write a CAF header, the timecaf storage
+manager now uses a larger blocksize.  On 32-bit systems, the CAF header
+is about 300 bytes, leaving about 200 bytes for the free bitmap index
+(the remaining of a 512-byte blocksize).  On 64-bit systems, the size
+of the CAF header could exceed 512 bytes, thus leaving no room for the
+free bitmap index.  A S<1 KB> blocksize is then used, or a larger
+size if need be.
+
+=item *
+
 A new CNFS version has been introduced by Miquel van Smoorenburg in
 the CNFS header.  CNFSv4 uses S<4 KB> blocks instead of S<512 bytes>,
 which more particularly makes writes faster.  CNFSv4 supports

Modified: storage/timecaf/caf.c
===================================================================
--- storage/timecaf/caf.c	2009-09-07 09:05:20 UTC (rev 8625)
+++ storage/timecaf/caf.c	2009-09-07 09:06:42 UTC (rev 8626)
@@ -626,9 +626,10 @@
 /*
 ** Given estimated size of CAF file (i.e., the size of the old CAF file found
 ** by cafclean), find an "optimal" blocksize (one big enough so that the
-** default FreeZoneTabSize can cover the entire
-** file so that we don't "lose" free space and not be able to reuse it.
-** (Currently only returns CAF_DEFAULT_BLOCKSIZE, as with the new 2-level
+** default FreeZoneTabSize can cover the entire file in order not to "lose"
+** free space and not be able to reuse it.
+** (Currently only returns the first multiple of CAF_DEFAULT_BLOCKSIZE that
+** allows to have at least CAF_MIN_FZSIZE bytes of index, as with the new 2-level
 ** bitmaps, the FreeZoneTabSize that results from a 512-byte blocksize can
 ** handle any file with <7.3G of data.  Yow!)
 */
@@ -636,10 +637,14 @@
 static unsigned int
 CAFFindOptimalBlocksize(ARTNUM tocsize UNUSED, size_t cfsize)
 {
+    /* No size given, use default. */
+    if (cfsize == 0) {
+        return (((sizeof(CAFHEADER) + CAF_MIN_FZSIZE)/CAF_DEFAULT_BLOCKSIZE + 1)
+                *CAF_DEFAULT_BLOCKSIZE);
+    }
 
-    if (cfsize == 0) return CAF_DEFAULT_BLOCKSIZE; /* no size given, use default. */
-
-    return CAF_DEFAULT_BLOCKSIZE;
+    return (((sizeof(CAFHEADER) + CAF_MIN_FZSIZE)/CAF_DEFAULT_BLOCKSIZE + 1)
+            *CAF_DEFAULT_BLOCKSIZE);
 }
 
 /*

Modified: storage/timecaf/caf.h
===================================================================
--- storage/timecaf/caf.h	2009-09-07 09:05:20 UTC (rev 8625)
+++ storage/timecaf/caf.h	2009-09-07 09:06:42 UTC (rev 8626)
@@ -56,7 +56,8 @@
 ** extend the CAF file instead.
 */
 
-#define CAF_DEFAULT_FZSIZE (512-sizeof(CAFHEADER))
+#define CAF_DEFAULT_FZSIZE (CAF_DEFAULT_BLOCKSIZE-sizeof(CAFHEADER))
+#define CAF_MIN_FZSIZE 128
 
 /*
 ** (Note: the CAFBITMAP structure isn't what's actually stored on disk
@@ -105,7 +106,7 @@
 
 /*
 ** Number of slots to put in TOC by default.  Can be raised if we ever get
-** more than 256K articles in a file (frightening thought).
+** more than 256*1024=262144 articles in a file (frightening thought).
 */
 
 #define CAF_DEFAULT_TOC_SIZE (256 * 1024)

Modified: storage/timecaf/timecaf.c
===================================================================
--- storage/timecaf/timecaf.c	2009-09-07 09:05:20 UTC (rev 8625)
+++ storage/timecaf/timecaf.c	2009-09-07 09:06:42 UTC (rev 8626)
@@ -104,7 +104,7 @@
     uint16_t            s;
 
     /* The token is @04nn00aabbccyyyyxxxx0000000000000000@
-     * where "02" is the timehash method number,
+     * where "04" is the timecaf method number,
      * "nn" the hexadecimal value of the storage class,
      * "aabbccdd" the arrival time in hexadecimal (dd is unused),
      * "xxxxyyyy" the hexadecimal sequence number seqnum. */




More information about the inn-committers mailing list