79 lines
2.7 KiB
Diff
79 lines
2.7 KiB
Diff
|
By heming.zhao@suse.com
|
||
|
|
||
|
This patch was updated/changed after boo#1230635
|
||
|
|
||
|
----
|
||
|
|
||
|
diff -Nupr a/drbd/drbd-kernel-compat/tests/have_bdev_open_by_path.c b/drbd/drbd-kernel-compat/tests/have_bdev_open_by_path.c
|
||
|
--- a/drbd/drbd-kernel-compat/tests/have_bdev_open_by_path.c 2024-06-19 15:02:47.050694378 +0800
|
||
|
+++ b/drbd/drbd-kernel-compat/tests/have_bdev_open_by_path.c 2024-06-19 15:11:39.313298178 +0800
|
||
|
@@ -2,7 +2,7 @@
|
||
|
|
||
|
#include <linux/blkdev.h>
|
||
|
|
||
|
-struct bdev_handle *foo(const char *path, blk_mode_t mode, void *holder,
|
||
|
- const struct blk_holder_ops *hops) {
|
||
|
- return bdev_open_by_path(path, mode, holder, hops);
|
||
|
+void foo(void)
|
||
|
+{
|
||
|
+ return;
|
||
|
}
|
||
|
diff -Nupr a/drbd/drbd-kernel-compat/tests/have_blk_alloc_disk.c b/drbd/drbd-kernel-compat/tests/have_blk_alloc_disk.c
|
||
|
--- a/drbd/drbd-kernel-compat/tests/have_blk_alloc_disk.c 2024-06-19 11:35:39.957400039 +0800
|
||
|
+++ b/drbd/drbd-kernel-compat/tests/have_blk_alloc_disk.c 2024-06-19 11:36:43.594396686 +0800
|
||
|
@@ -2,7 +2,17 @@
|
||
|
|
||
|
#include <linux/blkdev.h>
|
||
|
|
||
|
+#define DRBD_MAX_BIO_SIZE_SAFE (1U << 12) /* Works always = 4k */
|
||
|
+
|
||
|
struct gendisk *foo(int node)
|
||
|
{
|
||
|
- return blk_alloc_disk(node);
|
||
|
+ struct queue_limits lim = {
|
||
|
+ /*
|
||
|
+ * Setting the max_hw_sectors to an odd value of 8kibyte here.
|
||
|
+ * This triggers a max_bio_size message upon first attach or
|
||
|
+ * connect.
|
||
|
+ */
|
||
|
+ .max_hw_sectors = DRBD_MAX_BIO_SIZE_SAFE >> 8,
|
||
|
+ };
|
||
|
+ return blk_alloc_disk(&lim, node);
|
||
|
}
|
||
|
diff -Nupr a/drbd/drbd_main.c b/drbd/drbd_main.c
|
||
|
--- a/drbd/drbd_main.c 2024-06-19 11:41:59.409367593 +0800
|
||
|
+++ b/drbd/drbd_main.c 2024-06-19 11:41:40.052600574 +0800
|
||
|
@@ -3752,6 +3752,7 @@ static int init_submitter(struct drbd_de
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
+#define DRBD_MAX_BIO_SIZE_SAFE (1U << 12) /* Works always = 4k */
|
||
|
enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsigned int minor,
|
||
|
struct device_conf *device_conf, struct drbd_device **p_device)
|
||
|
{
|
||
|
@@ -3767,6 +3768,15 @@ enum drbd_ret_code drbd_create_device(st
|
||
|
enum drbd_ret_code err = ERR_NOMEM;
|
||
|
bool locked = false;
|
||
|
|
||
|
+ struct queue_limits lim = {
|
||
|
+ /*
|
||
|
+ * Setting the max_hw_sectors to an odd value of 8kibyte here.
|
||
|
+ * This triggers a max_bio_size message upon first attach or
|
||
|
+ * connect.
|
||
|
+ */
|
||
|
+ .max_hw_sectors = DRBD_MAX_BIO_SIZE_SAFE >> 8,
|
||
|
+ };
|
||
|
+
|
||
|
lockdep_assert_held(&resource->conf_update);
|
||
|
|
||
|
device = minor_to_device(minor);
|
||
|
@@ -3824,7 +3834,7 @@ enum drbd_ret_code drbd_create_device(st
|
||
|
|
||
|
init_rwsem(&device->uuid_sem);
|
||
|
|
||
|
- disk = blk_alloc_disk(NUMA_NO_NODE);
|
||
|
+ disk = blk_alloc_disk(&lim, NUMA_NO_NODE);
|
||
|
if (!disk)
|
||
|
goto out_no_disk;
|
||
|
|