Skip to content

Commit

Permalink
OSD: use map bl cache pinning during handle_osd_map
Browse files Browse the repository at this point in the history
Signed-off-by: Samuel Just <samuel.just@dreamhost.com>
  • Loading branch information
Samuel Just committed Apr 27, 2012
1 parent d0d6912 commit 10c616a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/osd/OSD.cc
Expand Up @@ -3165,7 +3165,7 @@ void OSD::handle_osd_map(MOSDMap *m)

hobject_t fulloid = get_osdmap_pobject_name(e);
t.write(coll_t::META_COLL, fulloid, 0, bl.length(), bl);
add_map_bl(e, bl);
pin_map_bl(e, bl);
continue;
}

Expand All @@ -3175,7 +3175,7 @@ void OSD::handle_osd_map(MOSDMap *m)
bufferlist& bl = p->second;
hobject_t oid = get_inc_osdmap_pobject_name(e);
t.write(coll_t::META_COLL, oid, 0, bl.length(), bl);
add_map_inc_bl(e, bl);
pin_map_inc_bl(e, bl);

OSDMap *o = new OSDMap;
if (e > 1) {
Expand All @@ -3200,7 +3200,7 @@ void OSD::handle_osd_map(MOSDMap *m)

hobject_t fulloid = get_osdmap_pobject_name(e);
t.write(coll_t::META_COLL, fulloid, 0, fbl.length(), fbl);
add_map_bl(e, fbl);
pin_map_bl(e, fbl);
continue;
}

Expand Down Expand Up @@ -3370,6 +3370,7 @@ void OSD::handle_osd_map(MOSDMap *m)
}

map_lock.put_write();
clear_map_bl_cache_pins();

/*
* wait for this to be stable.
Expand Down Expand Up @@ -3727,6 +3728,25 @@ void OSD::_add_map_inc_bl(epoch_t e, bufferlist& bl)
map_bl_inc_cache.add(e, bl);
}

void OSD::pin_map_inc_bl(epoch_t e, bufferlist &bl)
{
Mutex::Locker l(map_cache_lock);
map_bl_inc_cache.pin(e, bl);
}

void OSD::pin_map_bl(epoch_t e, bufferlist &bl)
{
Mutex::Locker l(map_cache_lock);
map_bl_cache.pin(e, bl);
}

void OSD::clear_map_bl_cache_pins()
{
Mutex::Locker l(map_cache_lock);
map_bl_inc_cache.clear_pinned();
map_bl_cache.clear_pinned();
}

OSDMapRef OSD::_add_map(OSDMap *o)
{
epoch_t e = o->get_epoch();
Expand Down
4 changes: 4 additions & 0 deletions src/osd/OSD.h
Expand Up @@ -428,6 +428,7 @@ class OSD : public Dispatcher {
Mutex::Locker l(map_cache_lock);
return _add_map_bl(e, bl);
}
void pin_map_bl(epoch_t e, bufferlist &bl);
void _add_map_bl(epoch_t e, bufferlist& bl);
bool get_map_bl(epoch_t e, bufferlist& bl) {
Mutex::Locker l(map_cache_lock);
Expand All @@ -439,8 +440,11 @@ class OSD : public Dispatcher {
Mutex::Locker l(map_cache_lock);
return _add_map_inc_bl(e, bl);
}
void pin_map_inc_bl(epoch_t e, bufferlist &bl);
void _add_map_inc_bl(epoch_t e, bufferlist& bl);
bool get_inc_map_bl(epoch_t e, bufferlist& bl);

void clear_map_bl_cache_pins();

MOSDMap *build_incremental_map_msg(epoch_t from, epoch_t to);
void send_incremental_map(epoch_t since, const entity_inst_t& inst, bool lazy=false);
Expand Down

0 comments on commit 10c616a

Please sign in to comment.