[Ocfs2-commits] mfasheh commits r1178 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Jun 21 21:32:23 CDT 2004


Author: mfasheh
Date: 2004-06-21 20:32:21 -0500 (Mon, 21 Jun 2004)
New Revision: 1178

Modified:
   trunk/src/namei.c
Log:
* we were still passing byte offsets into ocfs_add_entry in a couple
  places. Fix that.

* fix a bug in rename of directories

* add some of the LOG_ENTRY / LOG_EXIT junk into a couple places
  lacking it. This helped me track down the rename bug.



Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c	2004-06-22 01:30:28 UTC (rev 1177)
+++ trunk/src/namei.c	2004-06-22 01:32:21 UTC (rev 1178)
@@ -78,7 +78,7 @@
 static int __ocfs_add_entry(ocfs_journal_handle *handle,
 			    struct inode *dir,
 			    const char *name, int namelen, 
-			    struct inode *inode, __u64 inode_off, 
+			    struct inode *inode, u64 blkno, 
 			    struct buffer_head *parent_fe_bh);
 static inline int ocfs_match(int len, const char *const name,
 			     struct ocfs2_dir_entry *de);
@@ -124,7 +124,7 @@
 #endif
 {
 	int status;
-	__u64 fe_off;
+	__u64 fe_off = 0;
 	struct buffer_head *dirent_bh = NULL;
 	struct inode *inode = NULL;
 	struct super_block *sb = dir->i_sb;
@@ -1051,11 +1051,6 @@
 		goto bail;
 	}
 
-	if (OCFS_I(old_inode)->ip_open_cnt != 0) {
-		status = -EBUSY;
-		goto bail;
-	}
-
 	/* start our transaction */
 	handle = ocfs_start_trans(osb, OCFS_FILE_RENAME_CREDITS);
 	if (handle == NULL) {
@@ -1105,8 +1100,10 @@
 		old_inode_de_bh = ocfs_bread (handle, old_inode, 0, 0, &status, 0);
 		if (!old_inode_de_bh)
 			goto finally;
+
+		status = -EIO;
 		if (le64_to_cpu(PARENT_INO(old_inode_de_bh->b_data)) != 
-		    GET_INODE_FEOFF(old_dir))
+		    (GET_INODE_FEOFF(old_dir) >> old_dir->i_sb->s_blocksize_bits))
 			goto finally;
 		status = -EMLINK;
 		if (!new_inode && new_dir!=old_dir &&
@@ -1239,9 +1236,8 @@
 	} else {
 		/* if the name was not found in new_dir, add it now */
 		status = ocfs_add_entry (handle, new_dentry, old_inode, 
-					 oldfe_lockid, new_dir_bh);
+					 oldfe_lockid >> old_inode->i_sb->s_blocksize_bits, new_dir_bh);
 	}
-	
 
 finally:
 	if (status < 0) {
@@ -1536,6 +1532,8 @@
 	int retval, status;
 	ocfs2_dinode *fe = NULL;
 
+	LOG_ENTRY();
+
 	sb = dir->i_sb;
 
 	if (!namelen)
@@ -1624,6 +1622,8 @@
 	retval = -ENOSPC;
 bail:
 	brelse (bh);
+
+	LOG_EXIT_STATUS(retval);
 	return retval;
 }
 
@@ -1637,6 +1637,8 @@
 	struct ocfs2_dir_entry * de, * pde;
 	int i, status = -ENOENT;
 
+	LOG_ENTRY_ARGS("(0x%p, 0x%p, 0x%p, 0x%p)\n", handle, dir, de_del, bh);
+
 	i = 0;
 	pde = NULL;
 	de = (struct ocfs2_dir_entry *) bh->b_data;
@@ -1665,6 +1667,7 @@
 		de = (struct ocfs2_dir_entry *)((char *) de + le16_to_cpu(de->rec_len));
 	}
 bail:
+	LOG_EXIT_STATUS(status);
 	return status;
 }
 
@@ -1682,6 +1685,8 @@
 	int de_len;
 	int ret = 0;
 
+	LOG_ENTRY();
+
 	de = (struct ocfs2_dir_entry *) bh->b_data;
 	dlimit = (char *)de + dir->i_sb->s_blocksize;
 	while ((char *) de < dlimit) {
@@ -1709,6 +1714,8 @@
 		de = (struct ocfs2_dir_entry *) ((char *) de + de_len);
 	}
 bail:
+
+	LOG_EXIT_STATUS(ret);
 	return ret;
 }
 
@@ -1729,6 +1736,8 @@
 	int num = 0;
 	int nblocks, i, err;
 
+	LOG_ENTRY();
+
 	*res_dir = NULL;
 	sb = dir->i_sb;
 
@@ -1806,6 +1815,8 @@
 	/* Clean up the read-ahead blocks */
 	for (; ra_ptr < ra_max; ra_ptr++)
 		brelse (bh_use[ra_ptr]);
+
+	LOG_EXIT_PTR(ret);
 	return ret;
 }
 
@@ -1868,7 +1879,7 @@
 			     orphan_dir_inode, 1);
 
 	status = __ocfs_add_entry(handle, orphan_dir_inode, name, namelen, 
-				  inode, GET_INODE_FEOFF(inode), 
+				  inode, GET_INODE_FEOFF(inode) >> inode->i_sb->s_blocksize_bits, 
 				  orphan_dir_bh);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
@@ -1924,6 +1935,8 @@
 	struct buffer_head *target_de_bh;
 	struct ocfs2_dir_entry *target_de = NULL;
 
+	LOG_ENTRY();
+
 	name = kmalloc(OCFS2_MAX_FILENAME_LENGTH+1, GFP_KERNEL);
 	if (!name) {
 		status = -EFAIL;
@@ -1985,5 +1998,6 @@
 	if (name)
 		kfree(name);
 
+	LOG_EXIT_STATUS(status);
 	return status;
 }



More information about the Ocfs2-commits mailing list