mirror of
https://github.com/ceph/ceph
synced 2025-02-22 18:47:18 +00:00
removed legacy obfs stuff
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1533 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
parent
98f1850629
commit
f3e5d28ff6
@ -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 $@
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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", ®_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;
|
||||
}
|
@ -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
|
@ -19,11 +19,7 @@
|
||||
#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);
|
||||
|
Loading…
Reference in New Issue
Block a user