summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-aio.c
diff options
context:
space:
mode:
authorHari Gowtham <hgowtham@dhcp35-85.lab.eng.blr.redhat.com>2015-05-27 13:17:30 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-06-24 23:59:47 -0700
commit7b7e82f8770643e9edd5650340a387ea70e771f2 (patch)
treefba10fa9d5f0926ca24cb3320008d0e18dd18de5 /xlators/storage/posix/src/posix-aio.c
parent3e9bc0b4a00e006410521a78011a8feae0af9234 (diff)
Porting new log messages for posix
Backport of http://review.gluster.org/#/c/9893/ Cherry picked from 59e1c79ac6953e552fbdc8c627f5dc1d02eeacc8 >Change-Id: I29bdeefb755805858e3cb1817b679cb6f9a476a9 >BUG: 1194640 >Signed-off-by: Hari Gowtham <hgowtham@dhcp35-85.lab.eng.blr.redhat.com> >Reviewed-on: http://review.gluster.org/9893 >Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> >Tested-by: NetBSD Build System <jenkins@build.gluster.org> >Tested-by: Gluster Build System <jenkins@build.gluster.com> >Signed-off-by: Hari Gowtham <hgowtham@redhat.com> Change-Id: I29bdeefb755805858e3cb1817b679cb6f9a476a9 BUG: 1217722 Signed-off-by: Hari Gowtham <hgowtham@dhcp35-85.lab.eng.blr.redhat.com> Signed-off-by: Hari Gowtham <hgowtham@redhat.com> Reviewed-on: http://review.gluster.org/11279 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-aio.c')
-rw-r--r--xlators/storage/posix/src/posix-aio.c76
1 files changed, 41 insertions, 35 deletions
diff --git a/xlators/storage/posix/src/posix-aio.c b/xlators/storage/posix/src/posix-aio.c
index c3bbddd6737..3d4d2f69dbd 100644
--- a/xlators/storage/posix/src/posix-aio.c
+++ b/xlators/storage/posix/src/posix-aio.c
@@ -16,6 +16,7 @@
#include "glusterfs.h"
#include "posix.h"
#include <sys/uio.h>
+#include "posix-messages.h"
#ifdef HAVE_LIBAIO
#include <libaio.h>
@@ -55,9 +56,9 @@ __posix_fd_set_odirect (fd_t *fd, struct posix_fd *pfd, int opflags,
}
if (ret) {
- gf_log (THIS->name, GF_LOG_WARNING,
- "fcntl() failed (%s). fd=%d flags=%d pfd->odirect=%d",
- strerror (errno), pfd->fd, flags, pfd->odirect);
+ gf_msg (THIS->name, GF_LOG_WARNING, errno, P_MSG_FCNTL_FAILED,
+ "fcntl() failed. fd=%d flags=%d pfd->odirect=%d",
+ pfd->fd, flags, pfd->odirect);
}
}
@@ -101,11 +102,11 @@ posix_aio_readv_complete (struct posix_aio_cb *paiocb, int res, int res2)
if (res < 0) {
op_ret = -1;
op_errno = -res;
- gf_log (this->name, GF_LOG_ERROR,
- "readv(async) failed fd=%d,size=%lu,offset=%llu (%d/%s)",
+ gf_msg (this->name, GF_LOG_ERROR, op_errno, P_MSG_READV_FAILED,
+ "readv(async) failed fd=%d,size=%lu,offset=%llu (%d)",
_fd, paiocb->iocb.u.c.nbytes,
(unsigned long long) paiocb->offset,
- res, strerror (op_errno));
+ res);
goto out;
}
@@ -113,9 +114,8 @@ posix_aio_readv_complete (struct posix_aio_cb *paiocb, int res, int res2)
if (ret != 0) {
op_ret = -1;
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fstat failed on fd=%d: %s", _fd,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno, P_MSG_FSTAT_FAILED,
+ "fstat failed on fd=%d", _fd);
goto out;
}
@@ -182,7 +182,7 @@ posix_aio_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
op_errno = -ret;
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, op_errno, P_MSG_PFD_NULL,
"pfd is NULL from fd=%p", fd);
goto err;
}
@@ -190,7 +190,8 @@ posix_aio_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
if (!size) {
op_errno = EINVAL;
- gf_log (this->name, GF_LOG_WARNING, "size=%"GF_PRI_SIZET, size);
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ P_MSG_INVALID_ARGUMENT, "size=%"GF_PRI_SIZET, size);
goto err;
}
@@ -232,9 +233,10 @@ posix_aio_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
UNLOCK (&fd->lock);
if (ret != 1) {
- gf_log (this->name, GF_LOG_ERROR,
- "io_submit() returned %d", ret);
op_errno = -ret;
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ P_MSG_IO_SUBMIT_FAILED,
+ "io_submit() returned %d", ret);
goto err;
}
@@ -274,10 +276,10 @@ posix_aio_writev_complete (struct posix_aio_cb *paiocb, int res, int res2)
if (res < 0) {
op_ret = -1;
op_errno = -res;
- gf_log (this->name, GF_LOG_ERROR,
- "writev(async) failed fd=%d,offset=%llu (%d/%s)",
- _fd, (unsigned long long) paiocb->offset, res,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ P_MSG_WRITEV_FAILED,
+ "writev(async) failed fd=%d,offset=%llu (%d)",
+ _fd, (unsigned long long) paiocb->offset, res);
goto out;
}
@@ -286,9 +288,8 @@ posix_aio_writev_complete (struct posix_aio_cb *paiocb, int res, int res2)
if (ret != 0) {
op_ret = -1;
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fstat failed on fd=%d: %s", _fd,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno, P_MSG_FSTAT_FAILED,
+ "fstat failed on fd=%d", _fd);
goto out;
}
@@ -339,7 +340,7 @@ posix_aio_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
op_errno = -ret;
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, op_errno, P_MSG_PFD_NULL,
"pfd is NULL from fd=%p", fd);
goto err;
}
@@ -371,9 +372,8 @@ posix_aio_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
ret = posix_fdstat (this, _fd, &paiocb->prebuf);
if (ret != 0) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fstat failed on fd=%p: %s", fd,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno, P_MSG_FSTAT_FAILED,
+ "fstat failed on fd=%p", fd);
goto err;
}
@@ -388,9 +388,11 @@ posix_aio_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
UNLOCK (&fd->lock);
if (ret != 1) {
- gf_log (this->name, GF_LOG_ERROR,
- "io_submit() returned %d", ret);
op_errno = -ret;
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ P_MSG_IO_SUBMIT_FAILED,
+ "io_submit() returned %d,gfid=%s", ret,
+ uuid_utoa(fd->inode->gfid));
goto err;
}
@@ -428,7 +430,8 @@ posix_aio_thread (void *data)
ret = io_getevents (priv->ctxp, 1, POSIX_AIO_MAX_NR_GETEVENTS,
&events[0], NULL);
if (ret <= 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, -ret,
+ P_MSG_IO_GETEVENTS_FAILED,
"io_getevents() returned %d", ret);
if (ret == -EINTR)
continue;
@@ -450,7 +453,8 @@ posix_aio_thread (void *data)
event->res2);
break;
default:
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ P_MSG_UNKNOWN_OP,
"unknown op %d found in piocb",
paiocb->op);
break;
@@ -472,7 +476,7 @@ posix_aio_init (xlator_t *this)
ret = io_setup (POSIX_AIO_MAX_NR_EVENTS, &priv->ctxp);
if ((ret == -1 && errno == ENOSYS) || ret == -ENOSYS) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_AIO_UNAVAILABLE,
"Linux AIO not available at run-time."
" Continuing with synchronous IO");
ret = 0;
@@ -480,9 +484,10 @@ posix_aio_init (xlator_t *this)
}
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
- "io_setup() failed. ret=%d, errno=%d",
- ret, errno);
+ gf_msg (this->name, GF_LOG_WARNING, -ret,
+ P_MSG_IO_SETUP_FAILED,
+ "io_setup() failed. ret=%d",
+ ret);
goto out;
}
@@ -541,7 +546,7 @@ posix_aio_off (xlator_t *this)
int
posix_aio_on (xlator_t *this)
{
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0, P_MSG_AIO_UNAVAILABLE,
"Linux AIO not available at build-time."
" Continuing with synchronous IO");
return 0;
@@ -550,7 +555,7 @@ posix_aio_on (xlator_t *this)
int
posix_aio_off (xlator_t *this)
{
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0, P_MSG_AIO_UNAVAILABLE,
"Linux AIO not available at build-time."
" Continuing with synchronous IO");
return 0;
@@ -561,9 +566,10 @@ __posix_fd_set_odirect (fd_t *fd, struct posix_fd *pfd, int opflags,
off_t offset, size_t size)
{
xlator_t *this = THIS;
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0, P_MSG_AIO_UNAVAILABLE,
"Linux AIO not available at build-time."
" Continuing with synchronous IO");
return;
}
+
#endif