[Ocfs2-commits] manish commits r1181 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Jun 21 22:40:18 CDT 2004


Author: manish
Date: 2004-06-21 21:40:16 -0500 (Mon, 21 Jun 2004)
New Revision: 1181

Modified:
   trunk/src/dcache.c
   trunk/src/dir.c
   trunk/src/file.c
   trunk/src/inode.c
   trunk/src/ioctl.c
   trunk/src/namei.c
   trunk/src/ocfs_log.h
   trunk/src/super.c
   trunk/src/symlink.c
Log:
Evil tracing base functionality (untested)


Modified: trunk/src/dcache.c
===================================================================
--- trunk/src/dcache.c	2004-06-22 01:57:20 UTC (rev 1180)
+++ trunk/src/dcache.c	2004-06-22 02:40:16 UTC (rev 1181)
@@ -50,6 +50,8 @@
 	int ret = 0;    /* if all else fails, just return false */
 	ocfs_super *osb;
 
+	LOG_SET_CONTEXT(D_REVALIDATE);
+
 	LOG_ENTRY_ARGS ("(0x%p, %d, '%*s')\n", dentry, flags,
 			dentry->d_name.len, dentry->d_name.name);
 
@@ -90,8 +92,9 @@
 	atomic_set(&OCFS_I(inode)->ip_needs_verification, 1);
 
 bail:
+	LOG_EXIT_INT (ret);
 
-	LOG_EXIT_INT (ret);
+	LOG_CLEAR_CONTEXT();
 	return ret;
 }
 

Modified: trunk/src/dir.c
===================================================================
--- trunk/src/dir.c	2004-06-22 01:57:20 UTC (rev 1180)
+++ trunk/src/dir.c	2004-06-22 02:40:16 UTC (rev 1181)
@@ -79,6 +79,8 @@
 	struct super_block * sb = inode->i_sb;
 	int we_are_brown = 0;
 
+	LOG_SET_CONTEXT(READDIR);
+
 	LOG_ENTRY_ARGS("dirino=%llu\n", GET_INODE_FEOFF(inode));
 
 	stored = 0;
@@ -184,6 +186,8 @@
 	update_atime(inode);
 #endif
 	LOG_EXIT_STATUS(0);
+
+	LOG_CLEAR_CONTEXT();
 	return 0;
 }
 

Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c	2004-06-22 01:57:20 UTC (rev 1180)
+++ trunk/src/file.c	2004-06-22 02:40:16 UTC (rev 1181)
@@ -341,6 +341,8 @@
 	int last_close = 0;
 	int dec = 0;
 
+	LOG_SET_CONTEXT(RELEASE);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, '%*s')\n", inode, file,
 			file->f_dentry->d_name.len, file->f_dentry->d_name.name);
 
@@ -407,6 +409,8 @@
 		iput(inode);
 
 	LOG_EXIT_INT (0);
+
+	LOG_CLEAR_CONTEXT();
 	return 0;
 }				/* ocfs_file_release */
 
@@ -522,11 +526,15 @@
 {
 	int err = 0;
 
+	LOG_SET_CONTEXT(FLUSH);
+
 	LOG_ENTRY_ARGS ("(0x%p, '%*s')\n", file,
 			file->f_dentry->d_name.len, file->f_dentry->d_name.name);
 
 	err = ocfs_sync_inode(file->f_dentry->d_inode);
 	LOG_EXIT_STATUS (err);
+
+	LOG_CLEAR_CONTEXT();
 	return (err < 0) ? -EIO : 0;
 }				/* ocfs_flush */
 
@@ -542,6 +550,8 @@
 	struct inode *inode = dentry->d_inode;
 	ocfs_super *osb = OCFS_SB(inode->i_sb);
 
+	LOG_SET_CONTEXT(FSYNC);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, %d, '%*s')\n", file, dentry, datasync,
 			dentry->d_name.len, dentry->d_name.name);
 
@@ -554,6 +564,8 @@
 
 bail:
 	LOG_EXIT_STATUS (err);
+
+	LOG_CLEAR_CONTEXT();
 	return (err < 0) ? -EIO : 0;
 }				/* ocfs_sync_file */
 
@@ -670,7 +682,7 @@
 
 /*
  * ocfs_file_write()
- * Linux 2.5 TODO: Remove all O_DIRECT conditionals here, they are no longer
+ * Linux 2.6 TODO: Remove all O_DIRECT conditionals here, they are no longer
  * needed.
  */
 static ssize_t ocfs_file_write(struct file *filp, const char *buf,
@@ -685,6 +697,8 @@
 	struct super_block *sb = inode->i_sb;
 	int needs_trunc = 0;
 
+	LOG_SET_CONTEXT(WRITE);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, %u, '%*s')\n", filp, buf,
 			(unsigned int)count,
 			filp->f_dentry->d_name.len, filp->f_dentry->d_name.name);
@@ -828,12 +842,14 @@
 	}
 
 	LOG_EXIT_INT (ret);
+
+	LOG_CLEAR_CONTEXT();
 	return ret;
 }				/* ocfs_file_write */
 
 /*
  * ocfs_file_read()
- * Linux 2.5 TODO: Remove all O_DIRECT conditionals here, they are no longer
+ * Linux 2.6 TODO: Remove all O_DIRECT conditionals here, they are no longer
  * needed.
  */
 static ssize_t ocfs_file_read(struct file *filp, char *buf,
@@ -844,6 +860,8 @@
 	struct inode *inode = filp->f_dentry->d_inode;
 	int status = 0, needs_trunc = 0;
 
+	LOG_SET_CONTEXT(READ);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, %u, '%*s')\n", filp, buf,
 			(unsigned int)count,
 			filp->f_dentry->d_name.len, filp->f_dentry->d_name.name);
@@ -900,6 +918,8 @@
 
 bail:
 	LOG_EXIT_INT (ret);
+
+	LOG_CLEAR_CONTEXT();
 	return ret;
 }				/* ocfs_file_read */
 
@@ -1074,10 +1094,10 @@
 {
 	int status = 0;
 	int tmpstat;
-	ocfs2_dinode *fe = NULL;
+	ocfs2_dinode *fe;
 	__u64 tempOffset = 0;
 	__u64 current_alloc;
-	__u64 alloc_size = 0;
+	__u64 alloc_size;
 	__u64 bitmapOffset = 0;
 	__u64 numClustersAlloc = 0;
 	__u32 lockFlags = 0;
@@ -1378,6 +1398,8 @@
 	int extended = 0;
 	int needs_trunc = 0;
 
+	LOG_SET_CONTEXT(SETATTR);
+
 	LOG_ENTRY_ARGS ("(0x%p, '%*s')\n", dentry,
 			dentry->d_name.len, dentry->d_name.name);
 
@@ -1484,6 +1506,8 @@
 	up_write(&OCFS_I(inode)->ip_io_sem);
 
 	LOG_EXIT_INT (error);
+
+	LOG_CLEAR_CONTEXT();
 	return error;
 }				/* ocfs_setattr */
 
@@ -1499,6 +1523,8 @@
 	ocfs_super *osb = sb->s_fs_info;
 	int err;
 
+	LOG_SET_CONTEXT(GETATTR);
+
 	LOG_ENTRY();
 
 	err = ocfs_inode_revalidate(dentry);
@@ -1515,6 +1541,8 @@
 
 bail:
 	LOG_EXIT_INT (err);
+
+	LOG_CLEAR_CONTEXT();
 	return err;
 }
 #endif

Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c	2004-06-22 01:57:20 UTC (rev 1180)
+++ trunk/src/inode.c	2004-06-22 02:40:16 UTC (rev 1181)
@@ -148,8 +148,8 @@
 };
 
 struct inode_operations ocfs_symlink_inode_operations = {
-	readlink:       page_readlink,
-	follow_link:    ocfs_follow_link,
+	.readlink = page_readlink,
+	.follow_link = ocfs_follow_link,
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 	.revalidate = ocfs_inode_revalidate,
 #endif
@@ -309,12 +309,16 @@
 
 void ocfs_read_inode2(struct inode *inode, void *opaque)
 {
+	LOG_SET_CONTEXT(READ_INODE2);
 	ocfs_read_locked_inode(inode, opaque);
+	LOG_CLEAR_CONTEXT();
 }
 
 void ocfs_read_inode(struct inode *inode)
 {
+	LOG_SET_CONTEXT(READ_INODE);
 	make_bad_inode(inode);
+	LOG_CLEAR_CONTEXT();
 }
 
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */
@@ -547,10 +551,14 @@
 {
 	ocfs_super *osb;
 
+	LOG_SET_CONTEXT(PUT_INODE);
+
 	LOG_ENTRY_ARGS ("(0x%p, i_ino=%llu)\n", inode, GET_INODE_FEOFF(inode));
 	LOG_TRACE_ARGS ("put_inode: count=%d\n", atomic_read(&inode->i_count));
 	osb = OCFS_SB(inode->i_sb);
 	LOG_EXIT ();
+
+	LOG_CLEAR_CONTEXT();
 	return;
 }				/* ocfs_put_inode */
 
@@ -580,6 +588,8 @@
 	__u32 lock_flags = FLAG_FILE_DELETE;
 	ocfs2_dinode *fe;
 
+	LOG_SET_CONTEXT(DELETE_INODE);
+
 	LOG_ENTRY_ARGS("(inode->i_ino = %lu)\n", inode->i_ino);
 
 	if (OCFS_I(inode)->ip_flags & OCFS_INODE_SYSTEM_FILE) {
@@ -732,6 +742,9 @@
 	/* we must clear inode. */
 	clear_inode(inode);
 	LOG_EXIT();
+
+	LOG_CLEAR_CONTEXT();
+	return;
 }				/* ocfs_delete_inode */
 
 /*
@@ -743,6 +756,8 @@
 	__u64 offset = 0;
 	ocfs_super *osb;
 
+	LOG_SET_CONTEXT(CLEAR_INODE);
+
 	LOG_ENTRY();
 
 	if (!inode)
@@ -799,6 +814,8 @@
 	}
 
 	LOG_EXIT ();
+
+	LOG_CLEAR_CONTEXT();
 	return;
 }				/* ocfs_clear_inode */
 
@@ -811,11 +828,15 @@
 {
 	int ret;
 
+	LOG_SET_CONTEXT(PREPARE_WRITE);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, %u, %u)\n", file, page, from, to);
 
 	ret = block_prepare_write (page, from, to, ocfs_get_block);
 
 	LOG_EXIT_INT (ret);
+
+	LOG_CLEAR_CONTEXT();
 	return ret;
 }				/* ocfs_prepare_write */
 
@@ -827,11 +848,15 @@
 {
 	int ret;
 
+	LOG_SET_CONTEXT(COMMIT_WRITE);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, %u, %u)\n", file, page, from, to);
 
 	ret = generic_commit_write (file, page, from, to);
 
 	LOG_EXIT_INT (ret);
+
+	LOG_CLEAR_CONTEXT();
 	return ret;
 }				/* ocfs_commit_write */
 
@@ -1132,9 +1157,11 @@
 	__s64 vbo = 0;
 	__s64 lbo = 0;
 	__u32 len;
-	int err = 0;
+	int err = 0, status;
 	struct inode *inode = mapping->host;
 
+	LOG_SET_CONTEXT(BMAP);
+
 	LOG_ENTRY_ARGS("(block = %llu)\n", (unsigned long long)block);
 
 	if (!inode) {
@@ -1165,8 +1192,11 @@
 	disk_block = lbo >> inode->i_sb->s_blocksize_bits;
 
 bail:
-	LOG_EXIT_STATUS(err ? err : disk_block);
-	return(err ? err : disk_block);
+	status = err ? err : disk_block;
+	LOG_EXIT_STATUS(status);
+
+	LOG_CLEAR_CONTEXT();
+	return(status);
 }
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
@@ -1227,11 +1257,15 @@
 {
 	int ret;
 
+	LOG_SET_CONTEXT(READPAGE);
+
 	LOG_ENTRY_ARGS ("(0x%p, %lu)\n", file, (page ? page->index : 0));
 
 	ret = block_read_full_page (page, ocfs_get_block);
 
 	LOG_EXIT_INT (ret);
+
+	LOG_CLEAR_CONTEXT();
 	return ret;
 }				/* ocfs_readpage */
 
@@ -1244,11 +1278,15 @@
 {
 	int ret;
 
+	LOG_SET_CONTEXT(WRITEPAGE);
+
 	LOG_ENTRY_ARGS ("(0x%p)\n", page);
 
 	ret = block_write_full_page (page, ocfs_get_block, wbc);
 
 	LOG_EXIT_INT (ret);
+
+	LOG_CLEAR_CONTEXT();
 	return ret;
 }				/* ocfs_writepage */
 #else
@@ -1256,11 +1294,15 @@
 {
 	int ret;
 
+	LOG_SET_CONTEXT(WRITEPAGE);
+
 	LOG_ENTRY_ARGS ("(0x%p)\n", page);
 
 	ret = block_write_full_page (page, ocfs_get_block);
 
 	LOG_EXIT_INT (ret);
+
+	LOG_CLEAR_CONTEXT();
 	return ret;
 }				/* ocfs_writepage */
 #endif
@@ -1387,12 +1429,16 @@
 	struct inode *inode = file->f_dentry->d_inode->i_mapping->host;
 	int ret;
 
+	LOG_SET_CONTEXT(DIRECT_IO);
+
 	LOG_ENTRY ();
 
 	/* blockdev_direct_IO checks alignment for us, using */
 	ret = blockdev_direct_IO (rw, iocb, inode, inode->i_sb->s_bdev, iov, offset, nr_segs, ocfs_direct_IO_get_blocks, NULL);
 
 	LOG_EXIT_INT (ret);
+
+	LOG_CLEAR_CONTEXT();
 	return ret;
 }				/* ocfs_direct_IO */
 
@@ -1791,12 +1837,26 @@
 
 int ocfs_kvec_read(struct file *file, kvec_cb_t cb, size_t size, loff_t pos) 
 {
-	return ocfs_kvec_rw(file, READ, cb, size, pos);
+	int ret;
+
+	LOG_SET_CONTEXT(KVEC_READ);
+
+	ret = ocfs_kvec_rw(file, READ, cb, size, pos);
+
+	LOG_CLEAR_CONTEXT();
+	return ret;
 }
 
 int ocfs_kvec_write(struct file *file, kvec_cb_t cb, size_t size, loff_t pos) 
 {
-	return ocfs_kvec_rw(file, WRITE, cb, size, pos);
+	int ret;
+
+	LOG_SET_CONTEXT(KVEC_WRITE);
+
+	ret = ocfs_kvec_rw(file, WRITE, cb, size, pos);
+
+	LOG_CLEAR_CONTEXT();
+	return ret;
 }
 #endif
 
@@ -1814,6 +1874,8 @@
 	int needs_trunc;
 	ocfs_super *osb;
 
+	LOG_SET_CONTEXT(REVALIDATE);
+
 	LOG_ENTRY_ARGS("(inode = 0x%p, ino = %llu)\n", inode, 
 		       inode ? GET_INODE_FEOFF(inode) : 0ULL);
 
@@ -1863,8 +1925,9 @@
 		ocfs_truncate_inode_pages(inode, 0);
 
 no_inode:
+	LOG_EXIT_STATUS(status);
 
-	LOG_EXIT_STATUS(status);
+	LOG_CLEAR_CONTEXT();
 	return(status);
 }				/* ocfs_inode_revalidate */
 

Modified: trunk/src/ioctl.c
===================================================================
--- trunk/src/ioctl.c	2004-06-22 01:57:20 UTC (rev 1180)
+++ trunk/src/ioctl.c	2004-06-22 02:40:16 UTC (rev 1181)
@@ -53,6 +53,8 @@
 	extern char *ocfs_version;
 	int ret = 0;
 
+	LOG_SET_CONTEXT(IOCTL);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, %u, %lu)\n", inode, filp, cmd, arg);
 
 	if (_IOC_TYPE (cmd) != OCFS_IOC_MAGIC) {
@@ -78,5 +80,7 @@
 
 exit_ioctl:
 	LOG_EXIT_INT (ret);
+
+	LOG_CLEAR_CONTEXT();
 	return ret;
 }				/* ocfs_ioctl */

Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c	2004-06-22 01:57:20 UTC (rev 1180)
+++ trunk/src/namei.c	2004-06-22 02:40:16 UTC (rev 1181)
@@ -132,6 +132,8 @@
 	ocfs_super *osb = OCFS_SB(sb);
 	struct ocfs2_dir_entry *dirent;
 
+	LOG_SET_CONTEXT(LOOKUP);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, '%*s')\n", dir, dentry,
 			dentry->d_name.len, dentry->d_name.name);
 
@@ -169,6 +171,8 @@
 		brelse(dirent_bh);
 	
 	LOG_EXIT_PTR (ret);
+
+	LOG_CLEAR_CONTEXT();
 	return ret;
 }				/* ocfs_lookup */
 
@@ -184,6 +188,8 @@
 	struct buffer_head *new_fe_bh = NULL;
 	struct inode *inode = NULL;
 
+	LOG_SET_CONTEXT(MKNOD);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, %d, %d, '%*s')\n", dir, dentry, mode,
 			dev, dentry->d_name.len, dentry->d_name.name);
 
@@ -336,6 +342,8 @@
 		iput(inode);
 
 	LOG_EXIT_STATUS(status);
+
+	LOG_CLEAR_CONTEXT();
 	return(status);
 }		/* ocfs_mknod */
 
@@ -484,10 +492,14 @@
 {
 	int ret;
 
+	LOG_SET_CONTEXT(MKDIR);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, %d, '%*s')\n", dir, dentry, mode,
 			dentry->d_name.len, dentry->d_name.name);
 	ret = ocfs_mknod (dir, dentry, mode | S_IFDIR, OCFS_NODEV);
 	LOG_EXIT_INT (ret);
+
+	LOG_CLEAR_CONTEXT();
 	return ret;
 }				/* ocfs_mkdir */
 
@@ -503,10 +515,14 @@
 {
 	int ret;
 
+	LOG_SET_CONTEXT(CREATE);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, %d, '%*s')\n", dir, dentry, mode,
 			dentry->d_name.len, dentry->d_name.name);
 	ret = ocfs_mknod (dir, dentry, mode | S_IFREG, OCFS_NODEV);
 	LOG_EXIT_INT (ret);
+
+	LOG_CLEAR_CONTEXT();
 	return ret;
 }				/* ocfs_create */
 
@@ -529,6 +545,8 @@
 	ocfs_super *osb = OCFS_SB(dir->i_sb);
 	u64 fe_blkno;
 
+	LOG_SET_CONTEXT(LINK);
+
 	LOG_ENTRY_ARGS ("(inode=%lu, old='%*s' new='%*s')\n", 
 			inode->i_ino, old_dentry->d_name.len, 
 			old_dentry->d_name.name, dentry->d_name.len, 
@@ -646,6 +664,8 @@
 		brelse(parent_fe_bh);
 
 	LOG_EXIT_STATUS(err);
+
+	LOG_CLEAR_CONTEXT();
 	return err;
 }				/* ocfs_link */
 
@@ -671,6 +691,8 @@
 	struct ocfs2_dir_entry *dirent = NULL;
 	struct buffer_head *dirent_bh = NULL;
 
+	LOG_SET_CONTEXT(UNLINK);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, '%*s')\n", dir, dentry,
 			dentry->d_name.len, dentry->d_name.name);
 
@@ -865,6 +887,8 @@
 		brelse(parent_node_bh);
 
 	LOG_EXIT_INT (retval);
+
+	LOG_CLEAR_CONTEXT();
 	return retval;
 }				/* ocfs_unlink */
 
@@ -1015,7 +1039,9 @@
 	struct buffer_head *old_inode_de_bh = NULL; // if old_dentry is a dir,
 						    // this is the 1st dirent bh
 	nlink_t old_dir_nlink = old_dir->i_nlink, new_dir_nlink = new_dir->i_nlink;
-	
+
+	LOG_SET_CONTEXT(RENAME);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, 0x%p, 0x%p, from='%*s' to='%*s')\n",
 			old_dir, old_dentry, new_dir, new_dentry,
 			old_dentry->d_name.len, old_dentry->d_name.name,
@@ -1337,6 +1363,8 @@
 		brelse(old_inode_de_bh);
 
 	LOG_EXIT_STATUS(status);
+
+	LOG_CLEAR_CONTEXT();
 	return status;
 }				/* ocfs_rename */
 
@@ -1359,6 +1387,8 @@
 	ocfs_journal_handle *handle = NULL;
 	int got_lock = 0;
 
+	LOG_SET_CONTEXT(SYMLINK);
+
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, symname='%s' actual='%*s')\n", dir, 
 			dentry, symname, dentry->d_name.len, 
 			dentry->d_name.name);
@@ -1479,6 +1509,8 @@
 		brelse(parent_fe_bh);
 
 	LOG_EXIT_STATUS (status);
+
+	LOG_CLEAR_CONTEXT();
 	return status;
 }				/* ocfs_symlink */
 

Modified: trunk/src/ocfs_log.h
===================================================================
--- trunk/src/ocfs_log.h	2004-06-22 01:57:20 UTC (rev 1180)
+++ trunk/src/ocfs_log.h	2004-06-22 02:40:16 UTC (rev 1181)
@@ -33,8 +33,59 @@
 extern __u32 debug_level;
 extern __u32 debug_exclude;
 
+#ifndef TRACE
+#undef EVIL_TRACE
+#endif
 
+#ifdef EVIL_TRACE
+extern __u64 debug_mask;
 
+enum {
+	OCFS_TRACE_CREATE=1,
+	OCFS_TRACE_LOOKUP,
+	OCFS_TRACE_LINK,
+	OCFS_TRACE_UNLINK,
+	/* OCFS_TRACE_RMDIR, */
+	OCFS_TRACE_SYMLINK,
+	OCFS_TRACE_MKDIR,
+	OCFS_TRACE_MKNOD,
+	OCFS_TRACE_RENAME,
+	OCFS_TRACE_SETATTR,
+	OCFS_TRACE_GETATTR,
+	OCFS_TRACE_REVALIDATE,
+	OCFS_TRACE_READPAGE,
+	OCFS_TRACE_WRITEPAGE,
+	OCFS_TRACE_PREPARE_WRITE,
+	OCFS_TRACE_BMAP,
+	OCFS_TRACE_COMMIT_WRITE,
+	OCFS_TRACE_DIRECT_IO,
+	/* OCFS_TRACE_READLINK, */
+	OCFS_TRACE_FOLLOW_LINK,
+	OCFS_TRACE_READ,
+	OCFS_TRACE_WRITE,
+	/* OCFS_TRACE_MMAP, */
+	OCFS_TRACE_FSYNC,
+	OCFS_TRACE_FLUSH,
+	OCFS_TRACE_RELEASE,
+	OCFS_TRACE_IOCTL,
+	OCFS_TRACE_KVEC_READ,
+	OCFS_TRACE_KVEC_WRITE,
+	/* OCFS_TRACE_AIO_READ, */
+	/* OCFS_TRACE_AIO_WRITE, */
+	OCFS_TRACE_READDIR,
+	OCFS_TRACE_D_REVALIDATE,
+	OCFS_TRACE_STATFS,
+	OCFS_TRACE_PUT_INODE,
+	OCFS_TRACE_CLEAR_INODE,
+	OCFS_TRACE_DELETE_INODE,
+	OCFS_TRACE_READ_INODE,
+	OCFS_TRACE_READ_INODE2,
+	OCFS_TRACE_PUT_SUPER,
+};
+#endif
+
+
+
 /* Tracing Levels */
 #define OCFS_DEBUG_LEVEL_ERROR         0x00000001
 #define OCFS_DEBUG_LEVEL_TRACE         0x00000002
@@ -127,12 +178,20 @@
 #endif
 
 /* privately used macros */
-# define IF_LEVEL(level)	\
+# define IF_LEVEL_CONTEXT(level)	\
 	if ((debug_context & OCFS_DEBUG_CONTEXT) && (debug_level & level) && \
 	    current->pid!=debug_exclude)
 # define IF_LEVEL_NO_CONTEXT(level)	\
 	if ((debug_level & level) &&  current->pid!=debug_exclude)
-	
+
+#if defined(EVIL_TRACE)
+# define IF_LEVEL(level)	\
+	if (debug_mask & (1ULL << (current->flags >> 24)))
+#else
+# define IF_LEVEL(level) IF_LEVEL_CONTEXT(level)
+#endif
+
+
 #ifndef OCFS_DBG_TIMING
 # define ENTRY_TIMING_DECLS
 # define GET_TIMING(s, hi, lo)
@@ -140,7 +199,7 @@
 # define ENTRY_TIMING_DECLS    __u32 _HI = 0, _LO = 0
 # define GET_TIMING(s, hi, lo)					\
 	do {							\
-		IF_LEVEL(OCFS_DEBUG_LEVEL_TIMING) {		\
+		IF_LEVEL_CONTEXT(OCFS_DEBUG_LEVEL_TIMING) {	\
 			__u32 _lo, _hi;				\
 			rdtsc (_lo, _hi);			\
 			if ((s) == NULL) {			\
@@ -242,7 +301,7 @@
 		GET_TIMING(NULL, _HI, _LO);				\
 		IF_LEVEL(OCFS_DEBUG_LEVEL_ENTRY) {			\
 			PRINT_ENTRY(_t);				\
-			printk(fmt, ##arg);			\
+			printk(fmt, ##arg);				\
 		}							\
 	} while (0)
 
@@ -263,7 +322,7 @@
 			printk("(%d) EXIT : %s() %s", 			\
 			       current->pid, __FUNCTION__, 		\
 			       (*fmt == '\n' ? "" : "= "));		\
-			if (*fmt != '\n')					\
+			if (*fmt != '\n')				\
 				printk(fmt, ## arg);			\
 			PRINT_STRING(_t);				\
 		}							\
@@ -321,4 +380,12 @@
        		ocfs_show_trace(NULL); \
 	} while (0)
 
+#ifdef EVIL_TRACE
+#define LOG_SET_CONTEXT(ctxt) current->flags |= (OCFS_TRACE_ ## ctxt) << 24
+#define LOG_CLEAR_CONTEXT()   current->flags &= 0xffffff
+#else
+#define LOG_SET_CONTEXT(ctxt)
+#define LOG_CLEAR_CONTEXT()
+#endif
+
 #endif  /* OCFS_LOG_H */

Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c	2004-06-22 01:57:20 UTC (rev 1180)
+++ trunk/src/super.c	2004-06-22 02:40:16 UTC (rev 1181)
@@ -94,6 +94,10 @@
 __u32 comm_voting = 0;
 char *ocfs_hostname;
 
+#ifdef EVIL_TRACE
+__u64 debug_mask = 0;
+#endif
+
 #if 0
 extern ctl_table *ocfs_dbg_table;
 extern ctl_table *ocfs_kern_table;
@@ -681,6 +685,8 @@
  */
 static void ocfs_put_super (struct super_block *sb)
 {
+	LOG_SET_CONTEXT(PUT_SUPER);
+
 	LOG_ENTRY_ARGS ("(0x%p)\n", sb);
 
 	ocfs_sync_blockdev(sb);
@@ -689,6 +695,8 @@
 	MOD_DEC_USE_COUNT;
 #endif
 	LOG_EXIT ();
+
+	LOG_CLEAR_CONTEXT();
 	return;
 }				/* ocfs_put_super */
 
@@ -707,11 +715,13 @@
 	ocfs_super *osb;
 	__u32 numbits, freebits;
 	unsigned int reserved_bits;
-	int status;
+	int status, ret = 0;
 	ocfs2_dinode *bm_lock;
 	struct buffer_head *bh = NULL;
 	struct inode *inode = NULL;
 
+	LOG_SET_CONTEXT(STATFS);
+
 	LOG_ENTRY_ARGS ("(%p, %p)\n", sb, buf);
 
 	osb = OCFS_SB(sb);
@@ -719,15 +729,16 @@
 	inode = ocfs_get_system_file_inode(osb, GLOBAL_BITMAP_SYSTEM_INODE, -1);
 	if (!inode) {
 		LOG_ERROR_STR("failed to get bitmap inode");
-		return -EIO;
+		ret = -EIO;
+		goto bail;
 	}
 
 	status = ocfs_read_bh (osb, GET_INODE_FEOFF(inode), &bh, 
 			       OCFS_BH_CACHED, inode);
 	if (status < 0) {
 		LOG_ERROR_STR("failed to read bitmap data");
-		iput (inode);
-		return -EIO;
+		ret = -EIO;
+		goto bail;
 	}
 
 	bm_lock = (ocfs2_dinode *) bh->b_data;
@@ -768,9 +779,15 @@
 
 	brelse(bh);
 
-	iput (inode);
-	LOG_EXIT_INT (0);
-	return 0;
+
+bail:
+	if (inode)
+		iput (inode);
+
+	LOG_EXIT_INT (ret);
+
+	LOG_CLEAR_CONTEXT();
+	return ret;
 }                               /* ocfs_statfs */
 
 

Modified: trunk/src/symlink.c
===================================================================
--- trunk/src/symlink.c	2004-06-22 01:57:20 UTC (rev 1180)
+++ trunk/src/symlink.c	2004-06-22 02:40:16 UTC (rev 1181)
@@ -188,6 +188,8 @@
 	char *orig_link, *new_link;
 	unsigned int len, res = 0;
 
+	LOG_SET_CONTEXT(FOLLOW_LINK);
+
 	orig_link = my_page_getlink(dentry, &page);
 	len = ocfs_link_size(symlink_ops, orig_link, inode);
 	new_link = kmalloc(len, GFP_KERNEL); 
@@ -202,6 +204,8 @@
 		kunmap(page);
 		page_cache_release(page);
 	}
+
+	LOG_CLEAR_CONTEXT();
 	return res;
 }
 



More information about the Ocfs2-commits mailing list