]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
removed legacy obfs stuff
authorsageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 19 Jul 2007 23:09:52 +0000 (23:09 +0000)
committersageweil <sageweil@29311d96-e01e-0410-9327-a35deaab8ce9>
Thu, 19 Jul 2007 23:09:52 +0000 (23:09 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1533 29311d96-e01e-0410-9327-a35deaab8ce9

trunk/ceph/Makefile
trunk/ceph/config.cc
trunk/ceph/config.h
trunk/ceph/osd/FakeStore.cc
trunk/ceph/osd/OBFSStore.cc [deleted file]
trunk/ceph/osd/OBFSStore.h [deleted file]
trunk/ceph/osd/OSD.cc

index ee5164374fc0ccb876903fbc838a11c2bba00a72..6f5cf9d5fb5bed981ffa4b7470c6fdf7c18fdde6 100644 (file)
@@ -117,8 +117,6 @@ nofuse: depend ${NO_FUSE}
 
 test: depend ${TEST_TARGETS}
 
-obfs: depend obfstest
-
 
 # real bits
 mkmonmap: mkmonmap.cc common.o
@@ -186,17 +184,6 @@ test.ebofs: ebofs/test.ebofs.cc config.cc common/Clock.o ebofs.o
        ${CC} -pg ${CFLAGS} ${LIBS} $^ -o $@
 
 
-# + obfs (old)
-fakesynobfs: fakesyn.cc mds.o client.o osd_obfs.o msg/FakeMessenger.o common.o
-       ${CC} -DUSE_OBFS ${CFLAGS} ${LIBS} $^ -o $@
-
-tcpsynobfs: tcpsyn.cc mds.o client.o osd_obfs.o ${TCP_OBJS} common.o
-       ${MPICC} -DUSE_OBFS ${MPICFLAGS} ${MPILIBS} $^ -o $@ 
-
-osd_obfs.o: osd/OBFSStore.o osd/OSD.cc osd/PG.o osd/ObjectStore.o osd/FakeStore.o
-       ${MPICC} -DUSE_OBFS ${MPICFLAGS} ${MPILIBS} $^ -o $@ ../uofs/uofs.a
-
-
 # hadoop
 libhadoopcephfs.so: client/hadoop/CephFSInterface.cc client.o osdc.o msg/SimpleMessenger.o common.o
        ${CC} -fPIC -shared -Wl,-soname,$@.1 ${CFLAGS} -I/usr/local/java/include -I/usr/local/java/include/linux  ${LIBS} $^ -o $@
index 2e323322ac746ff6e3d9de1e33e700bdb173ee6b..e2ecbaf8469da1ed5bd63a406da502bde24f81f6 100644 (file)
@@ -267,21 +267,6 @@ md_config_t g_conf = {
   ebofs_abp_zero: false,          // zero newly allocated buffers (may shut up valgrind)
   ebofs_abp_max_alloc: 4096*16,   // max size of new buffers (larger -> more memory fragmentation)
 
-  // --- obfs ---
-  uofs: 0,
-  uofs_fake_sync: 2,      // 2 seconds
-  uofs_cache_size:             1 << 28,        //256MB
-  uofs_onode_size:             (int)1024,
-  uofs_small_block_size:       (int)4096,      //4KB
-  uofs_large_block_size:       (int)524288,    //512KB
-  uofs_segment_size:           (int)268435456, //256MB
-  uofs_block_meta_ratio:       (int)10,
-  uofs_sync_write:             (int)0,
-  uofs_nr_hash_buckets:        (int)1023,
-  uofs_flush_interval:         (int)5,         //seconds
-  uofs_min_flush_pages:        (int)1024,      //4096 4k-pages
-  uofs_delay_allocation:       (int)1,         //true
-
   // --- block device ---
   bdev_lock: true,
   bdev_iothreads:    1,         // number of ios to queue with kernel
@@ -750,12 +735,6 @@ void parse_config_options(std::vector<char*>& args)
     else if (strcmp(args[i], "--fakestore_fake_collections") == 0) 
       g_conf.fakestore_fake_collections = true;//atoi(args[++i]);
 
-    else if (strcmp(args[i], "--obfs") == 0) {
-      g_conf.uofs = 1;
-      g_conf.osd_maxthreads = 1;   // until feng merges joel's fixes
-    }
-
-
     else if (strcmp(args[i], "--osd_balance_reads") == 0) 
       g_conf.osd_balance_reads = atoi(args[++i]);
     else if ( strcmp(args[i],"--osd_immediate_read_from_cache" ) == 0)
index b5ae9eacfe30f0a7250b59254bfedef59c222d2e..13f03436763b4be3a492a69ba8d563e09c5fe8a6 100644 (file)
@@ -264,21 +264,6 @@ struct md_config_t {
   bool   ebofs_abp_zero;
   size_t ebofs_abp_max_alloc;
 
-  int uofs;
-  int uofs_fake_sync;
-  int     uofs_cache_size;
-  int     uofs_onode_size;
-  int     uofs_small_block_size;
-  int     uofs_large_block_size;
-  int     uofs_segment_size;
-  int     uofs_block_meta_ratio;
-  int     uofs_sync_write;
-  
-  int     uofs_nr_hash_buckets;
-  int     uofs_flush_interval;
-  int     uofs_min_flush_pages;
-  int     uofs_delay_allocation;
-
   // block device
   bool  bdev_lock;
   int   bdev_iothreads;
index 2ee0201bc9d7efc8b6f14d120ef77533c568e54c..f6c7cc116c3ed3eb5366853583ce31f541868b56 100644 (file)
@@ -29,7 +29,9 @@
 #include <cassert>
 #include <errno.h>
 #include <dirent.h>
-#include <sys/xattr.h>
+#ifndef __CYGWIN__
+# include <sys/xattr.h>
+#endif
 //#include <sys/vfs.h>
 
 #ifdef DARWIN
@@ -179,9 +181,12 @@ int FakeStore::mount()
 
   // fake attrs? 
   // let's test to see if they work.
+#ifndef __CYGWIN__
   if (g_conf.fakestore_fake_attrs) {
+#endif
     dout(0) << "faking attrs (in memory)" << endl;
     fake_attrs = true;
+#ifndef __CYGWIN__
   } else {
     char names[1000];
     r = ::listxattr(basedir.c_str(), names, 1000);
@@ -190,6 +195,7 @@ int FakeStore::mount()
       assert(0);
     }
   }
+#endif
 
   // all okay.
   return 0;
@@ -406,9 +412,12 @@ int FakeStore::setattr(object_t oid, const char *name,
 {
   if (fake_attrs) return attrs.setattr(oid, name, value, size, onsafe);
 
+  int r = 0;
+#ifndef __CYGWIN__
   char fn[100];
   get_oname(oid, fn);
-  int r = ::setxattr(fn, name, value, size, 0);
+  r = ::setxattr(fn, name, value, size, 0);
+#endif
   return r;
 }
 
@@ -419,12 +428,14 @@ int FakeStore::setattrs(object_t oid, map<string,bufferptr>& aset)
   char fn[100];
   get_oname(oid, fn);
   int r = 0;
+#ifndef __CYGWIN__
   for (map<string,bufferptr>::iterator p = aset.begin();
        p != aset.end();
        ++p) {
     r = ::setxattr(fn, p->first.c_str(), p->second.c_str(), p->second.length(), 0);
     if (r < 0) break;
   }
+#endif
   return r;
 }
 
@@ -432,9 +443,12 @@ int FakeStore::getattr(object_t oid, const char *name,
                       void *value, size_t size) 
 {
   if (fake_attrs) return attrs.getattr(oid, name, value, size);
+  int r = 0;
+#ifndef __CYGWIN__
   char fn[100];
   get_oname(oid, fn);
-  int r = ::getxattr(fn, name, value, size);
+  r = ::getxattr(fn, name, value, size);
+#endif
   return r;
 }
 
@@ -442,6 +456,7 @@ int FakeStore::getattrs(object_t oid, map<string,bufferptr>& aset)
 {
   if (fake_attrs) return attrs.getattrs(oid, aset);
 
+#ifndef __CYGWIN__
   char fn[100];
   get_oname(oid, fn);
 
@@ -457,16 +472,19 @@ int FakeStore::getattrs(object_t oid, map<string,bufferptr>& aset)
     aset[names].append(val, l);
     name += strlen(name) + 1;
   }
-  
+#endif
   return 0;
 }
 
 int FakeStore::rmattr(object_t oid, const char *name, Context *onsafe) 
 {
   if (fake_attrs) return attrs.rmattr(oid, name, onsafe);
+  int r = 0;
+#ifndef __CYGWIN__
   char fn[100];
   get_oname(oid, fn);
-  int r = ::removexattr(fn, name);
+  r = ::removexattr(fn, name);
+#endif
   return r;
 }
 
diff --git a/trunk/ceph/osd/OBFSStore.cc b/trunk/ceph/osd/OBFSStore.cc
deleted file mode 100644 (file)
index e679c0a..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-
-
-#include "OBFSStore.h"
-
-extern "C" {
-#include "../../uofs/uofs.h"
-}
-
-#include "common/Timer.h"
-
-#include "include/types.h"
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/file.h>
-#include <iostream>
-#include <cassert>
-#include <errno.h>
-#include <dirent.h>
-
-
-#include "config.h"
-#undef dout
-#define  dout(l)    if (l<=g_conf.debug) cout << "osd" << whoami << ".obfs "
-
-OBFSStore::OBFSStore(int whoami, char *param, char *dev)
-{
-    this->whoami = whoami;
-    this->mounted = -1;
-    this->bdev_id = -1;
-    this->param[0] = 0;
-    this->dev[0] = 0;
-    if (dev)
-        strcpy(this->dev, dev);
-    if (param) 
-        strcpy(this->param, param);
-}
-
-int OBFSStore::mount(void)
-{
-    dout(0) << "OBFS init!" << endl;
-    if ((this->bdev_id = device_open(this->dev, O_RDWR)) < 0) {
-        dout(0) << "device open FAILED on " << this->dev << ", errno " << errno << endl;
-        return -1;
-    }
-
-    this->mkfs();
-    this->mounted = uofs_mount(this->bdev_id, 
-                               g_conf.uofs_cache_size,
-                               g_conf.uofs_min_flush_pages,
-                               this->whoami);
-    switch (this->mounted) {
-        case -1:
-            this->mkfs();
-            //retry to mount
-            dout(0) << "remount the OBFS" << endl;
-            this->mounted = uofs_mount(this->bdev_id, 
-                                       g_conf.uofs_cache_size,
-                                       g_conf.uofs_min_flush_pages,
-                                       this->whoami);
-            assert(this->mounted >= 0);
-            break;
-        case -2: 
-            //fsck
-            dout(0) << "Need fsck! Simply formatted for now!" << endl;
-            this->mkfs();
-            this->mounted = uofs_mount(this->bdev_id, 
-                                       g_conf.uofs_cache_size,
-                                       g_conf.uofs_min_flush_pages,
-                                       this->whoami);
-            assert(this->mounted >= 0);
-            break;
-        case 0:
-            //success
-            break;
-        default:
-            break;
-    }
-
-    if (this->mounted >= 0) 
-        dout(0) << "successfully mounted!" << endl;
-    else
-        dout(0) << "error in mounting obfsstore!" << endl;
-    
-    return 0;
-}
-
-int OBFSStore::mkfs(void)
-{
-  /*int    donode_size_byte     = 1024,
-        bd_ratio                = 10,
-        reg_size_mb             = 256,
-        sb_size_kb              = 4,
-        lb_size_kb              = 1024,
-      nr_hash_table_buckets   = 1023,
-      delay_allocation        = 1,
-      flush_interval        = 5;
-    FILE    *param;
-  */
-    
-    
-    if (this->mounted >= 0)
-      return 0;
-
-    dout(0) << "OBFS.mkfs!" << endl;
-    /*
-    if (strlen(this->param) > 0) {
-        param = fopen(this->param, "r");
-        if (param) {
-            //fscanf(param, "Block Device: %s\n", this->dev);
-            fscanf(param, "Donode Size: %d\n", &donode_size_byte);
-            fscanf(param, "Block vs Donode Ratio: %d\n", &bd_ratio);
-            fscanf(param, "Region Size: %d MB\n", &reg_size_mb);
-            fscanf(param, "Small Block Size: %d KB\n", &sb_size_kb);
-            fscanf(param, "Large Block Size: %d KB\n", &lb_size_kb);
-            fscanf(param, "Hash Table Buckets: %d\n", &nr_hash_table_buckets);
-            fscanf(param, "Delayed Allocation: %d\n", &delay_allocation);
-        } else {
-            dout(0) << "read open FAILED on "<< this->param <<", errno " << errno << endl;
-            dout(0) << "use default parameters" << endl;
-        }
-    } else
-        dout(0) << "use default parameters" << endl;
-    */
-
-    if (this->bdev_id <= 0)
-        if ((this->bdev_id = device_open(this->dev, O_RDWR)) < 0) {
-            dout(0) << "device open FAILED on "<< this->dev <<", errno " << errno << endl;
-            return -1;
-        }
-    
-    dout(0) << "start formating!" << endl;
-
-    uofs_format(this->bdev_id,
-                g_conf.uofs_onode_size, 
-                g_conf.uofs_block_meta_ratio, 
-                g_conf.uofs_segment_size,
-                g_conf.uofs_small_block_size,
-                g_conf.uofs_large_block_size,
-                g_conf.uofs_nr_hash_buckets,
-                g_conf.uofs_delay_allocation, 
-                0,//g_conf.uofs_dev_force_size,
-                g_conf.uofs_flush_interval, 
-                0);
-
-    dout(0) << "formatting complete!" << endl;
-    return 0;
-}
-
-int OBFSStore::umount(void)
-{
-    uofs_shutdown();
-    close(this->bdev_id);
-
-    return 0;
-}
-
-int OBFSStore::statfs(struct statfs *sfs) 
-{
-  return 0;
-}
-
-bool OBFSStore::exists(object_t oid)
-{
-    //dout(0) << "calling function exists!" << endl;
-    return uofs_exist(oid);
-}
-
-int OBFSStore::stat(object_t oid, struct stat *st)
-{
-    dout(0) << "calling function stat!" << endl;
-    if (uofs_exist(oid)) return 0;
-    return -1;
-}
-
-int OBFSStore::remove(object_t oid)
-{
-    dout(0) << "calling remove function!" << endl;
-    return uofs_del(oid);
-}
-
-int OBFSStore::truncate(object_t oid, off_t size)
-{
-    dout(0) << "calling truncate function!" << endl;
-    //return uofs_truncate(oid, size);
-    return -1;
-}
-
-int OBFSStore::read(object_t oid, size_t len, 
-            off_t offset, bufferlist &bl)
-{
-    //dout(0) << "calling read function!" << endl;
-    //dout(0) << oid << " 0  " << len << " " << offset << " 100" << endl;
-
-  // FIXME: page-align this and we can avoid a memcpy...
-  bl.push_back(new buffer(len));
-  return uofs_read(oid, bl.c_str(), offset, len);
-}
-
-int OBFSStore::write(object_t oid, size_t len,
-                     off_t offset, bufferlist& bl, bool fsync)
-{
-    int ret = 0;
-    
-    //dout(0) << "calling write function!" << endl;
-    //if (whoami == 0)
-    //    dout(0) << oid << " 0  " << len << " " << offset << " 101" << endl;
-
-    for (list<bufferptr>::iterator p = bl.buffers().begin();
-         p != bl.buffers().end();
-         p++) {
-      ret += uofs_write(oid, (*p).c_str(), offset, len, 0);
-    }
-
-    if (fsync)
-        ret += uofs_sync(oid);
-    
-    return ret;
-}
-
-
-int OBFSStore::write(object_t oid, size_t len,
-             off_t offset, bufferlist& bl, Context *onflush)
-{
-  int r = write(oid, len, offset, bl, false);
-  g_timer.add_event_after((float)g_conf.uofs_fake_sync, onflush);
-  return r;
-}
diff --git a/trunk/ceph/osd/OBFSStore.h b/trunk/ceph/osd/OBFSStore.h
deleted file mode 100644 (file)
index aff7e96..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
-// vim: ts=8 sw=2 smarttab
-/*
- * Ceph - scalable distributed file system
- *
- * Copyright (C) 2004-2006 Sage Weil <sage@newdream.net>
- *
- * This is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software 
- * Foundation.  See file COPYING.
- * 
- */
-
-
-#ifndef _OBFSSTORE_H_
-#define _OBFSSTORE_H_
-
-#include "ObjectStore.h"
-#include "Fake.h"
-
-class OBFSStore : public ObjectStore, 
-                  public FakeStoreAttrs, 
-                  public FakeStoreCollections {
-  int    whoami;
-  int    bdev_id;
-  int    mounted;
-  char    dev[128];
-  char    param[128];
-  
- public:
-  OBFSStore(int whoami, char *param, char *dev);
-  
-  int mount(void);
-  int umount(void);
-  int mkfs(void);
-  
-  int statfs(struct statfs *);
-
-  bool exists(object_t oid);
-  int stat(object_t oid, struct stat *st);
-  
-  int remove(object_t oid);
-  int truncate(object_t oid, off_t size);
-  
-  int read(object_t oid, size_t len, 
-           off_t offset, bufferlist& bl);
-  int write(object_t oid, size_t len, 
-            off_t offset, bufferlist& bl,
-            bool fsync);
-  int write(object_t oid, size_t len, 
-            off_t offset, bufferlist& bl,
-            Context *onflush);
-  
-};
-
-#endif
index 309fa35c0a86421219a231607a1678d03e48014c..cab4d2e34c2a9c8aef0cf16dc85183a79d9ae104 100644 (file)
 #include "OSD.h"
 #include "OSDMap.h"
 
-#ifdef USE_OBFS
-# include "OBFSStore.h"
-#else
-# include "FakeStore.h"
-#endif
+#include "FakeStore.h"
 
 #include "ebofs/Ebofs.h"
 
@@ -163,11 +159,6 @@ OSD::OSD(int id, Messenger *m, MonMap *mm, char *dev) :
     store = new Ebofs(dev_path);
     //store->_fake_writes(true);
   }
-#ifdef USE_OBFS
-  else if (g_conf.uofs) {
-    store = new OBFSStore(whoami, NULL, dev_path);
-  }
-#endif
 #ifdef USE_OSBDB
   else if (g_conf.bdbstore) {
     store = new OSBDB(dev_path);