71 lines
2.6 KiB
Diff
71 lines
2.6 KiB
Diff
|
/* this patch is related with following upstream kernel commit */
|
||
|
|
||
|
commit 07888c665b405b1cd3577ddebfeb74f4717a84c4
|
||
|
Author: Christoph Hellwig <hch@lst.de>
|
||
|
Date: Mon Jan 24 10:11:05 2022 +0100
|
||
|
|
||
|
block: pass a block_device and opf to bio_alloc
|
||
|
|
||
|
Pass the block_device and operation that we plan to use this bio for to
|
||
|
bio_alloc to optimize the assignment. NULL/0 can be passed, both for the
|
||
|
passthrough case on a raw request_queue and to temporarily avoid
|
||
|
refactoring some nasty code.
|
||
|
|
||
|
Also move the gfp_mask argument after the nr_vecs argument for a much
|
||
|
more logical calling convention matching what most of the kernel does.
|
||
|
|
||
|
Signed-off-by: Christoph Hellwig <hch@lst.de>
|
||
|
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
|
||
|
Link: https://lore.kernel.org/r/20220124091107.642561-18-hch@lst.de
|
||
|
Signed-off-by: Jens Axboe <axboe@kernel.dk>
|
||
|
---
|
||
|
|
||
|
diff -Nupr a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c
|
||
|
--- a/drbd/drbd_receiver.c 2022-07-08 06:55:17.451589834 +0800
|
||
|
+++ b/drbd/drbd_receiver.c 2022-07-08 06:59:24.486571488 +0800
|
||
|
@@ -1263,7 +1263,8 @@ static void one_flush_endio(struct bio *
|
||
|
|
||
|
static void submit_one_flush(struct drbd_device *device, struct issue_flush_context *ctx)
|
||
|
{
|
||
|
- struct bio *bio = bio_alloc(GFP_NOIO, 0);
|
||
|
+ struct bio *bio = bio_alloc(device->ldev->backing_bdev, 0,
|
||
|
+ REQ_OP_FLUSH | REQ_PREFLUSH, GFP_NOIO);
|
||
|
struct one_flush_context *octx = kmalloc(sizeof(*octx), GFP_NOIO);
|
||
|
if (!bio || !octx) {
|
||
|
drbd_warn(device, "Could not allocate a bio, CANNOT ISSUE FLUSH\n");
|
||
|
@@ -1283,14 +1284,12 @@ static void submit_one_flush(struct drbd
|
||
|
|
||
|
octx->device = device;
|
||
|
octx->ctx = ctx;
|
||
|
- bio_set_dev(bio, device->ldev->backing_bdev);
|
||
|
bio->bi_private = octx;
|
||
|
bio->bi_end_io = one_flush_endio;
|
||
|
|
||
|
device->flush_jif = jiffies;
|
||
|
set_bit(FLUSH_PENDING, &device->flags);
|
||
|
atomic_inc(&ctx->pending);
|
||
|
- bio->bi_opf = REQ_OP_FLUSH | REQ_PREFLUSH;
|
||
|
submit_bio(bio);
|
||
|
}
|
||
|
|
||
|
@@ -1832,17 +1831,14 @@ next_bio:
|
||
|
goto fail;
|
||
|
}
|
||
|
|
||
|
- bio = bio_alloc(GFP_NOIO, nr_pages);
|
||
|
+ bio = bio_alloc(device->ldev->backing_bdev, nr_pages, peer_req->opf,
|
||
|
+ GFP_NOIO);
|
||
|
if (!bio) {
|
||
|
drbd_err(device, "submit_ee: Allocation of a bio failed (nr_pages=%u)\n", nr_pages);
|
||
|
goto fail;
|
||
|
}
|
||
|
/* > peer_req->i.sector, unless this is the first bio */
|
||
|
bio->bi_iter.bi_sector = sector;
|
||
|
- bio_set_dev(bio, device->ldev->backing_bdev);
|
||
|
- /* we special case some flags in the multi-bio case, see below
|
||
|
- * (REQ_PREFLUSH, or BIO_RW_BARRIER in older kernels) */
|
||
|
- bio->bi_opf = peer_req->opf;
|
||
|
bio->bi_private = peer_req;
|
||
|
bio->bi_end_io = drbd_peer_request_endio;
|
||
|
|