Re: [PATCH v2 3/5] zbd: Do not read offline zones

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/29/18 21:15, Damien Le Moal wrote:
> For an I/O trying to read an offline zone, another zone must be chosen
> using zbd_find_zone(). However, in zbd_adjust_block(), the variable
> range is set to 0 for an offline zone, which in the case of a random
> read pattern causes evaluation of the first if condition of the
> DDIR_READ case to true, resulting in the use of the offline zone.
> 
> Fix this simply by setting range to -1 so that the first if statement is
> false and zbd_find_zone() executed.
> 
> Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxx>
> ---
>  zbd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/zbd.c b/zbd.c
> index 19511454..e98c5a50 100644
> --- a/zbd.c
> +++ b/zbd.c
> @@ -1157,7 +1157,7 @@ enum io_u_action zbd_adjust_block(struct thread_data *td, struct io_u *io_u)
>  		 * hit the medium.
>  		 */
>  		range = zb->cond != BLK_ZONE_COND_OFFLINE ?
> -			((zb->wp - zb->start) << 9) - io_u->buflen : 0;
> +			((zb->wp - zb->start) << 9) - io_u->buflen : -1;
>  		if (td_random(td) && range >= 0) {
>  			io_u->offset = (zb->start << 9) +
>  				((io_u->offset - (zb->start << 9)) %
> 

Reviewed-by: Bart Van Assche <bvanassche@xxxxxxx>



[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux