osd: change tier-flush's operation type to ReadOperation

existing flush is the ReadOperation in order to flush older
clone that head.
Like existing flush, change tier-flush's type to ReadOperation

Signed-off-by: Myoungwon Oh <ohmyoungwon@gmail.com>
This commit is contained in:
myoungwon oh 2020-04-21 05:36:21 -04:00
parent 51719f6895
commit ede9164db0
6 changed files with 29 additions and 14 deletions

View File

@ -326,7 +326,7 @@ extern const char *ceph_osd_state_name(int s);
f(SET_CHUNK, __CEPH_OSD_OP(WR, DATA, 40), "set-chunk") \
f(TIER_PROMOTE, __CEPH_OSD_OP(WR, DATA, 41), "tier-promote") \
f(UNSET_MANIFEST, __CEPH_OSD_OP(WR, DATA, 42), "unset-manifest") \
f(TIER_FLUSH, __CEPH_OSD_OP(WR, DATA, 43), "tier-flush") \
f(TIER_FLUSH, __CEPH_OSD_OP(CACHE, DATA, 43), "tier-flush") \
\
/** attrs **/ \
/* read */ \

View File

@ -518,7 +518,6 @@ inline namespace v14_2_0 {
std::string tgt_oid, uint64_t tgt_offset, int flag = 0);
void tier_promote();
void unset_manifest();
void tier_flush();
friend class IoCtx;
@ -733,6 +732,12 @@ inline namespace v14_2_0 {
* triggering a promote on the OSD (that is then evicted).
*/
void cache_evict();
/**
* flush a manifest tier object to backing tier; will block racing
* updates.
*/
void tier_flush();
};
/* IoCtx : This is a context in which we can perform I/O.

View File

@ -631,6 +631,13 @@ void librados::ObjectReadOperation::cache_evict()
o->cache_evict();
}
void librados::ObjectReadOperation::tier_flush()
{
ceph_assert(impl);
::ObjectOperation *o = &impl->o;
o->tier_flush();
}
void librados::ObjectWriteOperation::set_redirect(const std::string& tgt_obj,
const IoCtx& tgt_ioctx,
uint64_t tgt_version,
@ -669,13 +676,6 @@ void librados::ObjectWriteOperation::unset_manifest()
o->unset_manifest();
}
void librados::ObjectWriteOperation::tier_flush()
{
ceph_assert(impl);
::ObjectOperation *o = &impl->o;
o->tier_flush();
}
void librados::ObjectWriteOperation::tmap_update(const bufferlist& cmdbl)
{
ceph_assert(impl);

View File

@ -6994,7 +6994,8 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
result = -EOPNOTSUPP;
break;
}
if (soid.has_snapset()) {
if (ctx->snapc.snaps.size() ||
(ctx->obc->ssc && ctx->obc->ssc->snapset.clones.size()) ) {
result = -EOPNOTSUPP;
break;
}

View File

@ -2700,7 +2700,7 @@ public:
class TierFlushOp : public TestOp {
public:
librados::AioCompletion *completion;
librados::ObjectWriteOperation op;
librados::ObjectReadOperation op;
string oid;
std::shared_ptr<int> in_use;
@ -2728,8 +2728,9 @@ public:
context->state_lock.unlock();
op.tier_flush();
unsigned flags = librados::OPERATION_IGNORE_CACHE;
int r = context->io_ctx.aio_operate(context->prefix+oid, completion,
&op);
&op, flags, NULL);
ceph_assert(!r);
}

View File

@ -3789,9 +3789,17 @@ static int rados_tool_common(const std::map < std::string, std::string > &opts,
}
string oid(nargs[1]);
ObjectWriteOperation op;
ObjectReadOperation op;
op.tier_flush();
ret = io_ctx.operate(oid, &op);
librados::AioCompletion *completion =
librados::Rados::aio_create_completion();
io_ctx.aio_operate(oid.c_str(), completion, &op,
librados::OPERATION_IGNORE_CACHE |
librados::OPERATION_IGNORE_OVERLAY,
NULL);
completion->wait_for_complete();
ret = completion->get_return_value();
completion->release();
if (ret < 0) {
cerr << "error tier-flush " << pool_name << "/" << oid << " : "
<< cpp_strerror(ret) << std::endl;