[RFC PATCH 05/34] xen-blkback: use bio_new
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: linux-xfs@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, dm-devel@xxxxxxxxxx, linux-block@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, drbd-dev@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-nvme@xxxxxxxxxxxxxxxxxxx, linux-scsi@xxxxxxxxxxxxxxx, target-devel@xxxxxxxxxxxxxxx, linux-fscrypt@xxxxxxxxxxxxxxx, jfs-discussion@xxxxxxxxxxxxxxxxxxxxx, linux-nilfs@xxxxxxxxxxxxxxx, ocfs2-devel@xxxxxxxxxxxxxx, linux-pm@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx
- Subject: [RFC PATCH 05/34] xen-blkback: use bio_new
- From: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx>
- Date: Wed, 27 Jan 2021 23:11:04 -0800
- In-reply-to: <20210128071133.60335-1-chaitanya.kulkarni@wdc.com>
- Ironport-sdr: Ex5/iAGHHr/D70S/ddSRyQZ8XO1wNJPg357Nse7n1UfrF09MRUQUagKwvOgEw9+8zi/z83DjBo 1/lWlkQ6WrUTgGKLOnCE1gv5LWIWQLpRaJdyFl3KFvumhjlynBtRZtg0BXyHbj5IdriugPqkbW 4TGoy/bnLzrBYbJRYcy4VTyKy3qCHFBkuGSVeKHZZ1x9TKDQvGPAtS8/QxGIUfv+JdRQNSanCA LX52aGomGjR7EF0yWfWiT7V2GXyaS7DM9pHUqtks+HhXn15r0GPZdlkYdmJHzHheBWOOR/nLrm C9Q=
- Ironport-sdr: 5hsv9wnCP5D94GKGuwBELxnohAflNYwRHdrWm3fTf1ZJLs7K386iSwLh9HIXrSUQbmc790psCo gDFjHP7cqpdgLSoAhOSaUe/TCYkttE4m3zfjQlnwyfNDzA2vE0wKiQQ3PSpOi+P6EUdw9ZMkLP mAEjxegfsi20N9fLF+HMe2LOT4/mN6eQ7Fo+82i4FJ8ogLP7jyQAjO552e1ldRnqe/vPX/WFzA KelbYkoOh8/uEPeS3UMO/70/JMqqQOKDRfmbImkor7n7Mra+tVIqqFp9lNAOWA69T2QW25jjUu NxV8aivDCRKKy9R+rr1A5rwo
- Ironport-sdr: AXyfJ+0DzRblLd1C2a8i26F/p5ozSimYWSlSS31hVM9ZD6XicSUM+PrSEKfC1Dird0dpCST4jr RH8MY1sbvDVq5P84PowPihV3IFXmyzQNH7jhgBGPCvDUQHmJMRxTWJczw7haMsXH6G94Is8ChW 3Thpc5BIBnKiKhlT74BApZ+91+Tr+DAOOck7bXVmzNs8yvwHiSmvLe1vToPqpHXLGvuEQ8CHDc wMtFD3vO2n6mQgoI8Yf56mEPo6oNIWF003bHhQMN3DD+ikOw4kJGblAZl7I7M30srcHVxOHbPk wqE=
- References: <20210128071133.60335-1-chaitanya.kulkarni@wdc.com>
- Wdcironportexception: Internal
Create a wrapper on the tio of the bio_new() named get_new_bio() & use
it in the dispatch_rw_block_io().
p
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@xxxxxxx>
---
drivers/block/xen-blkback/blkback.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 9ebf53903d7b..3760278f0ee6 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -1174,6 +1174,15 @@ do_block_io_op(struct xen_blkif_ring *ring, unsigned int *eoi_flags)
return more_to_do;
}
+
+static struct bio *
+get_new_bio(struct phys_req *preq, unsigned int op, unsigned int op_flags,
+ gfp_t gfp_mask, unsigned int nr_bvec)
+{
+ return bio_new(preq->bdev, preq->sector_number, op, op_flags, nr_bvec,
+ gfp_mask);
+
+}
/*
* Transmutation of the 'struct blkif_request' to a proper 'struct bio'
* and call the 'submit_bio' to pass it to the underlying storage.
@@ -1324,16 +1333,14 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
seg[i].offset) == 0)) {
int nr_iovecs = min_t(int, (nseg-i), BIO_MAX_PAGES);
- bio = bio_alloc(GFP_KERNEL, nr_iovecs);
+ bio = get_new_bio(&preq, operation, operation_flags,
+ GFP_KERNEL, nr_iovecs);
if (unlikely(bio == NULL))
goto fail_put_bio;
biolist[nbio++] = bio;
- bio_set_dev(bio, preq.bdev);
bio->bi_private = pending_req;
bio->bi_end_io = end_block_io_op;
- bio->bi_iter.bi_sector = preq.sector_number;
- bio_set_op_attrs(bio, operation, operation_flags);
}
preq.sector_number += seg[i].nsec;
@@ -1343,15 +1350,14 @@ static int dispatch_rw_block_io(struct xen_blkif_ring *ring,
if (!bio) {
BUG_ON(operation_flags != REQ_PREFLUSH);
- bio = bio_alloc(GFP_KERNEL, 0);
+ bio = get_new_bio(&preq, operation, operation_flags,
+ GFP_KERNEL, 0);
if (unlikely(bio == NULL))
goto fail_put_bio;
biolist[nbio++] = bio;
- bio_set_dev(bio, preq.bdev);
bio->bi_private = pending_req;
bio->bi_end_io = end_block_io_op;
- bio_set_op_attrs(bio, operation, operation_flags);
}
atomic_set(&pending_req->pendcnt, nbio);
--
2.22.1
[Index of Archives]
[linux Cryptography]
[Asterisk App Development]
[PJ SIP]
[Gnu Gatekeeper]
[IETF Sipping]
[Info Cyrus]
[ALSA User]
[Fedora Linux Users]
[Linux SCTP]
[DCCP]
[Gimp]
[Yosemite News]
[Deep Creek Hot Springs]
[Yosemite Campsites]
[ISDN Cause Codes]