[Ocfs2-commits] mfasheh commits r2186 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Apr 26 22:17:47 CDT 2005


Author: mfasheh
Signed-off-by: manish
Date: 2005-04-26 22:17:45 -0500 (Tue, 26 Apr 2005)
New Revision: 2186

Modified:
   trunk/fs/ocfs2/suballoc.c
Log:
* Remove the block group zeroing code as it is unused.

* Replace the #warning about block group zeroing with an explanation of why
  it's not necessary.

Signed-off-by: manish



Modified: trunk/fs/ocfs2/suballoc.c
===================================================================
--- trunk/fs/ocfs2/suballoc.c	2005-04-27 02:58:21 UTC (rev 2185)
+++ trunk/fs/ocfs2/suballoc.c	2005-04-27 03:17:45 UTC (rev 2186)
@@ -178,7 +178,12 @@
 	status = ocfs_journal_dirty(handle, bg_bh);
 	if (status < 0)
 		mlog_errno(status);
-#warning "we need to zero out the other blocks in the group! (only inode alloc?)"
+
+	/* There is no need to zero out or otherwise initialize the
+	 * other blocks in a group - All valid FS metadata in a block
+	 * group stores the superblock fs_generation value at
+	 * allocation time. */
+
 bail:
 	mlog_exit(status);
 	return status;
@@ -196,71 +201,7 @@
 	}
 	return best;
 }
-#ifdef OCFS_BG_ZERO
-static struct buffer_head **ocfs_block_group_zero_start(ocfs_super *osb,
-						       u32 bit_off,
-						       u16 clusters)
-{
-	struct buffer_head **bhs = NULL;
-	unsigned int blocks;
-	u64 blkno;
-	int i;
 
-	mlog_entry_void();
-
-	blocks = ocfs2_clusters_to_blocks(osb->sb, (u32) clusters) - 1ULL;
-	bhs = kmalloc(blocks * sizeof(struct buffer_head *), GFP_KERNEL);
-	if (!bhs) {
-		mlog_errno(-ENOMEM);
-		goto bail;
-	}
-	memset(bhs, 0, blocks * sizeof(struct buffer_head *));
-
-	blkno = ocfs2_clusters_to_blocks(osb->sb, bit_off) + 1ULL;
-	for(i = 0; i < blocks; i++) {
-		bhs[i] = sb_getblk(osb->sb, ((u64) i + blkno));
-		if (!bhs[i]) {
-			kfree(bhs);
-			bhs = NULL;
-			mlog_errno(-EIO);
-			goto bail;
-		}
-		lock_buffer(bhs[i]);
-		OCFS_ASSERT(!buffer_jbd(bhs[i]));
-
-		memset(bhs[i]->b_data, 0, osb->sb->s_blocksize);
-		set_buffer_uptodate(bhs[i]);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)		
-		clear_buffer_dirty(bhs[i]);
-#else
-		mark_buffer_clean(bhs[i]);
-#endif
-
-		bhs[i]->b_end_io = ocfs_end_buffer_io_sync;
-		submit_bh(WRITE, bhs[i]);
-	}
-bail:
-	mlog_exit_void();
-	return bhs;
-}
-
-static void ocfs_block_group_zero_wait(ocfs_super *osb, 
-				       struct buffer_head **bhs,
-				       u16 clusters)
-{
-	unsigned int blocks = 
-		ocfs2_clusters_to_blocks(osb->sb, (u32) clusters) - 1ULL;
-
-	do {
-		blocks--;
-		wait_on_buffer(bhs[i]);
-		brelse(bhs[i]);
-	} while (blocks);
-
-	kfree(bhs);
-	return;
-}
-#endif
 /*
  * We expect the block group allocator to already be locked.
  */
@@ -278,9 +219,6 @@
 	u64 bg_blkno;
 	struct buffer_head *bg_bh = NULL;
 	ocfs2_group_desc *bg;
-#ifdef OCFS_BG_ZERO
-	struct buffer_head **zero_bhs = NULL;
-#endif
 
 	OCFS_ASSERT(!ocfs2_is_cluster_bitmap(alloc_inode));
 
@@ -323,13 +261,6 @@
 		goto bail;
 	}
 
-#ifdef OCFS_BG_ZERO
-	status = ocfs_block_group_zero_start(osb, bit_off, cl->cpg, &zero_bhs);
-	if (status < 0) {
-		mlog_errno(status);
-		goto bail;
-	}
-#endif
 	alloc_rec = ocfs2_find_smallest_chain(cl);
 
 	/* setup the group */
@@ -398,10 +329,6 @@
 
 	status = 0;
 bail:
-#ifdef OCFS_BG_ZERO
-	if (zero_bhs)
-		ocfs_block_group_zero_wait(osb, zero_bhs, cl->cl_cpg);
-#endif
 	if (handle)
 		ocfs_commit_trans(handle);
 



More information about the Ocfs2-commits mailing list