On Apr 14, 2020 / 00:21, Alexey Dobriyan wrote: > > zbd_adjust_block > > > > + 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. > 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. -- Best Regards, Shin'ichiro Kawasaki