All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <mchristi@redhat.com>
To: nbd@other.debian.org, axboe@kernel.dk, josef@toxicpanda.com,
	linux-block@vger.kernel.org
Cc: Mike Christie <mchristi@redhat.com>
Subject: [PATCH 1/2] nbd: move send_disconnects
Date: Fri, 15 Nov 2019 23:50:16 -0600	[thread overview]
Message-ID: <20191116055017.6253-2-mchristi@redhat.com> (raw)
In-Reply-To: <20191116055017.6253-1-mchristi@redhat.com>

Just move send_disconnects so we can call it earlier in the file in the
next patch.

Signed-off-by: Mike Christie <mchristi@redhat.com>
---
 drivers/block/nbd.c | 48 ++++++++++++++++++++++-----------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index a94ee45440b3..06b63c11ae50 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -980,6 +980,30 @@ static blk_status_t nbd_queue_rq(struct blk_mq_hw_ctx *hctx,
 	return ret;
 }
 
+static void send_disconnects(struct nbd_device *nbd)
+{
+	struct nbd_config *config = nbd->config;
+	struct nbd_request request = {
+		.magic = htonl(NBD_REQUEST_MAGIC),
+		.type = htonl(NBD_CMD_DISC),
+	};
+	struct kvec iov = {.iov_base = &request, .iov_len = sizeof(request)};
+	struct iov_iter from;
+	int i, ret;
+
+	for (i = 0; i < config->num_connections; i++) {
+		struct nbd_sock *nsock = config->socks[i];
+
+		iov_iter_kvec(&from, WRITE, &iov, 1, sizeof(request));
+		mutex_lock(&nsock->tx_lock);
+		ret = sock_xmit(nbd, i, 1, &from, 0, NULL);
+		if (ret <= 0)
+			dev_err(disk_to_dev(nbd->disk),
+				"Send disconnect failed %d\n", ret);
+		mutex_unlock(&nsock->tx_lock);
+	}
+}
+
 static struct socket *nbd_get_socket(struct nbd_device *nbd, unsigned long fd,
 				     int *err)
 {
@@ -1139,30 +1163,6 @@ static void nbd_parse_flags(struct nbd_device *nbd)
 		blk_queue_write_cache(nbd->disk->queue, false, false);
 }
 
-static void send_disconnects(struct nbd_device *nbd)
-{
-	struct nbd_config *config = nbd->config;
-	struct nbd_request request = {
-		.magic = htonl(NBD_REQUEST_MAGIC),
-		.type = htonl(NBD_CMD_DISC),
-	};
-	struct kvec iov = {.iov_base = &request, .iov_len = sizeof(request)};
-	struct iov_iter from;
-	int i, ret;
-
-	for (i = 0; i < config->num_connections; i++) {
-		struct nbd_sock *nsock = config->socks[i];
-
-		iov_iter_kvec(&from, WRITE, &iov, 1, sizeof(request));
-		mutex_lock(&nsock->tx_lock);
-		ret = sock_xmit(nbd, i, 1, &from, 0, NULL);
-		if (ret <= 0)
-			dev_err(disk_to_dev(nbd->disk),
-				"Send disconnect failed %d\n", ret);
-		mutex_unlock(&nsock->tx_lock);
-	}
-}
-
 static int nbd_disconnect(struct nbd_device *nbd)
 {
 	struct nbd_config *config = nbd->config;
-- 
2.21.0


  reply	other threads:[~2019-11-16  5:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-16  5:50 [PATCH 0/2] nbd: local daemon restart support Mike Christie
2019-11-16  5:50 ` Mike Christie [this message]
2019-11-16  5:50 ` [PATCH 2/2] nbd: add support to replace running daemon Mike Christie
2019-11-19 16:46 ` [PATCH 0/2] nbd: local daemon restart support Mike Christie

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=20191116055017.6253-2-mchristi@redhat.com \
    --to=mchristi@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=nbd@other.debian.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.