mirror of
https://github.com/ceph/ceph
synced 2024-12-18 17:37:38 +00:00
filer fixes?
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@385 29311d96-e01e-0410-9327-a35deaab8ce9
This commit is contained in:
parent
923a115024
commit
59d6cd989a
@ -26,9 +26,9 @@ OSDFileLayout g_OSD_FileLayout( 1<<20, 1, 1<<20 ); // stripe files over whole
|
||||
OSDFileLayout g_OSD_MDDirLayout( 1<<14, 1<<2, 1<<19 );
|
||||
|
||||
// stripe mds log over 128 byte bits (see mds_log_pad_entry below to match!)
|
||||
OSDFileLayout g_OSD_MDLogLayout( 1<<7, 32, 1<<20 );
|
||||
OSDFileLayout g_OSD_MDLogLayout( 1<<7, 32, 1<<20 ); // new (good?) way
|
||||
//OSDFileLayout g_OSD_MDLogLayout( 57, 32, 1<<20 ); // pathological case to test striping buffer mapping
|
||||
//OSDFileLayout g_OSD_MDLogLayout( 1<<20, 1, 1<<20 );
|
||||
//OSDFileLayout g_OSD_MDLogLayout( 1<<20, 1, 1<<20 ); // old way
|
||||
|
||||
|
||||
md_config_t g_conf = {
|
||||
|
@ -385,7 +385,7 @@ inline ostream& operator<<(ostream& out, bufferlist& bl) {
|
||||
// encoder/decode helpers
|
||||
|
||||
// string
|
||||
inline void _encode(string& s, bufferlist& bl)
|
||||
inline void _encode(const string& s, bufferlist& bl)
|
||||
{
|
||||
bl.append(s.c_str(), s.length()+1);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class OSDExtent {
|
||||
object_t oid; // object id
|
||||
repgroup_t rg; // replica group
|
||||
size_t offset, len; // extent within the object
|
||||
map<size_t, size_t> extents_in_buffer; // off -> len. extents in buffer being mapped (may be fragmented bc of striping!)
|
||||
map<size_t, size_t> buffer_extents; // off -> len. extents in buffer being mapped (may be fragmented bc of striping!)
|
||||
|
||||
OSDExtent() : osd(0), oid(0), rg(0), offset(0), len(0) { }
|
||||
};
|
||||
@ -251,7 +251,7 @@ class OSDCluster {
|
||||
list<OSDExtent>& extents) {
|
||||
/* we want only one extent per object!
|
||||
* this means that each extent we read may map into different bits of the
|
||||
* final read buffer.. hence OSDExtent.extents_in_buffer
|
||||
* final read buffer.. hence OSDExtent.buffer_extents
|
||||
*/
|
||||
map< object_t, OSDExtent > object_extents;
|
||||
|
||||
@ -302,7 +302,7 @@ class OSDCluster {
|
||||
ex->offset = x_offset;
|
||||
ex->len = x_len;
|
||||
}
|
||||
ex->extents_in_buffer[cur-offset] = x_len;
|
||||
ex->buffer_extents[cur-offset] = x_len;
|
||||
|
||||
//cout << "map: ino " << ino << " oid " << ex.oid << " osd " << ex.osd << " offset " << ex.offset << " len " << ex.len << " ... left " << left << endl;
|
||||
|
||||
|
@ -102,7 +102,7 @@ Filer::read(inodeno_t ino,
|
||||
OSD_OP_READ);
|
||||
m->set_length(it->len);
|
||||
m->set_offset(it->offset);
|
||||
dout(15) << " read on " << last_tid << " from oid " << it->oid << " off " << it->offset << " len " << it->len << " (" << it->extents_in_buffer.size() << " buffer bits)" << endl;
|
||||
dout(15) << " read on " << last_tid << " from oid " << it->oid << " off " << it->offset << " len " << it->len << " (" << it->buffer_extents.size() << " buffer bits)" << endl;
|
||||
messenger->send_message(m, MSG_ADDR_OSD(it->osd), 0);
|
||||
|
||||
// add to gather set
|
||||
@ -152,7 +152,8 @@ Filer::handle_osd_read_reply(MOSDOpReply *m)
|
||||
|
||||
// map extents back into buffer
|
||||
map<off_t, bufferlist*> by_off; // buffer offset -> bufferlist
|
||||
|
||||
|
||||
// for each object extent
|
||||
for (list<OSDExtent>::iterator eit = p->extents.begin();
|
||||
eit != p->extents.end();
|
||||
eit++) {
|
||||
@ -161,26 +162,32 @@ Filer::handle_osd_read_reply(MOSDOpReply *m)
|
||||
int ox_off = 0;
|
||||
assert(ox_len <= eit->len);
|
||||
|
||||
for (map<size_t,size_t>::iterator bit = eit->extents_in_buffer.begin();
|
||||
bit != eit->extents_in_buffer.end();
|
||||
// for each buffer extent we're mapping into...
|
||||
for (map<size_t,size_t>::iterator bit = eit->buffer_extents.begin();
|
||||
bit != eit->buffer_extents.end();
|
||||
bit++) {
|
||||
dout(10) << "object " << eit->oid << " extent (...) : offset " << ox_off << " -> buffer " << bit->first << " len " << bit->second << endl;
|
||||
dout(10) << "object " << eit->oid << " extent " << eit->offset << " len " << eit->len << " : ox offset " << ox_off << " -> buffer extent " << bit->first << " len " << bit->second << endl;
|
||||
by_off[bit->first] = new bufferlist;
|
||||
|
||||
if (ox_off + bit->second <= ox_len) {
|
||||
// we got the whole bx
|
||||
by_off[bit->first]->substr_of(*ox_buf, ox_off, bit->second);
|
||||
if (p->bytes_read < bit->first + bit->second)
|
||||
p->bytes_read = bit->first + bit->second;
|
||||
} else if (ox_off > ox_len) {
|
||||
} else if (ox_off + bit->second > ox_len && ox_off < ox_len) {
|
||||
// we got part of this bx
|
||||
by_off[bit->first]->substr_of(*ox_buf, ox_off, (ox_len-ox_off));
|
||||
if (p->bytes_read < bit->first + ox_len-ox_off)
|
||||
p->bytes_read = bit->first + ox_len-ox_off;
|
||||
|
||||
// zero end bit
|
||||
// zero end of bx
|
||||
dout(10) << " adding some zeros to the end " << ox_off + bit->second-ox_len << endl;
|
||||
bufferptr z = new buffer(ox_off + bit->second - ox_len);
|
||||
memset(z.c_str(), 0, z.length());
|
||||
by_off[bit->first]->append( z );
|
||||
} else {
|
||||
// zero whole bit
|
||||
// we got none of this bx. zero whole thing.
|
||||
dout(10) << " adding all zeros for this bit " << bit->second << endl;
|
||||
bufferptr z = new buffer(bit->second);
|
||||
memset(z.c_str(), 0, z.length());
|
||||
by_off[bit->first]->append( z );
|
||||
@ -285,8 +292,8 @@ Filer::write(inodeno_t ino,
|
||||
// map buffer segments into this extent
|
||||
// (may be fragmented bc of striping)
|
||||
bufferlist cur;
|
||||
for (map<size_t,size_t>::iterator bit = it->extents_in_buffer.begin();
|
||||
bit != it->extents_in_buffer.end();
|
||||
for (map<size_t,size_t>::iterator bit = it->buffer_extents.begin();
|
||||
bit != it->buffer_extents.end();
|
||||
bit++) {
|
||||
bufferlist thisbit;
|
||||
thisbit.substr_of(bl, bit->first, bit->second);
|
||||
|
Loading…
Reference in New Issue
Block a user