[Ocfs2-commits] mfasheh commits r2164 - in trunk/fs/ocfs2: cluster dlm

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Apr 22 13:32:37 CDT 2005


Author: mfasheh
Signed-off-by: zab
Date: 2005-04-22 13:32:35 -0500 (Fri, 22 Apr 2005)
New Revision: 2164

Modified:
   trunk/fs/ocfs2/cluster/Makefile
   trunk/fs/ocfs2/cluster/heartbeat.c
   trunk/fs/ocfs2/cluster/masklog.c
   trunk/fs/ocfs2/cluster/masklog.h
   trunk/fs/ocfs2/dlm/dlmfs.c
   trunk/fs/ocfs2/dlm/userdlm.c
   trunk/fs/ocfs2/dlm/userdlm.h
Log:
* add mlog_errno, a convenience error status print

* remove __FILE__ from prints, that's just too verbose

* change mlog default level to KERN_INFO            

* add heartbeat bits and update heartbeat to use mlog

* add dlmfs bits and update dlmfs to use mlog

Signed-off-by: zab



Modified: trunk/fs/ocfs2/cluster/Makefile
===================================================================
--- trunk/fs/ocfs2/cluster/Makefile	2005-04-22 08:22:25 UTC (rev 2163)
+++ trunk/fs/ocfs2/cluster/Makefile	2005-04-22 18:32:35 UTC (rev 2164)
@@ -27,9 +27,7 @@
 EXTRA_CFLAGS += -I$(OUR_TOPDIR)/fs/configfs/compatinclude
 
 ifneq ($(QUIET),1)
-EXTRA_CFLAGS += -DENABLE_HBPRINTK
 EXTRA_CFLAGS += -DENABLE_NMPRINTK
-EXTRA_CFLAGS += -DENABLE_NETPRINTK
 endif
 
 #

Modified: trunk/fs/ocfs2/cluster/heartbeat.c
===================================================================
--- trunk/fs/ocfs2/cluster/heartbeat.c	2005-04-22 08:22:25 UTC (rev 2163)
+++ trunk/fs/ocfs2/cluster/heartbeat.c	2005-04-22 18:32:35 UTC (rev 2164)
@@ -65,9 +65,7 @@
 #include "tcp.h"
 #include "nodemanager.h"
 
-#ifndef __user
-#define __user
-#endif
+#include "masklog.h"
 
 
 /* 
@@ -96,16 +94,6 @@
 
 static struct hb_callback *hbcall_from_type(enum hb_callback_type type);
 
-#ifndef ENABLE_HBPRINTK
-#define hbprintk(x, arg...)    
-#define hbprintk0(x)
-#else
-#define hbprintk(x, arg...)    printk("(hb:(%d) %s:%d) " x, current->pid, \
-						__FUNCTION__, __LINE__, ##arg)
-#define hbprintk0(x)           printk("(hb:(%d) %s:%d) " x, __FUNCTION__, \
-						__LINE__current->pid)
-#endif
-
 #define HB_THREAD_MS                  2000   // every 2 seconds
 
 #define HB_DEFAULT_BLOCK_BITS         9
@@ -192,7 +180,7 @@
 	struct hb_bio_wait_ctxt *wc = bio->bi_private;
 
 	if (error)
-		printk("ocfs2_heartbeat: IO Error %d\n", error);
+		mlog(ML_ERROR, "IO Error %d\n", error);
 
 	if (bio->bi_size)
 		return 1;
@@ -219,7 +207,7 @@
 
 	bio = bio_alloc(GFP_KERNEL, nr_vecs);
 	if (!bio) {
-		hbprintk("Could not alloc slots BIO!\n");
+		mlog(ML_ERROR, "Could not alloc slots BIO!\n");
 		bio = ERR_PTR(-ENOMEM);
 		goto bail;
 	}
@@ -242,20 +230,17 @@
 			vec_len = ((num_slots + start_slot) % spp) << bits;
 		vec_len -=  vec_start;
 
-#if 0
-		/* Enable this for tons of output */
-		hbprintk("page %d, vec_len = %u, vec_start = %u\n", i,
-			 vec_len, vec_start);
-#endif
+		mlog(ML_HB_BIO, "page %d, vec_len = %u, vec_start = %u\n",
+		     i, vec_len, vec_start);
 
 		len = bio_add_page(bio, page, vec_len, vec_start);
 		if (len != vec_len) {
 			bio_put(bio);
 			bio = ERR_PTR(-EIO);
 
-			hbprintk("Error adding page to bio i = %d, vec_len = "
-				 "%u, len = %d\n, start = %u", i, vec_len,
-				 len, vec_start);
+			mlog(ML_ERROR, "Error adding page to bio i = %d, "
+			     "vec_len = %u, len = %d\n, start = %u\n",
+			     i, vec_len, len, vec_start);
 			goto bail;
 		}
 
@@ -310,13 +295,11 @@
 	*num_bios = (io_sectors + max_sectors - 1) / max_sectors;
 	*slots_per_bio = max_sectors >> (reg->hr_hb_block_bits - 9);
 
-#if 0
-	hbprintk("My io size is %u sectors for %u slots. This device can "
-		 "handle %u sectors of I/O\n", io_sectors, num_slots,
-		 max_sectors);
-	hbprintk("Will need %u bios holding %u slots each\n", *num_bios,
-		 *slots_per_bio);
-#endif
+	mlog(ML_HB_BIO, "My io size is %u sectors for %u slots. This "
+	     "device can handle %u sectors of I/O\n", io_sectors, num_slots,
+	     max_sectors);
+	mlog(ML_HB_BIO, "Will need %u bios holding %u slots each\n",
+	     *num_bios, *slots_per_bio);
 }
 
 static int hb_read_slots(struct hb_region *reg,
@@ -333,7 +316,7 @@
 	bios = kcalloc(num_bios, sizeof(struct bio *), GFP_KERNEL);
 	if (!bios) {
 		status = -ENOMEM;
-		hbprintk("%d\n", status);
+		mlog_errno(status);
 		return status;
 	}
 
@@ -352,7 +335,7 @@
 			hb_bio_wait_dec(&wc, num_bios - i);
 
 			status = PTR_ERR(bio);
-			hbprintk("%d\n", status);
+			mlog_errno(status);
 			goto bail_and_wait;
 		}
 		bios[i] = bio;
@@ -390,7 +373,7 @@
 	bio = hb_setup_one_bio(reg, write_wc, slot, 1);
 	if (IS_ERR(bio)) {
 		status = PTR_ERR(bio);
-		hbprintk("%d\n", status);
+		mlog_errno(status);
 		goto bail;
 	}
 
@@ -485,9 +468,9 @@
 		list_del_init(&event->hn_item);
 		spin_unlock(&hb_live_lock);
 
-		hbprintk("Node %s event for %d\n",
-			 event->hn_event_type == HB_NODE_UP_CB ? "UP" : "DOWN",
-			 event->hn_node_num);
+		mlog(ML_HEARTBEAT, "Node %s event for %d\n",
+		     event->hn_event_type == HB_NODE_UP_CB ? "UP" : "DOWN",
+		     event->hn_node_num);
 
 		hbcall = hbcall_from_type(event->hn_event_type);
 
@@ -516,8 +499,8 @@
 	event->hn_node = node;
 	event->hn_node_num = node_num;
 
-	hbprintk("Queue node %s event for node %d\n",
-		 type == HB_NODE_UP_CB ? "UP" : "DOWN", node_num);
+	mlog(ML_HEARTBEAT, "Queue node %s event for node %d\n",
+	     type == HB_NODE_UP_CB ? "UP" : "DOWN", node_num);
 
 	list_add_tail(&event->hn_item, &hb_node_events);
 }
@@ -534,8 +517,8 @@
 
 	spin_lock(&hb_live_lock);
 	if (!list_empty(&slot->ds_live_item)) {
-		hbprintk("Shutdown, node %d leaves region\n",
-			 slot->ds_node_num);
+		mlog(ML_HEARTBEAT, "Shutdown, node %d leaves region\n",
+		     slot->ds_node_num);
 
 		list_del_init(&slot->ds_live_item);
 
@@ -582,7 +565,7 @@
 	 * changes at any time during their dead time */
 	if (list_empty(&slot->ds_live_item) &&
 	    slot->ds_changed_samples >= HB_LIVE_THRESHOLD) {
-		hbprintk("Node %d joined my region\n", slot->ds_node_num);
+		mlog(ML_HEARTBEAT, "Node %d joined my region\n", slot->ds_node_num);
 
 		/* first on the list generates a callback */
 		if (list_empty(&hb_live_slots[slot->ds_node_num])) {
@@ -609,7 +592,7 @@
 	 * samples..  reset the missed counter whenever we see 
 	 * activity */
 	if (slot->ds_equal_samples >= HB_DEAD_THRESHOLD) {
-		hbprintk("Node %d left my region\n", slot->ds_node_num);
+		mlog(ML_HEARTBEAT, "Node %d left my region\n", slot->ds_node_num);
 
 		/* last off the live_slot generates a callback */
 		list_del_init(&slot->ds_live_item);
@@ -669,7 +652,7 @@
 
 	highest_node = hb_highest_node(configured_nodes, NM_MAX_NODES);
 	if (highest_node >= NM_MAX_NODES) {
-		printk("ocfs2_heartbeat: no configured nodes found!\n");
+		mlog(ML_NOTICE, "ocfs2_heartbeat: no configured nodes found!\n");
 		return;
 	}
 
@@ -679,7 +662,7 @@
 	 * best-effort. */
 	ret = hb_read_slots(reg, highest_node + 1);
 	if (ret < 0) {
-		hbprintk("ret = %d reading slots\n", ret);
+		mlog_errno(ret);
 		return;
 	}
 
@@ -687,8 +670,7 @@
 	 * other node has been improperly configured to heartbeat in
 	 * our slot. */
 	if (!hb_check_last_timestamp(reg))
-		printk(KERN_CRIT "ocfs2_heartbeat: Another node is "
-		       "heartbeating in our slot!\n");
+		mlog(ML_ERROR, "Another node is heartbeating in our slot!\n");
 
 	/* Set our raw timestamp */
 	hb_set_local_node_timestamp(reg);
@@ -697,7 +679,7 @@
 	 * until later. */
 	ret = hb_issue_node_write(reg, &write_bio, &write_wc);
 	if (ret < 0) {
-		hbprintk("ret = %d setting up read io\n", ret);
+		mlog_errno(ret);
 		return;
 	}
 
@@ -728,7 +710,7 @@
 	struct hb_region *reg = data;
 	int i;
 
-	hbprintk("hb thread running\n");
+	mlog(ML_HEARTBEAT|ML_KTHREAD, "hb thread running\n");
 
 	while (!kthread_should_stop()) {
 		hb_do_disk_heartbeat(reg);
@@ -739,7 +721,7 @@
 	for(i = 0; i < reg->hr_blocks; i++)
 		hb_shutdown_slot(&reg->hr_slots[i]);
 
-	hbprintk("hb thread exiting\n");
+	mlog(ML_HEARTBEAT|ML_KTHREAD, "hb thread exiting\n");
 
 	return 0;
 }
@@ -868,7 +850,7 @@
 
 	hb_init_region_params(reg, slot_bits);
 
-	hbprintk("Heartbeat region using %u sized slots\n", 1 << slot_bits);
+	mlog(ML_HEARTBEAT, "Heartbeat region using %u sized slots\n", 1 << slot_bits);
 
 	return count;
 }
@@ -977,13 +959,13 @@
 	tmp_bytes = reg->hr_fs_start_block << reg->hr_fs_block_bits;
 	reg->hr_start_block = tmp_bytes >> reg->hr_hb_block_bits;
 
-	hbprintk("fs_block_bytes = %u, fs_block_bits = %u\n",
-		 reg->hr_fs_block_bytes, reg->hr_fs_block_bits);
-	hbprintk("fs_start_block = %llu\n", reg->hr_fs_start_block);
-	hbprintk("hr_start_block = %llu, hr_blocks = %u\n",
-		 reg->hr_start_block, reg->hr_blocks);
-	hbprintk("hb block bytes = %u, hb block bits = %u\n",
-		 reg->hr_hb_block_bytes, reg->hr_hb_block_bits);
+	mlog(ML_HEARTBEAT, "fs_block_bytes = %u, fs_block_bits = %u\n",
+	     reg->hr_fs_block_bytes, reg->hr_fs_block_bits);
+	mlog(ML_HEARTBEAT, "fs_start_block = %llu\n", reg->hr_fs_start_block);
+	mlog(ML_HEARTBEAT, "hr_start_block = %llu, hr_blocks = %u\n",
+	     reg->hr_start_block, reg->hr_blocks);
+	mlog(ML_HEARTBEAT, "hb block bytes = %u, hb block bits = %u\n",
+	     reg->hr_hb_block_bytes, reg->hr_hb_block_bits);
 }
 
 static int hb_map_slot_data(struct hb_region *reg)
@@ -998,7 +980,7 @@
 	reg->hr_slots = kcalloc(reg->hr_blocks,
 				sizeof(struct hb_disk_slot), GFP_KERNEL);
 	if (reg->hr_slots == NULL) {
-		hbprintk("%d\n", -ENOMEM);
+		mlog_errno(-ENOMEM);
 		return -ENOMEM;
 	}
 
@@ -1010,21 +992,20 @@
 	}
 
 	reg->hr_num_pages = (reg->hr_blocks + spp - 1) / spp;
-	hbprintk("Going to require %u pages to cover %u blocks at %u "
-		 "blocks per page\n", reg->hr_num_pages, reg->hr_blocks,
-		 spp);
+	mlog(ML_HEARTBEAT, "Going to require %u pages to cover %u blocks at %u blocks "
+	     "per page\n", reg->hr_num_pages, reg->hr_blocks, spp);
 
 	reg->hr_slot_data = kcalloc(reg->hr_num_pages, sizeof(struct page *),
 				    GFP_KERNEL);
 	if (!reg->hr_slot_data) {
-		hbprintk("%d\n", -ENOMEM);
+		mlog_errno(-ENOMEM);
 		return -ENOMEM;
 	}
 
 	for(i = 0; i < reg->hr_num_pages; i++) {
 		page = alloc_page(GFP_KERNEL);
 		if (!page) {
-			hbprintk("%d\n", -ENOMEM);
+			mlog_errno(-ENOMEM);
 			return -ENOMEM;
 		}
 
@@ -1096,7 +1077,7 @@
 
 	ret = hb_map_slot_data(reg);
 	if (ret) {
-		hbprintk("Error %ld initializing slot data\n", (long) ret);
+		mlog_errno(ret);
 		goto out;
 	}
 
@@ -1373,15 +1354,15 @@
 	/* if this node was set then we have networking */
 	node_num = nm_this_node();
 	if (node_num == NM_MAX_NODES) {
-		hbprintk("this node has not been configured.\n");
+		mlog(ML_HEARTBEAT, "this node has not been configured.\n");
 		return 0;
 	}
 
 	hb_fill_node_map(testing_map, sizeof(testing_map));
 
 	if (!test_bit(node_num, testing_map)) {
-		hbprintk("this node (%u) does not have heartbeating enabled.",
-			 node_num);
+		mlog(ML_HEARTBEAT, "this node (%u) does not have heartbeating "
+		     "enabled.\n", node_num);
 		return 0;
 	}
 

Modified: trunk/fs/ocfs2/cluster/masklog.c
===================================================================
--- trunk/fs/ocfs2/cluster/masklog.c	2005-04-22 08:22:25 UTC (rev 2163)
+++ trunk/fs/ocfs2/cluster/masklog.c	2005-04-22 18:32:35 UTC (rev 2164)
@@ -168,6 +168,9 @@
 	set_a_string(MSG);
 	set_a_string(SOCKET);
 	set_a_string(AIO);
+	set_a_string(HEARTBEAT);
+	set_a_string(HB_BIO);
+	set_a_string(DLMFS);
 	set_a_string(ERROR);
 	set_a_string(NOTICE);
 	set_a_string(KTHREAD);

Modified: trunk/fs/ocfs2/cluster/masklog.h
===================================================================
--- trunk/fs/ocfs2/cluster/masklog.h	2005-04-22 08:22:25 UTC (rev 2163)
+++ trunk/fs/ocfs2/cluster/masklog.h	2005-04-22 18:32:35 UTC (rev 2164)
@@ -79,12 +79,16 @@
  */
 
 /* bits that are frequently given and infrequently matched in the low word */
+/* NOTE: If you add a flag, you need to also update mlog.c! */
 #define ML_ENTRY	0x0000000000000001ULL /* func call entry */
 #define ML_EXIT		0x0000000000000002ULL /* func call exit */
 #define ML_TCP		0x0000000000000004ULL /* cluster/tcp.c */
 #define ML_MSG		0x0000000000000008ULL /* network messages */
 #define ML_SOCKET	0x0000000000000010ULL /* socket lifetime */
 #define ML_AIO		0x0000000000000020ULL /* aio read and write */
+#define ML_HEARTBEAT    0x0000000000000040ULL /* cluster heartbeat */
+#define ML_HB_BIO	0x0000000000000080ULL /* heartbaet io tracing */
+#define ML_DLMFS	0x0000000000000100ULL /* ocfs2_dlmfs */
 /* bits that are infrequently given and frequently matched in the high word */
 #define ML_ERROR	0x0000000100000000ULL /* sent to KERN_ERR */
 #define ML_NOTICE	0x0000000200000000ULL /* setn to KERN_NOTICE */
@@ -136,7 +140,7 @@
 #endif
 
 #define __mlog_printk(level, fmt, args...)				\
-	printk(level "(%u,%u)"__FILE__":%s:%d " fmt, current->pid,	\
+	printk(level "(%u,%u):%s:%d " fmt, current->pid,	\
 	       smp_processor_id(), __PRETTY_FUNCTION__, __LINE__, ##args)
 
 #define mlog(mask, fmt, args...) do {					\
@@ -146,10 +150,15 @@
 			__mlog_printk(KERN_ERR, "ERROR: "fmt, ##args);	\
 		else if (__m & ML_NOTICE)				\
 			__mlog_printk(KERN_NOTICE, fmt, ##args);	\
-		else __mlog_printk(KERN_DEBUG, fmt, ##args);		\
+		else __mlog_printk(KERN_INFO, fmt, ##args);		\
 	}								\
 } while (0)
 
+#define mlog_errno(st) do {						\
+	if ((st) != -ERESTARTSYS && (st) != -EINTR)			\
+		mlog(ML_ERROR, "status = %lld\n", (long long)(st));	\
+} while (0)
+
 #include <linux/proc_fs.h>
 int mlog_init_proc(struct proc_dir_entry *parent);
 void mlog_remove_proc(struct proc_dir_entry *parent);

Modified: trunk/fs/ocfs2/dlm/dlmfs.c
===================================================================
--- trunk/fs/ocfs2/dlm/dlmfs.c	2005-04-22 08:22:25 UTC (rev 2163)
+++ trunk/fs/ocfs2/dlm/dlmfs.c	2005-04-22 18:32:35 UTC (rev 2164)
@@ -50,6 +50,9 @@
 
 #include "dlmfsver.h"
 
+#define MLOG_MASK_PREFIX ML_DLMFS
+#include "cluster/masklog.h"
+
 static struct super_operations dlmfs_ops;
 static struct file_operations dlmfs_file_operations;
 static struct inode_operations dlmfs_dir_inode_operations;
@@ -96,7 +99,7 @@
 	if (S_ISDIR(inode->i_mode))
 		BUG();
 
-	dprintk("open called on inode %lu, flags 0x%x\n", inode->i_ino,
+	mlog(0, "open called on inode %lu, flags 0x%x\n", inode->i_ino,
 		file->f_flags);
 
 	status = dlmfs_decode_open_flags(file->f_flags, &level, &flags);
@@ -144,7 +147,7 @@
 	if (S_ISDIR(inode->i_mode))
 		BUG();
 
-	dprintk("close called on inode %lu\n", inode->i_ino);
+	mlog(0, "close called on inode %lu\n", inode->i_ino);
 
 	status = 0;
 	if (fp) {
@@ -169,7 +172,7 @@
 	char *lvb_buf;
 	struct inode *inode = filp->f_dentry->d_inode;
 
-	dprintk("inode %lu, count = %zu, *ppos = %llu\n",
+	mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
 		inode->i_ino, count, *ppos);
 
 	if (*ppos >= i_size_read(inode))
@@ -199,7 +202,7 @@
 
 	*ppos = *ppos + readlen;
 
-	dprintk("read %zd bytes\n", readlen);
+	mlog(0, "read %zd bytes\n", readlen);
 	return readlen;
 }
 
@@ -213,7 +216,7 @@
 	char *lvb_buf;
 	struct inode *inode = filp->f_dentry->d_inode;
 
-	dprintk("inode %lu, count = %zu, *ppos = %llu\n",
+	mlog(0, "inode %lu, count = %zu, *ppos = %llu\n",
 		inode->i_ino, count, *ppos);
 
 	if (*ppos >= i_size_read(inode))
@@ -243,7 +246,7 @@
 	kfree(lvb_buf);
 
 	*ppos = *ppos + writelen;
-	dprintk("wrote %zd bytes\n", writelen);
+	mlog(0, "wrote %zd bytes\n", writelen);
 	return writelen;
 }
 
@@ -287,20 +290,19 @@
 	if (!inode)
 		return;
 
-	dprintk("inode %lu\n", inode->i_ino);
+	mlog(0, "inode %lu\n", inode->i_ino);
 
 	ip = DLMFS_I(inode);
 
 	if (S_ISREG(inode->i_mode)) {
 		status = user_dlm_destroy_lock(&ip->ip_lockres);
 		if (status < 0)
-			err_printk("status return of %d from "
-				   "user_dlm_destroy_lock!", status);
+			mlog_errno(status);
 		iput(ip->ip_parent);
 		goto clear_fields;
 	}
 
-	dprintk("we're a directory, ip->ip_dlm = 0x%p\n", ip->ip_dlm);
+	mlog(0, "we're a directory, ip->ip_dlm = 0x%p\n", ip->ip_dlm);
 	/* we must be a directory. If required, lets unregister the
 	 * dlm context now. */
 	if (ip->ip_dlm)
@@ -435,20 +437,19 @@
 	struct qstr *domain = &dentry->d_name;
 	struct dlmfs_inode_private *ip;
 
-	dprintk("mkdir %.*s\n", domain->len, domain->name);
+	mlog(0, "mkdir %.*s\n", domain->len, domain->name);
 
 	/* verify that we have a proper domain */
 	if (domain->len >= NM_MAX_NAME_LEN) {
 		status = -EINVAL;
-		err_printk("invalid domain name for directory.\n");
+		mlog(ML_ERROR, "invalid domain name for directory.\n");
 		goto bail;
 	}
 
 	inode = dlmfs_get_inode(dir, dentry, mode | S_IFDIR);
 	if (!inode) {
 		status = -ENOMEM;
-		err_printk("status %d returning from dlmfs_get_inode\n",
-			   status);
+		mlog_errno(status);
 		goto bail;
 	}
 
@@ -457,8 +458,8 @@
 	ip->ip_dlm = user_dlm_register_context(domain);
 	if (!ip->ip_dlm) {
 		status = -ENOMEM;
-		err_printk("could not register domain \"%.*s\"\n",
-			   domain->len, domain->name);
+		mlog(ML_ERROR, "could not register domain \"%.*s\"\n",
+		     domain->len, domain->name);
 		goto bail;
 	}
 
@@ -488,21 +489,22 @@
 	struct inode *inode;
 	struct qstr *name = &dentry->d_name;
 
-	dprintk("create %.*s\n", name->len, name->name);
+	mlog(0, "create %.*s\n", name->len, name->name);
 
 	/* verify name is valid and doesn't contain any dlm reserved
 	 * characters */
 	if (name->len >= USER_DLM_LOCK_ID_MAX_LEN ||
 	    name->name[0] == '$') {
 		status = -EINVAL;
-		err_printk("invalid lock name, %.*s\n", name->len, name->name);
+		mlog(ML_ERROR, "invalid lock name, %.*s\n", name->len,
+		     name->name);
 		goto bail;
 	}
 
 	inode = dlmfs_get_inode(dir, dentry, mode | S_IFREG);
 	if (!inode) {
 		status = -ENOMEM;
-		err_printk("could not get inode!\n");
+		mlog_errno(status);
 		goto bail;
 	}
 
@@ -518,14 +520,14 @@
 	int status;
 	struct inode *inode = dentry->d_inode;
 
-	dprintk("unlink inode %lu\n", inode->i_ino);
+	mlog(0, "unlink inode %lu\n", inode->i_ino);
 
 	/* if there are no current holders, or none that are waiting
 	 * to acquire a lock, this basically destroys our lockres. */
 	status = user_dlm_destroy_lock(&DLMFS_I(inode)->ip_lockres);
 	if (status < 0) {
-		err_printk("unlink %.*s, error %d from destroy\n",
-			   dentry->d_name.len, dentry->d_name.name, status);
+		mlog(ML_ERROR, "unlink %.*s, error %d from destroy\n",
+		     dentry->d_name.len, dentry->d_name.name, status);
 		goto bail;
 	}
 	status = simple_unlink(dir, dentry);

Modified: trunk/fs/ocfs2/dlm/userdlm.c
===================================================================
--- trunk/fs/ocfs2/dlm/userdlm.c	2005-04-22 08:22:25 UTC (rev 2163)
+++ trunk/fs/ocfs2/dlm/userdlm.c	2005-04-22 18:32:35 UTC (rev 2164)
@@ -44,6 +44,9 @@
 
 #include "userdlm.h"
 
+#define MLOG_MASK_PREFIX ML_DLMFS
+#include "cluster/masklog.h"
+
 static inline int user_check_wait_flag(struct user_lock_res *lockres,
 				       int flag)
 {
@@ -119,14 +122,14 @@
 	struct user_lock_res *lockres = opaque;
 	dlm_lockstatus *lksb;
 
-	dprintk("AST fired for lockres %s\n", lockres->l_name);
+	mlog(0, "AST fired for lockres %s\n", lockres->l_name);
 
 	spin_lock(&lockres->l_lock);
 
 	lksb = &(lockres->l_lksb);
 	if (lksb->status != DLM_NORMAL) {
-		err_printk("lksb status value of %u "
-			   "on lockres %s\n", lksb->status, lockres->l_name);
+		mlog(ML_ERROR, "lksb status value of %u on lockres %s\n",
+		     lksb->status, lockres->l_name);
 		spin_unlock(&lockres->l_lock);
 		return;
 	}
@@ -201,7 +204,7 @@
 {
 	struct user_lock_res *lockres = opaque;
 
-	dprintk("Blocking AST fired for lockres %s. Blocking level %d\n",
+	mlog(0, "Blocking AST fired for lockres %s. Blocking level %d\n",
 		lockres->l_name, level);
 
 	spin_lock(&lockres->l_lock);
@@ -219,10 +222,10 @@
 {
 	struct user_lock_res *lockres = opaque;
 
-	dprintk("UNLOCK AST called on lock %s\n", lockres->l_name);
+	mlog(0, "UNLOCK AST called on lock %s\n", lockres->l_name);
 
 	if (status != DLM_NORMAL)
-		err_printk("Dlm returns status %d\n", status);
+		mlog(ML_ERROR, "Dlm returns status %d\n", status);
 
 	spin_lock(&lockres->l_lock);
 	if (lockres->l_flags & USER_LOCK_IN_TEARDOWN)
@@ -256,7 +259,7 @@
 	struct user_lock_res *lockres = (struct user_lock_res *) opaque;
 	dlm_ctxt *dlm = dlm_ctxt_from_user_lockres(lockres);
 
-	dprintk("processing lockres %s\n", lockres->l_name);
+	mlog(0, "processing lockres %s\n", lockres->l_name);
 
 	spin_lock(&lockres->l_lock);
 
@@ -268,13 +271,13 @@
 	lockres->l_flags &= ~USER_LOCK_QUEUED;
 
 	if (lockres->l_flags & USER_LOCK_IN_TEARDOWN) {
-		dprintk("lock is in teardown so we do nothing\n");
+		mlog(0, "lock is in teardown so we do nothing\n");
 		spin_unlock(&lockres->l_lock);
 		goto drop_ref;
 	}
 
 	if (lockres->l_flags & USER_LOCK_BUSY) {
-		dprintk("BUSY flag detected...\n");
+		mlog(0, "BUSY flag detected...\n");
 		if (lockres->l_flags & USER_LOCK_IN_CANCEL) {
 			spin_unlock(&lockres->l_lock);
 			goto drop_ref;
@@ -296,7 +299,7 @@
 			lockres->l_flags &= ~USER_LOCK_IN_CANCEL;
 			spin_unlock(&lockres->l_lock);
 		} else if (status != DLM_NORMAL)
-			err_printk("Dlm returns %d\n", status);
+			mlog(ML_ERROR, "Dlm returns %d\n", status);
 		goto drop_ref;
 	}
 
@@ -306,7 +309,7 @@
 	if ((lockres->l_blocking == LKM_EXMODE)
 	    && (lockres->l_ex_holders || lockres->l_ro_holders)) {
 		spin_unlock(&lockres->l_lock);
-		dprintk("can't downconvert for ex: ro = %u, ex = %u\n",
+		mlog(0, "can't downconvert for ex: ro = %u, ex = %u\n",
 			lockres->l_ro_holders, lockres->l_ex_holders);
 		goto drop_ref;
 	}
@@ -314,7 +317,7 @@
 	if ((lockres->l_blocking == LKM_PRMODE)
 	    && lockres->l_ex_holders) {
 		spin_unlock(&lockres->l_lock);
-		dprintk("can't downconvert for pr: ex = %u\n",
+		mlog(0, "can't downconvert for pr: ex = %u\n",
 			lockres->l_ex_holders);
 		goto drop_ref;
 	}
@@ -323,7 +326,7 @@
 	new_level = user_highest_compat_lock_level(lockres->l_blocking);
 	lockres->l_requested = new_level;
 	lockres->l_flags |= USER_LOCK_BUSY;
-	dprintk("Downconvert lock from %d to %d\n",
+	mlog(0, "Downconvert lock from %d to %d\n",
 		lockres->l_level, new_level);
 	spin_unlock(&lockres->l_lock);
 
@@ -337,7 +340,7 @@
 			 lockres,
 			 user_bast);
 	if (status != DLM_NORMAL) {
-		err_printk("Dlm returns %d\n", status);
+		mlog(ML_ERROR, "Dlm returns %d\n", status);
 		user_recover_from_dlm_error(lockres);
 	}
 
@@ -381,12 +384,13 @@
 
 	if (level != LKM_EXMODE &&
 	    level != LKM_PRMODE) {
-		err_printk("lockres %s: invalid request!\n", lockres->l_name);
+		mlog(ML_ERROR, "lockres %s: invalid request!\n",
+		     lockres->l_name);
 		status = -EINVAL;
 		goto bail;
 	}
 
-	dprintk("lockres %s: asking for %s lock, passed flags = 0x%x\n",
+	mlog(0, "lockres %s: asking for %s lock, passed flags = 0x%x\n",
 		lockres->l_name,
 		(level == LKM_EXMODE) ? "LKM_EXMODE" : "LKM_PRMODE",
 		lkm_flags);
@@ -434,7 +438,7 @@
 		BUG_ON(level == LKM_IVMODE);
 		BUG_ON(level == LKM_NLMODE);
 
-		dprintk("lock %s, get lock from %d to level = %d\n",
+		mlog(0, "lock %s, get lock from %d to level = %d\n",
 			lockres->l_name, lockres->l_level, level);
 
 		/* call dlm_lock to upgrade lock now */
@@ -451,14 +455,14 @@
 			    (status == DLM_NOTQUEUED))
 				status = -EAGAIN;
 			else {
-				err_printk("Dlm returns %d\n", status);
+				mlog(ML_ERROR, "Dlm returns %d\n", status);
 				status = -ENOENT;
 			}
 			user_recover_from_dlm_error(lockres);
 			goto bail;
 		}
 
-		dprintk("lock %s, successfull return from dlmlock\n",
+		mlog(0, "lock %s, successfull return from dlmlock\n",
 			lockres->l_name);
 
 		user_wait_on_busy_lock(lockres);
@@ -468,7 +472,7 @@
 	user_dlm_inc_holders(lockres, level);
 	spin_unlock(&lockres->l_lock);
 
-	dprintk("lockres %s: Got %s lock!\n", lockres->l_name,
+	mlog(0, "lockres %s: Got %s lock!\n", lockres->l_name,
 		(level == LKM_EXMODE) ? "LKM_EXMODE" : "LKM_PRMODE");
 
 	status = 0;
@@ -498,11 +502,11 @@
 {
 	if (level != LKM_EXMODE &&
 	    level != LKM_PRMODE) {
-		err_printk("lockres %s: invalid request!\n", lockres->l_name);
+		mlog(ML_ERROR, "lockres %s: invalid request!\n", lockres->l_name);
 		return;
 	}
 
-	dprintk("lockres %s: dropping %s lock\n", lockres->l_name,
+	mlog(0, "lockres %s: dropping %s lock\n", lockres->l_name,
 		(level == LKM_EXMODE) ? "LKM_EXMODE" : "LKM_PRMODE");
 
 	spin_lock(&lockres->l_lock);
@@ -569,13 +573,13 @@
 	int status = -EBUSY;
 	dlm_ctxt *dlm = dlm_ctxt_from_user_lockres(lockres);
 
-	dprintk("asked to destroy %s\n", lockres->l_name);
+	mlog(0, "asked to destroy %s\n", lockres->l_name);
 
 	spin_lock(&lockres->l_lock);
 	while (lockres->l_flags & USER_LOCK_BUSY) {
 		spin_unlock(&lockres->l_lock);
 
-		dprintk("lock %s is busy\n", lockres->l_name);
+		mlog(0, "lock %s is busy\n", lockres->l_name);
 
 		user_wait_on_busy_lock(lockres);
 
@@ -584,14 +588,14 @@
 
 	if (lockres->l_ro_holders || lockres->l_ex_holders) {
 		spin_unlock(&lockres->l_lock);
-		dprintk("lock %s has holders\n", lockres->l_name);
+		mlog(0, "lock %s has holders\n", lockres->l_name);
 		goto bail;
 	}
 
 	status = 0;
 	if (!(lockres->l_flags & USER_LOCK_ATTACHED)) {
 		spin_unlock(&lockres->l_lock);
-		dprintk("lock %s is not attached\n", lockres->l_name);
+		mlog(0, "lock %s is not attached\n", lockres->l_name);
 		goto bail;
 	}
 
@@ -600,14 +604,14 @@
 	lockres->l_flags |= USER_LOCK_IN_TEARDOWN;
 	spin_unlock(&lockres->l_lock);
 
-	dprintk("unlocking lockres %s\n", lockres->l_name);
+	mlog(0, "unlocking lockres %s\n", lockres->l_name);
 	status = dlmunlock(dlm,
 			   &lockres->l_lksb,
 			   LKM_VALBLK,
 			   user_unlock_ast,
 			   lockres);
 	if (status != DLM_NORMAL) {
-		err_printk("dlm returns %d!\n", status);
+		mlog(ML_ERROR, "dlm returns %d!\n", status);
 		status = -EINVAL;
 		goto bail;
 	}
@@ -627,7 +631,7 @@
 
 	domain = kmalloc(name->len + 1, GFP_KERNEL);
 	if (!domain) {
-		err_printk("Out of memory\n");
+		mlog_errno(-ENOMEM);
 		return NULL;
 	}
 

Modified: trunk/fs/ocfs2/dlm/userdlm.h
===================================================================
--- trunk/fs/ocfs2/dlm/userdlm.h	2005-04-22 08:22:25 UTC (rev 2163)
+++ trunk/fs/ocfs2/dlm/userdlm.h	2005-04-22 18:32:35 UTC (rev 2164)
@@ -34,22 +34,6 @@
 
 #include "dlmfs_compat.h"
 
-#define DEBUG_TRACING
-
-#define err_printk(str, args...)					      \
-	printk(KERN_ERR "(%d) %s:%d " str, current->pid, __FUNCTION__, __LINE__, ##args)
-#define err_printk0(str)						      \
-	printk(KERN_ERR "(%d) %s:%d " str, current->pid, __FUNCTION__, __LINE__)
-#ifdef DEBUG_TRACING
-#define dprintk(str, args...)						      \
-	printk("(%d) %s:%d " str, current->pid, __FUNCTION__, __LINE__, ##args)
-#define dprintk0(str)							      \
-	printk("(%d) %s:%d " str, current->pid, __FUNCTION__, __LINE__)
-#else
-#define dprintk(str, args...)
-#define dprintk0(str)
-#endif
-
 /* user_lock_res->l_flags flags. */
 #define USER_LOCK_ATTACHED      (0x00000001) /* have we initialized
 					       * the lvb */



More information about the Ocfs2-commits mailing list