[Ocfs2-commits] manish commits r2315 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue May 24 17:43:55 CDT 2005


Author: manish
Signed-off-by: mfasheh
Date: 2005-05-24 17:43:53 -0500 (Tue, 24 May 2005)
New Revision: 2315

Modified:
   trunk/fs/ocfs2/namei.c
Log:
Fix screw up from the earlier clean up pass (and make the code more readable
too).

Signed-off-by: mfasheh


Modified: trunk/fs/ocfs2/namei.c
===================================================================
--- trunk/fs/ocfs2/namei.c	2005-05-24 21:30:33 UTC (rev 2314)
+++ trunk/fs/ocfs2/namei.c	2005-05-24 22:43:53 UTC (rev 2315)
@@ -1830,14 +1830,15 @@
 
 	mlog_entry_void();
 
-	de = (struct ocfs2_dir_entry *) bh->b_data;
-	de_buf = (char *) de;
+	de_buf = bh->b_data;
+	dlimit = de_buf + dir->i_sb->s_blocksize;
 
-	dlimit = de_buf + dir->i_sb->s_blocksize;
 	while (de_buf < dlimit) {
 		/* this code is executed quadratically often */
 		/* do minimal checking `by hand' */
 
+		de = (struct ocfs2_dir_entry *) de_buf;
+
 		if (de_buf + namelen <= dlimit &&
 		    ocfs_match(namelen, name, de)) {
 			/* found a match - just to be sure, do a full check */
@@ -1849,14 +1850,16 @@
 			ret = 1;
 			goto bail;
 		}
+
 		/* prevent looping on a bad block */
 		de_len = le16_to_cpu(de->rec_len);
 		if (de_len <= 0) {
 			ret = -1;
 			goto bail;
 		}
+
+		de_buf += de_len;
 		offset += de_len;
-		de = (struct ocfs2_dir_entry *) (de_buf + de_len);
 	}
 
 bail:



More information about the Ocfs2-commits mailing list