nbd: clean up log messages
Reduce the log level of the disconnection message to INFO (this is a normal occurrence when a connection is shut down), reword the message for clarity, add a newline, and convert the error number to a string. Also replace the printf() in spdk_nbd_start() with a SPDK log message. Change-Id: I35e493100e63f84a9b7257c6f84dad77e9a0d335 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/391025 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
b9b0fee224
commit
f566060ab4
@ -45,6 +45,8 @@
|
|||||||
#include "spdk/util.h"
|
#include "spdk/util.h"
|
||||||
#include "spdk/io_channel.h"
|
#include "spdk/io_channel.h"
|
||||||
|
|
||||||
|
#include "spdk_internal/log.h"
|
||||||
|
|
||||||
struct nbd_io {
|
struct nbd_io {
|
||||||
enum spdk_bdev_io_type type;
|
enum spdk_bdev_io_type type;
|
||||||
int ref;
|
int ref;
|
||||||
@ -489,11 +491,14 @@ static void
|
|||||||
spdk_nbd_poll(void *arg)
|
spdk_nbd_poll(void *arg)
|
||||||
{
|
{
|
||||||
struct spdk_nbd_disk *nbd = arg;
|
struct spdk_nbd_disk *nbd = arg;
|
||||||
|
char buf[64];
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = _spdk_nbd_poll(nbd);
|
rc = _spdk_nbd_poll(nbd);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
SPDK_NOTICELOG("spdk_nbd_poll got error %d; close it", rc);
|
spdk_strerror_r(-rc, buf, sizeof(buf));
|
||||||
|
SPDK_INFOLOG(SPDK_LOG_NBD, "spdk_nbd_poll() returned %s (%d); closing connection\n",
|
||||||
|
buf, rc);
|
||||||
spdk_nbd_stop(nbd);
|
spdk_nbd_stop(nbd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -596,7 +601,8 @@ spdk_nbd_start(const char *bdev_name, const char *nbd_path)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Enabling kernel access to bdev %s via %s\n", spdk_bdev_get_name(bdev), nbd_path);
|
SPDK_INFOLOG(SPDK_LOG_NBD, "Enabling kernel access to bdev %s via %s\n",
|
||||||
|
spdk_bdev_get_name(bdev), nbd_path);
|
||||||
|
|
||||||
rc = ioctl(nbd->dev_fd, NBD_SET_SOCK, nbd->kernel_sp_fd);
|
rc = ioctl(nbd->dev_fd, NBD_SET_SOCK, nbd->kernel_sp_fd);
|
||||||
if (rc == -1) {
|
if (rc == -1) {
|
||||||
@ -647,3 +653,5 @@ err:
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SPDK_LOG_REGISTER_COMPONENT("nbd", SPDK_LOG_NBD)
|
||||||
|
Loading…
Reference in New Issue
Block a user