Use a single timerfd_manager for all timers
parent
4f42e9659e
commit
0f2b8dbf6f
15
osd.cpp
15
osd.cpp
|
@ -42,13 +42,12 @@ osd_t::osd_t(blockstore_config_t & config, blockstore_t *bs, ring_loop_t *ringlo
|
||||||
throw std::runtime_error(std::string("epoll_create: ") + strerror(errno));
|
throw std::runtime_error(std::string("epoll_create: ") + strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
this->stats_tfd = new timerfd_interval(ringloop, print_stats_interval, [this]()
|
this->tfd = new timerfd_manager_t(ringloop);
|
||||||
|
this->tfd->set_timer(print_stats_interval*1000, true, [this](int timer_id)
|
||||||
{
|
{
|
||||||
print_stats();
|
print_stats();
|
||||||
});
|
});
|
||||||
|
|
||||||
this->tfd = new timerfd_manager_t(ringloop);
|
|
||||||
|
|
||||||
init_cluster();
|
init_cluster();
|
||||||
|
|
||||||
consumer.loop = [this]() { loop(); };
|
consumer.loop = [this]() { loop(); };
|
||||||
|
@ -62,16 +61,6 @@ osd_t::~osd_t()
|
||||||
delete tfd;
|
delete tfd;
|
||||||
tfd = NULL;
|
tfd = NULL;
|
||||||
}
|
}
|
||||||
if (stats_tfd)
|
|
||||||
{
|
|
||||||
delete stats_tfd;
|
|
||||||
stats_tfd = NULL;
|
|
||||||
}
|
|
||||||
if (sync_tfd)
|
|
||||||
{
|
|
||||||
delete sync_tfd;
|
|
||||||
sync_tfd = NULL;
|
|
||||||
}
|
|
||||||
ringloop->unregister_consumer(&consumer);
|
ringloop->unregister_consumer(&consumer);
|
||||||
close(epoll_fd);
|
close(epoll_fd);
|
||||||
close(listen_fd);
|
close(listen_fd);
|
||||||
|
|
2
osd.h
2
osd.h
|
@ -15,7 +15,6 @@
|
||||||
|
|
||||||
#include "blockstore.h"
|
#include "blockstore.h"
|
||||||
#include "ringloop.h"
|
#include "ringloop.h"
|
||||||
#include "timerfd_interval.h"
|
|
||||||
#include "timerfd_manager.h"
|
#include "timerfd_manager.h"
|
||||||
#include "osd_ops.h"
|
#include "osd_ops.h"
|
||||||
#include "osd_peering_pg.h"
|
#include "osd_peering_pg.h"
|
||||||
|
@ -246,7 +245,6 @@ class osd_t
|
||||||
uint32_t bs_block_size, bs_disk_alignment;
|
uint32_t bs_block_size, bs_disk_alignment;
|
||||||
uint64_t pg_stripe_size = 4*1024*1024; // 4 MB by default
|
uint64_t pg_stripe_size = 4*1024*1024; // 4 MB by default
|
||||||
ring_loop_t *ringloop;
|
ring_loop_t *ringloop;
|
||||||
timerfd_interval *stats_tfd = NULL, *sync_tfd = NULL;
|
|
||||||
timerfd_manager_t *tfd = NULL;
|
timerfd_manager_t *tfd = NULL;
|
||||||
|
|
||||||
int wait_state = 0;
|
int wait_state = 0;
|
||||||
|
|
|
@ -61,7 +61,7 @@ void osd_t::init_primary()
|
||||||
}
|
}
|
||||||
if (autosync_interval > 0)
|
if (autosync_interval > 0)
|
||||||
{
|
{
|
||||||
this->sync_tfd = new timerfd_interval(ringloop, autosync_interval, [this]()
|
this->tfd->set_timer(autosync_interval*1000, true, [this](int timer_id)
|
||||||
{
|
{
|
||||||
autosync();
|
autosync();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue