zbd: Ensure first I/O is write for random read/write to sequential zones
Review
Quoted 6 lines
zbd_adjust_block(quoted diff) +3
-0+ if (td_rw(td) && !f->zbd_info->sectors_with_data + && !td->o.read_beyond_wp) + io_u->ddir = DDIR_WRITE;
Oh, you've noticed this too. :-)
This will issue the first write with wrong length if bs[DDIR_READ] != bs[DDIR_WRITE]. Adjusting in zbd_adjust_block() is too late.
Quoted 10 lines · Alexey Dobriyan
Review
Quoted 6 lines
zbd_adjust_block(quoted diff) +3
-0+ if (td_rw(td) && !f->zbd_info->sectors_with_data + && !td->o.read_beyond_wp) + io_u->ddir = DDIR_WRITE;Oh, you've noticed this too. :-)
This will issue the first write with wrong length if bs[DDIR_READ] != bs[DDIR_WRITE].
Hi Alexey, thanks for pointing out that.
Quoted 1 line
Adjusting in
zbd_adjust_block()is too late.
Hmm, you are right. To align the new ddir with buflen and offset, need to call get_next_offset() and get_next_buflen() again from zbd_adjust_block(). Those functions are now static to io_u.c and will have duplicate code...
It is not ideal to add more zoned block device related code to io_u.c, but now I think it is the simplest to check conditions and enforce ddir=DDIR_WRITE in set_rw_ddir() of io_u.c. It modifies ddir before get_next_offset() and get_next_buflen() calls then makes io_u fields consistent. Will create a patch to ask opinions on this list.
Signature · 2 lines
Best Regards, Shin'ichiro Kawasaki