mirror of
https://github.com/ceph/ceph
synced 2024-12-18 01:16:55 +00:00
*** empty log message ***
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@407 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
parent
b219045945
commit
d5e6f23bef
@ -39,18 +39,19 @@ OBFSStore::OBFSStore(int whoami, char *param, char *dev)
|
||||
int OBFSStore::init(void)
|
||||
{
|
||||
dout(0) << "OBFS init!" << endl;
|
||||
if ((this->bdev_id = device_open(this->dev, 0)) < 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;
|
||||
}
|
||||
|
||||
this->mounted = uofs_mount(this->bdev_id);
|
||||
this->mkfs();
|
||||
this->mounted = uofs_mount(this->bdev_id, 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);
|
||||
this->mounted = uofs_mount(this->bdev_id, this->whoami);
|
||||
assert(this->mounted >= 0);
|
||||
break;
|
||||
case -2:
|
||||
@ -66,7 +67,7 @@ int OBFSStore::init(void)
|
||||
if (this->mounted >= 0)
|
||||
dout(0) << "successfully mounted!" << endl;
|
||||
else
|
||||
dout(0) << "error in mounting!" << endl;
|
||||
dout(0) << "error in mounting obfsstore!" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -77,17 +78,17 @@ int OBFSStore::mkfs(void)
|
||||
bd_ratio = 10,
|
||||
reg_size_mb = 256,
|
||||
sb_size_kb = 4,
|
||||
lb_size_kb = 512,
|
||||
lb_size_kb = 1024,
|
||||
nr_hash_table_buckets = 1023,
|
||||
delay_allocation = 0,
|
||||
flush_interval = 5;
|
||||
FILE *param;
|
||||
|
||||
|
||||
dout(0) << "OBFS.mkfs!" << endl;
|
||||
if (this->mounted >= 0)
|
||||
return 0;
|
||||
|
||||
dout(0) << "OBFS.mkfs!" << endl;
|
||||
if (strlen(this->param) > 0) {
|
||||
param = fopen(this->param, "r");
|
||||
if (param) {
|
||||
@ -107,7 +108,7 @@ int OBFSStore::mkfs(void)
|
||||
dout(0) << "use default parameters" << endl;
|
||||
|
||||
if (this->bdev_id <= 0)
|
||||
if ((this->bdev_id = device_open(this->dev, 0)) < 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;
|
||||
}
|
||||
@ -115,7 +116,7 @@ int OBFSStore::mkfs(void)
|
||||
dout(0) << "start formating!" << endl;
|
||||
|
||||
uofs_format(this->bdev_id, donode_size_byte, bd_ratio, (reg_size_mb << 20), (sb_size_kb << 10),
|
||||
(lb_size_kb << 10), nr_hash_table_buckets, delay_allocation, flush_interval);
|
||||
(lb_size_kb << 10), nr_hash_table_buckets, delay_allocation, flush_interval, this->whoami);
|
||||
|
||||
dout(0) << "formatting complete!" << endl;
|
||||
return 0;
|
||||
@ -131,35 +132,42 @@ int OBFSStore::finalize(void)
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
int OBFSStore::read(object_t oid, size_t len,
|
||||
off_t offset, char *buffer)
|
||||
{
|
||||
dout(0) << "calling read function!" << endl;
|
||||
return uofs_read(oid, buffer, offset, len);
|
||||
}
|
||||
|
||||
int OBFSStore::write(object_t oid, size_t len,
|
||||
off_t offset, char *buffer, bool fsync)
|
||||
{
|
||||
int ret;
|
||||
int ret, sync = 0;
|
||||
|
||||
ret = uofs_write(oid, buffer, offset, len);
|
||||
//dout(0) << "calling write function!" << endl;
|
||||
if (fsync) sync = 1;
|
||||
ret = uofs_write(oid, buffer, offset, len, sync);
|
||||
if (fsync)
|
||||
ret += uofs_sync(oid);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user