Re: [PATCH v3 4/5] brd: Accept non-aligned discard requests with size zero

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

 



On 04/12/2016 10:40 PM, Bart Van Assche wrote:
> Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxxxxxx>
> Cc: Jan Kara <jack@xxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: Mike Snitzer <snitzer@xxxxxxxxxx>
> Cc: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
> Cc: Dmitry Monakhov <dmonakhov@xxxxxxxxxx>
> ---
>  drivers/block/brd.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/block/brd.c b/drivers/block/brd.c
> index 91eb844..9806551 100644
> --- a/drivers/block/brd.c
> +++ b/drivers/block/brd.c
> @@ -342,8 +342,9 @@ static blk_qc_t brd_make_request(struct request_queue *q, struct bio *bio)
>  	blk_queue_split(q, &bio, q->bio_split);
>  
>  	if (unlikely(bio->bi_rw & REQ_DISCARD)) {
> -		if (sector & ((PAGE_SIZE >> SECTOR_SHIFT) - 1) ||
> -		    bio->bi_iter.bi_size & ~PAGE_MASK)
> +		if (bio->bi_iter.bi_size &&
> +		    (sector & ((PAGE_SIZE >> SECTOR_SHIFT) - 1) ||
> +		     bio->bi_iter.bi_size & ~PAGE_MASK))
>  			goto io_error;
>  		discard_from_brd(brd, sector, bio->bi_iter.bi_size);
>  		goto out;
> 
Reviewed-by: Hannes Reinecke <hare@xxxxxxxx>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		   Teamlead Storage & Networking
hare@xxxxxxx			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux