[Ocfs2-commits] zab commits r2632 - in branches/locking-changes/fs/ocfs2: . cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Oct 4 13:50:45 CDT 2005


Author: zab
Date: 2005-10-04 13:50:43 -0500 (Tue, 04 Oct 2005)
New Revision: 2632

Modified:
   branches/locking-changes/fs/ocfs2/cluster/tcp_internal.h
   branches/locking-changes/fs/ocfs2/dlmglue.c
   branches/locking-changes/fs/ocfs2/dlmglue.h
Log:
o store the entire i_size in the lvb
o increase the net protocol version to reflect lvb change and others


Modified: branches/locking-changes/fs/ocfs2/cluster/tcp_internal.h
===================================================================
--- branches/locking-changes/fs/ocfs2/cluster/tcp_internal.h	2005-10-04 00:21:10 UTC (rev 2631)
+++ branches/locking-changes/fs/ocfs2/cluster/tcp_internal.h	2005-10-04 18:50:43 UTC (rev 2632)
@@ -40,7 +40,17 @@
 #define O2NET_KEEPALIVE_DELAY_SECS	5
 #define O2NET_IDLE_TIMEOUT_SECS		10
 
-#define O2NET_PROTOCOL_VERSION 1ULL
+/* 
+ * This version number represents quite a lot, unfortunately.  It not
+ * only represents the raw network message protocol on the wire but also
+ * locking semantics of the file system using the protocol.  It should 
+ * be somewhere else, I'm sure, but right now it isn't.
+ *
+ * New in version 2:
+ * 	- full 64 bit i_size in the metadata lock lvbs
+ * 	- introduction of "rw" lock and pushing meta/data locking down
+ */
+#define O2NET_PROTOCOL_VERSION 2ULL
 struct o2net_handshake {
 	__be64	protocol_version;
 	__be64	connector_id;

Modified: branches/locking-changes/fs/ocfs2/dlmglue.c
===================================================================
--- branches/locking-changes/fs/ocfs2/dlmglue.c	2005-10-04 00:21:10 UTC (rev 2631)
+++ branches/locking-changes/fs/ocfs2/dlmglue.c	2005-10-04 18:50:43 UTC (rev 2632)
@@ -1299,7 +1299,6 @@
  * date from the truncate code. */
 static void __ocfs2_stuff_meta_lvb(struct inode *inode)
 {
-	unsigned int isize_off;
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
 	struct ocfs2_lock_res *lockres = &oi->ip_meta_lockres;
 	struct ocfs2_meta_lvb *lvb;
@@ -1308,13 +1307,7 @@
 
 	lvb = (struct ocfs2_meta_lvb *) lockres->l_lksb.lvb;
 
-	/* take advantage of the fact that we don't support holes --
-	 * we only need the byte offset from i_clusters which nicely
-	 * cuts our lvb storage requirement to a u32 */
-	isize_off = ocfs2_clusters_to_bytes(inode->i_sb, oi->ip_clusters)
-		- i_size_read(inode);
-
-	lvb->lvb_isize_off = cpu_to_be32(isize_off);
+	lvb->lvb_isize	   = cpu_to_be64(i_size_read(inode));
 	lvb->lvb_iclusters = cpu_to_be32(oi->ip_clusters);
 	lvb->lvb_iuid      = cpu_to_be32(inode->i_uid);
 	lvb->lvb_igid      = cpu_to_be32(inode->i_gid);
@@ -1341,7 +1334,6 @@
 
 static void ocfs2_refresh_inode_from_lvb(struct inode *inode)
 {
-	loff_t isize;
 	struct ocfs2_inode_info *oi = OCFS2_I(inode);
 	struct ocfs2_lock_res *lockres = &oi->ip_meta_lockres;
 	struct ocfs2_meta_lvb *lvb;
@@ -1355,11 +1347,8 @@
 	/* We're safe here without the lockres lock... */
 	spin_lock(&oi->ip_lock);
 	oi->ip_clusters = be32_to_cpu(lvb->lvb_iclusters);
+	i_size_write(inode, be64_to_cpu(lvb->lvb_isize));
 
-	isize = ocfs2_clusters_to_bytes(inode->i_sb, oi->ip_clusters)
-		- be32_to_cpu(lvb->lvb_isize_off);
-	i_size_write(inode, isize);
-
 	/* fast-symlinks are a special case */
 	if (S_ISLNK(inode->i_mode) && !oi->ip_clusters)
 		inode->i_blocks = 0;
@@ -2664,9 +2653,9 @@
 
 	mlog(level, "LVB information for %s (called from %s:%u):\n",
 	     lockres->l_name, function, line);
-	mlog(level, "trustable: %s, seq: %u, size_off: %u, clusters: %u\n",
+	mlog(level, "trustable: %s, seq: %u, size: %"MLFu64", clusters: %u\n",
 	     ocfs2_lvb_is_trustable(lockres) ? "yes" : "no",
-	     be32_to_cpu(lvb->lvb.lvb_seq), be32_to_cpu(lvb->lvb_isize_off),
+	     be32_to_cpu(lvb->lvb.lvb_seq), be64_to_cpu(lvb->lvb_isize),
 	     be32_to_cpu(lvb->lvb_iclusters));
 	mlog(level, "trunc clusters %u, uid %u, gid %u, mode 0x%x\n",
 	     be32_to_cpu(lvb->lvb_trunc_clusters), be32_to_cpu(lvb->lvb_iuid),

Modified: branches/locking-changes/fs/ocfs2/dlmglue.h
===================================================================
--- branches/locking-changes/fs/ocfs2/dlmglue.h	2005-10-04 00:21:10 UTC (rev 2631)
+++ branches/locking-changes/fs/ocfs2/dlmglue.h	2005-10-04 18:50:43 UTC (rev 2632)
@@ -74,8 +74,8 @@
 	__be64       lvb_iatime_packed;
 	__be64       lvb_ictime_packed;
 	__be64       lvb_imtime_packed;
-	__be32       lvb_isize_off;
-	__be32       lvb_reserved[3];
+	__be64       lvb_isize;
+	__be32       lvb_reserved[2];
 };
 
 int ocfs2_dlm_init(ocfs2_super *osb);



More information about the Ocfs2-commits mailing list