|
|
7f4c2a |
From 5c79ddf3d88bcc6d6492f7eae9eaa9931e338072 Mon Sep 17 00:00:00 2001
|
|
|
7f4c2a |
From: arao <arao@redhat.com>
|
|
|
7f4c2a |
Date: Mon, 22 Jun 2015 11:10:05 +0530
|
|
|
7f4c2a |
Subject: [PATCH 182/190] Logging: Porting the performance translator
|
|
|
7f4c2a |
logs to new logging framework.
|
|
|
7f4c2a |
|
|
|
7f4c2a |
BUG: 1231784
|
|
|
7f4c2a |
Change-Id: Id7535930442f6fc67fbe0cd93308f8fda534aa6f
|
|
|
7f4c2a |
Signed-off-by: Anusha <arao@redhat.com>
|
|
|
7f4c2a |
Reviewed-on: https://code.engineering.redhat.com/gerrit/51752
|
|
|
7f4c2a |
Reviewed-by: Nithya Balachandran <nbalacha@redhat.com>
|
|
|
7f4c2a |
Tested-by: Nithya Balachandran <nbalacha@redhat.com>
|
|
|
7f4c2a |
---
|
|
|
7f4c2a |
libglusterfs/src/glfs-message-id.h | 50 ++++++--
|
|
|
7f4c2a |
.../performance/io-cache/src/io-cache-messages.h | 111 +++++++++++++++
|
|
|
7f4c2a |
xlators/performance/io-cache/src/io-cache.c | 150 ++++++++++++--------
|
|
|
7f4c2a |
xlators/performance/io-cache/src/io-cache.h | 45 +++---
|
|
|
7f4c2a |
xlators/performance/io-cache/src/ioc-inode.c | 22 ++--
|
|
|
7f4c2a |
xlators/performance/io-cache/src/page.c | 103 +++++++-------
|
|
|
7f4c2a |
.../io-threads/src/io-threads-messages.h | 103 ++++++++++++++
|
|
|
7f4c2a |
xlators/performance/io-threads/src/io-threads.c | 56 +++++---
|
|
|
7f4c2a |
.../performance/md-cache/src/md-cache-messages.h | 66 +++++++++
|
|
|
7f4c2a |
xlators/performance/md-cache/src/md-cache.c | 13 +-
|
|
|
7f4c2a |
.../open-behind/src/open-behind-messages.h | 85 +++++++++++
|
|
|
7f4c2a |
xlators/performance/open-behind/src/open-behind.c | 15 ++-
|
|
|
7f4c2a |
.../quick-read/src/quick-read-messages.h | 119 ++++++++++++++++
|
|
|
7f4c2a |
xlators/performance/quick-read/src/quick-read.c | 41 +++---
|
|
|
7f4c2a |
xlators/performance/read-ahead/src/page.c | 11 +-
|
|
|
7f4c2a |
.../read-ahead/src/read-ahead-messages.h | 94 ++++++++++++
|
|
|
7f4c2a |
xlators/performance/read-ahead/src/read-ahead.c | 67 +++++----
|
|
|
7f4c2a |
.../readdir-ahead/src/readdir-ahead-messages.h | 105 ++++++++++++++
|
|
|
7f4c2a |
.../performance/readdir-ahead/src/readdir-ahead.c | 21 ++-
|
|
|
7f4c2a |
.../symlink-cache/src/symlink-cache-messages.h | 93 ++++++++++++
|
|
|
7f4c2a |
.../performance/symlink-cache/src/symlink-cache.c | 69 +++++----
|
|
|
7f4c2a |
.../write-behind/src/write-behind-messages.h | 121 ++++++++++++++++
|
|
|
7f4c2a |
.../performance/write-behind/src/write-behind.c | 26 +++-
|
|
|
7f4c2a |
23 files changed, 1308 insertions(+), 278 deletions(-)
|
|
|
7f4c2a |
create mode 100644 xlators/performance/io-cache/src/io-cache-messages.h
|
|
|
7f4c2a |
create mode 100644 xlators/performance/io-threads/src/io-threads-messages.h
|
|
|
7f4c2a |
create mode 100644 xlators/performance/md-cache/src/md-cache-messages.h
|
|
|
7f4c2a |
create mode 100644 xlators/performance/open-behind/src/open-behind-messages.h
|
|
|
7f4c2a |
create mode 100644 xlators/performance/quick-read/src/quick-read-messages.h
|
|
|
7f4c2a |
create mode 100644 xlators/performance/read-ahead/src/read-ahead-messages.h
|
|
|
7f4c2a |
create mode 100644 xlators/performance/readdir-ahead/src/readdir-ahead-messages.h
|
|
|
7f4c2a |
create mode 100644 xlators/performance/symlink-cache/src/symlink-cache-messages.h
|
|
|
7f4c2a |
create mode 100644 xlators/performance/write-behind/src/write-behind-messages.h
|
|
|
7f4c2a |
|
|
|
7f4c2a |
diff --git a/libglusterfs/src/glfs-message-id.h b/libglusterfs/src/glfs-message-id.h
|
|
|
7f4c2a |
index 53b004d..0087440 100644
|
|
|
7f4c2a |
--- a/libglusterfs/src/glfs-message-id.h
|
|
|
7f4c2a |
+++ b/libglusterfs/src/glfs-message-id.h
|
|
|
7f4c2a |
@@ -109,17 +109,49 @@
|
|
|
7f4c2a |
#define GLFS_MSGID_COMP_RPC_TRANS_SOCKET_END (GLFS_MSGID_COMP_RPC_TRANS_SOCKET + \
|
|
|
7f4c2a |
GLFS_MSGID_SEGMENT)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
-#define GLFS_MSGID_COMP_QUOTA GLFS_MSGID_COMP_RPC_TRANS_SOCKET_END
|
|
|
7f4c2a |
-#define GLFS_MSGID_COMP_QUOTA_END (GLFS_MSGID_COMP_QUOTA +\
|
|
|
7f4c2a |
- GLFS_MSGID_SEGMENT)
|
|
|
7f4c2a |
-
|
|
|
7f4c2a |
-#define GLFS_MSGID_COMP_CTR GLFS_MSGID_COMP_QUOTA_END
|
|
|
7f4c2a |
-#define GLFS_MSGID_COMP_CTR_END (GLFS_MSGID_COMP_CTR+\
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_QUOTA GLFS_MSGID_COMP_RPC_TRANS_SOCKET_END
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_QUOTA_END (GLFS_MSGID_COMP_QUOTA +\
|
|
|
7f4c2a |
GLFS_MSGID_SEGMENT)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
-#define GLFS_MSGID_COMP_EC GLFS_MSGID_COMP_CTR_END
|
|
|
7f4c2a |
-#define GLFS_MSGID_COMP_EC_END (GLFS_MSGID_COMP_EC +\
|
|
|
7f4c2a |
- GLFS_MSGID_SEGMENT)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_IO_CACHE GLFS_MSGID_COMP_EC_END
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_IO_CACHE_END (GLFS_MSGID_COMP_IO_CACHE+\
|
|
|
7f4c2a |
+ GLFS_MSGID_SEGMENT)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_IO_THREADS GLFS_MSGID_COMP_IO_CACHE_END
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_IO_THREADS_END (GLFS_MSGID_COMP_IO_THREADS+\
|
|
|
7f4c2a |
+ GLFS_MSGID_SEGMENT)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_MD_CACHE GLFS_MSGID_COMP_IO_THREADS_END
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_MD_CACHE_END (GLFS_MSGID_COMP_MD_CACHE+\
|
|
|
7f4c2a |
+ GLFS_MSGID_SEGMENT)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_OPEN_BEHIND GLFS_MSGID_COMP_MD_CACHE_END
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_OPEN_BEHIND_END (GLFS_MSGID_COMP_OPEN_BEHIND+\
|
|
|
7f4c2a |
+ GLFS_MSGID_SEGMENT)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_QUICK_READ GLFS_MSGID_COMP_OPEN_BEHIND_END
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_QUICK_READ_END (GLFS_MSGID_COMP_QUICK_READ+\
|
|
|
7f4c2a |
+ GLFS_MSGID_SEGMENT)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_READ_AHEAD GLFS_MSGID_COMP_QUICK_READ_END
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_READ_AHEAD_END (GLFS_MSGID_COMP_READ_AHEAD+\
|
|
|
7f4c2a |
+ GLFS_MSGID_SEGMENT)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_READDIR_AHEAD GLFS_MSGID_COMP_READ_AHEAD_END
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_READDIR_AHEAD_END (GLFS_MSGID_COMP_READDIR_AHEAD+\
|
|
|
7f4c2a |
+ GLFS_MSGID_SEGMENT)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_SYMLINK_CACHE \
|
|
|
7f4c2a |
+GLFS_MSGID_COMP_READDIR_AHEAD_END
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_SYMLINK_CACHE_END \
|
|
|
7f4c2a |
+(GLFS_MSGID_COMP_SYMLINK_CACHE+ \
|
|
|
7f4c2a |
+ GLFS_MSGID_SEGMENT)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_WRITE_BEHIND \
|
|
|
7f4c2a |
+GLFS_MSGID_COMP_SYMLINK_CACHE_END
|
|
|
7f4c2a |
+#define GLFS_MSGID_COMP_WRITE_BEHIND_END (GLFS_MSGID_COMP_WRITE_BEHIND+\
|
|
|
7f4c2a |
+ GLFS_MSGID_SEGMENT)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
/* --- new segments for messages goes above this line --- */
|
|
|
7f4c2a |
|
|
|
7f4c2a |
diff --git a/xlators/performance/io-cache/src/io-cache-messages.h b/xlators/performance/io-cache/src/io-cache-messages.h
|
|
|
7f4c2a |
new file mode 100644
|
|
|
7f4c2a |
index 0000000..5c4fbea
|
|
|
7f4c2a |
--- /dev/null
|
|
|
7f4c2a |
+++ b/xlators/performance/io-cache/src/io-cache-messages.h
|
|
|
7f4c2a |
@@ -0,0 +1,111 @@
|
|
|
7f4c2a |
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
|
|
|
7f4c2a |
+ This file is part of GlusterFS.
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+ This file is licensed to you under your choice of the GNU Lesser
|
|
|
7f4c2a |
+ General Public License, version 3 or any later version (LGPLv3 or
|
|
|
7f4c2a |
+ later), or the GNU General Public License, version 2 (GPLv2), in all
|
|
|
7f4c2a |
+ cases as published by the Free Software Foundation.
|
|
|
7f4c2a |
+*/
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#ifndef _IO_CACHE_MESSAGES_H_
|
|
|
7f4c2a |
+#define _IO_CACHE_MESSAGES_H_
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#include "glfs-message-id.h"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*! \file io-cache-messages.h
|
|
|
7f4c2a |
+ * \brief IO_CACHE log-message IDs and their descriptions
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* NOTE: Rules for message additions
|
|
|
7f4c2a |
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
|
|
|
7f4c2a |
+ * if the message format is the same. Reasoning is that, if the message
|
|
|
7f4c2a |
+ * format needs to change in one instance, the other instances are not
|
|
|
7f4c2a |
+ * impacted or the new change does not change the ID of the instance being
|
|
|
7f4c2a |
+ * modified.
|
|
|
7f4c2a |
+ * 2) Addition of a message,
|
|
|
7f4c2a |
+ * - Should increment the GLFS_NUM_MESSAGES
|
|
|
7f4c2a |
+ * - Append to the list of messages defined, towards the end
|
|
|
7f4c2a |
+ * - Retain macro naming as glfs_msg_X (for redability across developers)
|
|
|
7f4c2a |
+ * NOTE: Rules for message format modifications
|
|
|
7f4c2a |
+ * 3) Check acorss the code if the message ID macro in question is reused
|
|
|
7f4c2a |
+ * anywhere. If reused then then the modifications should ensure correctness
|
|
|
7f4c2a |
+ * everywhere, or needs a new message ID as (1) above was not adhered to. If
|
|
|
7f4c2a |
+ * not used anywhere, proceed with the required modification.
|
|
|
7f4c2a |
+ * NOTE: Rules for message deletion
|
|
|
7f4c2a |
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
|
|
|
7f4c2a |
+ * anywhere, then can be deleted, but will leave a hole by design, as
|
|
|
7f4c2a |
+ * addition rules specify modification to the end of the list and not filling
|
|
|
7f4c2a |
+ * holes.
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_IO_CACHE_BASE GLFS_MSGID_COMP_IO_CACHE
|
|
|
7f4c2a |
+#define GLFS_IO_CACHE_NUM_MESSAGES 6
|
|
|
7f4c2a |
+#define GLFS_MSGID_END (GLFS_IO_CACHE_BASE + GLFS_IO_CACHE_NUM_MESSAGES + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* Messages with message IDs */
|
|
|
7f4c2a |
+#define glfs_msg_start_x GLFS_IO_CACHE_BASE, "Invalid: Start of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define IO_CACHE_MSG_ENFORCEMENT_FAILED (GLFS_IO_CACHE_BASE + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define IO_CACHE_MSG_INVALID_ARGUMENT (GLFS_IO_CACHE_BASE + 2)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define IO_CACHE_MSG_XLATOR_CHILD_MISCONFIGURED (GLFS_IO_CACHE_BASE + 3)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define IO_CACHE_MSG_NO_MEMORY (GLFS_IO_CACHE_BASE + 4)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define IO_CACHE_MSG_VOL_MISCONFIGURED (GLFS_IO_CACHE_BASE + 5)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define IO_CACHE_MSG_INODE_NULL (GLFS_IO_CACHE_BASE + 6)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*------------*/
|
|
|
7f4c2a |
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#endif /* _IO_CACHE_MESSAGES_H_ */
|
|
|
7f4c2a |
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
|
|
|
7f4c2a |
index bfda85d..7eea867 100644
|
|
|
7f4c2a |
--- a/xlators/performance/io-cache/src/io-cache.c
|
|
|
7f4c2a |
+++ b/xlators/performance/io-cache/src/io-cache.c
|
|
|
7f4c2a |
@@ -22,7 +22,7 @@
|
|
|
7f4c2a |
#include "statedump.h"
|
|
|
7f4c2a |
#include <assert.h>
|
|
|
7f4c2a |
#include <sys/time.h>
|
|
|
7f4c2a |
-
|
|
|
7f4c2a |
+#include "io-cache-messages.h"
|
|
|
7f4c2a |
int ioc_log2_page_size;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
uint32_t
|
|
|
7f4c2a |
@@ -272,14 +272,16 @@ ioc_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc,
|
|
|
7f4c2a |
local = mem_get0 (this->local_pool);
|
|
|
7f4c2a |
if (local == NULL) {
|
|
|
7f4c2a |
op_errno = ENOMEM;
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "out of memory");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ IO_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
goto unwind;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
ret = loc_copy (&local->file_loc, loc);
|
|
|
7f4c2a |
if (ret != 0) {
|
|
|
7f4c2a |
op_errno = ENOMEM;
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "out of memory");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ IO_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
goto unwind;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -360,9 +362,9 @@ ioc_cache_validate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if ((op_ret == -1) ||
|
|
|
7f4c2a |
((op_ret >= 0) && !ioc_cache_still_valid(ioc_inode, stbuf))) {
|
|
|
7f4c2a |
- gf_log (ioc_inode->table->xl->name, GF_LOG_DEBUG,
|
|
|
7f4c2a |
- "cache for inode(%p) is invalid. flushing all pages",
|
|
|
7f4c2a |
- ioc_inode);
|
|
|
7f4c2a |
+ gf_msg_debug (ioc_inode->table->xl->name, 0,
|
|
|
7f4c2a |
+ "cache for inode(%p) is invalid. flushing all pages",
|
|
|
7f4c2a |
+ ioc_inode);
|
|
|
7f4c2a |
/* NOTE: only pages with no waiting frames are flushed by
|
|
|
7f4c2a |
* ioc_inode_flush. page_fault will be generated for all
|
|
|
7f4c2a |
* the pages which have waiting frames by ioc_inode_wakeup()
|
|
|
7f4c2a |
@@ -430,7 +432,8 @@ ioc_wait_on_inode (ioc_inode_t *ioc_inode, ioc_page_t *page)
|
|
|
7f4c2a |
waiter = GF_CALLOC (1, sizeof (ioc_waitq_t),
|
|
|
7f4c2a |
gf_ioc_mt_ioc_waitq_t);
|
|
|
7f4c2a |
if (waiter == NULL) {
|
|
|
7f4c2a |
- gf_log (ioc_inode->table->xl->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (ioc_inode->table->xl->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ ENOMEM, IO_CACHE_MSG_NO_MEMORY,
|
|
|
7f4c2a |
"out of memory");
|
|
|
7f4c2a |
ret = -ENOMEM;
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
@@ -468,8 +471,8 @@ ioc_cache_validate (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
|
|
|
7f4c2a |
ret = -1;
|
|
|
7f4c2a |
local->op_ret = -1;
|
|
|
7f4c2a |
local->op_errno = ENOMEM;
|
|
|
7f4c2a |
- gf_log (ioc_inode->table->xl->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
- "out of memory");
|
|
|
7f4c2a |
+ gf_msg (ioc_inode->table->xl->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ 0, IO_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -479,8 +482,8 @@ ioc_cache_validate (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
|
|
|
7f4c2a |
local->op_ret = -1;
|
|
|
7f4c2a |
local->op_errno = ENOMEM;
|
|
|
7f4c2a |
mem_put (validate_local);
|
|
|
7f4c2a |
- gf_log (ioc_inode->table->xl->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
- "out of memory");
|
|
|
7f4c2a |
+ gf_msg (ioc_inode->table->xl->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ 0, IO_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -560,8 +563,10 @@ ioc_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
//TODO: see why inode context is NULL and handle it.
|
|
|
7f4c2a |
if (!ioc_inode) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "inode context is "
|
|
|
7f4c2a |
- "NULL (%s)", uuid_utoa (fd->inode->gfid));
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ EINVAL, IO_CACHE_MSG_ENFORCEMENT_FAILED,
|
|
|
7f4c2a |
+ "inode context is NULL (%s)",
|
|
|
7f4c2a |
+ uuid_utoa (fd->inode->gfid));
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -660,7 +665,8 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
&& (table->max_file_size < ioc_inode->ia_size))) {
|
|
|
7f4c2a |
ret = fd_ctx_set (fd, this, 1);
|
|
|
7f4c2a |
if (ret)
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ ENOMEM, IO_CACHE_MSG_NO_MEMORY,
|
|
|
7f4c2a |
"%s: failed to set fd ctx",
|
|
|
7f4c2a |
local->file_loc.path);
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -677,7 +683,8 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
* as a whole */
|
|
|
7f4c2a |
ret = fd_ctx_set (fd, this, 1);
|
|
|
7f4c2a |
if (ret)
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ ENOMEM, IO_CACHE_MSG_NO_MEMORY,
|
|
|
7f4c2a |
"%s: failed to set fd ctx",
|
|
|
7f4c2a |
local->file_loc.path);
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -687,7 +694,8 @@ ioc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
/* we allow a pattern-matched cache disable this way */
|
|
|
7f4c2a |
ret = fd_ctx_set (fd, this, 1);
|
|
|
7f4c2a |
if (ret)
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ ENOMEM, IO_CACHE_MSG_NO_MEMORY,
|
|
|
7f4c2a |
"%s: failed to set fd ctx",
|
|
|
7f4c2a |
local->file_loc.path);
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -767,14 +775,16 @@ ioc_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
|
|
|
7f4c2a |
local = mem_get0 (this->local_pool);
|
|
|
7f4c2a |
if (local == NULL) {
|
|
|
7f4c2a |
op_errno = ENOMEM;
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "out of memory");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ 0, IO_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
goto unwind;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
ret = loc_copy (&local->file_loc, loc);
|
|
|
7f4c2a |
if (ret != 0) {
|
|
|
7f4c2a |
op_errno = ENOMEM;
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "out of memory");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ 0, IO_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
goto unwind;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -816,7 +826,8 @@ ioc_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
local = mem_get0 (this->local_pool);
|
|
|
7f4c2a |
if (local == NULL) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "out of memory");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ ENOMEM, IO_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
STACK_UNWIND_STRICT (open, frame, -1, ENOMEM, NULL, NULL);
|
|
|
7f4c2a |
return 0;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -852,7 +863,8 @@ ioc_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
local = mem_get0 (this->local_pool);
|
|
|
7f4c2a |
if (local == NULL) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "out of memory");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ ENOMEM, IO_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
STACK_UNWIND_STRICT (create, frame, -1, ENOMEM, NULL, NULL,
|
|
|
7f4c2a |
NULL, NULL, NULL, NULL);
|
|
|
7f4c2a |
return 0;
|
|
|
7f4c2a |
@@ -991,8 +1003,9 @@ ioc_dispatch_requests (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
|
|
|
7f4c2a |
trav_offset);
|
|
|
7f4c2a |
fault = 1;
|
|
|
7f4c2a |
if (!trav) {
|
|
|
7f4c2a |
- gf_log (frame->this->name,
|
|
|
7f4c2a |
+ gf_msg (frame->this->name,
|
|
|
7f4c2a |
GF_LOG_CRITICAL,
|
|
|
7f4c2a |
+ ENOMEM, IO_CACHE_MSG_NO_MEMORY,
|
|
|
7f4c2a |
"out of memory");
|
|
|
7f4c2a |
local->op_ret = -1;
|
|
|
7f4c2a |
local->op_errno = ENOMEM;
|
|
|
7f4c2a |
@@ -1008,10 +1021,13 @@ ioc_dispatch_requests (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
|
|
|
7f4c2a |
/* page found in cache */
|
|
|
7f4c2a |
if (!might_need_validate && !ioc_inode->waitq) {
|
|
|
7f4c2a |
/* fresh enough */
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "cache hit for trav_offset=%"
|
|
|
7f4c2a |
- PRId64"/local_offset=%"PRId64"",
|
|
|
7f4c2a |
- trav_offset, local_offset);
|
|
|
7f4c2a |
+ gf_msg_trace (frame->this->name, 0,
|
|
|
7f4c2a |
+ "cache hit for "
|
|
|
7f4c2a |
+ "trav_offset=%"
|
|
|
7f4c2a |
+ PRId64"/local_"
|
|
|
7f4c2a |
+ "offset=%"PRId64"",
|
|
|
7f4c2a |
+ trav_offset,
|
|
|
7f4c2a |
+ local_offset);
|
|
|
7f4c2a |
waitq = __ioc_page_wakeup (trav,
|
|
|
7f4c2a |
trav->op_errno);
|
|
|
7f4c2a |
} else {
|
|
|
7f4c2a |
@@ -1055,10 +1071,10 @@ ioc_dispatch_requests (call_frame_t *frame, ioc_inode_t *ioc_inode, fd_t *fd,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (need_validate) {
|
|
|
7f4c2a |
need_validate = 0;
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "sending validate request for "
|
|
|
7f4c2a |
- "inode(%s) at offset=%"PRId64"",
|
|
|
7f4c2a |
- uuid_utoa (fd->inode->gfid), trav_offset);
|
|
|
7f4c2a |
+ gf_msg_trace (frame->this->name, 0,
|
|
|
7f4c2a |
+ "sending validate request for "
|
|
|
7f4c2a |
+ "inode(%s) at offset=%"PRId64"",
|
|
|
7f4c2a |
+ uuid_utoa (fd->inode->gfid), trav_offset);
|
|
|
7f4c2a |
ret = ioc_cache_validate (frame, ioc_inode, fd, trav);
|
|
|
7f4c2a |
if (ret == -1) {
|
|
|
7f4c2a |
ioc_inode_lock (ioc_inode);
|
|
|
7f4c2a |
@@ -1128,7 +1144,8 @@ ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
7f4c2a |
table = this->private;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!table) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "table is null");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
|
|
|
7f4c2a |
+ IO_CACHE_MSG_ENFORCEMENT_FAILED, "table is null");
|
|
|
7f4c2a |
op_errno = EINVAL;
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -1162,7 +1179,8 @@ ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
local = mem_get0 (this->local_pool);
|
|
|
7f4c2a |
if (local == NULL) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "out of memory");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ ENOMEM, IO_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
op_errno = ENOMEM;
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -1176,9 +1194,10 @@ ioc_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
7f4c2a |
local->size = size;
|
|
|
7f4c2a |
local->inode = ioc_inode;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "NEW REQ (%p) offset = %"PRId64" && size = %"GF_PRI_SIZET"",
|
|
|
7f4c2a |
- frame, offset, size);
|
|
|
7f4c2a |
+ gf_msg_trace (this->name, 0,
|
|
|
7f4c2a |
+ "NEW REQ (%p) offset "
|
|
|
7f4c2a |
+ "= %"PRId64" && size = %"GF_PRI_SIZET"",
|
|
|
7f4c2a |
+ frame, offset, size);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
weight = ioc_inode->weight;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -1248,7 +1267,8 @@ ioc_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
local = mem_get0 (this->local_pool);
|
|
|
7f4c2a |
if (local == NULL) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "out of memory");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ ENOMEM, IO_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
|
|
|
7f4c2a |
STACK_UNWIND_STRICT (writev, frame, -1, ENOMEM, NULL, NULL, NULL);
|
|
|
7f4c2a |
return 0;
|
|
|
7f4c2a |
@@ -1383,8 +1403,8 @@ ioc_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
|
|
|
7f4c2a |
inode_ctx_get (fd->inode, this, &tmp_inode);
|
|
|
7f4c2a |
ioc_inode = (ioc_inode_t *)(long)tmp_inode;
|
|
|
7f4c2a |
if (!ioc_inode) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_DEBUG,
|
|
|
7f4c2a |
- "inode context is NULL: returning EBADFD");
|
|
|
7f4c2a |
+ gf_msg_debug (this->name, EBADFD,
|
|
|
7f4c2a |
+ "inode context is NULL: returning EBADFD");
|
|
|
7f4c2a |
STACK_UNWIND_STRICT (lk, frame, -1, EBADFD, NULL, NULL);
|
|
|
7f4c2a |
return 0;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -1537,10 +1557,9 @@ ioc_get_priority_list (const char *opt_str, struct list_head *first)
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log ("io-cache", GF_LOG_TRACE,
|
|
|
7f4c2a |
- "ioc priority : pattern %s : priority %s",
|
|
|
7f4c2a |
- pattern,
|
|
|
7f4c2a |
- priority);
|
|
|
7f4c2a |
+ gf_msg_trace ("io-cache", 0,
|
|
|
7f4c2a |
+ "ioc priority : pattern %s : priority %s",
|
|
|
7f4c2a |
+ pattern, priority);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
curr->pattern = gf_strdup (pattern);
|
|
|
7f4c2a |
if (curr->pattern == NULL) {
|
|
|
7f4c2a |
@@ -1588,8 +1607,9 @@ mem_acct_init (xlator_t *this)
|
|
|
7f4c2a |
ret = xlator_mem_acct_init (this, gf_ioc_mt_end + 1);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (ret != 0) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
|
|
|
7f4c2a |
- "failed");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ ENOMEM, IO_CACHE_MSG_NO_MEMORY,
|
|
|
7f4c2a |
+ "Memory accounting init failed");
|
|
|
7f4c2a |
return ret;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -1609,7 +1629,8 @@ check_cache_size_ok (xlator_t *this, uint64_t cache_size)
|
|
|
7f4c2a |
opt = xlator_volume_option_get (this, "cache-size");
|
|
|
7f4c2a |
if (!opt) {
|
|
|
7f4c2a |
ret = _gf_false;
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ EINVAL, IO_CACHE_MSG_ENFORCEMENT_FAILED,
|
|
|
7f4c2a |
"could not get cache-size option");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -1620,12 +1641,14 @@ check_cache_size_ok (xlator_t *this, uint64_t cache_size)
|
|
|
7f4c2a |
else
|
|
|
7f4c2a |
max_cache_size = total_mem;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_DEBUG, "Max cache size is %"PRIu64,
|
|
|
7f4c2a |
- max_cache_size);
|
|
|
7f4c2a |
+ gf_msg_debug (this->name, 0, "Max cache size is %"PRIu64,
|
|
|
7f4c2a |
+ max_cache_size);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (cache_size > max_cache_size) {
|
|
|
7f4c2a |
ret = _gf_false;
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "Cache size %"PRIu64
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ 0, IO_CACHE_MSG_INVALID_ARGUMENT,
|
|
|
7f4c2a |
+ "Cache size %"PRIu64
|
|
|
7f4c2a |
" is greater than the max size of %"PRIu64,
|
|
|
7f4c2a |
cache_size, max_cache_size);
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
@@ -1655,8 +1678,8 @@ reconfigure (xlator_t *this, dict_t *options)
|
|
|
7f4c2a |
if (data) {
|
|
|
7f4c2a |
char *option_list = data_to_str (data);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "option path %s", option_list);
|
|
|
7f4c2a |
+ gf_msg_trace (this->name, 0,
|
|
|
7f4c2a |
+ "option path %s", option_list);
|
|
|
7f4c2a |
/* parse the list of pattern:priority */
|
|
|
7f4c2a |
table->max_pri = ioc_get_priority_list (option_list,
|
|
|
7f4c2a |
&table->priority_list);
|
|
|
7f4c2a |
@@ -1675,7 +1698,8 @@ reconfigure (xlator_t *this, dict_t *options)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if ((table->max_file_size <= UINT64_MAX) &&
|
|
|
7f4c2a |
(table->min_file_size > table->max_file_size)) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "minimum size (%"
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ IO_CACHE_MSG_INVALID_ARGUMENT, "minimum size (%"
|
|
|
7f4c2a |
PRIu64") of a file that can be cached is "
|
|
|
7f4c2a |
"greater than maximum size (%"PRIu64"). "
|
|
|
7f4c2a |
"Hence Defaulting to old value",
|
|
|
7f4c2a |
@@ -1687,7 +1711,8 @@ reconfigure (xlator_t *this, dict_t *options)
|
|
|
7f4c2a |
options, size_uint64, unlock);
|
|
|
7f4c2a |
if (!check_cache_size_ok (this, cache_size_new)) {
|
|
|
7f4c2a |
ret = -1;
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ 0, IO_CACHE_MSG_INVALID_ARGUMENT,
|
|
|
7f4c2a |
"Not reconfiguring cache-size");
|
|
|
7f4c2a |
goto unlock;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -1721,20 +1746,23 @@ init (xlator_t *this)
|
|
|
7f4c2a |
xl_options = this->options;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!this->children || this->children->next) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ IO_CACHE_MSG_XLATOR_CHILD_MISCONFIGURED,
|
|
|
7f4c2a |
"FATAL: io-cache not configured with exactly "
|
|
|
7f4c2a |
"one child");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!this->parents) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
7f4c2a |
+ IO_CACHE_MSG_VOL_MISCONFIGURED,
|
|
|
7f4c2a |
"dangling volume. check volfile ");
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
table = (void *) GF_CALLOC (1, sizeof (*table), gf_ioc_mt_ioc_table_t);
|
|
|
7f4c2a |
if (table == NULL) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "out of memory");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
7f4c2a |
+ IO_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -1759,8 +1787,8 @@ init (xlator_t *this)
|
|
|
7f4c2a |
data = dict_get (xl_options, "priority");
|
|
|
7f4c2a |
if (data) {
|
|
|
7f4c2a |
char *option_list = data_to_str (data);
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "option path %s", option_list);
|
|
|
7f4c2a |
+ gf_msg_trace (this->name, 0,
|
|
|
7f4c2a |
+ "option path %s", option_list);
|
|
|
7f4c2a |
/* parse the list of pattern:priority */
|
|
|
7f4c2a |
table->max_pri = ioc_get_priority_list (option_list,
|
|
|
7f4c2a |
&table->priority_list);
|
|
|
7f4c2a |
@@ -1775,7 +1803,8 @@ init (xlator_t *this)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if ((table->max_file_size <= UINT64_MAX)
|
|
|
7f4c2a |
&& (table->min_file_size > table->max_file_size)) {
|
|
|
7f4c2a |
- gf_log ("io-cache", GF_LOG_ERROR, "minimum size (%"
|
|
|
7f4c2a |
+ gf_msg ("io-cache", GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ IO_CACHE_MSG_INVALID_ARGUMENT, "minimum size (%"
|
|
|
7f4c2a |
PRIu64") of a file that can be cached is "
|
|
|
7f4c2a |
"greater than maximum size (%"PRIu64")",
|
|
|
7f4c2a |
table->min_file_size, table->max_file_size);
|
|
|
7f4c2a |
@@ -1795,7 +1824,8 @@ init (xlator_t *this)
|
|
|
7f4c2a |
this->local_pool = mem_pool_new (ioc_local_t, 64);
|
|
|
7f4c2a |
if (!this->local_pool) {
|
|
|
7f4c2a |
ret = -1;
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ ENOMEM, IO_CACHE_MSG_NO_MEMORY,
|
|
|
7f4c2a |
"failed to create local_t's memory pool");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -1809,8 +1839,8 @@ init (xlator_t *this)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
table->mem_pool = mem_pool_new (rbthash_entry_t, num_pages);
|
|
|
7f4c2a |
if (!table->mem_pool) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
- "Unable to allocate mem_pool");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
7f4c2a |
+ IO_CACHE_MSG_NO_MEMORY, "Unable to allocate mem_pool");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
diff --git a/xlators/performance/io-cache/src/io-cache.h b/xlators/performance/io-cache/src/io-cache.h
|
|
|
7f4c2a |
index 46d758a..1bdd66b 100644
|
|
|
7f4c2a |
--- a/xlators/performance/io-cache/src/io-cache.h
|
|
|
7f4c2a |
+++ b/xlators/performance/io-cache/src/io-cache.h
|
|
|
7f4c2a |
@@ -29,6 +29,7 @@
|
|
|
7f4c2a |
#include "hashfn.h"
|
|
|
7f4c2a |
#include <sys/time.h>
|
|
|
7f4c2a |
#include <fnmatch.h>
|
|
|
7f4c2a |
+#include "io-cache-messages.h"
|
|
|
7f4c2a |
|
|
|
7f4c2a |
#define IOC_PAGE_SIZE (1024 * 128) /* 128KB */
|
|
|
7f4c2a |
#define IOC_CACHE_SIZE (32 * 1024 * 1024)
|
|
|
7f4c2a |
@@ -224,64 +225,64 @@ ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
#define ioc_inode_lock(ioc_inode) \
|
|
|
7f4c2a |
do { \
|
|
|
7f4c2a |
- gf_log (ioc_inode->table->xl->name, GF_LOG_TRACE, \
|
|
|
7f4c2a |
- "locked inode(%p)", ioc_inode); \
|
|
|
7f4c2a |
+ gf_msg_trace (ioc_inode->table->xl->name, 0, \
|
|
|
7f4c2a |
+ "locked inode(%p)", ioc_inode); \
|
|
|
7f4c2a |
pthread_mutex_lock (&ioc_inode->inode_lock); \
|
|
|
7f4c2a |
} while (0)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
|
|
|
7f4c2a |
#define ioc_inode_unlock(ioc_inode) \
|
|
|
7f4c2a |
do { \
|
|
|
7f4c2a |
- gf_log (ioc_inode->table->xl->name, GF_LOG_TRACE, \
|
|
|
7f4c2a |
- "unlocked inode(%p)", ioc_inode); \
|
|
|
7f4c2a |
+ gf_msg_trace (ioc_inode->table->xl->name, 0, \
|
|
|
7f4c2a |
+ "unlocked inode(%p)", ioc_inode); \
|
|
|
7f4c2a |
pthread_mutex_unlock (&ioc_inode->inode_lock); \
|
|
|
7f4c2a |
} while (0)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
|
|
|
7f4c2a |
-#define ioc_table_lock(table) \
|
|
|
7f4c2a |
- do { \
|
|
|
7f4c2a |
- gf_log (table->xl->name, GF_LOG_TRACE, \
|
|
|
7f4c2a |
- "locked table(%p)", table); \
|
|
|
7f4c2a |
- pthread_mutex_lock (&table->table_lock); \
|
|
|
7f4c2a |
+#define ioc_table_lock(table) \
|
|
|
7f4c2a |
+ do { \
|
|
|
7f4c2a |
+ gf_msg_trace (table->xl->name, 0, \
|
|
|
7f4c2a |
+ "locked table(%p)", table); \
|
|
|
7f4c2a |
+ pthread_mutex_lock (&table->table_lock); \
|
|
|
7f4c2a |
} while (0)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
|
|
|
7f4c2a |
-#define ioc_table_unlock(table) \
|
|
|
7f4c2a |
- do { \
|
|
|
7f4c2a |
- gf_log (table->xl->name, GF_LOG_TRACE, \
|
|
|
7f4c2a |
- "unlocked table(%p)", table); \
|
|
|
7f4c2a |
- pthread_mutex_unlock (&table->table_lock); \
|
|
|
7f4c2a |
+#define ioc_table_unlock(table) \
|
|
|
7f4c2a |
+ do { \
|
|
|
7f4c2a |
+ gf_msg_trace (table->xl->name, 0, \
|
|
|
7f4c2a |
+ "unlocked table(%p)", table); \
|
|
|
7f4c2a |
+ pthread_mutex_unlock (&table->table_lock); \
|
|
|
7f4c2a |
} while (0)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
|
|
|
7f4c2a |
#define ioc_local_lock(local) \
|
|
|
7f4c2a |
do { \
|
|
|
7f4c2a |
- gf_log (local->inode->table->xl->name, GF_LOG_TRACE, \
|
|
|
7f4c2a |
- "locked local(%p)", local); \
|
|
|
7f4c2a |
+ gf_msg_trace (local->inode->table->xl->name, 0, \
|
|
|
7f4c2a |
+ "locked local(%p)", local); \
|
|
|
7f4c2a |
pthread_mutex_lock (&local->local_lock); \
|
|
|
7f4c2a |
} while (0)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
|
|
|
7f4c2a |
#define ioc_local_unlock(local) \
|
|
|
7f4c2a |
do { \
|
|
|
7f4c2a |
- gf_log (local->inode->table->xl->name, GF_LOG_TRACE, \
|
|
|
7f4c2a |
- "unlocked local(%p)", local); \
|
|
|
7f4c2a |
+ gf_msg_trace (local->inode->table->xl->name, 0, \
|
|
|
7f4c2a |
+ "unlocked local(%p)", local); \
|
|
|
7f4c2a |
pthread_mutex_unlock (&local->local_lock); \
|
|
|
7f4c2a |
} while (0)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
|
|
|
7f4c2a |
#define ioc_page_lock(page) \
|
|
|
7f4c2a |
do { \
|
|
|
7f4c2a |
- gf_log (page->inode->table->xl->name, GF_LOG_TRACE, \
|
|
|
7f4c2a |
- "locked page(%p)", page); \
|
|
|
7f4c2a |
+ gf_msg_trace (page->inode->table->xl->name, 0, \
|
|
|
7f4c2a |
+ "locked page(%p)", page); \
|
|
|
7f4c2a |
pthread_mutex_lock (&page->page_lock); \
|
|
|
7f4c2a |
} while (0)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
|
|
|
7f4c2a |
#define ioc_page_unlock(page) \
|
|
|
7f4c2a |
do { \
|
|
|
7f4c2a |
- gf_log (page->inode->table->xl->name, GF_LOG_TRACE, \
|
|
|
7f4c2a |
- "unlocked page(%p)", page); \
|
|
|
7f4c2a |
+ gf_msg_trace (page->inode->table->xl->name, 0, \
|
|
|
7f4c2a |
+ "unlocked page(%p)", page); \
|
|
|
7f4c2a |
pthread_mutex_unlock (&page->page_lock); \
|
|
|
7f4c2a |
} while (0)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
diff --git a/xlators/performance/io-cache/src/ioc-inode.c b/xlators/performance/io-cache/src/ioc-inode.c
|
|
|
7f4c2a |
index 86a54bb..fcaab96 100644
|
|
|
7f4c2a |
--- a/xlators/performance/io-cache/src/ioc-inode.c
|
|
|
7f4c2a |
+++ b/xlators/performance/io-cache/src/ioc-inode.c
|
|
|
7f4c2a |
@@ -82,7 +82,8 @@ ioc_inode_wakeup (call_frame_t *frame, ioc_inode_t *ioc_inode,
|
|
|
7f4c2a |
if (ioc_inode == NULL) {
|
|
|
7f4c2a |
local->op_ret = -1;
|
|
|
7f4c2a |
local->op_errno = EINVAL;
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_WARNING, "ioc_inode is NULL");
|
|
|
7f4c2a |
+ gf_msg (frame->this->name, GF_LOG_WARNING, 0,
|
|
|
7f4c2a |
+ IO_CACHE_MSG_INODE_NULL, "ioc_inode is NULL");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -130,12 +131,15 @@ ioc_inode_wakeup (call_frame_t *frame, ioc_inode_t *ioc_inode,
|
|
|
7f4c2a |
waiter_page->ready = 0;
|
|
|
7f4c2a |
need_fault = 1;
|
|
|
7f4c2a |
} else {
|
|
|
7f4c2a |
- gf_log (frame->this->name,
|
|
|
7f4c2a |
- GF_LOG_TRACE,
|
|
|
7f4c2a |
- "validate frame(%p) is "
|
|
|
7f4c2a |
- "waiting for in-transit"
|
|
|
7f4c2a |
- " page = %p", frame,
|
|
|
7f4c2a |
- waiter_page);
|
|
|
7f4c2a |
+ gf_msg_trace (frame->this->name,
|
|
|
7f4c2a |
+ 0,
|
|
|
7f4c2a |
+ "validate "
|
|
|
7f4c2a |
+ "frame(%p) is "
|
|
|
7f4c2a |
+ "waiting for "
|
|
|
7f4c2a |
+ "in-transit"
|
|
|
7f4c2a |
+ " page = %p",
|
|
|
7f4c2a |
+ frame,
|
|
|
7f4c2a |
+ waiter_page);
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
ioc_inode_unlock (ioc_inode);
|
|
|
7f4c2a |
@@ -198,8 +202,8 @@ ioc_inode_update (ioc_table_t *table, inode_t *inode, uint32_t weight)
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
ioc_table_unlock (table);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (table->xl->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "adding to inode_lru[%d]", weight);
|
|
|
7f4c2a |
+ gf_msg_trace (table->xl->name, 0,
|
|
|
7f4c2a |
+ "adding to inode_lru[%d]", weight);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
out:
|
|
|
7f4c2a |
return ioc_inode;
|
|
|
7f4c2a |
diff --git a/xlators/performance/io-cache/src/page.c b/xlators/performance/io-cache/src/page.c
|
|
|
7f4c2a |
index 416cd5f..4019ec0 100644
|
|
|
7f4c2a |
--- a/xlators/performance/io-cache/src/page.c
|
|
|
7f4c2a |
+++ b/xlators/performance/io-cache/src/page.c
|
|
|
7f4c2a |
@@ -21,7 +21,7 @@
|
|
|
7f4c2a |
#include "ioc-mem-types.h"
|
|
|
7f4c2a |
#include <assert.h>
|
|
|
7f4c2a |
#include <sys/time.h>
|
|
|
7f4c2a |
-
|
|
|
7f4c2a |
+#include "io-cache-messages.h"
|
|
|
7f4c2a |
char
|
|
|
7f4c2a |
ioc_empty (struct ioc_cache *cache)
|
|
|
7f4c2a |
{
|
|
|
7f4c2a |
@@ -108,10 +108,10 @@ __ioc_page_destroy (ioc_page_t *page)
|
|
|
7f4c2a |
sizeof (page->offset));
|
|
|
7f4c2a |
list_del (&page->page_lru);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (page->inode->table->xl->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "destroying page = %p, offset = %"PRId64" "
|
|
|
7f4c2a |
- "&& inode = %p",
|
|
|
7f4c2a |
- page, page->offset, page->inode);
|
|
|
7f4c2a |
+ gf_msg_trace (page->inode->table->xl->name, 0,
|
|
|
7f4c2a |
+ "destroying page = %p, offset = %"PRId64" "
|
|
|
7f4c2a |
+ "&& inode = %p",
|
|
|
7f4c2a |
+ page, page->offset, page->inode);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (page->vector){
|
|
|
7f4c2a |
iobref_unref (page->iobref);
|
|
|
7f4c2a |
@@ -174,10 +174,11 @@ __ioc_inode_prune (ioc_inode_t *curr, uint64_t *size_pruned,
|
|
|
7f4c2a |
if (ret != -1)
|
|
|
7f4c2a |
table->cache_used -= ret;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (table->xl->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "index = %d && table->cache_used = %"PRIu64" && table->"
|
|
|
7f4c2a |
- "cache_size = %"PRIu64, index, table->cache_used,
|
|
|
7f4c2a |
- table->cache_size);
|
|
|
7f4c2a |
+ gf_msg_trace (table->xl->name, 0,
|
|
|
7f4c2a |
+ "index = %d && "
|
|
|
7f4c2a |
+ "table->cache_used = %"PRIu64" && table->"
|
|
|
7f4c2a |
+ "cache_size = %"PRIu64, index, table->cache_used,
|
|
|
7f4c2a |
+ table->cache_size);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if ((*size_pruned) >= size_to_prune)
|
|
|
7f4c2a |
break;
|
|
|
7f4c2a |
@@ -284,8 +285,8 @@ __ioc_page_create (ioc_inode_t *ioc_inode, off_t offset)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
page = newpage;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log ("io-cache", GF_LOG_TRACE,
|
|
|
7f4c2a |
- "returning new page %p", page);
|
|
|
7f4c2a |
+ gf_msg_trace ("io-cache", 0,
|
|
|
7f4c2a |
+ "returning new page %p", page);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
out:
|
|
|
7f4c2a |
return page;
|
|
|
7f4c2a |
@@ -315,7 +316,8 @@ __ioc_wait_on_page (ioc_page_t *page, call_frame_t *frame, off_t offset,
|
|
|
7f4c2a |
if (page == NULL) {
|
|
|
7f4c2a |
local->op_ret = -1;
|
|
|
7f4c2a |
local->op_errno = ENOMEM;
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (frame->this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ 0, IO_CACHE_MSG_NO_MEMORY,
|
|
|
7f4c2a |
"asked to wait on a NULL page");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -327,10 +329,10 @@ __ioc_wait_on_page (ioc_page_t *page, call_frame_t *frame, off_t offset,
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "frame(%p) waiting on page = %p, offset=%"PRId64", "
|
|
|
7f4c2a |
- "size=%"GF_PRI_SIZET"",
|
|
|
7f4c2a |
- frame, page, offset, size);
|
|
|
7f4c2a |
+ gf_msg_trace (frame->this->name, 0,
|
|
|
7f4c2a |
+ "frame(%p) waiting on page = %p, offset=%"PRId64", "
|
|
|
7f4c2a |
+ "size=%"GF_PRI_SIZET"",
|
|
|
7f4c2a |
+ frame, page, offset, size);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
waitq->data = frame;
|
|
|
7f4c2a |
waitq->next = page->waitq;
|
|
|
7f4c2a |
@@ -444,9 +446,9 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
if (op_ret == -1 || !(zero_filled ||
|
|
|
7f4c2a |
ioc_cache_still_valid(ioc_inode,
|
|
|
7f4c2a |
stbuf))) {
|
|
|
7f4c2a |
- gf_log (ioc_inode->table->xl->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "cache for inode(%p) is invalid. flushing "
|
|
|
7f4c2a |
- "all pages", ioc_inode);
|
|
|
7f4c2a |
+ gf_msg_trace (ioc_inode->table->xl->name, 0,
|
|
|
7f4c2a |
+ "cache for inode(%p) is invalid. flushing "
|
|
|
7f4c2a |
+ "all pages", ioc_inode);
|
|
|
7f4c2a |
destroy_size = __ioc_inode_flush (ioc_inode);
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -464,8 +466,8 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
waitq = __ioc_page_error (page, op_ret,
|
|
|
7f4c2a |
op_errno);
|
|
|
7f4c2a |
} else {
|
|
|
7f4c2a |
- gf_log (ioc_inode->table->xl->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "op_ret = %d", op_ret);
|
|
|
7f4c2a |
+ gf_msg_trace (ioc_inode->table->xl->name, 0,
|
|
|
7f4c2a |
+ "op_ret = %d", op_ret);
|
|
|
7f4c2a |
page = __ioc_page_get (ioc_inode, offset);
|
|
|
7f4c2a |
if (!page) {
|
|
|
7f4c2a |
/* page was flushed */
|
|
|
7f4c2a |
@@ -500,8 +502,9 @@ ioc_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
} else {
|
|
|
7f4c2a |
/* TODO: we have got a response to
|
|
|
7f4c2a |
* our request and no data */
|
|
|
7f4c2a |
- gf_log (frame->this->name,
|
|
|
7f4c2a |
+ gf_msg (frame->this->name,
|
|
|
7f4c2a |
GF_LOG_CRITICAL,
|
|
|
7f4c2a |
+ ENOMEM, IO_CACHE_MSG_NO_MEMORY,
|
|
|
7f4c2a |
"frame>root>rsp_refs is null");
|
|
|
7f4c2a |
} /* if(frame->root->rsp_refs) */
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -553,8 +556,8 @@ unlock:
|
|
|
7f4c2a |
ioc_prune (ioc_inode->table);
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_TRACE, "fault frame %p returned",
|
|
|
7f4c2a |
- frame);
|
|
|
7f4c2a |
+ gf_msg_trace (frame->this->name, 0, "fault frame %p returned",
|
|
|
7f4c2a |
+ frame);
|
|
|
7f4c2a |
pthread_mutex_destroy (&local->local_lock);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
fd_unref (local->fd);
|
|
|
7f4c2a |
@@ -588,7 +591,8 @@ ioc_page_fault (ioc_inode_t *ioc_inode, call_frame_t *frame, fd_t *fd,
|
|
|
7f4c2a |
if (frame == NULL) {
|
|
|
7f4c2a |
op_ret = -1;
|
|
|
7f4c2a |
op_errno = EINVAL;
|
|
|
7f4c2a |
- gf_log ("io-cache", GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg ("io-cache", GF_LOG_WARNING,
|
|
|
7f4c2a |
+ EINVAL, IO_CACHE_MSG_ENFORCEMENT_FAILED,
|
|
|
7f4c2a |
"page fault on a NULL frame");
|
|
|
7f4c2a |
goto err;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -622,9 +626,9 @@ ioc_page_fault (ioc_inode_t *ioc_inode, call_frame_t *frame, fd_t *fd,
|
|
|
7f4c2a |
fault_local->pending_size = table->page_size;
|
|
|
7f4c2a |
fault_local->inode = ioc_inode;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "stack winding page fault for offset = %"PRId64" with "
|
|
|
7f4c2a |
- "frame %p", offset, fault_frame);
|
|
|
7f4c2a |
+ gf_msg_trace (frame->this->name, 0,
|
|
|
7f4c2a |
+ "stack winding page fault for offset = %"PRId64" with "
|
|
|
7f4c2a |
+ "frame %p", offset, fault_frame);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
STACK_WIND (fault_frame, ioc_fault_cbk, FIRST_CHILD(fault_frame->this),
|
|
|
7f4c2a |
FIRST_CHILD(fault_frame->this)->fops->readv, fd,
|
|
|
7f4c2a |
@@ -667,7 +671,8 @@ __ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
|
|
|
7f4c2a |
GF_VALIDATE_OR_GOTO (frame->this->name, local, out);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (page == NULL) {
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (frame->this->name, GF_LOG_WARNING, 0,
|
|
|
7f4c2a |
+ IO_CACHE_MSG_ENFORCEMENT_FAILED,
|
|
|
7f4c2a |
"NULL page has been provided to serve read request");
|
|
|
7f4c2a |
local->op_ret = -1;
|
|
|
7f4c2a |
local->op_errno = EINVAL;
|
|
|
7f4c2a |
@@ -676,10 +681,10 @@ __ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
ioc_inode = page->inode;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "frame (%p) offset = %"PRId64" && size = %"GF_PRI_SIZET" "
|
|
|
7f4c2a |
- "&& page->size = %"GF_PRI_SIZET" && wait_count = %d",
|
|
|
7f4c2a |
- frame, offset, size, page->size, local->wait_count);
|
|
|
7f4c2a |
+ gf_msg_trace (frame->this->name, 0,
|
|
|
7f4c2a |
+ "frame (%p) offset = %"PRId64" && size = %"GF_PRI_SIZET" "
|
|
|
7f4c2a |
+ "&& page->size = %"GF_PRI_SIZET" && wait_count = %d",
|
|
|
7f4c2a |
+ frame, offset, size, page->size, local->wait_count);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
/* immediately move this page to the end of the page_lru list */
|
|
|
7f4c2a |
list_move_tail (&page->page_lru, &ioc_inode->cache.page_lru);
|
|
|
7f4c2a |
@@ -713,10 +718,10 @@ __ioc_frame_fill (ioc_page_t *page, call_frame_t *frame, off_t offset,
|
|
|
7f4c2a |
copy_size = src_offset = 0;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (page->inode->table->xl->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "copy_size = %"GF_PRI_SIZET" && src_offset = "
|
|
|
7f4c2a |
- "%"PRId64" && dst_offset = %"PRId64"",
|
|
|
7f4c2a |
- copy_size, src_offset, dst_offset);
|
|
|
7f4c2a |
+ gf_msg_trace (page->inode->table->xl->name, 0,
|
|
|
7f4c2a |
+ "copy_size = %"GF_PRI_SIZET" && src_offset = "
|
|
|
7f4c2a |
+ "%"PRId64" && dst_offset = %"PRId64"",
|
|
|
7f4c2a |
+ copy_size, src_offset, dst_offset);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
{
|
|
|
7f4c2a |
new = GF_CALLOC (1, sizeof (*new),
|
|
|
7f4c2a |
@@ -814,8 +819,8 @@ ioc_frame_unwind (call_frame_t *frame)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
local = frame->local;
|
|
|
7f4c2a |
if (local == NULL) {
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
- "local is NULL");
|
|
|
7f4c2a |
+ gf_msg (frame->this->name, GF_LOG_WARNING, ENOMEM,
|
|
|
7f4c2a |
+ IO_CACHE_MSG_NO_MEMORY, "local is NULL");
|
|
|
7f4c2a |
op_ret = -1;
|
|
|
7f4c2a |
op_errno = ENOMEM;
|
|
|
7f4c2a |
goto unwind;
|
|
|
7f4c2a |
@@ -835,10 +840,10 @@ ioc_frame_unwind (call_frame_t *frame)
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (list_empty (&local->fill_list)) {
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "frame(%p) has 0 entries in local->fill_list "
|
|
|
7f4c2a |
- "(offset = %"PRId64" && size = %"GF_PRI_SIZET")",
|
|
|
7f4c2a |
- frame, local->offset, local->size);
|
|
|
7f4c2a |
+ gf_msg_trace (frame->this->name, 0,
|
|
|
7f4c2a |
+ "frame(%p) has 0 entries in local->fill_list "
|
|
|
7f4c2a |
+ "(offset = %"PRId64" && size = %"GF_PRI_SIZET")",
|
|
|
7f4c2a |
+ frame, local->offset, local->size);
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
list_for_each_entry (fill, &local->fill_list, list) {
|
|
|
7f4c2a |
@@ -876,8 +881,8 @@ ioc_frame_unwind (call_frame_t *frame)
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
unwind:
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "frame(%p) unwinding with op_ret=%d", frame, op_ret);
|
|
|
7f4c2a |
+ gf_msg_trace (frame->this->name, 0,
|
|
|
7f4c2a |
+ "frame(%p) unwinding with op_ret=%d", frame, op_ret);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
// ioc_local_unlock (local);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -951,8 +956,8 @@ __ioc_page_wakeup (ioc_page_t *page, int32_t op_errno)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
page->ready = 1;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (page->inode->table->xl->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "page is %p && waitq = %p", page, waitq);
|
|
|
7f4c2a |
+ gf_msg_trace (page->inode->table->xl->name, 0,
|
|
|
7f4c2a |
+ "page is %p && waitq = %p", page, waitq);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
for (trav = waitq; trav; trav = trav->next) {
|
|
|
7f4c2a |
frame = trav->data;
|
|
|
7f4c2a |
@@ -994,8 +999,8 @@ __ioc_page_error (ioc_page_t *page, int32_t op_ret, int32_t op_errno)
|
|
|
7f4c2a |
waitq = page->waitq;
|
|
|
7f4c2a |
page->waitq = NULL;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (page->inode->table->xl->name, GF_LOG_DEBUG,
|
|
|
7f4c2a |
- "page error for page = %p & waitq = %p", page, waitq);
|
|
|
7f4c2a |
+ gf_msg_debug (page->inode->table->xl->name, 0,
|
|
|
7f4c2a |
+ "page error for page = %p & waitq = %p", page, waitq);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
for (trav = waitq; trav; trav = trav->next) {
|
|
|
7f4c2a |
|
|
|
7f4c2a |
diff --git a/xlators/performance/io-threads/src/io-threads-messages.h b/xlators/performance/io-threads/src/io-threads-messages.h
|
|
|
7f4c2a |
new file mode 100644
|
|
|
7f4c2a |
index 0000000..ab1f672
|
|
|
7f4c2a |
--- /dev/null
|
|
|
7f4c2a |
+++ b/xlators/performance/io-threads/src/io-threads-messages.h
|
|
|
7f4c2a |
@@ -0,0 +1,103 @@
|
|
|
7f4c2a |
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
|
|
|
7f4c2a |
+ This file is part of GlusterFS.
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+ This file is licensed to you under your choice of the GNU Lesser
|
|
|
7f4c2a |
+ General Public License, version 3 or any later version (LGPLv3 or
|
|
|
7f4c2a |
+ later), or the GNU General Public License, version 2 (GPLv2), in all
|
|
|
7f4c2a |
+ cases as published by the Free Software Foundation.
|
|
|
7f4c2a |
+*/
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#ifndef _IO_THREADS_MESSAGES_H_
|
|
|
7f4c2a |
+#define _IO_THREADS_MESSAGES_H_
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#include "glfs-message-id.h"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*! \file io-threads-messages.h
|
|
|
7f4c2a |
+ * \brief IO_THREADS log-message IDs and their descriptions
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* NOTE: Rules for message additions
|
|
|
7f4c2a |
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
|
|
|
7f4c2a |
+ * if the message format is the same. Reasoning is that, if the message
|
|
|
7f4c2a |
+ * format needs to change in one instance, the other instances are not
|
|
|
7f4c2a |
+ * impacted or the new change does not change the ID of the instance being
|
|
|
7f4c2a |
+ * modified.
|
|
|
7f4c2a |
+ * 2) Addition of a message,
|
|
|
7f4c2a |
+ * - Should increment the GLFS_NUM_MESSAGES
|
|
|
7f4c2a |
+ * - Append to the list of messages defined, towards the end
|
|
|
7f4c2a |
+ * - Retain macro naming as glfs_msg_X (for redability across developers)
|
|
|
7f4c2a |
+ * NOTE: Rules for message format modifications
|
|
|
7f4c2a |
+ * 3) Check acorss the code if the message ID macro in question is reused
|
|
|
7f4c2a |
+ * anywhere. If reused then then the modifications should ensure correctness
|
|
|
7f4c2a |
+ * everywhere, or needs a new message ID as (1) above was not adhered to. If
|
|
|
7f4c2a |
+ * not used anywhere, proceed with the required modification.
|
|
|
7f4c2a |
+ * NOTE: Rules for message deletion
|
|
|
7f4c2a |
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
|
|
|
7f4c2a |
+ * anywhere, then can be deleted, but will leave a hole by design, as
|
|
|
7f4c2a |
+ * addition rules specify modification to the end of the list and not filling
|
|
|
7f4c2a |
+ * holes.
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_IO_THREADS_BASE GLFS_MSGID_COMP_IO_THREADS
|
|
|
7f4c2a |
+#define GLFS_IO_THREADS_NUM_MESSAGES 5
|
|
|
7f4c2a |
+#define GLFS_MSGID_END (GLFS_IO_THREADS_BASE + \
|
|
|
7f4c2a |
+ GLFS_IO_THREADS_NUM_MESSAGES + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* Messages with message IDs */
|
|
|
7f4c2a |
+#define glfs_msg_start_x GLFS_IO_THREADS_BASE, "Invalid: Start of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define IO_THREADS_MSG_INIT_FAILED (GLFS_IO_THREADS_BASE + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define IO_THREADS_MSG_XLATOR_CHILD_MISCONFIGURED (GLFS_IO_THREADS_BASE + 2)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define IO_THREADS_MSG_NO_MEMORY (GLFS_IO_THREADS_BASE + 3)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define IO_THREADS_MSG_VOL_MISCONFIGURED (GLFS_IO_THREADS_BASE + 4)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define IO_THREADS_MSG_SIZE_NOT_SET (GLFS_IO_THREADS_BASE + 5)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*------------*/
|
|
|
7f4c2a |
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#endif /* _IO_THREADS_MESSAGES_H_ */
|
|
|
7f4c2a |
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
|
|
|
7f4c2a |
index 148e55a..0234587 100644
|
|
|
7f4c2a |
--- a/xlators/performance/io-threads/src/io-threads.c
|
|
|
7f4c2a |
+++ b/xlators/performance/io-threads/src/io-threads.c
|
|
|
7f4c2a |
@@ -24,6 +24,7 @@
|
|
|
7f4c2a |
#include <sys/time.h>
|
|
|
7f4c2a |
#include <time.h>
|
|
|
7f4c2a |
#include "locking.h"
|
|
|
7f4c2a |
+#include "io-threads-messages.h"
|
|
|
7f4c2a |
|
|
|
7f4c2a |
void *iot_worker (void *arg);
|
|
|
7f4c2a |
int iot_workers_scale (iot_conf_t *conf);
|
|
|
7f4c2a |
@@ -192,9 +193,9 @@ iot_worker (void *data)
|
|
|
7f4c2a |
if (conf->curr_count > IOT_MIN_THREADS) {
|
|
|
7f4c2a |
conf->curr_count--;
|
|
|
7f4c2a |
bye = 1;
|
|
|
7f4c2a |
- gf_log (conf->this->name, GF_LOG_DEBUG,
|
|
|
7f4c2a |
- "timeout, terminated. conf->curr_count=%d",
|
|
|
7f4c2a |
- conf->curr_count);
|
|
|
7f4c2a |
+ gf_msg_debug (conf->this->name, 0,
|
|
|
7f4c2a |
+ "timeout, terminated. conf->curr_count=%d",
|
|
|
7f4c2a |
+ conf->curr_count);
|
|
|
7f4c2a |
} else {
|
|
|
7f4c2a |
timeout = 0;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -346,8 +347,8 @@ iot_schedule (call_frame_t *frame, xlator_t *this, call_stub_t *stub)
|
|
|
7f4c2a |
return -EINVAL;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
out:
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_DEBUG, "%s scheduled as %s fop",
|
|
|
7f4c2a |
- gf_fop_list[stub->fop], iot_get_pri_meaning (pri));
|
|
|
7f4c2a |
+ gf_msg_debug (this->name, 0, "%s scheduled as %s fop",
|
|
|
7f4c2a |
+ gf_fop_list[stub->fop], iot_get_pri_meaning (pri));
|
|
|
7f4c2a |
ret = do_iot_schedule (this->private, stub, pri);
|
|
|
7f4c2a |
return ret;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -768,9 +769,10 @@ __iot_workers_scale (iot_conf_t *conf)
|
|
|
7f4c2a |
ret = gf_thread_create (&thread, &conf->w_attr, iot_worker, conf);
|
|
|
7f4c2a |
if (ret == 0) {
|
|
|
7f4c2a |
conf->curr_count++;
|
|
|
7f4c2a |
- gf_log (conf->this->name, GF_LOG_DEBUG,
|
|
|
7f4c2a |
- "scaled threads to %d (queue_size=%d/%d)",
|
|
|
7f4c2a |
- conf->curr_count, conf->queue_size, scale);
|
|
|
7f4c2a |
+ gf_msg_debug (conf->this->name, 0,
|
|
|
7f4c2a |
+ "scaled threads to %d (queue_size=%d/%d)",
|
|
|
7f4c2a |
+ conf->curr_count,
|
|
|
7f4c2a |
+ conf->queue_size, scale);
|
|
|
7f4c2a |
} else {
|
|
|
7f4c2a |
break;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -815,11 +817,13 @@ set_stack_size (iot_conf_t *conf)
|
|
|
7f4c2a |
if (err == EINVAL) {
|
|
|
7f4c2a |
err = pthread_attr_getstacksize (&conf->w_attr, &stacksize);
|
|
|
7f4c2a |
if (!err)
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ 0, IO_THREADS_MSG_SIZE_NOT_SET,
|
|
|
7f4c2a |
"Using default thread stack size %zd",
|
|
|
7f4c2a |
stacksize);
|
|
|
7f4c2a |
else
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ 0, IO_THREADS_MSG_SIZE_NOT_SET,
|
|
|
7f4c2a |
"Using default thread stack size");
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -838,8 +842,9 @@ mem_acct_init (xlator_t *this)
|
|
|
7f4c2a |
ret = xlator_mem_acct_init (this, gf_iot_mt_end + 1);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (ret != 0) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
|
|
|
7f4c2a |
- "failed");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ ENOMEM, IO_THREADS_MSG_NO_MEMORY,
|
|
|
7f4c2a |
+ "Memory accounting init failed");
|
|
|
7f4c2a |
return ret;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -930,32 +935,37 @@ init (xlator_t *this)
|
|
|
7f4c2a |
int i = 0;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!this->children || this->children->next) {
|
|
|
7f4c2a |
- gf_log ("io-threads", GF_LOG_ERROR,
|
|
|
7f4c2a |
- "FATAL: iot not configured with exactly one child");
|
|
|
7f4c2a |
+ gf_msg ("io-threads", GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ IO_THREADS_MSG_XLATOR_CHILD_MISCONFIGURED,
|
|
|
7f4c2a |
+ "FATAL: iot not configured "
|
|
|
7f4c2a |
+ "with exactly one child");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!this->parents) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
- "dangling volume. check volfile ");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
7f4c2a |
+ IO_THREADS_MSG_VOL_MISCONFIGURED,
|
|
|
7f4c2a |
+ "dangling volume. check volfile ");
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
conf = (void *) GF_CALLOC (1, sizeof (*conf),
|
|
|
7f4c2a |
gf_iot_mt_iot_conf_t);
|
|
|
7f4c2a |
if (conf == NULL) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
- "out of memory");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
7f4c2a |
+ IO_THREADS_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if ((ret = pthread_cond_init(&conf->cond, NULL)) != 0) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ IO_THREADS_MSG_INIT_FAILED,
|
|
|
7f4c2a |
"pthread_cond_init failed (%d)", ret);
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if ((ret = pthread_mutex_init(&conf->mutex, NULL)) != 0) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ IO_THREADS_MSG_INIT_FAILED,
|
|
|
7f4c2a |
"pthread_mutex_init failed (%d)", ret);
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -983,7 +993,8 @@ init (xlator_t *this)
|
|
|
7f4c2a |
GF_OPTION_INIT("least-rate-limit", conf->throttle.rate_limit, int32,
|
|
|
7f4c2a |
out);
|
|
|
7f4c2a |
if ((ret = pthread_mutex_init(&conf->throttle.lock, NULL)) != 0) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ IO_THREADS_MSG_INIT_FAILED,
|
|
|
7f4c2a |
"pthread_mutex_init failed (%d)", ret);
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -997,7 +1008,8 @@ init (xlator_t *this)
|
|
|
7f4c2a |
ret = iot_workers_scale (conf);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (ret == -1) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ IO_THREADS_MSG_INIT_FAILED,
|
|
|
7f4c2a |
"cannot initialize worker threads, exiting init");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
diff --git a/xlators/performance/md-cache/src/md-cache-messages.h b/xlators/performance/md-cache/src/md-cache-messages.h
|
|
|
7f4c2a |
new file mode 100644
|
|
|
7f4c2a |
index 0000000..2fe8d45
|
|
|
7f4c2a |
--- /dev/null
|
|
|
7f4c2a |
+++ b/xlators/performance/md-cache/src/md-cache-messages.h
|
|
|
7f4c2a |
@@ -0,0 +1,66 @@
|
|
|
7f4c2a |
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
|
|
|
7f4c2a |
+ This file is part of GlusterFS.
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+ This file is licensed to you under your choice of the GNU Lesser
|
|
|
7f4c2a |
+ General Public License, version 3 or any later version (LGPLv3 or
|
|
|
7f4c2a |
+ later), or the GNU General Public License, version 2 (GPLv2), in all
|
|
|
7f4c2a |
+ cases as published by the Free Software Foundation.
|
|
|
7f4c2a |
+*/
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#ifndef _MD_CACHE_MESSAGES_H_
|
|
|
7f4c2a |
+#define _MD_CACHE_MESSAGES_H_
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#include "glfs-message-id.h"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*! \file md-cache-messages.h
|
|
|
7f4c2a |
+ * \brief MD_CACHE log-message IDs and their descriptions
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* NOTE: Rules for message additions
|
|
|
7f4c2a |
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
|
|
|
7f4c2a |
+ * if the message format is the same. Reasoning is that, if the message
|
|
|
7f4c2a |
+ * format needs to change in one instance, the other instances are not
|
|
|
7f4c2a |
+ * impacted or the new change does not change the ID of the instance being
|
|
|
7f4c2a |
+ * modified.
|
|
|
7f4c2a |
+ * 2) Addition of a message,
|
|
|
7f4c2a |
+ * - Should increment the GLFS_NUM_MESSAGES
|
|
|
7f4c2a |
+ * - Append to the list of messages defined, towards the end
|
|
|
7f4c2a |
+ * - Retain macro naming as glfs_msg_X (for redability across developers)
|
|
|
7f4c2a |
+ * NOTE: Rules for message format modifications
|
|
|
7f4c2a |
+ * 3) Check acorss the code if the message ID macro in question is reused
|
|
|
7f4c2a |
+ * anywhere. If reused then then the modifications should ensure correctness
|
|
|
7f4c2a |
+ * everywhere, or needs a new message ID as (1) above was not adhered to. If
|
|
|
7f4c2a |
+ * not used anywhere, proceed with the required modification.
|
|
|
7f4c2a |
+ * NOTE: Rules for message deletion
|
|
|
7f4c2a |
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
|
|
|
7f4c2a |
+ * anywhere, then can be deleted, but will leave a hole by design, as
|
|
|
7f4c2a |
+ * addition rules specify modification to the end of the list and not filling
|
|
|
7f4c2a |
+ * holes.
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_MD_CACHE_BASE GLFS_MSGID_COMP_MD_CACHE
|
|
|
7f4c2a |
+#define GLFS_MD_CACHE_NUM_MESSAGES 1
|
|
|
7f4c2a |
+#define GLFS_MSGID_END (GLFS_MD_CACHE_BASE + GLFS_MD_CACHE_NUM_MESSAGES + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* Messages with message IDs */
|
|
|
7f4c2a |
+#define glfs_msg_start_x GLFS_MD_CACHE_BASE, "Invalid: Start of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define MD_CACHE_MSG_NO_MEMORY (GLFS_MD_CACHE_BASE + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*------------*/
|
|
|
7f4c2a |
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#endif /* _MD_CACHE_MESSAGES_H_ */
|
|
|
7f4c2a |
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
|
|
|
7f4c2a |
index 51c0733..c3b4dfe 100644
|
|
|
7f4c2a |
--- a/xlators/performance/md-cache/src/md-cache.c
|
|
|
7f4c2a |
+++ b/xlators/performance/md-cache/src/md-cache.c
|
|
|
7f4c2a |
@@ -22,6 +22,7 @@
|
|
|
7f4c2a |
#include "glusterfs-acl.h"
|
|
|
7f4c2a |
#include <assert.h>
|
|
|
7f4c2a |
#include <sys/time.h>
|
|
|
7f4c2a |
+#include "md-cache-messages.h"
|
|
|
7f4c2a |
|
|
|
7f4c2a |
|
|
|
7f4c2a |
/* TODO:
|
|
|
7f4c2a |
@@ -292,8 +293,8 @@ mdc_inode_prep (xlator_t *this, inode_t *inode)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
mdc = GF_CALLOC (sizeof (*mdc), 1, gf_mdc_mt_md_cache_t);
|
|
|
7f4c2a |
if (!mdc) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
- "out of memory :(");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
7f4c2a |
+ MD_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
goto unlock;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -301,8 +302,8 @@ mdc_inode_prep (xlator_t *this, inode_t *inode)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
ret = __mdc_inode_ctx_set (this, inode, mdc);
|
|
|
7f4c2a |
if (ret) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
- "out of memory :(");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
7f4c2a |
+ MD_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
GF_FREE (mdc);
|
|
|
7f4c2a |
mdc = NULL;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -2247,8 +2248,8 @@ init (xlator_t *this)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
conf = GF_CALLOC (sizeof (*conf), 1, gf_mdc_mt_mdc_conf_t);
|
|
|
7f4c2a |
if (!conf) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
- "out of memory");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
7f4c2a |
+ MD_CACHE_MSG_NO_MEMORY, "out of memory");
|
|
|
7f4c2a |
return -1;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
diff --git a/xlators/performance/open-behind/src/open-behind-messages.h b/xlators/performance/open-behind/src/open-behind-messages.h
|
|
|
7f4c2a |
new file mode 100644
|
|
|
7f4c2a |
index 0000000..57e63ea
|
|
|
7f4c2a |
--- /dev/null
|
|
|
7f4c2a |
+++ b/xlators/performance/open-behind/src/open-behind-messages.h
|
|
|
7f4c2a |
@@ -0,0 +1,85 @@
|
|
|
7f4c2a |
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
|
|
|
7f4c2a |
+ This file is part of GlusterFS.
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+ This file is licensed to you under your choice of the GNU Lesser
|
|
|
7f4c2a |
+ General Public License, version 3 or any later version (LGPLv3 or
|
|
|
7f4c2a |
+ later), or the GNU General Public License, version 2 (GPLv2), in all
|
|
|
7f4c2a |
+ cases as published by the Free Software Foundation.
|
|
|
7f4c2a |
+*/
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#ifndef _OPEN_BEHIND_MESSAGES_H_
|
|
|
7f4c2a |
+#define _OPEN_BEHIND_MESSAGES_H_
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#include "glfs-message-id.h"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*! \file open-behind-messages.h
|
|
|
7f4c2a |
+ * \brief OPEN_BEHIND log-message IDs and their descriptions
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* NOTE: Rules for message additions
|
|
|
7f4c2a |
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
|
|
|
7f4c2a |
+ * if the message format is the same. Reasoning is that, if the message
|
|
|
7f4c2a |
+ * format needs to change in one instance, the other instances are not
|
|
|
7f4c2a |
+ * impacted or the new change does not change the ID of the instance being
|
|
|
7f4c2a |
+ * modified.
|
|
|
7f4c2a |
+ * 2) Addition of a message,
|
|
|
7f4c2a |
+ * - Should increment the GLFS_NUM_MESSAGES
|
|
|
7f4c2a |
+ * - Append to the list of messages defined, towards the end
|
|
|
7f4c2a |
+ * - Retain macro naming as glfs_msg_X (for redability across developers)
|
|
|
7f4c2a |
+ * NOTE: Rules for message format modifications
|
|
|
7f4c2a |
+ * 3) Check acorss the code if the message ID macro in question is reused
|
|
|
7f4c2a |
+ * anywhere. If reused then then the modifications should ensure correctness
|
|
|
7f4c2a |
+ * everywhere, or needs a new message ID as (1) above was not adhered to. If
|
|
|
7f4c2a |
+ * not used anywhere, proceed with the required modification.
|
|
|
7f4c2a |
+ * NOTE: Rules for message deletion
|
|
|
7f4c2a |
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
|
|
|
7f4c2a |
+ * anywhere, then can be deleted, but will leave a hole by design, as
|
|
|
7f4c2a |
+ * addition rules specify modification to the end of the list and not filling
|
|
|
7f4c2a |
+ * holes.
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_OPEN_BEHIND_BASE GLFS_MSGID_COMP_OPEN_BEHIND
|
|
|
7f4c2a |
+#define GLFS_OPEN_BEHIND_NUM_MESSAGES 3
|
|
|
7f4c2a |
+#define GLFS_MSGID_END (GLFS_OPEN_BEHIND_BASE + \
|
|
|
7f4c2a |
+ GLFS_OPEN_BEHIND_NUM_MESSAGES + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* Messages with message IDs */
|
|
|
7f4c2a |
+#define glfs_msg_start_x GLFS_OPEN_BEHIND_BASE, "Invalid: Start of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define OPEN_BEHIND_MSG_XLATOR_CHILD_MISCONFIGURED (GLFS_OPEN_BEHIND_BASE + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define OPEN_BEHIND_MSG_VOL_MISCONFIGURED (GLFS_OPEN_BEHIND_BASE + 2)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define OPEN_BEHIND_MSG_NO_MEMORY (GLFS_OPEN_BEHIND_BASE + 3)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*------------*/
|
|
|
7f4c2a |
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#endif /* _OPEN_BEHIND_MESSAGES_H_ */
|
|
|
7f4c2a |
diff --git a/xlators/performance/open-behind/src/open-behind.c b/xlators/performance/open-behind/src/open-behind.c
|
|
|
7f4c2a |
index 742e4df..97c12fa 100644
|
|
|
7f4c2a |
--- a/xlators/performance/open-behind/src/open-behind.c
|
|
|
7f4c2a |
+++ b/xlators/performance/open-behind/src/open-behind.c
|
|
|
7f4c2a |
@@ -13,6 +13,7 @@
|
|
|
7f4c2a |
#include "statedump.h"
|
|
|
7f4c2a |
#include "call-stub.h"
|
|
|
7f4c2a |
#include "defaults.h"
|
|
|
7f4c2a |
+#include "open-behind-messages.h"
|
|
|
7f4c2a |
|
|
|
7f4c2a |
typedef struct ob_conf {
|
|
|
7f4c2a |
gf_boolean_t use_anonymous_fd; /* use anonymous FDs wherever safe
|
|
|
7f4c2a |
@@ -340,8 +341,8 @@ ob_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
return 0;
|
|
|
7f4c2a |
err:
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "%s: %s", loc->path,
|
|
|
7f4c2a |
- strerror (op_errno));
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, op_errno, OPEN_BEHIND_MSG_NO_MEMORY,
|
|
|
7f4c2a |
+ "%s", loc->path);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
STACK_UNWIND_STRICT (open, frame, -1, op_errno, 0, 0);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -887,7 +888,9 @@ mem_acct_init (xlator_t *this)
|
|
|
7f4c2a |
ret = xlator_mem_acct_init (this, gf_ob_mt_end + 1);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (ret)
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "Memory accounting failed");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
7f4c2a |
+ OPEN_BEHIND_MSG_NO_MEMORY,
|
|
|
7f4c2a |
+ "Memory accounting failed");
|
|
|
7f4c2a |
|
|
|
7f4c2a |
return ret;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -920,14 +923,16 @@ init (xlator_t *this)
|
|
|
7f4c2a |
ob_conf_t *conf = NULL;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!this->children || this->children->next) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ OPEN_BEHIND_MSG_XLATOR_CHILD_MISCONFIGURED,
|
|
|
7f4c2a |
"FATAL: volume (%s) not configured with exactly one "
|
|
|
7f4c2a |
"child", this->name);
|
|
|
7f4c2a |
return -1;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!this->parents)
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
7f4c2a |
+ OPEN_BEHIND_MSG_VOL_MISCONFIGURED,
|
|
|
7f4c2a |
"dangling volume. check volfile ");
|
|
|
7f4c2a |
|
|
|
7f4c2a |
conf = GF_CALLOC (1, sizeof (*conf), gf_ob_mt_conf_t);
|
|
|
7f4c2a |
diff --git a/xlators/performance/quick-read/src/quick-read-messages.h b/xlators/performance/quick-read/src/quick-read-messages.h
|
|
|
7f4c2a |
new file mode 100644
|
|
|
7f4c2a |
index 0000000..d7444dd
|
|
|
7f4c2a |
--- /dev/null
|
|
|
7f4c2a |
+++ b/xlators/performance/quick-read/src/quick-read-messages.h
|
|
|
7f4c2a |
@@ -0,0 +1,119 @@
|
|
|
7f4c2a |
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
|
|
|
7f4c2a |
+ This file is part of GlusterFS.
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+ This file is licensed to you under your choice of the GNU Lesser
|
|
|
7f4c2a |
+ General Public License, version 3 or any later version (LGPLv3 or
|
|
|
7f4c2a |
+ later), or the GNU General Public License, version 2 (GPLv2), in all
|
|
|
7f4c2a |
+ cases as published by the Free Software Foundation.
|
|
|
7f4c2a |
+*/
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#ifndef _QUICK_READ_MESSAGES_H_
|
|
|
7f4c2a |
+#define _QUICK_READ_MESSAGES_H_
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#include "glfs-message-id.h"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*! \file quick-read-messages.h
|
|
|
7f4c2a |
+ * \brief QUICK_READ log-message IDs and their descriptions
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* NOTE: Rules for message additions
|
|
|
7f4c2a |
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
|
|
|
7f4c2a |
+ * if the message format is the same. Reasoning is that, if the message
|
|
|
7f4c2a |
+ * format needs to change in one instance, the other instances are not
|
|
|
7f4c2a |
+ * impacted or the new change does not change the ID of the instance being
|
|
|
7f4c2a |
+ * modified.
|
|
|
7f4c2a |
+ * 2) Addition of a message,
|
|
|
7f4c2a |
+ * - Should increment the GLFS_NUM_MESSAGES
|
|
|
7f4c2a |
+ * - Append to the list of messages defined, towards the end
|
|
|
7f4c2a |
+ * - Retain macro naming as glfs_msg_X (for redability across developers)
|
|
|
7f4c2a |
+ * NOTE: Rules for message format modifications
|
|
|
7f4c2a |
+ * 3) Check acorss the code if the message ID macro in question is reused
|
|
|
7f4c2a |
+ * anywhere. If reused then then the modifications should ensure correctness
|
|
|
7f4c2a |
+ * everywhere, or needs a new message ID as (1) above was not adhered to. If
|
|
|
7f4c2a |
+ * not used anywhere, proceed with the required modification.
|
|
|
7f4c2a |
+ * NOTE: Rules for message deletion
|
|
|
7f4c2a |
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
|
|
|
7f4c2a |
+ * anywhere, then can be deleted, but will leave a hole by design, as
|
|
|
7f4c2a |
+ * addition rules specify modification to the end of the list and not filling
|
|
|
7f4c2a |
+ * holes.
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_QUICK_READ_BASE GLFS_MSGID_COMP_QUICK_READ
|
|
|
7f4c2a |
+#define GLFS_QUICK_READ_NUM_MESSAGES 7
|
|
|
7f4c2a |
+#define GLFS_MSGID_END (GLFS_QUICK_READ_BASE +\
|
|
|
7f4c2a |
+ GLFS_QUICK_READ_NUM_MESSAGES + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* Messages with message IDs */
|
|
|
7f4c2a |
+#define glfs_msg_start_x GLFS_QUICK_READ_BASE, "Invalid: Start of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define QUICK_READ_MSG_ENFORCEMENT_FAILED (GLFS_QUICK_READ_BASE + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define QUICK_READ_MSG_INVALID_ARGUMENT (GLFS_QUICK_READ_BASE + 2)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define QUICK_READ_MSG_XLATOR_CHILD_MISCONFIGURED\
|
|
|
7f4c2a |
+ (GLFS_QUICK_READ_BASE + 3)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define QUICK_READ_MSG_NO_MEMORY (GLFS_QUICK_READ_BASE + 4)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define QUICK_READ_MSG_VOL_MISCONFIGURED (GLFS_QUICK_READ_BASE + 5)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define QUICK_READ_MSG_DICT_SET_FAILED (GLFS_QUICK_READ_BASE + 6)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define QUICK_READ_MSG_INVALID_CONFIG (GLFS_QUICK_READ_BASE + 7)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*------------*/
|
|
|
7f4c2a |
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#endif /* _QUICK_READ_MESSAGES_H_ */
|
|
|
7f4c2a |
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
|
|
|
7f4c2a |
index 53f9a5d..c6913ee 100644
|
|
|
7f4c2a |
--- a/xlators/performance/quick-read/src/quick-read.c
|
|
|
7f4c2a |
+++ b/xlators/performance/quick-read/src/quick-read.c
|
|
|
7f4c2a |
@@ -10,6 +10,7 @@
|
|
|
7f4c2a |
|
|
|
7f4c2a |
#include "quick-read.h"
|
|
|
7f4c2a |
#include "statedump.h"
|
|
|
7f4c2a |
+#include "quick-read-messages.h"
|
|
|
7f4c2a |
|
|
|
7f4c2a |
qr_inode_t *qr_inode_ctx_get (xlator_t *this, inode_t *inode);
|
|
|
7f4c2a |
void __qr_inode_prune (qr_inode_table_t *table, qr_inode_t *qr_inode);
|
|
|
7f4c2a |
@@ -471,8 +472,9 @@ qr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
|
|
|
7f4c2a |
ret = dict_set (xdata, GF_CONTENT_KEY,
|
|
|
7f4c2a |
data_from_uint64 (conf->max_file_size));
|
|
|
7f4c2a |
if (ret)
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
- "cannot set key in request dict (%s)",
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
7f4c2a |
+ QUICK_READ_MSG_DICT_SET_FAILED,
|
|
|
7f4c2a |
+ "cannot set key in request dict (%s)",
|
|
|
7f4c2a |
loc->path);
|
|
|
7f4c2a |
wind:
|
|
|
7f4c2a |
frame->local = inode_ref (loc->inode);
|
|
|
7f4c2a |
@@ -784,8 +786,9 @@ mem_acct_init (xlator_t *this)
|
|
|
7f4c2a |
ret = xlator_mem_acct_init (this, gf_qr_mt_end + 1);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (ret != 0) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
|
|
|
7f4c2a |
- "failed");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
7f4c2a |
+ QUICK_READ_MSG_NO_MEMORY,
|
|
|
7f4c2a |
+ "Memory accounting init failed");
|
|
|
7f4c2a |
return ret;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -805,7 +808,8 @@ check_cache_size_ok (xlator_t *this, int64_t cache_size)
|
|
|
7f4c2a |
opt = xlator_volume_option_get (this, "cache-size");
|
|
|
7f4c2a |
if (!opt) {
|
|
|
7f4c2a |
ret = _gf_false;
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
|
|
|
7f4c2a |
+ QUICK_READ_MSG_INVALID_ARGUMENT,
|
|
|
7f4c2a |
"could not get cache-size option");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -816,11 +820,12 @@ check_cache_size_ok (xlator_t *this, int64_t cache_size)
|
|
|
7f4c2a |
else
|
|
|
7f4c2a |
max_cache_size = total_mem;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_DEBUG, "Max cache size is %"PRIu64,
|
|
|
7f4c2a |
- max_cache_size);
|
|
|
7f4c2a |
+ gf_msg_debug (this->name, 0, "Max cache size is %"PRIu64,
|
|
|
7f4c2a |
+ max_cache_size);
|
|
|
7f4c2a |
if (cache_size > max_cache_size) {
|
|
|
7f4c2a |
ret = _gf_false;
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "Cache size %"PRIu64
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ QUICK_READ_MSG_INVALID_ARGUMENT, "Cache size %"PRIu64
|
|
|
7f4c2a |
" is greater than the max size of %"PRIu64,
|
|
|
7f4c2a |
cache_size, max_cache_size);
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
@@ -854,7 +859,8 @@ reconfigure (xlator_t *this, dict_t *options)
|
|
|
7f4c2a |
GF_OPTION_RECONF ("cache-size", cache_size_new, options, size_uint64, out);
|
|
|
7f4c2a |
if (!check_cache_size_ok (this, cache_size_new)) {
|
|
|
7f4c2a |
ret = -1;
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
|
|
|
7f4c2a |
+ QUICK_READ_MSG_INVALID_CONFIG,
|
|
|
7f4c2a |
"Not reconfiguring cache-size");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -923,10 +929,9 @@ qr_get_priority_list (const char *opt_str, struct list_head *first)
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log ("quick-read", GF_LOG_TRACE,
|
|
|
7f4c2a |
- "quick-read priority : pattern %s : priority %s",
|
|
|
7f4c2a |
- pattern,
|
|
|
7f4c2a |
- priority);
|
|
|
7f4c2a |
+ gf_msg_trace ("quick-read", 0,
|
|
|
7f4c2a |
+ "quick-read priority : pattern %s : priority %s",
|
|
|
7f4c2a |
+ pattern, priority);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
curr->pattern = gf_strdup (pattern);
|
|
|
7f4c2a |
if (curr->pattern == NULL) {
|
|
|
7f4c2a |
@@ -972,14 +977,16 @@ init (xlator_t *this)
|
|
|
7f4c2a |
qr_conf_t *conf = NULL;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!this->children || this->children->next) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ QUICK_READ_MSG_XLATOR_CHILD_MISCONFIGURED,
|
|
|
7f4c2a |
"FATAL: volume (%s) not configured with exactly one "
|
|
|
7f4c2a |
"child", this->name);
|
|
|
7f4c2a |
return -1;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!this->parents) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
7f4c2a |
+ QUICK_READ_MSG_VOL_MISCONFIGURED,
|
|
|
7f4c2a |
"dangling volume. check volfile ");
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -1007,8 +1014,8 @@ init (xlator_t *this)
|
|
|
7f4c2a |
if (dict_get (this->options, "priority")) {
|
|
|
7f4c2a |
char *option_list = data_to_str (dict_get (this->options,
|
|
|
7f4c2a |
"priority"));
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "option path %s", option_list);
|
|
|
7f4c2a |
+ gf_msg_trace (this->name, 0,
|
|
|
7f4c2a |
+ "option path %s", option_list);
|
|
|
7f4c2a |
/* parse the list of pattern:priority */
|
|
|
7f4c2a |
conf->max_pri = qr_get_priority_list (option_list,
|
|
|
7f4c2a |
&conf->priority_list);
|
|
|
7f4c2a |
diff --git a/xlators/performance/read-ahead/src/page.c b/xlators/performance/read-ahead/src/page.c
|
|
|
7f4c2a |
index 6e5b52c..f96a23c 100644
|
|
|
7f4c2a |
--- a/xlators/performance/read-ahead/src/page.c
|
|
|
7f4c2a |
+++ b/xlators/performance/read-ahead/src/page.c
|
|
|
7f4c2a |
@@ -19,6 +19,7 @@
|
|
|
7f4c2a |
#include "xlator.h"
|
|
|
7f4c2a |
#include "read-ahead.h"
|
|
|
7f4c2a |
#include <assert.h>
|
|
|
7f4c2a |
+#include "read-ahead-messages.h"
|
|
|
7f4c2a |
|
|
|
7f4c2a |
ra_page_t *
|
|
|
7f4c2a |
ra_page_get (ra_file_t *file, off_t offset)
|
|
|
7f4c2a |
@@ -155,7 +156,8 @@ ra_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
pending_offset = local->pending_offset;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (file == NULL) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING, EBADF,
|
|
|
7f4c2a |
+ READ_AHEAD_MSG_FD_CONTEXT_NOT_SET,
|
|
|
7f4c2a |
"read-ahead context not set in fd (%p)", fd);
|
|
|
7f4c2a |
op_ret = -1;
|
|
|
7f4c2a |
op_errno = EBADF;
|
|
|
7f4c2a |
@@ -170,9 +172,10 @@ ra_fault_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
page = ra_page_get (file, pending_offset);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!page) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "wasted copy: %"PRId64"[+%"PRId64"] file=%p",
|
|
|
7f4c2a |
- pending_offset, file->page_size, file);
|
|
|
7f4c2a |
+ gf_msg_trace (this->name, 0,
|
|
|
7f4c2a |
+ "wasted copy: "
|
|
|
7f4c2a |
+ "%"PRId64"[+%"PRId64"] file=%p",
|
|
|
7f4c2a |
+ pending_offset, file->page_size, file);
|
|
|
7f4c2a |
goto unlock;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
diff --git a/xlators/performance/read-ahead/src/read-ahead-messages.h b/xlators/performance/read-ahead/src/read-ahead-messages.h
|
|
|
7f4c2a |
new file mode 100644
|
|
|
7f4c2a |
index 0000000..a205cee
|
|
|
7f4c2a |
--- /dev/null
|
|
|
7f4c2a |
+++ b/xlators/performance/read-ahead/src/read-ahead-messages.h
|
|
|
7f4c2a |
@@ -0,0 +1,94 @@
|
|
|
7f4c2a |
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
|
|
|
7f4c2a |
+ This file is part of GlusterFS.
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+ This file is licensed to you under your choice of the GNU Lesser
|
|
|
7f4c2a |
+ General Public License, version 3 or any later version (LGPLv3 or
|
|
|
7f4c2a |
+ later), or the GNU General Public License, version 2 (GPLv2), in all
|
|
|
7f4c2a |
+ cases as published by the Free Software Foundation.
|
|
|
7f4c2a |
+*/
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#ifndef _READ_AHEAD_MESSAGES_H_
|
|
|
7f4c2a |
+#define _READ_AHEAD_MESSAGES_H_
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#include "glfs-message-id.h"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*! \file read-ahead-messages.h
|
|
|
7f4c2a |
+ * \brief READ_AHEAD log-message IDs and their descriptions
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* NOTE: Rules for message additions
|
|
|
7f4c2a |
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
|
|
|
7f4c2a |
+ * if the message format is the same. Reasoning is that, if the message
|
|
|
7f4c2a |
+ * format needs to change in one instance, the other instances are not
|
|
|
7f4c2a |
+ * impacted or the new change does not change the ID of the instance being
|
|
|
7f4c2a |
+ * modified.
|
|
|
7f4c2a |
+ * 2) Addition of a message,
|
|
|
7f4c2a |
+ * - Should increment the GLFS_NUM_MESSAGES
|
|
|
7f4c2a |
+ * - Append to the list of messages defined, towards the end
|
|
|
7f4c2a |
+ * - Retain macro naming as glfs_msg_X (for redability across developers)
|
|
|
7f4c2a |
+ * NOTE: Rules for message format modifications
|
|
|
7f4c2a |
+ * 3) Check acorss the code if the message ID macro in question is reused
|
|
|
7f4c2a |
+ * anywhere. If reused then then the modifications should ensure correctness
|
|
|
7f4c2a |
+ * everywhere, or needs a new message ID as (1) above was not adhered to. If
|
|
|
7f4c2a |
+ * not used anywhere, proceed with the required modification.
|
|
|
7f4c2a |
+ * NOTE: Rules for message deletion
|
|
|
7f4c2a |
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
|
|
|
7f4c2a |
+ * anywhere, then can be deleted, but will leave a hole by design, as
|
|
|
7f4c2a |
+ * addition rules specify modification to the end of the list and not filling
|
|
|
7f4c2a |
+ * holes.
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_READ_AHEAD_BASE GLFS_MSGID_COMP_READ_AHEAD
|
|
|
7f4c2a |
+#define GLFS_READ_AHEAD_NUM_MESSAGES 4
|
|
|
7f4c2a |
+#define GLFS_MSGID_END (GLFS_READ_AHEAD_BASE +\
|
|
|
7f4c2a |
+ GLFS_READ_AHEAD_NUM_MESSAGES + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* Messages with message IDs */
|
|
|
7f4c2a |
+#define glfs_msg_start_x GLFS_READ_AHEAD_BASE, "Invalid: Start of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define READ_AHEAD_MSG_XLATOR_CHILD_MISCONFIGURED (GLFS_READ_AHEAD_BASE + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define READ_AHEAD_MSG_VOL_MISCONFIGURED (GLFS_READ_AHEAD_BASE + 2)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define READ_AHEAD_MSG_NO_MEMORY (GLFS_READ_AHEAD_BASE + 3)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define READ_AHEAD_MSG_FD_CONTEXT_NOT_SET (GLFS_READ_AHEAD_BASE + 4)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*------------*/
|
|
|
7f4c2a |
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#endif /* _READ_AHEAD_MESSAGES_H_ */
|
|
|
7f4c2a |
diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c
|
|
|
7f4c2a |
index 7ea9f40..f33263c 100644
|
|
|
7f4c2a |
--- a/xlators/performance/read-ahead/src/read-ahead.c
|
|
|
7f4c2a |
+++ b/xlators/performance/read-ahead/src/read-ahead.c
|
|
|
7f4c2a |
@@ -28,6 +28,7 @@
|
|
|
7f4c2a |
#include "statedump.h"
|
|
|
7f4c2a |
#include <assert.h>
|
|
|
7f4c2a |
#include <sys/time.h>
|
|
|
7f4c2a |
+#include "read-ahead-messages.h"
|
|
|
7f4c2a |
|
|
|
7f4c2a |
static void
|
|
|
7f4c2a |
read_ahead (call_frame_t *frame, ra_file_t *file);
|
|
|
7f4c2a |
@@ -89,8 +90,10 @@ ra_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
ret = fd_ctx_set (fd, this, (uint64_t)(long)file);
|
|
|
7f4c2a |
if (ret == -1) {
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
- "cannot set read-ahead context information in fd (%p)",
|
|
|
7f4c2a |
+ gf_msg (frame->this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ 0, READ_AHEAD_MSG_NO_MEMORY,
|
|
|
7f4c2a |
+ "cannot set read-ahead context"
|
|
|
7f4c2a |
+ "information in fd (%p)",
|
|
|
7f4c2a |
fd);
|
|
|
7f4c2a |
ra_file_destroy (file);
|
|
|
7f4c2a |
op_ret = -1;
|
|
|
7f4c2a |
@@ -161,8 +164,10 @@ ra_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
ret = fd_ctx_set (fd, this, (uint64_t)(long)file);
|
|
|
7f4c2a |
if (ret == -1) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
- "cannot set read ahead context information in fd (%p)",
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ 0, READ_AHEAD_MSG_NO_MEMORY,
|
|
|
7f4c2a |
+ "cannot set read ahead context"
|
|
|
7f4c2a |
+ "information in fd (%p)",
|
|
|
7f4c2a |
fd);
|
|
|
7f4c2a |
ra_file_destroy (file);
|
|
|
7f4c2a |
op_ret = -1;
|
|
|
7f4c2a |
@@ -329,8 +334,8 @@ read_ahead (call_frame_t *frame, ra_file_t *file)
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (fault) {
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "RA at offset=%"PRId64, trav_offset);
|
|
|
7f4c2a |
+ gf_msg_trace (frame->this->name, 0,
|
|
|
7f4c2a |
+ "RA at offset=%"PRId64, trav_offset);
|
|
|
7f4c2a |
ra_page_fault (file, frame, trav_offset);
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
trav_offset += file->page_size;
|
|
|
7f4c2a |
@@ -396,14 +401,15 @@ dispatch_requests (call_frame_t *frame, ra_file_t *file)
|
|
|
7f4c2a |
trav->dirty = 0;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (trav->ready) {
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "HIT at offset=%"PRId64".",
|
|
|
7f4c2a |
- trav_offset);
|
|
|
7f4c2a |
+ gf_msg_trace (frame->this->name, 0,
|
|
|
7f4c2a |
+ "HIT at offset=%"PRId64".",
|
|
|
7f4c2a |
+ trav_offset);
|
|
|
7f4c2a |
ra_frame_fill (trav, frame);
|
|
|
7f4c2a |
} else {
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "IN-TRANSIT at offset=%"PRId64".",
|
|
|
7f4c2a |
- trav_offset);
|
|
|
7f4c2a |
+ gf_msg_trace (frame->this->name, 0,
|
|
|
7f4c2a |
+ "IN-TRANSIT at "
|
|
|
7f4c2a |
+ "offset=%"PRId64".",
|
|
|
7f4c2a |
+ trav_offset);
|
|
|
7f4c2a |
ra_wait_on_page (trav, frame);
|
|
|
7f4c2a |
need_atime_update = 0;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -416,9 +422,9 @@ dispatch_requests (call_frame_t *frame, ra_file_t *file)
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (fault) {
|
|
|
7f4c2a |
- gf_log (frame->this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "MISS at offset=%"PRId64".",
|
|
|
7f4c2a |
- trav_offset);
|
|
|
7f4c2a |
+ gf_msg_trace (frame->this->name, 0,
|
|
|
7f4c2a |
+ "MISS at offset=%"PRId64".",
|
|
|
7f4c2a |
+ trav_offset);
|
|
|
7f4c2a |
ra_page_fault (file, frame, trav_offset);
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -476,9 +482,9 @@ ra_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
conf = this->private;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "NEW REQ at offset=%"PRId64" for size=%"GF_PRI_SIZET"",
|
|
|
7f4c2a |
- offset, size);
|
|
|
7f4c2a |
+ gf_msg_trace (this->name, 0,
|
|
|
7f4c2a |
+ "NEW REQ at offset=%"PRId64" for size=%"GF_PRI_SIZET"",
|
|
|
7f4c2a |
+ offset, size);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
fd_ctx_get (fd, this, &tmp_file);
|
|
|
7f4c2a |
file = (ra_file_t *)(long)tmp_file;
|
|
|
7f4c2a |
@@ -488,15 +494,16 @@ ra_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (file->offset != offset) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "unexpected offset (%"PRId64" != %"PRId64") resetting",
|
|
|
7f4c2a |
- file->offset, offset);
|
|
|
7f4c2a |
+ gf_msg_trace (this->name, 0,
|
|
|
7f4c2a |
+ "unexpected offset (%"PRId64" != %"PRId64") "
|
|
|
7f4c2a |
+ "resetting",
|
|
|
7f4c2a |
+ file->offset, offset);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
expected_offset = file->expected = file->page_count = 0;
|
|
|
7f4c2a |
} else {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_TRACE,
|
|
|
7f4c2a |
- "expected offset (%"PRId64") when page_count=%d",
|
|
|
7f4c2a |
- offset, file->page_count);
|
|
|
7f4c2a |
+ gf_msg_trace (this->name, 0,
|
|
|
7f4c2a |
+ "expected offset (%"PRId64") when page_count=%d",
|
|
|
7f4c2a |
+ offset, file->page_count);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (file->expected < (file->page_size * conf->page_count)) {
|
|
|
7f4c2a |
file->expected += size;
|
|
|
7f4c2a |
@@ -1103,7 +1110,8 @@ mem_acct_init (xlator_t *this)
|
|
|
7f4c2a |
ret = xlator_mem_acct_init (this, gf_ra_mt_end + 1);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (ret != 0) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
7f4c2a |
+ READ_AHEAD_MSG_NO_MEMORY, "Memory accounting init"
|
|
|
7f4c2a |
"failed");
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -1141,14 +1149,16 @@ init (xlator_t *this)
|
|
|
7f4c2a |
GF_VALIDATE_OR_GOTO ("read-ahead", this, out);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!this->children || this->children->next) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ READ_AHEAD_MSG_XLATOR_CHILD_MISCONFIGURED,
|
|
|
7f4c2a |
"FATAL: read-ahead not configured with exactly one"
|
|
|
7f4c2a |
" child");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!this->parents) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
7f4c2a |
+ READ_AHEAD_MSG_VOL_MISCONFIGURED,
|
|
|
7f4c2a |
"dangling volume. check volfile ");
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -1173,7 +1183,8 @@ init (xlator_t *this)
|
|
|
7f4c2a |
this->local_pool = mem_pool_new (ra_local_t, 64);
|
|
|
7f4c2a |
if (!this->local_pool) {
|
|
|
7f4c2a |
ret = -1;
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ ENOMEM, READ_AHEAD_MSG_NO_MEMORY,
|
|
|
7f4c2a |
"failed to create local_t's memory pool");
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead-messages.h b/xlators/performance/readdir-ahead/src/readdir-ahead-messages.h
|
|
|
7f4c2a |
new file mode 100644
|
|
|
7f4c2a |
index 0000000..0e19348
|
|
|
7f4c2a |
--- /dev/null
|
|
|
7f4c2a |
+++ b/xlators/performance/readdir-ahead/src/readdir-ahead-messages.h
|
|
|
7f4c2a |
@@ -0,0 +1,105 @@
|
|
|
7f4c2a |
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
|
|
|
7f4c2a |
+ This file is part of GlusterFS.
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+ This file is licensed to you under your choice of the GNU Lesser
|
|
|
7f4c2a |
+ General Public License, version 3 or any later version (LGPLv3 or
|
|
|
7f4c2a |
+ later), or the GNU General Public License, version 2 (GPLv2), in all
|
|
|
7f4c2a |
+ cases as published by the Free Software Foundation.
|
|
|
7f4c2a |
+*/
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#ifndef _READDIR_AHEAD_MESSAGES_H_
|
|
|
7f4c2a |
+#define _READDIR_AHEAD_MESSAGES_H_
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#include "glfs-message-id.h"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*! \file readdir-ahead-messages.h
|
|
|
7f4c2a |
+ * \brief READDIR_AHEAD log-message IDs and their descriptions
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* NOTE: Rules for message additions
|
|
|
7f4c2a |
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
|
|
|
7f4c2a |
+ * if the message format is the same. Reasoning is that, if the message
|
|
|
7f4c2a |
+ * format needs to change in one instance, the other instances are not
|
|
|
7f4c2a |
+ * impacted or the new change does not change the ID of the instance being
|
|
|
7f4c2a |
+ * modified.
|
|
|
7f4c2a |
+ * 2) Addition of a message,
|
|
|
7f4c2a |
+ * - Should increment the GLFS_NUM_MESSAGES
|
|
|
7f4c2a |
+ * - Append to the list of messages defined, towards the end
|
|
|
7f4c2a |
+ * - Retain macro naming as glfs_msg_X (for redability across developers)
|
|
|
7f4c2a |
+ * NOTE: Rules for message format modifications
|
|
|
7f4c2a |
+ * 3) Check acorss the code if the message ID macro in question is reused
|
|
|
7f4c2a |
+ * anywhere. If reused then then the modifications should ensure correctness
|
|
|
7f4c2a |
+ * everywhere, or needs a new message ID as (1) above was not adhered to. If
|
|
|
7f4c2a |
+ * not used anywhere, proceed with the required modification.
|
|
|
7f4c2a |
+ * NOTE: Rules for message deletion
|
|
|
7f4c2a |
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
|
|
|
7f4c2a |
+ * anywhere, then can be deleted, but will leave a hole by design, as
|
|
|
7f4c2a |
+ * addition rules specify modification to the end of the list and not filling
|
|
|
7f4c2a |
+ * holes.
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_READDIR_AHEAD_BASE GLFS_MSGID_COMP_READDIR_AHEAD
|
|
|
7f4c2a |
+#define GLFS_READDIR_AHEAD_NUM_MESSAGES 5
|
|
|
7f4c2a |
+#define GLFS_MSGID_END (GLFS_READDIR_AHEAD_BASE +\
|
|
|
7f4c2a |
+ GLFS_READDIR_AHEAD_NUM_MESSAGES + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* Messages with message IDs */
|
|
|
7f4c2a |
+#define glfs_msg_start_x GLFS_READDIR_AHEAD_BASE, "Invalid: Start of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define READDIR_AHEAD_MSG_XLATOR_CHILD_MISCONFIGURED\
|
|
|
7f4c2a |
+ (GLFS_READDIR_AHEAD_BASE + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define READDIR_AHEAD_MSG_VOL_MISCONFIGURED (GLFS_READDIR_AHEAD_BASE + 2)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define READDIR_AHEAD_MSG_NO_MEMORY (GLFS_READDIR_AHEAD_BASE + 3)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define READDIR_AHEAD_MSG_DIR_RELEASE_PENDING_STUB \
|
|
|
7f4c2a |
+ (GLFS_READDIR_AHEAD_BASE + 4)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define READDIR_AHEAD_MSG_OUT_OF_SEQUENCE (GLFS_READDIR_AHEAD_BASE + 5)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*------------*/
|
|
|
7f4c2a |
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#endif /* _READDIR_AHEAD_MESSAGES_H_ */
|
|
|
7f4c2a |
diff --git a/xlators/performance/readdir-ahead/src/readdir-ahead.c b/xlators/performance/readdir-ahead/src/readdir-ahead.c
|
|
|
7f4c2a |
index 1a567a0..75f30d9 100644
|
|
|
7f4c2a |
--- a/xlators/performance/readdir-ahead/src/readdir-ahead.c
|
|
|
7f4c2a |
+++ b/xlators/performance/readdir-ahead/src/readdir-ahead.c
|
|
|
7f4c2a |
@@ -34,7 +34,7 @@
|
|
|
7f4c2a |
#include "readdir-ahead.h"
|
|
|
7f4c2a |
#include "readdir-ahead-mem-types.h"
|
|
|
7f4c2a |
#include "defaults.h"
|
|
|
7f4c2a |
-
|
|
|
7f4c2a |
+#include "readdir-ahead-messages.h"
|
|
|
7f4c2a |
static int rda_fill_fd(call_frame_t *, xlator_t *, fd_t *);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
/*
|
|
|
7f4c2a |
@@ -262,8 +262,9 @@ rda_fill_fd_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
/* Verify that the preload buffer is still pending on this data. */
|
|
|
7f4c2a |
if (ctx->next_offset != local->offset) {
|
|
|
7f4c2a |
- gf_log(this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
- "Out of sequence directory preload.");
|
|
|
7f4c2a |
+ gf_msg(this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ 0, READDIR_AHEAD_MSG_OUT_OF_SEQUENCE,
|
|
|
7f4c2a |
+ "Out of sequence directory preload.");
|
|
|
7f4c2a |
ctx->state |= (RDA_FD_BYPASS|RDA_FD_ERROR);
|
|
|
7f4c2a |
ctx->op_errno = EUCLEAN;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -434,8 +435,9 @@ rda_releasedir(xlator_t *this, fd_t *fd)
|
|
|
7f4c2a |
STACK_DESTROY(ctx->fill_frame->root);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (ctx->stub)
|
|
|
7f4c2a |
- gf_log(this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
- "released a directory with a pending stub");
|
|
|
7f4c2a |
+ gf_msg(this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ READDIR_AHEAD_MSG_DIR_RELEASE_PENDING_STUB,
|
|
|
7f4c2a |
+ "released a directory with a pending stub");
|
|
|
7f4c2a |
|
|
|
7f4c2a |
GF_FREE(ctx);
|
|
|
7f4c2a |
return 0;
|
|
|
7f4c2a |
@@ -452,7 +454,8 @@ mem_acct_init(xlator_t *this)
|
|
|
7f4c2a |
ret = xlator_mem_acct_init(this, gf_rda_mt_end + 1);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (ret != 0)
|
|
|
7f4c2a |
- gf_log(this->name, GF_LOG_ERROR, "Memory accounting init"
|
|
|
7f4c2a |
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
7f4c2a |
+ READDIR_AHEAD_MSG_NO_MEMORY, "Memory accounting init"
|
|
|
7f4c2a |
"failed");
|
|
|
7f4c2a |
|
|
|
7f4c2a |
out:
|
|
|
7f4c2a |
@@ -484,14 +487,16 @@ init(xlator_t *this)
|
|
|
7f4c2a |
GF_VALIDATE_OR_GOTO("readdir-ahead", this, err);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!this->children || this->children->next) {
|
|
|
7f4c2a |
- gf_log(this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg(this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ READDIR_AHEAD_MSG_XLATOR_CHILD_MISCONFIGURED,
|
|
|
7f4c2a |
"FATAL: readdir-ahead not configured with exactly one"
|
|
|
7f4c2a |
" child");
|
|
|
7f4c2a |
goto err;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!this->parents) {
|
|
|
7f4c2a |
- gf_log(this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg(this->name, GF_LOG_WARNING, 0,
|
|
|
7f4c2a |
+ READDIR_AHEAD_MSG_VOL_MISCONFIGURED,
|
|
|
7f4c2a |
"dangling volume. check volfile ");
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
diff --git a/xlators/performance/symlink-cache/src/symlink-cache-messages.h b/xlators/performance/symlink-cache/src/symlink-cache-messages.h
|
|
|
7f4c2a |
new file mode 100644
|
|
|
7f4c2a |
index 0000000..89ea118
|
|
|
7f4c2a |
--- /dev/null
|
|
|
7f4c2a |
+++ b/xlators/performance/symlink-cache/src/symlink-cache-messages.h
|
|
|
7f4c2a |
@@ -0,0 +1,93 @@
|
|
|
7f4c2a |
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
|
|
|
7f4c2a |
+ This file is part of GlusterFS.
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+ This file is licensed to you under your choice of the GNU Lesser
|
|
|
7f4c2a |
+ General Public License, version 3 or any later version (LGPLv3 or
|
|
|
7f4c2a |
+ later), or the GNU General Public License, version 2 (GPLv2), in all
|
|
|
7f4c2a |
+ cases as published by the Free Software Foundation.
|
|
|
7f4c2a |
+*/
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#ifndef _SYMLINK_CACHE_MESSAGES_H_
|
|
|
7f4c2a |
+#define _SYMLINK_CACHE_MESSAGES_H_
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#include "glfs-message-id.h"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*! \file symlink_cache-messages.h
|
|
|
7f4c2a |
+ * \brief SYMLINK_CACHE log-message IDs and their descriptions
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* NOTE: Rules for message additions
|
|
|
7f4c2a |
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
|
|
|
7f4c2a |
+ * if the message format is the same. Reasoning is that, if the message
|
|
|
7f4c2a |
+ * format needs to change in one instance, the other instances are not
|
|
|
7f4c2a |
+ * impacted or the new change does not change the ID of the instance being
|
|
|
7f4c2a |
+ * modified.
|
|
|
7f4c2a |
+ * 2) Addition of a message,
|
|
|
7f4c2a |
+ * - Should increment the GLFS_NUM_MESSAGES
|
|
|
7f4c2a |
+ * - Append to the list of messages defined, towards the end
|
|
|
7f4c2a |
+ * - Retain macro naming as glfs_msg_X (for redability across developers)
|
|
|
7f4c2a |
+ * NOTE: Rules for message format modifications
|
|
|
7f4c2a |
+ * 3) Check acorss the code if the message ID macro in question is reused
|
|
|
7f4c2a |
+ * anywhere. If reused then then the modifications should ensure correctness
|
|
|
7f4c2a |
+ * everywhere, or needs a new message ID as (1) above was not adhered to. If
|
|
|
7f4c2a |
+ * not used anywhere, proceed with the required modification.
|
|
|
7f4c2a |
+ * NOTE: Rules for message deletion
|
|
|
7f4c2a |
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
|
|
|
7f4c2a |
+ * anywhere, then can be deleted, but will leave a hole by design, as
|
|
|
7f4c2a |
+ * addition rules specify modification to the end of the list and not filling
|
|
|
7f4c2a |
+ * holes.
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_SYMLINK_CACHE_BASE GLFS_MSGID_COMP_SYMLINK_CACHE
|
|
|
7f4c2a |
+#define GLFS_SYMLINK_CACHE_NUM_MESSAGES 5
|
|
|
7f4c2a |
+#define GLFS_MSGID_END (GLFS_SYMLINK_CACHE_BASE +\
|
|
|
7f4c2a |
+ GLFS_SYMLINK_CACHE_NUM_MESSAGES + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* Messages with message IDs */
|
|
|
7f4c2a |
+#define glfs_msg_start_x GLFS_SYMLINK_CACHE_BASE, "Invalid: Start of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define SYMLINK_CACHE_MSG_XLATOR_CHILD_MISCONFIGURED\
|
|
|
7f4c2a |
+ (GLFS_SYMLINK_CACHE_BASE + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define SYMLINK_CACHE_MSG_VOL_MISCONFIGURED (GLFS_SYMLINK_CACHE_BASE + 2)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define SYMLINK_CACHE_MSG_NO_MEMORY (GLFS_SYMLINK_CACHE_BASE + 3)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define SYMLINK_CACHE_MSG_DICT_GET_FAILED (GLFS_SYMLINK_CACHE_BASE + 4)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define SYMLINK_CACHE_MSG_DICT_SET_FAILED (GLFS_SYMLINK_CACHE_BASE + 5)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*------------*/
|
|
|
7f4c2a |
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#endif /* _SYMLINK_CACHE_MESSAGES_H_ */
|
|
|
7f4c2a |
diff --git a/xlators/performance/symlink-cache/src/symlink-cache.c b/xlators/performance/symlink-cache/src/symlink-cache.c
|
|
|
7f4c2a |
index c65629b..6ecfad4 100644
|
|
|
7f4c2a |
--- a/xlators/performance/symlink-cache/src/symlink-cache.c
|
|
|
7f4c2a |
+++ b/xlators/performance/symlink-cache/src/symlink-cache.c
|
|
|
7f4c2a |
@@ -22,6 +22,7 @@
|
|
|
7f4c2a |
#include "compat.h"
|
|
|
7f4c2a |
#include "compat-errno.h"
|
|
|
7f4c2a |
#include "common-utils.h"
|
|
|
7f4c2a |
+#include "symlink-cache-messages.h"
|
|
|
7f4c2a |
|
|
|
7f4c2a |
struct symlink_cache {
|
|
|
7f4c2a |
time_t ctime;
|
|
|
7f4c2a |
@@ -36,7 +37,8 @@ symlink_inode_ctx_get (inode_t *inode, xlator_t *this, void **ctx)
|
|
|
7f4c2a |
uint64_t tmp_ctx = 0;
|
|
|
7f4c2a |
ret = inode_ctx_get (inode, this, &tmp_ctx);
|
|
|
7f4c2a |
if (-1 == ret)
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "dict get failed");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
|
|
|
7f4c2a |
+ SYMLINK_CACHE_MSG_DICT_GET_FAILED, "dict get failed");
|
|
|
7f4c2a |
else
|
|
|
7f4c2a |
*ctx = (void *)(long)tmp_ctx;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -50,7 +52,8 @@ symlink_inode_ctx_set (inode_t *inode, xlator_t *this, void *ctx)
|
|
|
7f4c2a |
int ret = 0;
|
|
|
7f4c2a |
ret = inode_ctx_put (inode, this, (uint64_t)(long) ctx);
|
|
|
7f4c2a |
if (-1 == ret)
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "dict set failed");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
|
|
|
7f4c2a |
+ SYMLINK_CACHE_MSG_DICT_SET_FAILED, "dict set failed");
|
|
|
7f4c2a |
|
|
|
7f4c2a |
return 0;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -66,15 +69,15 @@ sc_cache_update (xlator_t *this, inode_t *inode, const char *link)
|
|
|
7f4c2a |
return 0;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!sc->readlink) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_DEBUG,
|
|
|
7f4c2a |
- "updating cache: %s", link);
|
|
|
7f4c2a |
+ gf_msg_debug (this->name, 0,
|
|
|
7f4c2a |
+ "updating cache: %s", link);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
sc->readlink = strdup (link);
|
|
|
7f4c2a |
- } else {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_DEBUG,
|
|
|
7f4c2a |
- "not updating existing cache: %s with %s",
|
|
|
7f4c2a |
- sc->readlink, link);
|
|
|
7f4c2a |
- }
|
|
|
7f4c2a |
+ } else
|
|
|
7f4c2a |
+ gf_msg_debug (this->name, 0,
|
|
|
7f4c2a |
+ "not updating existing cache: %s with %s",
|
|
|
7f4c2a |
+ sc->readlink, link);
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
|
|
|
7f4c2a |
return 0;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -94,16 +97,17 @@ sc_cache_set (xlator_t *this, inode_t *inode, struct iatt *buf,
|
|
|
7f4c2a |
need_set = 1;
|
|
|
7f4c2a |
sc = CALLOC (1, sizeof (*sc));
|
|
|
7f4c2a |
if (!sc) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
- "out of memory :(");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
7f4c2a |
+ SYMLINK_CACHE_MSG_NO_MEMORY,
|
|
|
7f4c2a |
+ "out of memory :(");
|
|
|
7f4c2a |
goto err;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (sc->readlink) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_DEBUG,
|
|
|
7f4c2a |
- "replacing old cache: %s with new cache: %s",
|
|
|
7f4c2a |
- sc->readlink, link);
|
|
|
7f4c2a |
+ gf_msg_debug (this->name, 0,
|
|
|
7f4c2a |
+ "replacing old cache: %s with new cache: %s",
|
|
|
7f4c2a |
+ sc->readlink, link);
|
|
|
7f4c2a |
FREE (sc->readlink);
|
|
|
7f4c2a |
sc->readlink = NULL;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -111,24 +115,25 @@ sc_cache_set (xlator_t *this, inode_t *inode, struct iatt *buf,
|
|
|
7f4c2a |
if (link) {
|
|
|
7f4c2a |
sc->readlink = strdup (link);
|
|
|
7f4c2a |
if (!sc->readlink) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
- "out of memory :(");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
7f4c2a |
+ SYMLINK_CACHE_MSG_NO_MEMORY,
|
|
|
7f4c2a |
+ "out of memory :(");
|
|
|
7f4c2a |
goto err;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
sc->ctime = buf->ia_ctime;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_DEBUG,
|
|
|
7f4c2a |
- "setting symlink cache: %s", link);
|
|
|
7f4c2a |
+ gf_msg_debug (this->name, 0,
|
|
|
7f4c2a |
+ "setting symlink cache: %s", link);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (need_set) {
|
|
|
7f4c2a |
ret = symlink_inode_ctx_set (inode, this, sc);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (ret < 0) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
- "could not set inode context (%s)",
|
|
|
7f4c2a |
- strerror (-ret));
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ -ret, SYMLINK_CACHE_MSG_NO_MEMORY,
|
|
|
7f4c2a |
+ "could not set inode context ");
|
|
|
7f4c2a |
goto err;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -156,8 +161,8 @@ sc_cache_flush (xlator_t *this, inode_t *inode)
|
|
|
7f4c2a |
return 0;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (sc->readlink) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_DEBUG,
|
|
|
7f4c2a |
- "flushing cache: %s", sc->readlink);
|
|
|
7f4c2a |
+ gf_msg_debug (this->name, 0,
|
|
|
7f4c2a |
+ "flushing cache: %s", sc->readlink);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
FREE (sc->readlink);
|
|
|
7f4c2a |
sc->readlink = NULL;
|
|
|
7f4c2a |
@@ -199,8 +204,8 @@ sc_cache_validate (xlator_t *this, inode_t *inode, struct iatt *buf)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
/* STALE */
|
|
|
7f4c2a |
if (sc->readlink) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_DEBUG,
|
|
|
7f4c2a |
- "flushing cache: %s", sc->readlink);
|
|
|
7f4c2a |
+ gf_msg_debug (this->name, 0,
|
|
|
7f4c2a |
+ "flushing cache: %s", sc->readlink);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
FREE (sc->readlink);
|
|
|
7f4c2a |
sc->readlink = NULL;
|
|
|
7f4c2a |
@@ -257,9 +262,9 @@ sc_readlink (call_frame_t *frame, xlator_t *this,
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (link) {
|
|
|
7f4c2a |
/* cache hit */
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_DEBUG,
|
|
|
7f4c2a |
- "cache hit %s -> %s",
|
|
|
7f4c2a |
- loc->path, link);
|
|
|
7f4c2a |
+ gf_msg_debug (this->name, 0,
|
|
|
7f4c2a |
+ "cache hit %s -> %s",
|
|
|
7f4c2a |
+ loc->path, link);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
/*
|
|
|
7f4c2a |
libglusterfsclient, nfs or any other translators
|
|
|
7f4c2a |
@@ -361,15 +366,17 @@ init (xlator_t *this)
|
|
|
7f4c2a |
{
|
|
|
7f4c2a |
if (!this->children || this->children->next)
|
|
|
7f4c2a |
{
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ SYMLINK_CACHE_MSG_XLATOR_CHILD_MISCONFIGURED,
|
|
|
7f4c2a |
"FATAL: volume (%s) not configured with exactly one "
|
|
|
7f4c2a |
"child", this->name);
|
|
|
7f4c2a |
return -1;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!this->parents) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
- "dangling volume. check volfile ");
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
7f4c2a |
+ SYMLINK_CACHE_MSG_VOL_MISCONFIGURED,
|
|
|
7f4c2a |
+ "dangling volume. check volfile ");
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
return 0;
|
|
|
7f4c2a |
diff --git a/xlators/performance/write-behind/src/write-behind-messages.h b/xlators/performance/write-behind/src/write-behind-messages.h
|
|
|
7f4c2a |
new file mode 100644
|
|
|
7f4c2a |
index 0000000..d0934cf
|
|
|
7f4c2a |
--- /dev/null
|
|
|
7f4c2a |
+++ b/xlators/performance/write-behind/src/write-behind-messages.h
|
|
|
7f4c2a |
@@ -0,0 +1,121 @@
|
|
|
7f4c2a |
+/*Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
|
|
|
7f4c2a |
+ This file is part of GlusterFS.
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+ This file is licensed to you under your choice of the GNU Lesser
|
|
|
7f4c2a |
+ General Public License, version 3 or any later version (LGPLv3 or
|
|
|
7f4c2a |
+ later), or the GNU General Public License, version 2 (GPLv2), in all
|
|
|
7f4c2a |
+ cases as published by the Free Software Foundation.
|
|
|
7f4c2a |
+*/
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#ifndef _WRITE_BEHIND_MESSAGES_H_
|
|
|
7f4c2a |
+#define _WRITE_BEHIND_MESSAGES_H_
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#include "glfs-message-id.h"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*! \file write-behind-messages.h
|
|
|
7f4c2a |
+ * \brief WRITE_BEHIND log-message IDs and their descriptions
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* NOTE: Rules for message additions
|
|
|
7f4c2a |
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
|
|
|
7f4c2a |
+ * if the message format is the same. Reasoning is that, if the message
|
|
|
7f4c2a |
+ * format needs to change in one instance, the other instances are not
|
|
|
7f4c2a |
+ * impacted or the new change does not change the ID of the instance being
|
|
|
7f4c2a |
+ * modified.
|
|
|
7f4c2a |
+ * 2) Addition of a message,
|
|
|
7f4c2a |
+ * - Should increment the GLFS_NUM_MESSAGES
|
|
|
7f4c2a |
+ * - Append to the list of messages defined, towards the end
|
|
|
7f4c2a |
+ * - Retain macro naming as glfs_msg_X (for redability across developers)
|
|
|
7f4c2a |
+ * NOTE: Rules for message format modifications
|
|
|
7f4c2a |
+ * 3) Check acorss the code if the message ID macro in question is reused
|
|
|
7f4c2a |
+ * anywhere. If reused then then the modifications should ensure correctness
|
|
|
7f4c2a |
+ * everywhere, or needs a new message ID as (1) above was not adhered to. If
|
|
|
7f4c2a |
+ * not used anywhere, proceed with the required modification.
|
|
|
7f4c2a |
+ * NOTE: Rules for message deletion
|
|
|
7f4c2a |
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
|
|
|
7f4c2a |
+ * anywhere, then can be deleted, but will leave a hole by design, as
|
|
|
7f4c2a |
+ * addition rules specify modification to the end of the list and not filling
|
|
|
7f4c2a |
+ * holes.
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define GLFS_WRITE_BEHIND_BASE GLFS_MSGID_COMP_WRITE_BEHIND
|
|
|
7f4c2a |
+#define GLFS_WRITE_BEHIND_NUM_MESSAGES 7
|
|
|
7f4c2a |
+#define GLFS_MSGID_END (GLFS_WRITE_BEHIND_BASE +\
|
|
|
7f4c2a |
+ GLFS_WRITE_BEHIND_NUM_MESSAGES + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/* Messages with message IDs */
|
|
|
7f4c2a |
+#define glfs_msg_start_x GLFS_WRITE_BEHIND_BASE, "Invalid: Start of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define WRITE_BEHIND_MSG_EXCEEDED_MAX_SIZE (GLFS_WRITE_BEHIND_BASE + 1)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define WRITE_BEHIND_MSG_INIT_FAILED (GLFS_WRITE_BEHIND_BASE + 2)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define WRITE_BEHIND_MSG_INVALID_ARGUMENT (GLFS_WRITE_BEHIND_BASE + 3)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define WRITE_BEHIND_MSG_NO_MEMORY (GLFS_WRITE_BEHIND_BASE + 4)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define WRITE_BEHIND_MSG_SIZE_NOT_SET (GLFS_WRITE_BEHIND_BASE + 5)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define WRITE_BEHIND_MSG_VOL_MISCONFIGURED (GLFS_WRITE_BEHIND_BASE + 6)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*!
|
|
|
7f4c2a |
+ * @messageid
|
|
|
7f4c2a |
+ * @diagnosis
|
|
|
7f4c2a |
+ * @recommendedaction None
|
|
|
7f4c2a |
+ *
|
|
|
7f4c2a |
+ */
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#define WRITE_BEHIND_MSG_RES_UNAVAILABLE (GLFS_WRITE_BEHIND_BASE + 7)
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+/*------------*/
|
|
|
7f4c2a |
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+#endif /* _WRITE_BEHIND_MESSAGES_H_ */
|
|
|
7f4c2a |
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
|
|
|
7f4c2a |
index 3cb0d44..84e444d 100644
|
|
|
7f4c2a |
--- a/xlators/performance/write-behind/src/write-behind.c
|
|
|
7f4c2a |
+++ b/xlators/performance/write-behind/src/write-behind.c
|
|
|
7f4c2a |
@@ -26,6 +26,7 @@
|
|
|
7f4c2a |
#include "statedump.h"
|
|
|
7f4c2a |
#include "defaults.h"
|
|
|
7f4c2a |
#include "write-behind-mem-types.h"
|
|
|
7f4c2a |
+#include "write-behind-messages.h"
|
|
|
7f4c2a |
|
|
|
7f4c2a |
#define MAX_VECTOR_COUNT 8
|
|
|
7f4c2a |
#define WB_AGGREGATE_SIZE 131072 /* 128 KB */
|
|
|
7f4c2a |
@@ -356,7 +357,8 @@ __wb_request_unref (wb_request_t *req)
|
|
|
7f4c2a |
wb_inode = req->wb_inode;
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (req->refcount <= 0) {
|
|
|
7f4c2a |
- gf_log ("wb-request", GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg ("wb-request", GF_LOG_WARNING,
|
|
|
7f4c2a |
+ 0, WRITE_BEHIND_MSG_RES_UNAVAILABLE,
|
|
|
7f4c2a |
"refcount(%d) is <= 0", req->refcount);
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
@@ -422,7 +424,8 @@ __wb_request_ref (wb_request_t *req)
|
|
|
7f4c2a |
GF_VALIDATE_OR_GOTO ("write-behind", req, out);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (req->refcount < 0) {
|
|
|
7f4c2a |
- gf_log ("wb-request", GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg ("wb-request", GF_LOG_WARNING, 0,
|
|
|
7f4c2a |
+ WRITE_BEHIND_MSG_RES_UNAVAILABLE,
|
|
|
7f4c2a |
"refcount(%d) is < 0", req->refcount);
|
|
|
7f4c2a |
req = NULL;
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
@@ -993,7 +996,8 @@ __wb_collapse_small_writes (wb_request_t *holder, wb_request_t *req)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
ret = iobref_add (iobref, iobuf);
|
|
|
7f4c2a |
if (ret != 0) {
|
|
|
7f4c2a |
- gf_log (req->wb_inode->this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (req->wb_inode->this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ -ret, WRITE_BEHIND_MSG_INVALID_ARGUMENT,
|
|
|
7f4c2a |
"cannot add iobuf (%p) into iobref (%p)",
|
|
|
7f4c2a |
iobuf, iobref);
|
|
|
7f4c2a |
iobuf_unref (iobuf);
|
|
|
7f4c2a |
@@ -2099,7 +2103,9 @@ mem_acct_init (xlator_t *this)
|
|
|
7f4c2a |
ret = xlator_mem_acct_init (this, gf_wb_mt_end + 1);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (ret != 0) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
7f4c2a |
+ WRITE_BEHIND_MSG_NO_MEMORY,
|
|
|
7f4c2a |
+ "Memory accounting init"
|
|
|
7f4c2a |
"failed");
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -2143,14 +2149,16 @@ init (xlator_t *this)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if ((this->children == NULL)
|
|
|
7f4c2a |
|| this->children->next) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ WRITE_BEHIND_MSG_INIT_FAILED,
|
|
|
7f4c2a |
"FATAL: write-behind (%s) not configured with exactly "
|
|
|
7f4c2a |
"one child", this->name);
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (this->parents == NULL) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
7f4c2a |
+ WRITE_BEHIND_MSG_VOL_MISCONFIGURED,
|
|
|
7f4c2a |
"dangling volume. check volfilex");
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -2166,7 +2174,8 @@ init (xlator_t *this)
|
|
|
7f4c2a |
GF_OPTION_INIT ("cache-size", conf->window_size, size_uint64, out);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (!conf->window_size && conf->aggregate_size) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_WARNING,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
7f4c2a |
+ WRITE_BEHIND_MSG_SIZE_NOT_SET,
|
|
|
7f4c2a |
"setting window-size to be equal to "
|
|
|
7f4c2a |
"aggregate-size(%"PRIu64")",
|
|
|
7f4c2a |
conf->aggregate_size);
|
|
|
7f4c2a |
@@ -2174,7 +2183,8 @@ init (xlator_t *this)
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (conf->window_size < conf->aggregate_size) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR,
|
|
|
7f4c2a |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
7f4c2a |
+ WRITE_BEHIND_MSG_EXCEEDED_MAX_SIZE,
|
|
|
7f4c2a |
"aggregate-size(%"PRIu64") cannot be more than "
|
|
|
7f4c2a |
"window-size(%"PRIu64")", conf->aggregate_size,
|
|
|
7f4c2a |
conf->window_size);
|
|
|
7f4c2a |
--
|
|
|
7f4c2a |
1.7.1
|
|
|
7f4c2a |
|