From d6514df945f855c7ce02b760e151c8e96cfa1aab Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 22 Oct 2019 14:53:59 +0800 Subject: [PATCH] tools/rados: s/wait_for_safe/wait_for_complete/ wait_for_safe() and friend are deprecated, so use wait_for_complete() instead. Signed-off-by: Kefu Chai --- src/tools/rados/rados.cc | 18 +++++++++--------- src/tools/scratchtool.c | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/tools/rados/rados.cc b/src/tools/rados/rados.cc index 29fe84a1292..d88c2709172 100644 --- a/src/tools/rados/rados.cc +++ b/src/tools/rados/rados.cc @@ -863,7 +863,7 @@ int LoadGen::bootstrap(const char *pool) } } - librados::AioCompletion *c = rados->aio_create_completion(NULL, NULL, NULL); + librados::AioCompletion *c = rados->aio_create_completion(nullptr, nullptr); completions.push_back(c); // generate object ret = io_ctx.aio_write(info.name, c, bl, buf_len, info.len - buf_len); @@ -890,7 +890,7 @@ int LoadGen::bootstrap(const char *pool) void LoadGen::run_op(LoadGenOp *op) { - op->completion = rados->aio_create_completion(op, _load_gen_cb, NULL); + op->completion = rados->aio_create_completion(op, _load_gen_cb); switch (op->type) { case OP_READ: @@ -1053,7 +1053,7 @@ protected: completions = NULL; } int create_completion(int slot, void (*cb)(void *, void*), void *arg) override { - completions[slot] = rados.aio_create_completion((void *) arg, 0, cb); + completions[slot] = rados.aio_create_completion((void *) arg, cb); if (!completions[slot]) return -EINVAL; @@ -1115,11 +1115,11 @@ protected: } bool completion_is_done(int slot) override { - return completions[slot]->is_safe(); + return completions[slot]->is_complete(); } int completion_wait(int slot) override { - return completions[slot]->wait_for_safe_and_cb(); + return completions[slot]->wait_for_complete_and_cb(); } int completion_ret(int slot) override { return completions[slot]->get_return_value(); @@ -1330,7 +1330,7 @@ static int do_cache_flush(IoCtx& io_ctx, string oid) librados::OPERATION_IGNORE_CACHE | librados::OPERATION_IGNORE_OVERLAY, NULL); - completion->wait_for_safe(); + completion->wait_for_complete(); int r = completion->get_return_value(); completion->release(); return r; @@ -1347,7 +1347,7 @@ static int do_cache_try_flush(IoCtx& io_ctx, string oid) librados::OPERATION_IGNORE_OVERLAY | librados::OPERATION_SKIPRWLOCKS, NULL); - completion->wait_for_safe(); + completion->wait_for_complete(); int r = completion->get_return_value(); completion->release(); return r; @@ -1364,7 +1364,7 @@ static int do_cache_evict(IoCtx& io_ctx, string oid) librados::OPERATION_IGNORE_OVERLAY | librados::OPERATION_SKIPRWLOCKS, NULL); - completion->wait_for_safe(); + completion->wait_for_complete(); int r = completion->get_return_value(); completion->release(); return r; @@ -1789,7 +1789,7 @@ static int do_get_inconsistent_cmd(const std::vector &nargs, auto completion = librados::Rados::aio_create_completion(); ret = do_get_inconsistent(rados, pg, start, max_item_num, completion, &items, &interval); - completion->wait_for_safe(); + completion->wait_for_complete(); ret = completion->get_return_value(); completion->release(); if (ret < 0) { diff --git a/src/tools/scratchtool.c b/src/tools/scratchtool.c index b344f0b7473..b090df42b1e 100644 --- a/src/tools/scratchtool.c +++ b/src/tools/scratchtool.c @@ -263,9 +263,9 @@ static int testrados(void) rados_aio_create_completion(0, 0, 0, &b); rados_aio_write(io_ctx, "a", a, buf, 100, 0); rados_aio_write(io_ctx, "../b/bb_bb_bb\\foo\\bar", b, buf, 100, 0); - rados_aio_wait_for_safe(a); + rados_aio_wait_for_complete(a); printf("a safe\n"); - rados_aio_wait_for_safe(b); + rados_aio_wait_for_complete(b); printf("b safe\n"); rados_aio_release(a); rados_aio_release(b); -- 2.39.5