tventi: add bootstrap mode (write + no index) - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit e7e953b3dadb5aba3bb2f3f05b2beff94934a4dc
 (DIR) parent a2df31f46d2119bf79d5b0e0fba07cef4564abcc
 (HTM) Author: Russ Cox <rsc@swtch.com>
       Date:   Sun, 22 Apr 2012 15:27:06 -0400
       
       venti: add bootstrap mode (write + no index)
       
       R=rsc, rsc
       http://codereview.appspot.com/6097047
       
       Diffstat:
         M src/cmd/venti/srv/dat.h             |       1 +
         M src/cmd/venti/srv/httpd.c           |       1 +
         M src/cmd/venti/srv/icache.c          |       6 ++++++
         M src/cmd/venti/srv/lump.c            |       1 +
       
       4 files changed, 9 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/venti/srv/dat.h b/src/cmd/venti/srv/dat.h
       t@@ -740,6 +740,7 @@ extern        Stats                stats;
        extern        u8int                zeroscore[VtScoreSize];
        extern        int                compressblocks;
        extern        int                writestodevnull;        /* dangerous - for performance debugging */
       +extern        int                bootstrap;                /* writes but does not index - cannot read */
        extern        int                collectstats;
        extern        QLock        memdrawlock;
        extern        int                icachesleeptime;
 (DIR) diff --git a/src/cmd/venti/srv/httpd.c b/src/cmd/venti/srv/httpd.c
       t@@ -396,6 +396,7 @@ static struct
                "ignorebloom",        &ignorebloom,
                "syncwrites",        &syncwrites,
                "icacheprefetch",        &icacheprefetch,
       +        "bootstrap",        &bootstrap,
                0
        };
        
 (DIR) diff --git a/src/cmd/venti/srv/icache.c b/src/cmd/venti/srv/icache.c
       t@@ -387,6 +387,9 @@ icachelookup(u8int score[VtScoreSize], int type, IAddr *ia)
        {
                IEntry *ie;
        
       +        if(bootstrap)
       +                return -1;
       +
                qlock(&icache.lock);
                addstat(StatIcacheLookup, 1);
                if((ie = ihashlookup(icache.hash, score, type)) != nil){
       t@@ -417,6 +420,9 @@ insertscore(u8int score[VtScoreSize], IAddr *ia, int state, AState *as)
        {
                ISum *toload;
        
       +        if(bootstrap)
       +                return -1;
       +
                qlock(&icache.lock);
                icacheinsert(score, ia, state);
                if(state == IEClean)
 (DIR) diff --git a/src/cmd/venti/srv/lump.c b/src/cmd/venti/srv/lump.c
       t@@ -2,6 +2,7 @@
        #include "dat.h"
        #include "fns.h"
        
       +int                        bootstrap = 0;
        int                        syncwrites = 0;
        int                        queuewrites = 0;
        int                        writestodevnull = 0;