summaryrefslogtreecommitdiffstats
path: root/src/osd/PrimaryLogPG.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/PrimaryLogPG.cc')
-rw-r--r--src/osd/PrimaryLogPG.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc
index 243e127eb..49178dc40 100644
--- a/src/osd/PrimaryLogPG.cc
+++ b/src/osd/PrimaryLogPG.cc
@@ -1667,7 +1667,11 @@ bool PrimaryLogPG::get_rw_locks(bool write_ordered, OpContext *ctx)
* to get the second.
*/
if (write_ordered && ctx->op->may_read()) {
- ctx->lock_type = RWState::RWEXCL;
+ if (ctx->op->may_read_data()) {
+ ctx->lock_type = RWState::RWEXCL;
+ } else {
+ ctx->lock_type = RWState::RWWRITE;
+ }
} else if (write_ordered) {
ctx->lock_type = RWState::RWWRITE;
} else {
@@ -5953,8 +5957,8 @@ int PrimaryLogPG::do_sparse_read(OpContext *ctx, OSDOp& osd_op) {
encode(m, osd_op.outdata); // re-encode since it might be modified
::encode_destructively(data_bl, osd_op.outdata);
- dout(10) << " sparse_read got " << r << " bytes from object "
- << soid << dendl;
+ dout(10) << " sparse_read got " << m.size() << " extents and " << r
+ << " bytes from object " << soid << dendl;
}
ctx->delta_stats.num_rd_kb += shift_round_up(op.extent.length, 10);
@@ -15627,8 +15631,10 @@ PrimaryLogPG::AwaitAsyncWork::AwaitAsyncWork(my_context ctx)
NamedState(nullptr, "Trimming/AwaitAsyncWork")
{
auto *pg = context< SnapTrimmer >().pg;
+ // Determine cost in terms of the average object size
+ uint64_t cost_per_object = pg->get_average_object_size();
context< SnapTrimmer >().log_enter(state_name);
- context< SnapTrimmer >().pg->osd->queue_for_snap_trim(pg);
+ context< SnapTrimmer >().pg->osd->queue_for_snap_trim(pg, cost_per_object);
pg->state_set(PG_STATE_SNAPTRIM);
pg->state_clear(PG_STATE_SNAPTRIM_ERROR);
pg->publish_stats_to_osd();