Skip to content

Commit

Permalink
fix: Ensure block io queue segment size is correct (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickkenney9801 authored Dec 11, 2024
1 parent 515a788 commit db4069b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ static int block_4k_ios(u32 bytes) {

// copied from linux kernel
static inline unsigned short blk_rq_nr_phys_segments_dup(struct request* rq) {
if ((rq->cmd_flags & REQ_IDLE) && (rq->cmd_flags & REQ_FUA) && (rq->cmd_flags & REQ_META))
return 0;
if (rq->rq_flags & RQF_SPECIAL_PAYLOAD)
return 1;
return rq->nr_phys_segments;
Expand Down
18 changes: 13 additions & 5 deletions python/kernmlops/data_schema/block_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,23 @@ def from_tables(cls, queue_table: BlockIOQueueTable, latency_table: BlockIOLaten
"collection_id",
],
how="inner",
).with_columns(
).filter(
((pl.col("finish_ts_uptime_us") - pl.col(UPTIME_TIMESTAMP)) > 0) &
((pl.col("finish_ts_uptime_us") - pl.col(UPTIME_TIMESTAMP)) < pl.col("block_latency_us"))
)
block_df = block_df.unique([
"cpu",
"device",
"sector",
"segments",
"block_io_bytes",
UPTIME_TIMESTAMP,
"block_io_flags",
]).with_columns(
(pl.col("finish_ts_uptime_us") - pl.col(UPTIME_TIMESTAMP)).alias("measured_latency_us"),
pl.col("block_io_flags").map_elements(
flags_print, return_dtype=pl.String,
).alias("block_io_flags_string"),
).filter(
pl.col("measured_latency_us") > 0
).filter(
(pl.col("measured_latency_us") - 100) < pl.col("block_latency_us")
).sort(UPTIME_TIMESTAMP, descending=False)
return cls.from_df(block_df)

Expand Down

0 comments on commit db4069b

Please sign in to comment.