Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
From: Nick Wang <nwang@suse.com>
To: drbd-dev@lists.linbit.com
Cc: Philipp Reisner <philipp.reisner@linbit.com>,
	Lars Ellenberg <lars.ellenberg@linbit.com>
Subject: [Drbd-dev] [Patch v0 3/8] Adapt pointer backing_dev_info in struct request_queue
Date: Tue,  7 Mar 2017 11:27:54 +0800	[thread overview]
Message-ID: <1488857279-29079-4-git-send-email-nwang@suse.com> (raw)
In-Reply-To: <1488857279-29079-1-git-send-email-nwang@suse.com>

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


  parent reply	other threads:[~2017-03-07  3:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Nick Wang [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488857279-29079-4-git-send-email-nwang@suse.com \
    --to=nwang@suse.com \
    --cc=drbd-dev@lists.linbit.com \
    --cc=lars.ellenberg@linbit.com \
    --cc=philipp.reisner@linbit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox