linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars Ellenberg <lars.ellenberg@linbit.com>
To: Jens Axboe <axboe@kernel.dk>,
	linux-kernel@vger.kernel.org, linux-block@vger.kernel.org
Cc: drbd-dev@lists.linbit.com
Subject: [PATCH 03/17] drbd: centralize printk reporting of new size into drbd_set_my_capacity()
Date: Thu, 20 Dec 2018 17:23:30 +0100	[thread overview]
Message-ID: <20181220162344.8430-4-lars.ellenberg@linbit.com> (raw)
In-Reply-To: <20181220162344.8430-1-lars.ellenberg@linbit.com>

Previously, some implicit resizes that happend during handshake
have not been reported as prominently as explicit resize.

Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
---
 drivers/block/drbd/drbd_int.h  |  8 +-------
 drivers/block/drbd/drbd_main.c | 17 ++++++++++++++++-
 drivers/block/drbd/drbd_nl.c   |  3 ---
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index 1e47db57b9d2..ab718582a092 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -1609,13 +1609,7 @@ static inline void drbd_tcp_quickack(struct socket *sock)
 }
 
 /* sets the number of 512 byte sectors of our virtual device */
-static inline void drbd_set_my_capacity(struct drbd_device *device,
-					sector_t size)
-{
-	/* set_capacity(device->this_bdev->bd_disk, size); */
-	set_capacity(device->vdisk, size);
-	device->this_bdev->bd_inode->i_size = (loff_t)size << 9;
-}
+void drbd_set_my_capacity(struct drbd_device *device, sector_t size);
 
 /*
  * used to submit our private bio
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index f973a2a845c8..f9b4228cc2d9 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -2034,6 +2034,21 @@ void drbd_init_set_defaults(struct drbd_device *device)
 	device->local_max_bio_size = DRBD_MAX_BIO_SIZE_SAFE;
 }
 
+static void _drbd_set_my_capacity(struct drbd_device *device, sector_t size)
+{
+	/* set_capacity(device->this_bdev->bd_disk, size); */
+	set_capacity(device->vdisk, size);
+	device->this_bdev->bd_inode->i_size = (loff_t)size << 9;
+}
+
+void drbd_set_my_capacity(struct drbd_device *device, sector_t size)
+{
+	char ppb[10];
+	_drbd_set_my_capacity(device, size);
+	drbd_info(device, "size = %s (%llu KB)\n",
+		ppsize(ppb, size>>1), (unsigned long long)size>>1);
+}
+
 void drbd_device_cleanup(struct drbd_device *device)
 {
 	int i;
@@ -2059,7 +2074,7 @@ void drbd_device_cleanup(struct drbd_device *device)
 	}
 	D_ASSERT(device, first_peer_device(device)->connection->net_conf == NULL);
 
-	drbd_set_my_capacity(device, 0);
+	_drbd_set_my_capacity(device, 0);
 	if (device->bitmap) {
 		/* maybe never allocated. */
 		drbd_bm_resize(device, 0, 1);
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index d15703b1ffe8..d02d38fd1288 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -921,7 +921,6 @@ drbd_determine_dev_size(struct drbd_device *device, enum dds_flags flags, struct
 	} prev;
 	sector_t u_size, size;
 	struct drbd_md *md = &device->ldev->md;
-	char ppb[10];
 	void *buffer;
 
 	int md_moved, la_size_changed;
@@ -999,8 +998,6 @@ drbd_determine_dev_size(struct drbd_device *device, enum dds_flags flags, struct
 		/* racy, see comments above. */
 		drbd_set_my_capacity(device, size);
 		md->la_size_sect = size;
-		drbd_info(device, "size = %s (%llu KB)\n", ppsize(ppb, size>>1),
-		     (unsigned long long)size>>1);
 	}
 	if (rv <= DS_ERROR)
 		goto err_out;
-- 
2.17.1


  parent reply	other threads:[~2018-12-20 16:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20 16:23 [PATCH 00/17] DRBD updates for 4.21 Lars Ellenberg
2018-12-20 16:23 ` [PATCH 01/17] drbd: narrow rcu_read_lock in drbd_sync_handshake Lars Ellenberg
2018-12-20 16:23 ` [PATCH 02/17] drbd: must not use connection after kref_put(&connection->kref) Lars Ellenberg
2018-12-20 16:23 ` Lars Ellenberg [this message]
2018-12-20 16:23 ` [PATCH 04/17] drbd: ignore "all zero" peer volume sizes in handshake Lars Ellenberg
2018-12-20 16:23 ` [PATCH 05/17] drbd: disconnect, if the wrong UUIDs are attached on a connected peer Lars Ellenberg
2018-12-20 16:23 ` [PATCH 06/17] drbd: fix confusing error message during attach Lars Ellenberg
2018-12-20 16:23 ` [PATCH 07/17] drbd: attach on connected diskless peer must not shrink a consistent device Lars Ellenberg
2018-12-20 16:23 ` [PATCH 08/17] drbd: reject attach of unsuitable uuids even if connected Lars Ellenberg
2018-12-20 16:23 ` [PATCH 09/17] drbd: fix comment typos Lars Ellenberg
2018-12-20 16:23 ` [PATCH 10/17] drbd: do not block when adjusting "disk-options" while IO is frozen Lars Ellenberg
2018-12-20 16:23 ` [PATCH 11/17] drbd: avoid spurious self-outdating with concurrent disconnect / down Lars Ellenberg
2018-12-20 16:23 ` [PATCH 12/17] drbd: fix print_st_err()'s prototype to match the definition Lars Ellenberg
2018-12-20 16:23 ` [PATCH 13/17] drbd: don't retry connection if peers do not agree on "authentication" settings Lars Ellenberg
2018-12-20 16:23 ` [PATCH 14/17] drbd: skip spurious timeout (ping-timeo) when failing promote Lars Ellenberg
2018-12-20 16:23 ` [PATCH 15/17] drbd: introduce P_ZEROES (REQ_OP_WRITE_ZEROES on the "wire") Lars Ellenberg
2018-12-20 16:23 ` [PATCH 16/17] drbd: Avoid Clang warning about pointless switch statment Lars Ellenberg
2018-12-20 16:23 ` [PATCH 17/17] drbd: Change drbd_request_detach_interruptible's return type to int Lars Ellenberg
2018-12-20 16:27 ` [PATCH 00/17] DRBD updates for 4.21 Jens Axboe

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=20181220162344.8430-4-lars.ellenberg@linbit.com \
    --to=lars.ellenberg@linbit.com \
    --cc=axboe@kernel.dk \
    --cc=drbd-dev@lists.linbit.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).