Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 263691
b: refs/heads/master
c: aca420b
h: refs/heads/master
i:
  263689: 15fdc4e
  263687: 1f6573d
v: v3
  • Loading branch information
Sage Weil committed Aug 31, 2011
1 parent 42183fa commit b4477cb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 259a187ade45056fd44856654f78aa9e9f0f7c75
refs/heads/master: aca420bc51f48b0701963ba3a6234442a0cabebd
22 changes: 17 additions & 5 deletions trunk/net/ceph/osd_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,18 @@ static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd)
put_osd(osd);
}

static void remove_all_osds(struct ceph_osd_client *osdc)
{
dout("__remove_old_osds %p\n", osdc);
mutex_lock(&osdc->request_mutex);
while (!RB_EMPTY_ROOT(&osdc->osds)) {
struct ceph_osd *osd = rb_entry(rb_first(&osdc->osds),
struct ceph_osd, o_node);
__remove_osd(osdc, osd);
}
mutex_unlock(&osdc->request_mutex);
}

static void __move_osd_to_lru(struct ceph_osd_client *osdc,
struct ceph_osd *osd)
{
Expand All @@ -701,14 +713,14 @@ static void __remove_osd_from_lru(struct ceph_osd *osd)
list_del_init(&osd->o_osd_lru);
}

static void remove_old_osds(struct ceph_osd_client *osdc, int remove_all)
static void remove_old_osds(struct ceph_osd_client *osdc)
{
struct ceph_osd *osd, *nosd;

dout("__remove_old_osds %p\n", osdc);
mutex_lock(&osdc->request_mutex);
list_for_each_entry_safe(osd, nosd, &osdc->osd_lru, o_osd_lru) {
if (!remove_all && time_before(jiffies, osd->lru_ttl))
if (time_before(jiffies, osd->lru_ttl))
break;
__remove_osd(osdc, osd);
}
Expand Down Expand Up @@ -751,6 +763,7 @@ static void __insert_osd(struct ceph_osd_client *osdc, struct ceph_osd *new)
struct rb_node *parent = NULL;
struct ceph_osd *osd = NULL;

dout("__insert_osd %p osd%d\n", new, new->o_osd);
while (*p) {
parent = *p;
osd = rb_entry(parent, struct ceph_osd, o_node);
Expand Down Expand Up @@ -1144,7 +1157,7 @@ static void handle_osds_timeout(struct work_struct *work)

dout("osds timeout\n");
down_read(&osdc->map_sem);
remove_old_osds(osdc, 0);
remove_old_osds(osdc);
up_read(&osdc->map_sem);

schedule_delayed_work(&osdc->osds_timeout_work,
Expand Down Expand Up @@ -1862,8 +1875,7 @@ void ceph_osdc_stop(struct ceph_osd_client *osdc)
ceph_osdmap_destroy(osdc->osdmap);
osdc->osdmap = NULL;
}
remove_old_osds(osdc, 1);
WARN_ON(!RB_EMPTY_ROOT(&osdc->osds));
remove_all_osds(osdc);
mempool_destroy(osdc->req_mempool);
ceph_msgpool_destroy(&osdc->msgpool_op);
ceph_msgpool_destroy(&osdc->msgpool_op_reply);
Expand Down

0 comments on commit b4477cb

Please sign in to comment.