From 1a15a5996888021300bc62a4404de84409e0bee0 Mon Sep 17 00:00:00 2001 From: sage Date: Fri, 30 Dec 2005 05:10:51 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@550 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/client/SyntheticClient.cc | 18 ++++++++++++++++-- ceph/ebofs/BlockDevice.cc | 7 ++++--- ceph/ebofs/Ebofs.cc | 12 ++++++------ ceph/ebofs/types.h | 1 + 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/ceph/client/SyntheticClient.cc b/ceph/client/SyntheticClient.cc index e32df1fdbee..366e61b0d65 100644 --- a/ceph/client/SyntheticClient.cc +++ b/ceph/client/SyntheticClient.cc @@ -642,8 +642,8 @@ int SyntheticClient::make_dirs(const char *basedir, int dirs, int files, int dep int SyntheticClient::write_file(string& fn, int size, int wrsize) // size is in MB, wrsize in bytes { //__uint64_t wrsize = 1024*256; - char *buf = new char[wrsize]; // 1 MB - memset(buf, 1, wrsize); + char *buf = new char[wrsize+100]; // 1 MB + memset(buf, 7, wrsize); __uint64_t chunks = (__uint64_t)size * (__uint64_t)(1024*1024) / (__uint64_t)wrsize; int fd = client->open(fn.c_str(), O_WRONLY|O_CREAT); @@ -653,6 +653,20 @@ int SyntheticClient::write_file(string& fn, int size, int wrsize) // size is i for (unsigned i=0; iget_nodeid(); + p++; + *p = 0; + p++; + } + client->write(fd, buf, wrsize, i*wrsize); } diff --git a/ceph/ebofs/BlockDevice.cc b/ceph/ebofs/BlockDevice.cc index 317206faa58..20313d02054 100644 --- a/ceph/ebofs/BlockDevice.cc +++ b/ceph/ebofs/BlockDevice.cc @@ -80,7 +80,7 @@ int BlockDevice::io_thread_entry() io_queue_map.erase(bio); io_queue.erase(prev); - if (i == io_queue.end()) break; + if (true || i == io_queue.end()) break; } lock.Unlock(); @@ -120,7 +120,7 @@ int BlockDevice::io_thread_entry() io_queue_map.erase(bio); io_queue.erase(prev); - if (begin) break; + if (true || begin) break; } lock.Unlock(); @@ -338,7 +338,8 @@ int BlockDevice::_write(unsigned bno, unsigned num, bufferlist& bl) assert(fd > 0); - off_t offset = bno * EBOFS_BLOCK_SIZE; + off_t offset = (off_t)bno << EBOFS_BLOCK_BITS; + assert((off_t)bno * (off_t)EBOFS_BLOCK_SIZE == offset); off_t actual = lseek(fd, offset, SEEK_SET); assert(actual == offset); diff --git a/ceph/ebofs/Ebofs.cc b/ceph/ebofs/Ebofs.cc index 9d2be3d36a8..452f6c4a988 100644 --- a/ceph/ebofs/Ebofs.cc +++ b/ceph/ebofs/Ebofs.cc @@ -510,7 +510,7 @@ Onode* Ebofs::get_onode(object_t oid) p += sizeof(len); on->attr[key] = AttrVal(p, len); p += len; - dout(10) << "get_onode " << *on << " attr " << key << " len " << len << endl; + dout(15) << "get_onode " << *on << " attr " << key << " len " << len << endl; } // parse extents @@ -519,7 +519,7 @@ Onode* Ebofs::get_onode(object_t oid) for (int i=0; inum_extents; i++) { Extent ex = *((Extent*)p); on->extents.push_back(ex); - dout(10) << "get_onode " << *on << " ex " << i << ": " << ex << endl; + dout(15) << "get_onode " << *on << " ex " << i << ": " << ex << endl; n += ex.length; p += sizeof(Extent); } @@ -592,14 +592,14 @@ void Ebofs::write_onode(Onode *on) off += sizeof(int); bl.copy_in(off, i->second.len, i->second.data); off += i->second.len; - dout(10) << "write_onode " << *on << " attr " << i->first << " len " << i->second.len << endl; + dout(15) << "write_onode " << *on << " attr " << i->first << " len " << i->second.len << endl; } // extents for (unsigned i=0; iextents.size(); i++) { bl.copy_in(off, sizeof(Extent), (char*)&on->extents[i]); off += sizeof(Extent); - dout(10) << "write_onode " << *on << " ex " << i << ": " << on->extents[i] << endl; + dout(15) << "write_onode " << *on << " ex " << i << ": " << on->extents[i] << endl; } // write @@ -825,7 +825,7 @@ Cnode* Ebofs::get_cnode(object_t cid) p += sizeof(len); cn->attr[key] = AttrVal(p, len); p += len; - dout(10) << "get_cnode " << *cn << " attr " << key << " len " << len << endl; + dout(15) << "get_cnode " << *cn << " attr " << key << " len " << len << endl; } // wake up other waiters @@ -880,7 +880,7 @@ void Ebofs::write_cnode(Cnode *cn) bl.copy_in(off, i->second.len, i->second.data); off += i->second.len; - dout(10) << "write_cnode " << *cn << " attr " << i->first << " len " << i->second.len << endl; + dout(15) << "write_cnode " << *cn << " attr " << i->first << " len " << i->second.len << endl; } // write diff --git a/ceph/ebofs/types.h b/ceph/ebofs/types.h index 9c1d9041e30..ed1f2132416 100644 --- a/ceph/ebofs/types.h +++ b/ceph/ebofs/types.h @@ -63,6 +63,7 @@ namespace __gnu_cxx { typedef __uint64_t block_t; // disk location/sector/block static const int EBOFS_BLOCK_SIZE = 4096; +static const int EBOFS_BLOCK_BITS = 12; // 1<<12 == 4096 class Extent { public: