Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NES-8] NES의 writeback 캐시 티어 읽기 쓰기 동작 조정 #48

Merged
merged 4 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/common/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2494,7 +2494,7 @@ std::vector<Option> get_global_options() {
.set_description("how frequently to retry recovery reservations after being denied (e.g., due to a full OSD)"),

Option("osd_agent_max_ops", Option::TYPE_INT, Option::LEVEL_ADVANCED)
.set_default(4)
.set_default(8)
.set_description("maximum concurrent tiering operations for tiering agent"),

Option("osd_agent_max_low_ops", Option::TYPE_INT, Option::LEVEL_ADVANCED)
Expand Down
42 changes: 29 additions & 13 deletions src/osd/PrimaryLogPG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2791,16 +2791,22 @@ PrimaryLogPG::cache_result_t PrimaryLogPG::maybe_handle_cache_detail(
}

if (op->may_write() || op->may_cache()) {
do_proxy_write(op);

// Promote too?
if (!op->need_skip_promote() &&
maybe_promote(obc, missing_oid, oloc, in_hit_set,
pool.info.min_write_recency_for_promote,
OpRequestRef(),
promote_obc)) {
return cache_result_t::BLOCKED_PROMOTE;
// Prepare to check first osd operation
vector<OSDOp> ops = m->ops;
OSDOp& first_op = *(ops.begin());
int first_opcode = first_op.op.op;

// Skip object promotion if target object is completely new
if ( first_opcode == CEPH_OSD_OP_WRITEFULL ||
(first_opcode == CEPH_OSD_OP_CREATE && (first_op.op.flags & CEPH_OSD_OP_FLAG_EXCL)) )
{
do_proxy_write(op, NULL, true); // self proxy write
}
else {
promote_object(obc, missing_oid, oloc, op, promote_obc);
do_proxy_write(op, NULL, true); // self proxy write
}

return cache_result_t::HANDLED_PROXY;
} else {
do_proxy_read(op);
Expand Down Expand Up @@ -3037,7 +3043,7 @@ struct C_ProxyChunkRead : public Context {
}
};

void PrimaryLogPG::do_proxy_read(OpRequestRef op, ObjectContextRef obc)
void PrimaryLogPG::do_proxy_read(OpRequestRef op, ObjectContextRef obc, bool self)
{
// NOTE: non-const here because the ProxyReadOp needs mutable refs to
// stash the result in the request's OSDOp vector
Expand All @@ -3058,7 +3064,12 @@ void PrimaryLogPG::do_proxy_read(OpRequestRef op, ObjectContextRef obc)
/* proxy */
soid = m->get_hobj();
oloc = object_locator_t(m->get_object_locator());
oloc.pool = pool.info.tier_of;
if (self) {
oloc.hash = soid.get_hash();
}
else {
oloc.pool = pool.info.tier_of;
}
}
unsigned flags = CEPH_OSD_FLAG_IGNORE_CACHE | CEPH_OSD_FLAG_IGNORE_OVERLAY;

Expand Down Expand Up @@ -3249,7 +3260,7 @@ struct C_ProxyWrite_Commit : public Context {
}
};

void PrimaryLogPG::do_proxy_write(OpRequestRef op, ObjectContextRef obc)
void PrimaryLogPG::do_proxy_write(OpRequestRef op, ObjectContextRef obc, bool self)
{
// NOTE: non-const because ProxyWriteOp takes a mutable ref
MOSDOp *m = static_cast<MOSDOp*>(op->get_nonconst_req());
Expand All @@ -3270,7 +3281,12 @@ void PrimaryLogPG::do_proxy_write(OpRequestRef op, ObjectContextRef obc)
/* proxy */
soid = m->get_hobj();
oloc = object_locator_t(m->get_object_locator());
oloc.pool = pool.info.tier_of;
if (self) {
oloc.hash = soid.get_hash();
}
else {
oloc.pool = pool.info.tier_of;
}
}

unsigned flags = CEPH_OSD_FLAG_IGNORE_CACHE | CEPH_OSD_FLAG_IGNORE_OVERLAY;
Expand Down
4 changes: 2 additions & 2 deletions src/osd/PrimaryLogPG.h
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener {
// -- proxyread --
map<ceph_tid_t, ProxyReadOpRef> proxyread_ops;

void do_proxy_read(OpRequestRef op, ObjectContextRef obc = NULL);
void do_proxy_read(OpRequestRef op, ObjectContextRef obc = NULL, bool self = false);
void finish_proxy_read(hobject_t oid, ceph_tid_t tid, int r);
void cancel_proxy_read(ProxyReadOpRef prdop, vector<ceph_tid_t> *tids);

Expand All @@ -1474,7 +1474,7 @@ class PrimaryLogPG : public PG, public PGBackend::Listener {
// -- proxywrite --
map<ceph_tid_t, ProxyWriteOpRef> proxywrite_ops;

void do_proxy_write(OpRequestRef op, ObjectContextRef obc = NULL);
void do_proxy_write(OpRequestRef op, ObjectContextRef obc = NULL, bool self = false);
void finish_proxy_write(hobject_t oid, ceph_tid_t tid, int r);
void cancel_proxy_write(ProxyWriteOpRef pwop, vector<ceph_tid_t> *tids);

Expand Down