Skip to content

Conversation

@minwooim
Copy link
Contributor

For randtrimwrite, we should issue trim + write pair and those offsets should be same.

This works good for cases without offset= option, but not for cases with offset= option. In cases with offset= option, it's necessary to subtract file_offset, which is value of offset= option, when calculationg offset of write.

This is a bit confusing because last_start is an actual offset that has already been issued through trim. However, last_start is the value to which file_offset is added. Since we add back file_offset later on after calling get_next_block in get_next_offset, last_start should be adjusted.

For randtrimwrite, we should issue trim + write pair and those offsets
should be same.

This works good for cases without `offset=` option, but not for cases
with `offset=` option.  In cases with `offset=` option, it's necessary
to subtract `file_offset`, which is value of `offset=` option, when
calculationg offset of write.

This is a bit confusing because `last_start` is an actual offset that
has already been issued through trim.  However, `last_start` is the
value to which `file_offset` is added.  Since we add back `file_offset`
later on after calling `get_next_block` in `get_next_offset`,
`last_start` should be adjusted.

Signed-off-by: Jungwon Lee <[email protected]>
Signed-off-by: Minwoo Im <[email protected]>
[+ updated commit title]
@axboe axboe merged commit 5db7e6b into axboe:master Jun 30, 2025
32 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants