[Ocfs2-commits] khackel commits r1098 - branches/format-changes/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Jun 14 18:34:20 CDT 2004


Author: khackel
Date: 2004-06-14 17:34:18 -0500 (Mon, 14 Jun 2004)
New Revision: 1098

Modified:
   branches/format-changes/src/alloc.c
   branches/format-changes/src/alloc.h
   branches/format-changes/src/dlm.c
   branches/format-changes/src/extmap.c
   branches/format-changes/src/file.c
   branches/format-changes/src/inode.c
   branches/format-changes/src/sysfile.c
Log:
fixed problem with units of lookup_file_allocation
fixed several small problems so that we can now mount and create a file
moved extent map init above the fastpath so that it actually gets initted ;-)
found several problems in read_system_file



Modified: branches/format-changes/src/alloc.c
===================================================================
--- branches/format-changes/src/alloc.c	2004-06-14 20:57:14 UTC (rev 1097)
+++ branches/format-changes/src/alloc.c	2004-06-14 22:34:18 UTC (rev 1098)
@@ -1187,7 +1187,8 @@
 	u64 parent_blk, new_eb_blkno;
 	ocfs2_dinode *fe = NULL;
 
-	LOG_ENTRY_ARGS("(blkno=%llu, new_clusters=%u)\n", blkno, new_clusters);
+	LOG_ENTRY_ARGS("(blkno=%llu, new_clusters=%u, inode=%llu)\n", blkno, new_clusters, 
+		       GET_INODE_FEOFF(inode));
 
 	fe = OCFS_BH_GET_DATA_WRITE(fe_bh);
 	OCFS_ASSERT(fe);
@@ -1199,7 +1200,8 @@
 	fel = &fe->id2.i_list;
 
 	if (fel->l_tree_depth < 0) {
-		LOG_TRACE_STR("Using local extents");
+		LOG_TRACE_ARGS("Using local extents: depth=%d, next_free=%u, l_count=%u\n", 
+			       fel->l_tree_depth, fel->l_next_free_rec, fel->l_count);
 		/* We are still using the local extents of File Entry */
 		if (fel->l_next_free_rec > fel->l_count) {
 			LOG_ERROR_STATUS(status = -EINVAL);
@@ -2610,7 +2612,7 @@
  */
 int ocfs_lookup_file_allocation(ocfs_super *osb, __s64 Vbo,
 				__s64 *Lbo, __u32 sectors,
-				u32 *sector_count, struct inode *inode)
+				__s64 *contig_bytes, struct inode *inode)
 {
 	int status = -EFAIL;
 	ocfs2_dinode *fe = NULL;
@@ -2633,13 +2635,13 @@
 						 &(OCFS_I(inode)->map), 
 						 Vbo, Lbo, &cnt,
 						 &NumIndex) &&
-		    (cnt >= sectors)) {
+		    (cnt >= (__u64)sectors << osb->sb->s_blocksize_bits)) {
 			status = 0;
-			goto finally;
+			goto success;
 		}
 	}
 
-	remainingLength = sectors;
+	remainingLength = sectors << osb->sb->s_blocksize_bits;
 	localVbo = Vbo;
 	    		
 	/*  We are looking for a Vbo, but it is not in the Map or not Valid. */
@@ -2747,10 +2749,13 @@
 		printk("failed to lookup extmap... vbo=%llu mapcount=%d\n", Vbo, OCFS_I(inode)->map.count);
 	}
 
+success:
 	/* want to return cnt only if asked for it */
-	if (sector_count)
-		*sector_count = (u32) cnt;
+	if (contig_bytes)
+		*contig_bytes = cnt;
 
+	LOG_TRACE_ARGS("returning contig_bytes=%lld, lbo=%lld\n", cnt, *Lbo);
+
 finally:
 	if (fe_bh) {
 		if (fe)

Modified: branches/format-changes/src/alloc.h
===================================================================
--- branches/format-changes/src/alloc.h	2004-06-14 20:57:14 UTC (rev 1097)
+++ branches/format-changes/src/alloc.h	2004-06-14 22:34:18 UTC (rev 1098)
@@ -65,7 +65,7 @@
 int ocfs_load_local_alloc(ocfs_super *osb);
 int ocfs_lookup_file_allocation(ocfs_super *osb, __s64 Vbo,
 				__s64 *Lbo, __u32 sectors,
-				u32 *sector_count, struct inode *inode);
+				__s64 *contig_bytes, struct inode *inode);
 int ocfs_process_bitmap_free_head(ocfs_super *osb,
 				  ocfs_bitmap_free_head *f);
 int ocfs_recover_local_alloc(ocfs_super *osb, int node_num);

Modified: branches/format-changes/src/dlm.c
===================================================================
--- branches/format-changes/src/dlm.c	2004-06-14 20:57:14 UTC (rev 1097)
+++ branches/format-changes/src/dlm.c	2004-06-14 22:34:18 UTC (rev 1098)
@@ -1332,12 +1332,13 @@
 		need_to_zap_buffers = 0; 
 	}
 
+	ocfs_node_map_init(osb, &open_map);
+
 	/* that's why it's called fast path */
 	if (flags & FLAG_FAST_PATH_LOCK)
 		goto vote_success;
 
 
-	ocfs_node_map_init(osb, &open_map);
 
 	/* figure out who to vote with */
 	if (flags & (FLAG_REMASTER | FLAG_FILE_DELETE |

Modified: branches/format-changes/src/extmap.c
===================================================================
--- branches/format-changes/src/extmap.c	2004-06-14 20:57:14 UTC (rev 1097)
+++ branches/format-changes/src/extmap.c	2004-06-14 22:34:18 UTC (rev 1098)
@@ -575,6 +575,7 @@
 			*SectorCount -= remainder;
 		}
 	}
+	
 
 	LOG_EXIT_INT (ret);
 	return ret;

Modified: branches/format-changes/src/file.c
===================================================================
--- branches/format-changes/src/file.c	2004-06-14 20:57:14 UTC (rev 1097)
+++ branches/format-changes/src/file.c	2004-06-14 22:34:18 UTC (rev 1098)
@@ -438,13 +438,16 @@
 		goto leave;
 	}
 	tmp = OCFS_BH_GET_DATA_READ(fe_bh);
-	memcpy(fe, tmp, osb->sb->s_blocksize_bits);
+	memcpy(fe, tmp, osb->sb->s_blocksize);
 	OCFS_BH_PUT_DATA(fe_bh);
 	tempoff = fe->i_blkno << osb->sb->s_blocksize_bits;
 
+#warning I think we DO want extent map stuff for dirs now
+#if 0
 	/* we don't want to do the extent map stuff for a directory. */
 	if (S_ISDIR(fe->i_mode))
 		goto leave;
+#endif
 
 	el = &fe->id2.i_list;
 	if (el->l_tree_depth < 0) {

Modified: branches/format-changes/src/inode.c
===================================================================
--- branches/format-changes/src/inode.c	2004-06-14 20:57:14 UTC (rev 1097)
+++ branches/format-changes/src/inode.c	2004-06-14 22:34:18 UTC (rev 1098)
@@ -1350,7 +1350,7 @@
 	__s64 lbo; /* logical (disk) offset */
 	__s64 vbo_max; /* file offset, max_blocks from iblock */
 	int set_new = 0; /* flag */
-	u32 new_size; /* In sectors, the size of the contiguous block */
+	__u64 new_size; /* In bytes, the size of the contiguous block */
 	unsigned char blocksize_bits;
 	int needs_trunc = 0;
 
@@ -1415,9 +1415,9 @@
 
 	/* make sure we don't map more than max_blocks blocks here as
 	   that's all the kernel will handle at this point. */
-	if (new_size > max_blocks)
-		new_size = max_blocks;
-	bh_result->b_size = new_size << blocksize_bits;
+	if (new_size > (__u64)max_blocks << blocksize_bits)
+		new_size = (__u64)max_blocks << blocksize_bits;
+	bh_result->b_size = new_size;
 
 	ret = 0;
 bail:

Modified: branches/format-changes/src/sysfile.c
===================================================================
--- branches/format-changes/src/sysfile.c	2004-06-14 20:57:14 UTC (rev 1097)
+++ branches/format-changes/src/sysfile.c	2004-06-14 22:34:18 UTC (rev 1098)
@@ -135,8 +135,8 @@
 	int status = 0, i;
 	__u64 ret = 0;
 	struct inode *inode = NULL;
-	__u32 blocks, contig_blocks;
-	__u64 off;
+	__u32 blocks;
+	__u64 off, contig_blocks, contig_bytes;
 
 	LOG_ENTRY_ARGS ("type=%d, node=%u, Length = %llu\n", type, node, Length);
 
@@ -150,13 +150,19 @@
 	i = 0;
 	blocks = Length >> osb->sb->s_blocksize_bits;
 	while (blocks > 0) {
-		contig_blocks = 0;
 		status = ocfs_lookup_file_allocation (osb, off, &ret, blocks, 
-						      &contig_blocks, inode);
+						      &contig_bytes, inode);
+		contig_blocks = contig_bytes >> osb->sb->s_blocksize_bits;
+		if (contig_bytes != contig_blocks << osb->sb->s_blocksize_bits) {
+			LOG_ERROR_ARGS("unaligned system file read! off=%llu, "
+				       "contig_bytes=%llu\n", off, contig_bytes);
+			LOG_ERROR_STATUS(status=-EINVAL);
+			goto leave;
+		}
 		if (status == 0) {
 			// found all remaining
-			if (blocks <= contig_blocks) {
-				LOG_ERROR_ARGS("blocks (%u) <= contig_blocks (%u)\n",
+			if (blocks <= (__u32)contig_blocks) {
+				LOG_ERROR_ARGS("blocks (%u) <= contig_blocks (%llu)\n",
 					       blocks, contig_blocks);
 			}
 		} else if (status == -EFAIL && contig_blocks > 0) {
@@ -166,18 +172,14 @@
 			LOG_ERROR_STATUS(status = -EIO);
 			goto leave;
 		}
-
-		status = ocfs_read_bhs(osb, ret, 
-				       contig_blocks << osb->sb->s_blocksize_bits, 
-				       &(bhs[i]), 
-				       OCFS_BH_CACHED, inode);
+		status = ocfs_read_bhs(osb, ret, contig_bytes, &(bhs[i]), OCFS_BH_CACHED, inode);
 		if (status < 0) {
 			LOG_ERROR_STATUS (status);
 			goto leave;
 		}
 		i += contig_blocks;
 		blocks -= contig_blocks;
-		off += (contig_blocks << osb->sb->s_blocksize_bits);
+		off += contig_bytes;
 	}
 
 leave:



More information about the Ocfs2-commits mailing list