drbd/bsc-1201335_05-bio_alloc.patch
Roger Zhou 1eb6b25c2a Accepting request 987977 from home:hmzhao:branches:network:ha-clustering:Factory
- drbd: build error against kernel v5.18 (bsc#1201335)
  - remove patch: move_bdi_from_request_queue_to_gendisk
  - change exist patches name from bsc#1192929:
    old name:
      make_block_holder_optional.patch
      move_kvmalloc_related_to_slab.patch
      polling_to_bio_base.patch
      pass_gend_to_blk_queue_update_readahead.patch
      dax_support.patch
      add_disk_error_handle.patch
      have_void_drbd_submit_bio.patch
      remove_bdgrab.patch
    new name:
      bsc-1192929_01-make_block_holder_optional.patch
      bsc-1192929_02-move_kvmalloc_related_to_slab.patch
      bsc-1192929_03-polling_to_bio_base.patch
      bsc-1192929_04-pass_gend_to_blk_queue_update_readahead.patch
      bsc-1192929_06-dax_support.patch
      bsc-1192929_07-add_disk_error_handle.patch
      bsc-1192929_08-have_void_drbd_submit_bio.patch
      bsc-1192929_09-remove_bdgrab.patch
  - add patch:
    + bsc-1201335_01-compat-test-and-cocci-patch-for-bdi-in-gendisk.patch
    + bsc-1201335_02-0001-compat-only-apply-bdi-pointer-patch-if-bdi-is-in-req.patch
    + bsc-1201335_03-genhd.patch
    + bsc-1201335_04-bio_alloc_bioset.patch
    + bsc-1201335_05-bio_alloc.patch
    + bsc-1201335_06-bdi.patch
    + bsc-1201335_07-write-same.patch
    + bsc-1201335_08-bio_clone_fast.patch

OBS-URL: https://build.opensuse.org/request/show/987977
OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/drbd?expand=0&rev=137
2022-07-09 00:28:28 +00:00

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;