diff mbox

[v3,3/5] brd: Split bio if needed

Message ID 570D5D1F.5090909@sandisk.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bart Van Assche April 12, 2016, 8:39 p.m. UTC
If a bio is submitted to the brd driver that does not satisfy the
requirements of this driver, split the bio.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Dmitry Monakhov <dmonakhov@openvz.org>
---
 drivers/block/brd.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Hannes Reinecke April 13, 2016, 5:50 a.m. UTC | #1
On 04/12/2016 10:39 PM, Bart Van Assche wrote:
> If a bio is submitted to the brd driver that does not satisfy the
> requirements of this driver, split the bio.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Jan Kara <jack@suse.cz>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Mike Snitzer <snitzer@redhat.com>
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Cc: Dmitry Monakhov <dmonakhov@openvz.org>
> ---
>  drivers/block/brd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/block/brd.c b/drivers/block/brd.c
> index 51a071e..91eb844 100644
> --- a/drivers/block/brd.c
> +++ b/drivers/block/brd.c
> @@ -339,6 +339,8 @@ static blk_qc_t brd_make_request(struct request_queue *q, struct bio *bio)
>  	if (bio_end_sector(bio) > get_capacity(bdev->bd_disk))
>  		goto io_error;
>  
> +	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)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
diff mbox

Patch

diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index 51a071e..91eb844 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -339,6 +339,8 @@  static blk_qc_t brd_make_request(struct request_queue *q, struct bio *bio)
 	if (bio_end_sector(bio) > get_capacity(bdev->bd_disk))
 		goto io_error;
 
+	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)