[Ocfs2-commits] mfasheh commits r899 - in trunk/src: . inc

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed May 5 17:55:30 CDT 2004


Author: mfasheh
Date: 2004-05-05 16:55:28 -0500 (Wed, 05 May 2004)
New Revision: 899

Modified:
   trunk/src/dir.c
   trunk/src/hash.c
   trunk/src/inc/ocfs.h
   trunk/src/inc/proto.h
Log:
* fix filldir so that we give the proper inode numbers (or
  OCFS_UNUSED_INODE_NUMBER for entities which don't have an inode yet)



Modified: trunk/src/dir.c
===================================================================
--- trunk/src/dir.c	2004-05-05 21:54:16 UTC (rev 898)
+++ trunk/src/dir.c	2004-05-05 21:55:28 UTC (rev 899)
@@ -109,6 +109,8 @@
 		    ofile = (ocfs_file *) filp->private_data;
 		    while (1) {
                             int r;
+			    ino_t ino;
+			    __u64 voteoff;
                             /* TODO: find out if we need locking around this ofile */
                             if (ofile->filldir.ino != 0) {
                                     r=filldir (dirent, ofile->filldir.fname, strlen (ofile->filldir.fname), 
@@ -122,13 +124,14 @@
 				    if (r < 0)
 					    break;
 				    entry = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(entry_bh); /* read */
-#warning Do these ino_t (used to be LO(entry->this_sector)) need to be fixed for the inode hash
-                                    r=filldir (dirent, entry->filename, strlen (entry->filename), filp->f_pos,
-                                                 (ino_t)(entry->this_sector & 0xFFFFFFFFULL), DT_UNKNOWN);
+
+				    voteoff = (entry->attribs & OCFS_ATTRIB_DIRECTORY) ? entry->u.child_dirnode : entry->this_sector;
+				    ino = ocfs_inode_hash_lookup_ino(osb, voteoff);
+                                    r=filldir (dirent, entry->filename, strlen (entry->filename), filp->f_pos, ino, DT_UNKNOWN);
                             	    if (r < 0) {
                                     	memcpy(ofile->filldir.fname, entry->filename, OCFS_MAX_FILENAME_LENGTH);
                                     	ofile->filldir.pos = filp->f_pos;
-                                    	ofile->filldir.ino = (ino_t)(entry->this_sector & 0xFFFFFFFFULL);
+                                    	ofile->filldir.ino = ino;
 				    }
 			    	    OCFS_BH_PUT_DATA(entry_bh);
 				    brelse(entry_bh);

Modified: trunk/src/hash.c
===================================================================
--- trunk/src/hash.c	2004-05-05 21:54:16 UTC (rev 898)
+++ trunk/src/hash.c	2004-05-05 21:55:28 UTC (rev 899)
@@ -829,6 +829,30 @@
 	return(inode);
 }
 
+/* used for filldir. We don't want the whole inode just i_ino if it
+ * exists, otherwise we return an unused inode number */
+ino_t ocfs_inode_hash_lookup_ino(ocfs_super *osb, __u64 voteoff)
+{
+	ocfs_inode_num *inum = NULL;
+	ocfs_inode_hash *h = &osb->inode_hash;
+	ino_t ino = OCFS_UNUSED_INODE_NUMBER;
+
+	LOG_ENTRY_ARGS("(voteoff=%llu)\n", voteoff);
+
+	spin_lock(&h->lock);
+
+	inum = __ocfs_inode_hash_lookup(h, voteoff);
+
+	if (inum)
+		ino = inum->i_ino;
+
+	spin_unlock(&h->lock);
+
+	LOG_EXIT_ULONG(ino);
+
+	return(ino);
+}
+
 static inline void ocfs_debug_print_inum(ocfs_inode_num *inum, 
 					 struct inode * inode)
 {

Modified: trunk/src/inc/ocfs.h
===================================================================
--- trunk/src/inc/ocfs.h	2004-05-05 21:54:16 UTC (rev 898)
+++ trunk/src/inc/ocfs.h	2004-05-05 21:55:28 UTC (rev 899)
@@ -505,6 +505,8 @@
 #define OCFS_LINUX_MAX_FILE_SIZE   9223372036854775807LL
 #define INITIAL_EXTENT_MAP_SIZE    10
 
+#define OCFS_UNUSED_INODE_NUMBER   1
+
 #define OCFS_VOLCFG_LOCK_ITERATE	(HZ/10)	/* in jiffies */
 #define OCFS_VOLCFG_LOCK_TIME		1000    /* in ms */
 #define OCFS_VOLCFG_HDR_SECTORS		2	/* in sectors */

Modified: trunk/src/inc/proto.h
===================================================================
--- trunk/src/inc/proto.h	2004-05-05 21:54:16 UTC (rev 898)
+++ trunk/src/inc/proto.h	2004-05-05 21:55:28 UTC (rev 899)
@@ -301,6 +301,7 @@
 struct inode *ocfs_inode_hash_lookup(ocfs_super *osb, 
 				     __u64 voteoff, 
 				     bool reverse);
+ino_t ocfs_inode_hash_lookup_ino(ocfs_super *osb, __u64 voteoff);
 
 void ocfs_init_timeout(ocfs_timeout *to);
 void ocfs_set_timeout(ocfs_timeout *to, __u32 timeout);



More information about the Ocfs2-commits mailing list