Move "ack write" debug message

This commit is contained in:
Vitaliy Filippov
2025-12-02 01:52:12 +03:00
parent 11783a2d7a
commit a9773b1908
+29 -31
View File
@@ -351,44 +351,42 @@ resume_4:
return 1; return 1;
} }
resume_6: resume_6:
// Apply throttling to not fill the journal too fast for the SSD+HDD case
if (!PRIV(op)->is_big && throttle_small_writes)
{ {
#ifdef BLOCKSTORE_DEBUG // Apply throttling
printf("Ack write %jx:%jx v%ju\n", op->oid.inode, op->oid.stripe, op->version); timespec tv_end;
#endif clock_gettime(CLOCK_REALTIME, &tv_end);
// Apply throttling to not fill the journal too fast for the SSD+HDD case uint64_t exec_us =
if (!PRIV(op)->is_big && throttle_small_writes) (tv_end.tv_sec - PRIV(op)->tv_begin.tv_sec)*1000000 +
(tv_end.tv_nsec - PRIV(op)->tv_begin.tv_nsec)/1000;
// Compare with target execution time
// 100% free -> target time = 0
// 0% free -> target time = iodepth/parallelism * (iops + size/bw) / write per second
uint64_t buffer_free_space = dsk.journal_len - heap->get_buffer_area_used_space();
uint64_t ref_us =
(write_iodepth <= throttle_target_parallelism ? 100 : 100*write_iodepth/throttle_target_parallelism)
* (1000000/throttle_target_iops + op->len*1000000/throttle_target_mbs/1024/1024)
/ 100;
ref_us -= ref_us * buffer_free_space / dsk.journal_len;
if (ref_us > exec_us + throttle_threshold_us)
{ {
// Apply throttling // Pause reply
timespec tv_end; PRIV(op)->op_state = 7;
clock_gettime(CLOCK_REALTIME, &tv_end); // Remember that the timer can in theory be called right here
uint64_t exec_us = tfd->set_timer_us(ref_us-exec_us, false, [this, op](int timer_id)
(tv_end.tv_sec - PRIV(op)->tv_begin.tv_sec)*1000000 +
(tv_end.tv_nsec - PRIV(op)->tv_begin.tv_nsec)/1000;
// Compare with target execution time
// 100% free -> target time = 0
// 0% free -> target time = iodepth/parallelism * (iops + size/bw) / write per second
uint64_t buffer_free_space = dsk.journal_len - heap->get_buffer_area_used_space();
uint64_t ref_us =
(write_iodepth <= throttle_target_parallelism ? 100 : 100*write_iodepth/throttle_target_parallelism)
* (1000000/throttle_target_iops + op->len*1000000/throttle_target_mbs/1024/1024)
/ 100;
ref_us -= ref_us * buffer_free_space / dsk.journal_len;
if (ref_us > exec_us + throttle_threshold_us)
{ {
// Pause reply PRIV(op)->op_state++;
PRIV(op)->op_state = 7; ringloop->wakeup();
// Remember that the timer can in theory be called right here });
tfd->set_timer_us(ref_us-exec_us, false, [this, op](int timer_id) return 1;
{
PRIV(op)->op_state++;
ringloop->wakeup();
});
return 1;
}
} }
} }
resume_8: resume_8:
// Acknowledge write // Acknowledge write
#ifdef BLOCKSTORE_DEBUG
printf("Ack write %jx:%jx v%ju\n", op->oid.inode, op->oid.stripe, op->version);
#endif
op->retval = op->len; op->retval = op->len;
heap->mark_lsn_completed(PRIV(op)->lsn); heap->mark_lsn_completed(PRIV(op)->lsn);
write_iodepth--; write_iodepth--;