diff options
Diffstat (limited to 'fs/ocfs2/export.c')
| -rw-r--r-- | fs/ocfs2/export.c | 80 | 
1 files changed, 34 insertions, 46 deletions
diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index 19ad145d2af..29651167190 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c @@ -26,7 +26,6 @@  #include <linux/fs.h>  #include <linux/types.h> -#define MLOG_MASK_PREFIX ML_EXPORT  #include <cluster/masklog.h>  #include "ocfs2.h" @@ -40,6 +39,7 @@  #include "buffer_head_io.h"  #include "suballoc.h" +#include "ocfs2_trace.h"  struct ocfs2_inode_handle  { @@ -56,10 +56,9 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb,  	int status, set;  	struct dentry *result; -	mlog_entry("(0x%p, 0x%p)\n", sb, handle); +	trace_ocfs2_get_dentry_begin(sb, handle, (unsigned long long)blkno);  	if (blkno == 0) { -		mlog(0, "nfs wants inode with blkno: 0\n");  		result = ERR_PTR(-ESTALE);  		goto bail;  	} @@ -83,6 +82,7 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb,  	}  	status = ocfs2_test_inode_bit(osb, blkno, &set); +	trace_ocfs2_get_dentry_test_bit(status, set);  	if (status < 0) {  		if (status == -EINVAL) {  			/* @@ -90,18 +90,14 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb,  			 * as an inode, we return -ESTALE to be  			 * nice  			 */ -			mlog(0, "test inode bit failed %d\n", status);  			status = -ESTALE; -		} else { +		} else  			mlog(ML_ERROR, "test inode bit failed %d\n", status); -		}  		goto unlock_nfs_sync;  	}  	/* If the inode allocator bit is clear, this inode must be stale */  	if (!set) { -		mlog(0, "inode %llu suballoc bit is clear\n", -		     (unsigned long long)blkno);  		status = -ESTALE;  		goto unlock_nfs_sync;  	} @@ -114,8 +110,8 @@ unlock_nfs_sync:  check_err:  	if (status < 0) {  		if (status == -ESTALE) { -			mlog(0, "stale inode ino: %llu generation: %u\n", -			     (unsigned long long)blkno, handle->ih_generation); +			trace_ocfs2_get_dentry_stale((unsigned long long)blkno, +						     handle->ih_generation);  		}  		result = ERR_PTR(status);  		goto bail; @@ -130,20 +126,19 @@ check_err:  check_gen:  	if (handle->ih_generation != inode->i_generation) {  		iput(inode); -		mlog(0, "stale inode ino: %llu generation: %u\n", -		     (unsigned long long)blkno, handle->ih_generation); +		trace_ocfs2_get_dentry_generation((unsigned long long)blkno, +						  handle->ih_generation, +						  inode->i_generation);  		result = ERR_PTR(-ESTALE);  		goto bail;  	}  	result = d_obtain_alias(inode); -	if (!IS_ERR(result)) -		result->d_op = &ocfs2_dentry_ops; -	else +	if (IS_ERR(result))  		mlog_errno(PTR_ERR(result));  bail: -	mlog_exit_ptr(result); +	trace_ocfs2_get_dentry_end(result);  	return result;  } @@ -154,11 +149,8 @@ static struct dentry *ocfs2_get_parent(struct dentry *child)  	struct dentry *parent;  	struct inode *dir = child->d_inode; -	mlog_entry("(0x%p, '%.*s')\n", child, -		   child->d_name.len, child->d_name.name); - -	mlog(0, "find parent of directory %llu\n", -	     (unsigned long long)OCFS2_I(dir)->ip_blkno); +	trace_ocfs2_get_parent(child, child->d_name.len, child->d_name.name, +			       (unsigned long long)OCFS2_I(dir)->ip_blkno);  	status = ocfs2_inode_lock(dir, NULL, 0);  	if (status < 0) { @@ -175,55 +167,53 @@ static struct dentry *ocfs2_get_parent(struct dentry *child)  	}  	parent = d_obtain_alias(ocfs2_iget(OCFS2_SB(dir->i_sb), blkno, 0, 0)); -	if (!IS_ERR(parent)) -		parent->d_op = &ocfs2_dentry_ops;  bail_unlock:  	ocfs2_inode_unlock(dir, 0);  bail: -	mlog_exit_ptr(parent); +	trace_ocfs2_get_parent_end(parent);  	return parent;  } -static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len, -			   int connectable) +static int ocfs2_encode_fh(struct inode *inode, u32 *fh_in, int *max_len, +			   struct inode *parent)  { -	struct inode *inode = dentry->d_inode;  	int len = *max_len;  	int type = 1;  	u64 blkno;  	u32 generation;  	__le32 *fh = (__force __le32 *) fh_in; -	mlog_entry("(0x%p, '%.*s', 0x%p, %d, %d)\n", dentry, -		   dentry->d_name.len, dentry->d_name.name, -		   fh, len, connectable); +#ifdef TRACE_HOOKS_ARE_NOT_BRAINDEAD_IN_YOUR_OPINION +#error "You go ahead and fix that mess, then.  Somehow" +	trace_ocfs2_encode_fh_begin(dentry, dentry->d_name.len, +				    dentry->d_name.name, +				    fh, len, connectable); +#endif -	if (len < 3 || (connectable && len < 6)) { -		mlog(ML_ERROR, "fh buffer is too small for encoding\n"); -		type = 255; +	if (parent && (len < 6)) { +		*max_len = 6; +		type = FILEID_INVALID; +		goto bail; +	} else if (len < 3) { +		*max_len = 3; +		type = FILEID_INVALID;  		goto bail;  	}  	blkno = OCFS2_I(inode)->ip_blkno;  	generation = inode->i_generation; -	mlog(0, "Encoding fh: blkno: %llu, generation: %u\n", -	     (unsigned long long)blkno, generation); +	trace_ocfs2_encode_fh_self((unsigned long long)blkno, generation);  	len = 3;  	fh[0] = cpu_to_le32((u32)(blkno >> 32));  	fh[1] = cpu_to_le32((u32)(blkno & 0xffffffff));  	fh[2] = cpu_to_le32(generation); -	if (connectable && !S_ISDIR(inode->i_mode)) { -		struct inode *parent; - -		spin_lock(&dentry->d_lock); - -		parent = dentry->d_parent->d_inode; +	if (parent) {  		blkno = OCFS2_I(parent)->ip_blkno;  		generation = parent->i_generation; @@ -231,19 +221,17 @@ static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len,  		fh[4] = cpu_to_le32((u32)(blkno & 0xffffffff));  		fh[5] = cpu_to_le32(generation); -		spin_unlock(&dentry->d_lock); -  		len = 6;  		type = 2; -		mlog(0, "Encoding parent: blkno: %llu, generation: %u\n", -		     (unsigned long long)blkno, generation); +		trace_ocfs2_encode_fh_parent((unsigned long long)blkno, +					     generation);  	}  	*max_len = len;  bail: -	mlog_exit(type); +	trace_ocfs2_encode_fh_type(type);  	return type;  }  | 
