diff -Naur drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd-kernel-compat/gen_patch_names.c drbd-9.0.30~1+git.8e9c0812/drbd/drbd-kernel-compat/gen_patch_names.c --- drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd-kernel-compat/gen_patch_names.c 2021-11-22 14:00:22.158226957 +0800 +++ drbd-9.0.30~1+git.8e9c0812/drbd/drbd-kernel-compat/gen_patch_names.c 2021-11-22 14:10:47.141520981 +0800 @@ -396,8 +396,10 @@ COMPAT_HAVE_BLK_QUEUE_UPDATE_READAHEAD, "present"); #endif +#ifndef COMPAT_HAVE_GENDISK_BACKING_DEV_INFO patch(1, "backing_dev_info", true, false, COMPAT_HAVE_POINTER_BACKING_DEV_INFO, "is_pointer"); +#endif patch(1, "sendpage_ok", true, false, COMPAT_HAVE_SENDPAGE_OK, "present"); diff -Naur drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd-kernel-compat/tests/have_gendisk_backing_dev_info.c drbd-9.0.30~1+git.8e9c0812/drbd/drbd-kernel-compat/tests/have_gendisk_backing_dev_info.c --- drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd-kernel-compat/tests/have_gendisk_backing_dev_info.c 1970-01-01 08:00:00.000000000 +0800 +++ drbd-9.0.30~1+git.8e9c0812/drbd/drbd-kernel-compat/tests/have_gendisk_backing_dev_info.c 2021-11-22 14:08:58.564950244 +0800 @@ -0,0 +1,11 @@ +/* { "version": "v5.15-rc1~161", "commit": "edb0872f44ec9976ea6d052cb4b93cd2d23ac2ba", "comment": "block: move the bdi from the request_queue to the gendisk", "author": "Christoph Hellwig ", "date": "Mon Aug 9 16:17:43 2021 +0200" } */ + + +#include +#include + +void dummy(struct gendisk *gd) +{ + struct backing_dev_info *b; + b = gd->bdi; +} diff -Naur drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd_nl.c drbd-9.0.30~1+git.8e9c0812/drbd/drbd_nl.c --- drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd_nl.c 2021-11-22 14:00:22.158226957 +0800 +++ drbd-9.0.30~1+git.8e9c0812/drbd/drbd_nl.c 2021-11-22 14:40:51.131336874 +0800 @@ -5594,7 +5594,9 @@ if (get_ldev(device)) { struct drbd_md *md = &device->ldev->md; u64 *history_uuids = (u64 *)s->history_uuids; +#ifndef COMPAT_HAVE_GENDISK_BACKING_DEV_INFO struct request_queue *q; +#endif int n; spin_lock_irq(&md->uuid_lock); @@ -5606,11 +5608,18 @@ spin_unlock_irq(&md->uuid_lock); s->dev_disk_flags = md->flags; +#ifndef COMPAT_HAVE_GENDISK_BACKING_DEV_INFO q = bdev_get_queue(device->ldev->backing_bdev); s->dev_lower_blocked = bdi_congested(q->backing_dev_info, (1 << WB_async_congested) | (1 << WB_sync_congested)); +#else + s->dev_lower_blocked = + bdi_congested(device->ldev->backing_bdev->bd_disk->bdi, + (1 << WB_async_congested) | + (1 << WB_sync_congested)); +#endif put_ldev(device); } s->dev_size = get_capacity(device->vdisk); diff -Naur drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd_req.c drbd-9.0.30~1+git.8e9c0812/drbd/drbd_req.c --- drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd_req.c 2021-11-22 14:00:22.158226957 +0800 +++ drbd-9.0.30~1+git.8e9c0812/drbd/drbd_req.c 2021-11-22 14:15:43.103076717 +0800 @@ -1148,13 +1148,19 @@ struct drbd_peer_device *peer_device, sector_t sector, enum drbd_read_balancing rbm) { +#ifndef COMPAT_HAVE_GENDISK_BACKING_DEV_INFO struct backing_dev_info *bdi; +#endif int stripe_shift; switch (rbm) { case RB_CONGESTED_REMOTE: +#ifndef COMPAT_HAVE_GENDISK_BACKING_DEV_INFO bdi = device->ldev->backing_bdev->bd_disk->queue->backing_dev_info; return bdi_read_congested(bdi); +#else + return bdi_read_congested(device->ldev->backing_bdev->bd_disk->bdi); +#endif case RB_LEAST_PENDING: return atomic_read(&device->local_cnt) > atomic_read(&peer_device->ap_pending_cnt) + atomic_read(&peer_device->rs_pending_cnt);