[Ocfs2-commits] zab commits r2167 - trunk/fs/ocfs2/cluster
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Apr 22 17:04:20 CDT 2005
Author: zab
Signed-off-by: mfasheh
Date: 2005-04-22 17:04:18 -0500 (Fri, 22 Apr 2005)
New Revision: 2167
Modified:
trunk/fs/ocfs2/cluster/masklog.c
trunk/fs/ocfs2/cluster/masklog.h
Log:
o changed the source settings from on and off to allow, deny, and off so that a
given source can be actively supressed.
o sample the calling cpu in mlog with {get,put}_cpu() instead of
smp_current_id()
Signed-off-by: mfasheh
Modified: trunk/fs/ocfs2/cluster/masklog.c
===================================================================
--- trunk/fs/ocfs2/cluster/masklog.c 2005-04-22 20:57:22 UTC (rev 2166)
+++ trunk/fs/ocfs2/cluster/masklog.c 2005-04-22 22:04:18 UTC (rev 2167)
@@ -29,8 +29,10 @@
#include "masklog.h"
-struct mlog_bits mlog_active_bits = MLOG_BITS_RHS(MLOG_INITIAL_MASK);
-EXPORT_SYMBOL(mlog_active_bits);
+struct mlog_bits mlog_and_bits = MLOG_BITS_RHS(MLOG_INITIAL_AND_MASK);
+EXPORT_SYMBOL(mlog_and_bits);
+struct mlog_bits mlog_not_bits = MLOG_BITS_RHS(MLOG_INITIAL_NOT_MASK);
+EXPORT_SYMBOL(mlog_not_bits);
static char *mlog_bit_names[MLOG_MAX_BITS];
@@ -62,10 +64,16 @@
{
char **name = v;
int bit = name - mlog_bit_names;
+ char *state;
- seq_printf(seq, "%s %s\n", *name,
- __mlog_test_u64((u64)1 << bit, mlog_active_bits) ?
- "on" : "off");
+ if (__mlog_test_u64((u64)1 << bit, mlog_and_bits))
+ state = "allow";
+ else if (__mlog_test_u64((u64)1 << bit, mlog_not_bits))
+ state = "deny";
+ else
+ state = "off";
+
+ seq_printf(seq, "%s %s\n", *name, state);
return 0;
}
@@ -95,8 +103,8 @@
if (count == 0)
return 0;
- /* count at least mask + space + 1 */
- if (*pos != 0 || count < 3 || count >= sizeof(str))
+ /* count at least mask + space + 3 for "off" */
+ if (*pos != 0 || count < 5 || count >= sizeof(str))
return -EINVAL;
if (copy_from_user(str, buf, count))
@@ -123,10 +131,15 @@
if (i == ARRAY_SIZE(mlog_bit_names))
return -EINVAL;
- if (!strnicmp(val, "on", 2) || !strnicmp(val, "1", 1)) {
- __mlog_set_u64((u64)1 << i, mlog_active_bits);
- } else if (!strnicmp(val, "off", 3) || !strnicmp(val, "0", 1)) {
- __mlog_clear_u64((u64)1 << i, mlog_active_bits);
+ if (!strnicmp(val, "allow", 5)) {
+ __mlog_set_u64((u64)1 << i, mlog_and_bits);
+ __mlog_clear_u64((u64)1 << i, mlog_not_bits);
+ } else if (!strnicmp(val, "deny", 4)) {
+ __mlog_set_u64((u64)1 << i, mlog_not_bits);
+ __mlog_clear_u64((u64)1 << i, mlog_and_bits);
+ } else if (!strnicmp(val, "off", 3)) {
+ __mlog_clear_u64((u64)1 << i, mlog_not_bits);
+ __mlog_clear_u64((u64)1 << i, mlog_and_bits);
} else
return -EINVAL;
Modified: trunk/fs/ocfs2/cluster/masklog.h
===================================================================
--- trunk/fs/ocfs2/cluster/masklog.h 2005-04-22 20:57:22 UTC (rev 2166)
+++ trunk/fs/ocfs2/cluster/masklog.h 2005-04-22 22:04:18 UTC (rev 2167)
@@ -94,7 +94,8 @@
#define ML_NOTICE 0x0000000200000000ULL /* setn to KERN_NOTICE */
#define ML_KTHREAD 0x0000000400000000ULL /* kernel thread activity */
-#define MLOG_INITIAL_MASK (ML_ERROR|ML_NOTICE)
+#define MLOG_INITIAL_AND_MASK (ML_ERROR|ML_NOTICE)
+#define MLOG_INITIAL_NOT_MASK (ML_ENTRY|ML_EXIT)
#ifndef MLOG_MASK_PREFIX
#define MLOG_MASK_PREFIX 0
#endif
@@ -105,7 +106,7 @@
unsigned long words[MLOG_MAX_BITS / BITS_PER_LONG];
};
-extern struct mlog_bits mlog_active_bits;
+extern struct mlog_bits mlog_and_bits, mlog_not_bits;
#if BITS_PER_LONG == 32
@@ -139,13 +140,26 @@
#endif
+/*
+ * smp_processor_id() "helpfully" screams when called outside preemptible
+ * regions in current kernels. sles doesn't have the variants that don't
+ * scream. just do this instead of trying to guess which we're building
+ * against.. *sigh*.
+ */
+#define __mlog_cpu_guess ({ \
+ unsigned long _cpu = get_cpu(); \
+ put_cpu(); \
+ _cpu; \
+})
#define __mlog_printk(level, fmt, args...) \
- printk(level "(%u,%u):%s:%d " fmt, current->pid, \
- smp_processor_id(), __PRETTY_FUNCTION__, __LINE__, ##args)
+ printk(level "(%u,%lu):%s:%d " fmt, current->pid, \
+ __mlog_cpu_guess, __PRETTY_FUNCTION__, __LINE__, \
+ ##args)
#define mlog(mask, fmt, args...) do { \
u64 __m = MLOG_MASK_PREFIX | (mask); \
- if (__mlog_test_u64(__m, mlog_active_bits)) { \
+ if (__mlog_test_u64(__m, mlog_and_bits) && \
+ !__mlog_test_u64(__m, mlog_not_bits)) { \
if (__m & ML_ERROR) \
__mlog_printk(KERN_ERR, "ERROR: "fmt, ##args); \
else if (__m & ML_NOTICE) \
More information about the Ocfs2-commits
mailing list