Pass min_offset/max_offset to list_inode()
This commit is contained in:
@@ -138,7 +138,7 @@ public:
|
||||
|
||||
void continue_ops(int time_passed = 0);
|
||||
|
||||
void list_inode(inode_t inode, int max_parallel_pgs, std::function<void(
|
||||
void list_inode(inode_t inode, uint64_t min_offset, uint64_t max_offset, int max_parallel_pgs, std::function<void(
|
||||
int status, int pgs_left, pg_num_t pg_num, std::set<object_id>&& objects, std::vector<osd_num_t> && inactive_osds)> pg_callback);
|
||||
|
||||
//inline uint32_t get_bs_bitmap_granularity() { return st_cli.global_bitmap_granularity; }
|
||||
|
||||
@@ -44,6 +44,8 @@ struct inode_list_t
|
||||
cluster_client_t *cli = NULL;
|
||||
pool_id_t pool_id = 0;
|
||||
inode_t inode = 0;
|
||||
uint64_t min_offset = 0;
|
||||
uint64_t max_offset = 0;
|
||||
int max_parallel_pgs = 16;
|
||||
|
||||
int inflight_pgs = 0;
|
||||
@@ -55,7 +57,7 @@ struct inode_list_t
|
||||
std::function<void(int status, int pgs_left, pg_num_t pg_num, std::set<object_id>&& objects, std::vector<osd_num_t> && inactive_osds)> callback;
|
||||
};
|
||||
|
||||
void cluster_client_t::list_inode(inode_t inode, int max_parallel_pgs, std::function<void(
|
||||
void cluster_client_t::list_inode(inode_t inode, uint64_t min_offset, uint64_t max_offset, int max_parallel_pgs, std::function<void(
|
||||
int status, int pgs_left, pg_num_t pg_num, std::set<object_id>&& objects, std::vector<osd_num_t> && inactive_osds)> pg_callback)
|
||||
{
|
||||
init_msgr();
|
||||
@@ -67,10 +69,15 @@ void cluster_client_t::list_inode(inode_t inode, int max_parallel_pgs, std::func
|
||||
pg_callback(-EINVAL, 0, 0, std::set<object_id>(), std::vector<osd_num_t>());
|
||||
return;
|
||||
}
|
||||
auto pg_stripe_size = st_cli.pool_config.at(pool_id).pg_stripe_size;
|
||||
if (min_offset)
|
||||
min_offset = (min_offset/pg_stripe_size) * pg_stripe_size;
|
||||
inode_list_t *lst = new inode_list_t();
|
||||
lst->cli = this;
|
||||
lst->pool_id = pool_id;
|
||||
lst->inode = inode;
|
||||
lst->min_offset = min_offset;
|
||||
lst->max_offset = max_offset;
|
||||
lst->callback = pg_callback;
|
||||
lst->max_parallel_pgs = max_parallel_pgs <= 0 ? 16 : max_parallel_pgs;
|
||||
lists.push_back(lst);
|
||||
@@ -342,6 +349,8 @@ void cluster_client_t::send_list(inode_list_osd_t *cur_list)
|
||||
.pg_stripe_size = pool_cfg.pg_stripe_size,
|
||||
.min_inode = cur_list->pg->lst->inode,
|
||||
.max_inode = cur_list->pg->lst->inode,
|
||||
.min_stripe = cur_list->pg->lst->min_offset,
|
||||
.max_stripe = cur_list->pg->lst->max_offset,
|
||||
},
|
||||
};
|
||||
op->callback = [this, cur_list](osd_op_t *op)
|
||||
|
||||
@@ -389,7 +389,7 @@ struct snap_merger_t
|
||||
if (lower ? (sp.second < target_rank) : (sp.second > target_rank))
|
||||
{
|
||||
lists_todo++;
|
||||
parent->cli->list_inode(src, parent->parallel_osds, [this, src](
|
||||
parent->cli->list_inode(src, 0, 0, parent->parallel_osds, [this, src](
|
||||
int errcode, int pgs_left, pg_num_t pg_num, std::set<object_id>&& objects, std::vector<osd_num_t> && inactive_osds)
|
||||
{
|
||||
if (errcode)
|
||||
|
||||
@@ -51,7 +51,7 @@ struct rm_inode_t
|
||||
return;
|
||||
}
|
||||
pgs_to_list = pool_it->second.real_pg_count;
|
||||
parent->cli->list_inode(inode, parent->parallel_osds, [this](
|
||||
parent->cli->list_inode(inode, min_offset, max_offset, parent->parallel_osds, [this](
|
||||
int errcode, int pgs_left, pg_num_t pg_num, std::set<object_id>&& objects, std::vector<osd_num_t> && inactive_osds)
|
||||
{
|
||||
osd_num_t rm_osd_num = 0;
|
||||
@@ -142,6 +142,7 @@ struct rm_inode_t
|
||||
cur_list->in_flight--;
|
||||
if (op->reply.hdr.retval < 0)
|
||||
{
|
||||
// FIXME: Retry -EPIPE
|
||||
fprintf(stderr, "Failed to remove object %jx:%jx from PG %u (OSD %ju) (retval=%jd)\n",
|
||||
op->req.rw.inode, op->req.rw.offset,
|
||||
cur_list->pg_num, cur_list->rm_osd_num, op->reply.hdr.retval);
|
||||
@@ -153,9 +154,13 @@ struct rm_inode_t
|
||||
continue_delete();
|
||||
};
|
||||
cur_list->in_flight++;
|
||||
cur_list->obj_pos++;
|
||||
parent->cli->msgr.outbox_push(op);
|
||||
}
|
||||
cur_list->obj_pos++;
|
||||
else
|
||||
{
|
||||
cur_list->obj_pos++;
|
||||
}
|
||||
}
|
||||
if (cur_list->in_flight == 0 && cur_list->obj_pos == cur_list->objects.end() &&
|
||||
!cur_list->synced)
|
||||
|
||||
Reference in New Issue
Block a user