Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10
@ 2017-03-07  3:27 Nick Wang
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 1/8] Remove bio_set_op_attrs Nick Wang
                   ` (9 more replies)
  0 siblings, 10 replies; 15+ messages in thread
From: Nick Wang @ 2017-03-07  3:27 UTC (permalink / raw)
  To: drbd-dev; +Cc: Philipp Reisner, Lars Ellenberg

Patches for drbd9 compatible to kernel4.10, including drbd,
drbd-kernel-compat and drbd-headers repos. Ordered as 
functionality, so may mix the three repos in one patch set.

block layer API and genetlink API have many changes in kernel v4.10.
93c5bdf7 and 70fd7614, bio_set_op_attrs change to inline 
    then obsolete by use flag directly.
dc3b17cc, use pointer to backing_dev_info in struct request_queue.
10383aea, use refcount_t for struct kref.
a07ea4d9 and 489111e5, statically initialize genetlink family.

Signed-off-by: Nick Wang <nwang@suse.com>
CC: Philipp Reisner <philipp.reisner@linbit.com>
CC: Lars Ellenberg <lars.ellenberg@linbit.com>
CC: drbd-dev@lists.linbit.com 

-- 
1.8.5.6


^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Drbd-dev] [Patch v0 1/8] Remove bio_set_op_attrs
  2017-03-07  3:27 [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Nick Wang
@ 2017-03-07  3:27 ` Nick Wang
  2017-03-07  3:37   ` Nick Wang
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 2/8] Adapt pointer backing_dev_info in struct request_queue Nick Wang
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Nick Wang @ 2017-03-07  3:27 UTC (permalink / raw)
  To: drbd-dev; +Cc: Philipp Reisner, Lars Ellenberg

In 93c5bdf7, bio_set_op_attrs changed from define to inline.
Then dropped by use flag directly. Also clean the old value
for the new op and op_flags.
Use REQ_SYNC instead of WRITE_SYNC.

This patch in drbd-kernel-compat.

Signed-off-by: Nick Wang <nwang@suse.com>
CC: Philipp Reisner <philipp.reisner@linbit.com>
CC: Lars Ellenberg <lars.ellenberg@linbit.com>
CC: drbd-dev@lists.linbit.com 

---
 drbd_wrappers.h               | 13 +++++++++++--
 tests/have_bio_set_op_attrs.c | 11 +++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
 create mode 100644 tests/have_bio_set_op_attrs.c

diff --git a/drbd_wrappers.h b/drbd_wrappers.h
index 1d9289f..0489e7f 100644
--- a/drbd_wrappers.h
+++ b/drbd_wrappers.h
@@ -719,7 +719,7 @@ static inline void blk_queue_write_cache(struct request_queue *q, bool enabled,
  * bi_opf (some kernel version) -> data packet flags -> bi_opf (other kernel version)
  */
 
-#if defined(bio_set_op_attrs)
+#ifdef COMPAT_HAVE_BIO_SET_OP_ATTRS
 /* Linux 4.8 split bio OPs and FLAGs {{{2 */
 
 #define DRBD_REQ_PREFLUSH	REQ_PREFLUSH
@@ -872,12 +872,21 @@ static inline void blk_queue_write_cache(struct request_queue *q, bool enabled,
 #define DRBD_REQ_WSAME		0
 #endif
 
+#ifdef COMPAT_HAVE_BIO_SET_OP_ATTRS
+#ifndef WRITE_FLUSH
+#define bio_set_op_attrs(bio, op, op_flags) do {        \
+	(bio)->bi_opf = op | op_flags;              \
+} while (0)
+#define WRITE_FLUSH (REQ_SYNC | DRBD_REQ_PREFLUSH)
+#endif
+#else
 #ifndef WRITE_FLUSH
 #ifndef WRITE_SYNC
 #error  FIXME WRITE_SYNC undefined??
 #endif
 #define WRITE_FLUSH       (WRITE_SYNC | DRBD_REQ_PREFLUSH)
 #endif
+#endif
 
 #ifndef REQ_NOIDLE
 /* introduced in aeb6faf (2.6.30), relevant for CFQ */
@@ -885,7 +894,7 @@ static inline void blk_queue_write_cache(struct request_queue *q, bool enabled,
 #endif
 
 
-#ifndef bio_set_op_attrs /* compat for Linux before 4.8 {{{2 */
+#ifndef COMPAT_HAVE_BIO_SET_OP_ATTRS /*compat for Linux before 4.8 {{{2 */
 
 #define bi_opf bi_rw
 
diff --git a/tests/have_bio_set_op_attrs.c b/tests/have_bio_set_op_attrs.c
new file mode 100644
index 0000000..6aa0781
--- /dev/null
+++ b/tests/have_bio_set_op_attrs.c
@@ -0,0 +1,11 @@
+#include <linux/bio.h>
+
+/*
+ * bio_set_op_attrs() change to inline since 93c5bdf7 (4.10-rc1)
+ */
+void test(void)
+{
+	struct bio *bio = NULL;
+
+	bio_set_op_attrs(bio, 0, 0);
+}
-- 
1.8.5.6


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Drbd-dev] [Patch v0 2/8] Adapt pointer backing_dev_info in struct request_queue
  2017-03-07  3:27 [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Nick Wang
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 1/8] Remove bio_set_op_attrs Nick Wang
@ 2017-03-07  3:27 ` Nick Wang
  2017-03-09 10:27   ` Roland Kammerer
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 3/8] " Nick Wang
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Nick Wang @ 2017-03-07  3:27 UTC (permalink / raw)
  To: drbd-dev; +Cc: Philipp Reisner, Lars Ellenberg

In dc3b17cc, struct request_queue use pointer to backing_dev_info,
so all related call should be converted.

This patch is for drbd-kernel-compat

Signed-off-by: Nick Wang <nwang@suse.com>
CC: Philipp Reisner <philipp.reisner@linbit.com>
CC: Lars Ellenberg <lars.ellenberg@linbit.com>
CC: drbd-dev@lists.linbit.com 

---
 drbd_wrappers.h                       | 5 +++++
 tests/have_pointer_backing_dev_info.c | 7 +++++++
 2 files changed, 12 insertions(+)
 create mode 100644 tests/have_pointer_backing_dev_info.c

diff --git a/drbd_wrappers.h b/drbd_wrappers.h
index 0489e7f..778a6fd 100644
--- a/drbd_wrappers.h
+++ b/drbd_wrappers.h
@@ -888,6 +888,11 @@ static inline void blk_queue_write_cache(struct request_queue *q, bool enabled,
 #endif
 #endif
 
+#ifdef COMPAT_HAVE_POINTER_BACKING_DEV_INFO
+#define bdi_rw_congested(B) bdi_rw_congested(*(B))
+#define bdi_congested(B, C) bdi_congested(*(B), C)
+#endif
+
 #ifndef REQ_NOIDLE
 /* introduced in aeb6faf (2.6.30), relevant for CFQ */
 #define REQ_NOIDLE 0
diff --git a/tests/have_pointer_backing_dev_info.c b/tests/have_pointer_backing_dev_info.c
new file mode 100644
index 0000000..e9999ce
--- /dev/null
+++ b/tests/have_pointer_backing_dev_info.c
@@ -0,0 +1,7 @@
+#include <linux/blkdev.h>
+
+void test(void)
+{
+	struct request_queue q = {};
+	q.backing_dev_info = NULL;
+}
-- 
1.8.5.6


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Drbd-dev] [Patch v0 3/8] Adapt pointer backing_dev_info in struct request_queue
  2017-03-07  3:27 [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Nick Wang
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 1/8] Remove bio_set_op_attrs Nick Wang
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 2/8] Adapt pointer backing_dev_info in struct request_queue Nick Wang
@ 2017-03-07  3:27 ` Nick Wang
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 4/8] Use refcount_t 'atomic' type to implement struct kref Nick Wang
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Nick Wang @ 2017-03-07  3:27 UTC (permalink / raw)
  To: drbd-dev; +Cc: Philipp Reisner, Lars Ellenberg

In dc3b17cc, struct request_queue use pointer to backing_dev_info,
so all related call should be converted.

Signed-off-by: Nick Wang <nwang@suse.com>
CC: Philipp Reisner <philipp.reisner@linbit.com>
CC: Lars Ellenberg <lars.ellenberg@linbit.com>
CC: drbd-dev@lists.linbit.com 

---
 drbd/drbd_main.c        | 5 +++++
 drbd/drbd_nl.c          | 9 ++++++++
 drbd/drbd_req.c         | 4 ++++
 3 files changed, 18 insertions(+)

diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
index b2f839e..324239b 100644
--- a/drbd/drbd_main.c
+++ b/drbd/drbd_main.c
@@ -3583,8 +3583,13 @@ enum drbd_ret_code drbd_create_device(struct drbd_config_context *adm_ctx, unsig
 	/* we have no partitions. we contain only ourselves. */
 	device->this_bdev->bd_contains = device->this_bdev;
 
+#ifdef COMPAT_HAVE_POINTER_BACKING_DEV_INFO
+	q->backing_dev_info->congested_fn = drbd_congested;
+	q->backing_dev_info->congested_data = device;
+#else
 	q->backing_dev_info.congested_fn = drbd_congested;
 	q->backing_dev_info.congested_data = device;
+#endif
 
 	blk_queue_make_request(q, drbd_make_request);
 	blk_queue_write_cache(q, true, true);
diff --git a/drbd/drbd_nl.c b/drbd/drbd_nl.c
index 22044ab..ace77c5 100644
--- a/drbd/drbd_nl.c
+++ b/drbd/drbd_nl.c
@@ -1882,12 +1882,21 @@ static void drbd_setup_queue_param(struct drbd_device *device, struct drbd_backi
 	if (b) {
 		blk_queue_stack_limits(q, b);
 
+#ifdef COMPAT_HAVE_POINTER_BACKING_DEV_INFO
+		if (q->backing_dev_info->ra_pages != b->backing_dev_info->ra_pages) {
+			drbd_info(device, "Adjusting my ra_pages to backing device's (%lu -> %lu)\n",
+				 q->backing_dev_info->ra_pages,
+				 b->backing_dev_info->ra_pages);
+			q->backing_dev_info->ra_pages = b->backing_dev_info->ra_pages;
+		}
+#else
 		if (q->backing_dev_info.ra_pages != b->backing_dev_info.ra_pages) {
 			drbd_info(device, "Adjusting my ra_pages to backing device's (%lu -> %lu)\n",
 				 q->backing_dev_info.ra_pages,
 				 b->backing_dev_info.ra_pages);
 			q->backing_dev_info.ra_pages = b->backing_dev_info.ra_pages;
 		}
+#endif
 	}
 	fixup_discard_if_not_supported(q);
 }
diff --git a/drbd/drbd_req.c b/drbd/drbd_req.c
index e1e9595..d6d9dc1 100644
--- a/drbd/drbd_req.c
+++ b/drbd/drbd_req.c
@@ -1155,7 +1155,11 @@ static bool remote_due_to_read_balancing(struct drbd_device *device,
 
 	switch (rbm) {
 	case RB_CONGESTED_REMOTE:
+#ifdef COMPAT_HAVE_POINTER_BACKING_DEV_INFO
+		bdi = device->ldev->backing_bdev->bd_disk->queue->backing_dev_info;
+#else
 		bdi = &device->ldev->backing_bdev->bd_disk->queue->backing_dev_info;
+#endif
 		return bdi_read_congested(bdi);
 	case RB_LEAST_PENDING:
 		return atomic_read(&device->local_cnt) >
-- 
1.8.5.6


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Drbd-dev] [Patch v0 4/8] Use refcount_t 'atomic' type to implement struct kref
  2017-03-07  3:27 [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Nick Wang
                   ` (2 preceding siblings ...)
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 3/8] " Nick Wang
@ 2017-03-07  3:27 ` Nick Wang
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 5/8] Use refcount_t 'atomic' type to implement structref Nick Wang
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Nick Wang @ 2017-03-07  3:27 UTC (permalink / raw)
  To: drbd-dev; +Cc: Philipp Reisner, Lars Ellenberg

In 10383aea, atomic type for refcount is obsoleted, instead 
using refcount_t. Also convert the related call.

This patch is for drbd-kernel-compat

Signed-off-by: Nick Wang <nwang@suse.com>
CC: Philipp Reisner <philipp.reisner@linbit.com>
CC: Lars Ellenberg <lars.ellenberg@linbit.com>
CC: drbd-dev@lists.linbit.com 

---
 tests/have_refcount_inc.c | 6 ++++++
 1 file changed, 6 insertions(+)
 create mode 100644 tests/have_refcount_inc.c

diff --git a/tests/have_refcount_inc.c b/tests/have_refcount_inc.c
new file mode 100644
index 0000000..38373e7
--- /dev/null
+++ b/tests/have_refcount_inc.c
@@ -0,0 +1,6 @@
+#include <linux/refcount.h>
+
+void test(refcount_t *r)
+{
+	refcount_inc(r);
+}
-- 
1.8.5.6


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Drbd-dev] [Patch v0 5/8] Use refcount_t 'atomic' type to implement structref
  2017-03-07  3:27 [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Nick Wang
                   ` (3 preceding siblings ...)
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 4/8] Use refcount_t 'atomic' type to implement struct kref Nick Wang
@ 2017-03-07  3:27 ` Nick Wang
  2017-03-09 10:33   ` Roland Kammerer
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 6/6] Statically initialize families Nick Wang
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 15+ messages in thread
From: Nick Wang @ 2017-03-07  3:27 UTC (permalink / raw)
  To: drbd-dev; +Cc: Philipp Reisner, Lars Ellenberg

In 10383aea, atomic type for refcount is obsoleted, instead use
refcount_t. Also convert the related call.

Signed-off-by: Nick Wang <nwang@suse.com>
CC: Philipp Reisner <philipp.reisner@linbit.com>
CC: Lars Ellenberg <lars.ellenberg@linbit.com>
CC: drbd-dev@lists.linbit.com 

---
 drbd/drbd_bitmap.c      |  4 ++++
 drbd/drbd_req.c         | 12 ++++++++++++
 drbd/kref_debug.c       |  4 ++++
 3 files changed, 20 insertions(+)

diff --git a/drbd/drbd_bitmap.c b/drbd/drbd_bitmap.c
index 51cfdc8..726cfae 100644
--- a/drbd/drbd_bitmap.c
+++ b/drbd/drbd_bitmap.c
@@ -1182,7 +1182,11 @@ static int bm_rw_range(struct drbd_device *device,
 		.done = 0,
 		.flags = flags,
 		.error = 0,
+#ifdef KREF_INIT
+		.kref = KREF_INIT(2),
+#else
 		.kref = { ATOMIC_INIT(2) },
+#endif
 	};
 
 	if (!expect(device, get_ldev_if_state(device, D_ATTACHING))) {  /* put is in drbd_bm_aio_ctx_destroy() */
diff --git a/drbd/drbd_req.c b/drbd/drbd_req.c
index d6d9dc1..467549a 100644
--- a/drbd/drbd_req.c
+++ b/drbd/drbd_req.c
@@ -124,7 +124,11 @@ void drbd_queue_peer_ack(struct drbd_resource *resource, struct drbd_request *re
 		    connection->cstate[NOW] != C_CONNECTED ||
 		    !(req->rq_state[1 + node_id] & RQ_NET_SENT))
 			continue;
+#ifdef COMPAT_HAVE_REFCOUNT_INC
+		refcount_inc(&req->kref.refcount); /* was 0, instead of kref_get() */
+#else
 		atomic_inc(&req->kref.refcount); /* was 0, instead of kref_get() */
+#endif
 		req->rq_state[1 + node_id] |= RQ_PEER_ACK;
 		if (!queued) {
 			list_add_tail(&req->tl_requests, &resource->peer_ack_list);
@@ -324,7 +328,11 @@ void drbd_req_destroy(struct kref *kref)
 	 */
 	if (destroy_next) {
 		req = destroy_next;
+#ifdef COMPAT_HAVE_REFCOUNT_INC
+		if (refcount_dec_and_test(&req->kref.refcount))
+#else
 		if (atomic_dec_and_test(&req->kref.refcount))
+#endif
 			goto tail_recursion;
 	}
 
@@ -722,7 +730,11 @@ static void mod_rq_state(struct drbd_request *req, struct bio_and_error *m,
 		/* Completion does it's own kref_put.  If we are going to
 		 * kref_sub below, we need req to be still around then. */
 		int at_least = k_put + !!c_put;
+#ifdef COMPAT_HAVE_REFCOUNT_INC
+		int refcount = refcount_read(&req->kref.refcount);
+#else
 		int refcount = atomic_read(&req->kref.refcount);
+#endif
 		if (refcount < at_least)
 			drbd_err(req->device,
 				"mod_rq_state: Logic BUG: 0: %x -> %x, %d: %x -> %x: refcount = %d, should be >= %d\n",
diff --git a/drbd/kref_debug.c b/drbd/kref_debug.c
index 0aa0e6e..4c50f53 100644
--- a/drbd/kref_debug.c
+++ b/drbd/kref_debug.c
@@ -108,7 +108,11 @@ void print_kref_debug_info(struct seq_file *seq)
 		char obj_name[80];
 
 		debug_refs = number_of_debug_refs(debug_info);
+#ifdef COMPAT_HAVE_REFCOUNT_INC
+		refs = refcount_read(&debug_info->kref->refcount);
+#else
 		refs = atomic_read(&debug_info->kref->refcount);
+#endif
 		debug_info->class->get_object_name(debug_info, obj_name);
 
 		seq_printf(seq, "class: %s, name: %s, refs: %d, dr: %d\n",
-- 
1.8.5.6


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Drbd-dev] [Patch v0 6/6] Statically initialize families
  2017-03-07  3:27 [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Nick Wang
                   ` (4 preceding siblings ...)
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 5/8] Use refcount_t 'atomic' type to implement structref Nick Wang
@ 2017-03-07  3:27 ` Nick Wang
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 7/8] " Nick Wang
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Nick Wang @ 2017-03-07  3:27 UTC (permalink / raw)
  To: drbd-dev; +Cc: Philipp Reisner, Lars Ellenberg

In a07ea4d9, genetlink no longer use static family id.
GENL_ID_GENERATE is removed.
In 489111e5, statically initialize the families and remove
the inline functions.

This is for drbd-kernel-compat

Signed-off-by: Nick Wang <nwang@suse.com>
CC: Philipp Reisner <philipp.reisner@linbit.com>
CC: Lars Ellenberg <lars.ellenberg@linbit.com>
CC: drbd-dev@lists.linbit.com 

---
 tests/have_genl_family_in_genlmsg_multicast.c | 9 +++++++++
 tests/have_genl_id_generate.c                 | 6 ++++++
 2 files changed, 15 insertions(+)
 create mode 100644 tests/have_genl_family_in_genlmsg_multicast.c
 create mode 100644 tests/have_genl_id_generate.c

diff --git a/tests/have_genl_family_in_genlmsg_multicast.c b/tests/have_genl_family_in_genlmsg_multicast.c
new file mode 100644
index 0000000..6d44faa
--- /dev/null
+++ b/tests/have_genl_family_in_genlmsg_multicast.c
@@ -0,0 +1,9 @@
+#include <net/genetlink.h>
+
+void test(void)
+{
+	struct genl_family family = { };
+	struct sk_buff *skb = NULL;
+
+	genlmsg_multicast(&family, skb, 0, 0, GFP_KERNEL);
+}
diff --git a/tests/have_genl_id_generate.c b/tests/have_genl_id_generate.c
new file mode 100644
index 0000000..4ef0e8e
--- /dev/null
+++ b/tests/have_genl_id_generate.c
@@ -0,0 +1,6 @@
+#include <linux/genetlink.h>
+
+void test(void)
+{
+	int i = GENL_ID_GENERATE;
+}
-- 
1.8.5.6


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Drbd-dev] [Patch v0 7/8] Statically initialize families
  2017-03-07  3:27 [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Nick Wang
                   ` (5 preceding siblings ...)
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 6/6] Statically initialize families Nick Wang
@ 2017-03-07  3:27 ` Nick Wang
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 8/8] " Nick Wang
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 15+ messages in thread
From: Nick Wang @ 2017-03-07  3:27 UTC (permalink / raw)
  To: drbd-dev; +Cc: Philipp Reisner, Lars Ellenberg

In a07ea4d9, genetlink no longer use static family id.
GENL_ID_GENERATE is removed.
In 489111e5, statically initialize the families and remove
the inline functions.

Signed-off-by: Nick Wang <nwang@suse.com>
CC: Philipp Reisner <philipp.reisner@linbit.com>
CC: Lars Ellenberg <lars.ellenberg@linbit.com>
CC: drbd-dev@lists.linbit.com 

---
 drbd/linux/genl_magic_func-genl_register_family_with_ops_groups.h | 4 ++++
 1 files changed, 4 insertions(+)

diff --git a/drbd/linux/genl_magic_func-genl_register_family_with_ops_groups.h b/drbd/linux/genl_magic_func-genl_register_family_with_ops_groups.h
index 27d8f73..cbd776e 100644
--- a/drbd/linux/genl_magic_func-genl_register_family_with_ops_groups.h
+++ b/drbd/linux/genl_magic_func-genl_register_family_with_ops_groups.h
@@ -29,9 +29,13 @@ static int CONCAT_(GENL_MAGIC_FAMILY, _genl_multicast_ ## group)(	\
 
 int CONCAT_(GENL_MAGIC_FAMILY, _genl_register)(void)
 {
+#ifdef genl_register_family_with_ops_groups
 	return genl_register_family_with_ops_groups(&ZZZ_genl_family,	\
 						    ZZZ_genl_ops,	\
 						    ZZZ_genl_mcgrps);
+#else
+	return genl_register_family(&ZZZ_genl_family);
+#endif
 }
 
 void CONCAT_(GENL_MAGIC_FAMILY, _genl_unregister)(void)
-- 
1.8.5.6


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [Drbd-dev] [Patch v0 8/8] Statically initialize families
  2017-03-07  3:27 [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Nick Wang
                   ` (6 preceding siblings ...)
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 7/8] " Nick Wang
@ 2017-03-07  3:27 ` Nick Wang
  2017-03-09  9:21 ` [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Lars Ellenberg
  2017-03-09 10:22 ` Roland Kammerer
  9 siblings, 0 replies; 15+ messages in thread
From: Nick Wang @ 2017-03-07  3:27 UTC (permalink / raw)
  To: drbd-dev; +Cc: Philipp Reisner, Lars Ellenberg

In a07ea4d9, genetlink no longer use static family id.
GENL_ID_GENERATE is removed.
In 489111e5, statically initialize the families and remove
the inline functions.

This patch is for drbd-headers.

Signed-off-by: Nick Wang <nwang@suse.com>
CC: Philipp Reisner <philipp.reisner@linbit.com>
CC: Lars Ellenberg <lars.ellenberg@linbit.com>
CC: drbd-dev@lists.linbit.com 

---
 linux/genl_magic_func.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/linux/genl_magic_func.h b/linux/genl_magic_func.h
index d14a557..ae9b9de 100644
--- a/linux/genl_magic_func.h
+++ b/linux/genl_magic_func.h
@@ -251,7 +251,9 @@ static struct genl_ops ZZZ_genl_ops[] __read_mostly = {
  */
 #define ZZZ_genl_family		CONCAT_(GENL_MAGIC_FAMILY, _genl_family)
 static struct genl_family ZZZ_genl_family __read_mostly = {
+#ifdef HAVE_GENL_ID_GENERATE
 	.id = GENL_ID_GENERATE,
+#endif
 	.name = __stringify(GENL_MAGIC_FAMILY),
 	.version = GENL_MAGIC_VERSION,
 #ifdef GENL_MAGIC_FAMILY_HDRSZ
@@ -275,7 +277,8 @@ static struct genl_family ZZZ_genl_family __read_mostly = {
  * genetlink: only pass array to genl_register_family_with_ops()
  * which are commits c53ed742..2a94fe48
  */
-#ifdef genl_register_family_with_ops_groups
+#if defined(genl_register_family_with_ops_groups) || \
+    defined(COMPAT_HAVE_GENL_FAMILY_IN_GENLMSG_MULTICAST)
 #include <linux/genl_magic_func-genl_register_family_with_ops_groups.h>
 #else
 #include <linux/genl_magic_func-genl_register_mc_group.h>
-- 
1.8.5.6


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [Drbd-dev] [Patch v0 1/8] Remove bio_set_op_attrs
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 1/8] Remove bio_set_op_attrs Nick Wang
@ 2017-03-07  3:37   ` Nick Wang
  0 siblings, 0 replies; 15+ messages in thread
From: Nick Wang @ 2017-03-07  3:37 UTC (permalink / raw)
  To: drbd-dev, Nick Wang

>>> On 2017-3-7 at 11:27, in message
<1488857279-29079-2-git-send-email-nwang@suse.com>, Nick Wang <nwang@suse.com>
wrote:
>  #ifndef WRITE_FLUSH
>  #ifndef WRITE_SYNC
>  #error  FIXME WRITE_SYNC undefined??
    Maybe can define WRITE_SYNC to 0 in this case?
    #define WRITE_SYNC 0
>  #endif
>  #define WRITE_FLUSH       (WRITE_SYNC | DRBD_REQ_PREFLUSH)
>  #endif
> +#endif

Best regards,
Nick



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10
  2017-03-07  3:27 [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Nick Wang
                   ` (7 preceding siblings ...)
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 8/8] " Nick Wang
@ 2017-03-09  9:21 ` Lars Ellenberg
  2017-03-09 10:22 ` Roland Kammerer
  9 siblings, 0 replies; 15+ messages in thread
From: Lars Ellenberg @ 2017-03-09  9:21 UTC (permalink / raw)
  To: drbd-dev

On Tue, Mar 07, 2017 at 11:27:51AM +0800, Nick Wang wrote:
> Patches for drbd9 compatible to kernel4.10, including drbd,
> drbd-kernel-compat and drbd-headers repos. Ordered as 
> functionality, so may mix the three repos in one patch set.
> 
> block layer API and genetlink API have many changes in kernel v4.10.
> 93c5bdf7 and 70fd7614, bio_set_op_attrs change to inline 
>     then obsolete by use flag directly.
> dc3b17cc, use pointer to backing_dev_info in struct request_queue.
> 10383aea, use refcount_t for struct kref.
> a07ea4d9 and 489111e5, statically initialize genetlink family.
> 
> Signed-off-by: Nick Wang <nwang@suse.com>
> CC: Philipp Reisner <philipp.reisner@linbit.com>
> CC: Lars Ellenberg <lars.ellenberg@linbit.com>
> CC: drbd-dev@lists.linbit.com 

Thanks,
We'll find time review them "soon", I hope.

    Lars


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10
  2017-03-07  3:27 [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Nick Wang
                   ` (8 preceding siblings ...)
  2017-03-09  9:21 ` [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Lars Ellenberg
@ 2017-03-09 10:22 ` Roland Kammerer
  2017-03-10  3:48   ` Nick Wang
  9 siblings, 1 reply; 15+ messages in thread
From: Roland Kammerer @ 2017-03-09 10:22 UTC (permalink / raw)
  To: drbd-dev

On Tue, Mar 07, 2017 at 11:27:51AM +0800, Nick Wang wrote:
> Patches for drbd9 compatible to kernel4.10, including drbd,
> drbd-kernel-compat and drbd-headers repos. Ordered as 
> functionality, so may mix the three repos in one patch set.

Hi Nick,

thanks again for the time spent, it's highly appreciated.

There are some things that need to change before I can apply the series.
I will answer to some patch mails (2 and 5) that exemplify how we do
compat work.

It would then be great if you resend your series. If not, just let
me know, then I will do the compat work.

Regards, rck

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Drbd-dev] [Patch v0 2/8] Adapt pointer backing_dev_info in struct request_queue
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 2/8] Adapt pointer backing_dev_info in struct request_queue Nick Wang
@ 2017-03-09 10:27   ` Roland Kammerer
  0 siblings, 0 replies; 15+ messages in thread
From: Roland Kammerer @ 2017-03-09 10:27 UTC (permalink / raw)
  To: drbd-dev

On Tue, Mar 07, 2017 at 11:27:53AM +0800, Nick Wang wrote:
> In dc3b17cc, struct request_queue use pointer to backing_dev_info,
> so all related call should be converted.
> 
> This patch is for drbd-kernel-compat
> 
> Signed-off-by: Nick Wang <nwang@suse.com>
> CC: Philipp Reisner <philipp.reisner@linbit.com>
> CC: Lars Ellenberg <lars.ellenberg@linbit.com>
> CC: drbd-dev@lists.linbit.com 
> 
> ---
>  drbd_wrappers.h                       | 5 +++++
>  tests/have_pointer_backing_dev_info.c | 7 +++++++
>  2 files changed, 12 insertions(+)
>  create mode 100644 tests/have_pointer_backing_dev_info.c
> 
> diff --git a/drbd_wrappers.h b/drbd_wrappers.h
> index 0489e7f..778a6fd 100644
> --- a/drbd_wrappers.h
> +++ b/drbd_wrappers.h
> @@ -888,6 +888,11 @@ static inline void blk_queue_write_cache(struct request_queue *q, bool enabled,
>  #endif
>  #endif
>  
> +#ifdef COMPAT_HAVE_POINTER_BACKING_DEV_INFO
> +#define bdi_rw_congested(B) bdi_rw_congested(*(B))
> +#define bdi_congested(B, C) bdi_congested(*(B), C)
> +#endif
> +

We do compat work the other way round. The goal is to have our
out-of-tree code as close as possible to linux upstream. Otherwise we
would "get stuck" at the old paradigms.

In that specific case it actually means to change drbd_debugfs.c in a
way that it looks like linux upstream (basically removing the '&') and
provide compat #defines for older kernels.

Regards, rck

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Drbd-dev] [Patch v0 5/8] Use refcount_t 'atomic' type to implement structref
  2017-03-07  3:27 ` [Drbd-dev] [Patch v0 5/8] Use refcount_t 'atomic' type to implement structref Nick Wang
@ 2017-03-09 10:33   ` Roland Kammerer
  0 siblings, 0 replies; 15+ messages in thread
From: Roland Kammerer @ 2017-03-09 10:33 UTC (permalink / raw)
  To: drbd-dev

On Tue, Mar 07, 2017 at 11:27:56AM +0800, Nick Wang wrote:
> diff --git a/drbd/drbd_req.c b/drbd/drbd_req.c
> index d6d9dc1..467549a 100644
> --- a/drbd/drbd_req.c
> +++ b/drbd/drbd_req.c
> @@ -124,7 +124,11 @@ void drbd_queue_peer_ack(struct drbd_resource *resource, struct drbd_request *re
>  		    connection->cstate[NOW] != C_CONNECTED ||
>  		    !(req->rq_state[1 + node_id] & RQ_NET_SENT))
>  			continue;
> +#ifdef COMPAT_HAVE_REFCOUNT_INC
> +		refcount_inc(&req->kref.refcount); /* was 0, instead of kref_get() */
> +#else
>  		atomic_inc(&req->kref.refcount); /* was 0, instead of kref_get() */
> +#endif

We want to avoid #ifdef hell as much as possible in the code itself. In
that case use the new refcount_inc() and if it does not exist, fall back
to atomic_inc() via defining refcount_inc() to atomic_inc.

Regards, rck

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10
  2017-03-09 10:22 ` Roland Kammerer
@ 2017-03-10  3:48   ` Nick Wang
  0 siblings, 0 replies; 15+ messages in thread
From: Nick Wang @ 2017-03-10  3:48 UTC (permalink / raw)
  To: Roland Kammerer, drbd-dev



>>> On 2017-3-9 at 18:22, in message <20170309102230.GA18615@rck.sh>, Roland
Kammerer <roland.kammerer@linbit.com> wrote:
> There are some things that need to change before I can apply the series.
> I will answer to some patch mails (2 and 5) that exemplify how we do
> compat work.
>
 Thanks for your opinion, that is much better and valuable. I do struggling 
to find a better idea to compat old version and avoid too many #ifdef 
branches in code.

> It would then be great if you resend your series. If not, just let
> me know, then I will do the compat work.
  I will polish them based on your idea and resend later.

Best regards,
Nick


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-03-10  3:48 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-07  3:27 [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Nick Wang
2017-03-07  3:27 ` [Drbd-dev] [Patch v0 1/8] Remove bio_set_op_attrs Nick Wang
2017-03-07  3:37   ` Nick Wang
2017-03-07  3:27 ` [Drbd-dev] [Patch v0 2/8] Adapt pointer backing_dev_info in struct request_queue Nick Wang
2017-03-09 10:27   ` Roland Kammerer
2017-03-07  3:27 ` [Drbd-dev] [Patch v0 3/8] " Nick Wang
2017-03-07  3:27 ` [Drbd-dev] [Patch v0 4/8] Use refcount_t 'atomic' type to implement struct kref Nick Wang
2017-03-07  3:27 ` [Drbd-dev] [Patch v0 5/8] Use refcount_t 'atomic' type to implement structref Nick Wang
2017-03-09 10:33   ` Roland Kammerer
2017-03-07  3:27 ` [Drbd-dev] [Patch v0 6/6] Statically initialize families Nick Wang
2017-03-07  3:27 ` [Drbd-dev] [Patch v0 7/8] " Nick Wang
2017-03-07  3:27 ` [Drbd-dev] [Patch v0 8/8] " Nick Wang
2017-03-09  9:21 ` [Drbd-dev] [Patch v0 0/8] Patches for compat drbd9 to kernel v4.10 Lars Ellenberg
2017-03-09 10:22 ` Roland Kammerer
2017-03-10  3:48   ` Nick Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox