[Ocfs2-commits] mfasheh commits r1541 - branches/dlm-changes/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Oct 1 19:14:12 CDT 2004


Author: mfasheh
Date: 2004-10-01 19:14:10 -0500 (Fri, 01 Oct 2004)
New Revision: 1541

Modified:
   branches/dlm-changes/src/localalloc.c
Log:
* move ocfs_local_alloc_new_window down a bit.



Modified: branches/dlm-changes/src/localalloc.c
===================================================================
--- branches/dlm-changes/src/localalloc.c	2004-10-02 00:12:47 UTC (rev 1540)
+++ branches/dlm-changes/src/localalloc.c	2004-10-02 00:14:10 UTC (rev 1541)
@@ -617,67 +617,6 @@
 } /* ocfs_clear_local_alloc */
 
 /*
- * ocfs_local_alloc_new_window
- *
- * pass it the bitmap lock in lock_bh if you have it. 
- */
-static int ocfs_local_alloc_new_window(ocfs_super *osb, 
-				       ocfs_journal_handle *handle,
-				       ocfs2_alloc_context *ac)
-{
-	int status = 0;
-	u32 cluster_off, cluster_count;
-	ocfs2_dinode *alloc = NULL;
-
-	LOG_ENTRY();
-
-	alloc = (ocfs2_dinode *) osb->local_alloc_bh->b_data;
-	if (LOCAL_ALLOC(alloc)->la_bm_bits != 0)
-		LOG_TRACE_STR("asking me to alloc a new window over a"
-			      " non-empty one");
-
-	LOG_TRACE_ARGS("Allocating %u clusters for a new window.\n", 
-		       ocfs_local_alloc_window_bits(osb));
-	/* we used the main bitmap specific reserve function, but we
-	 * set everything up nicely, so there's no reason why we can't
-	 * use the generic claim. */
-	status = ocfs_claim_bits(osb, 
-				 handle, 
-				 ac, 
-				 ocfs_local_alloc_window_bits(osb),
-				 &cluster_off, 
-				 &cluster_count);
-	if (status < 0) {
-		if (status != -ENOSPC)
-			LOG_ERROR_STATUS(status);
-		goto bail;
-	}
-	atomic_inc(&osb->alloc_stats.bitmap_data);
-
-	alloc = (ocfs2_dinode *) osb->local_alloc_bh->b_data;
-
-	LOCAL_ALLOC(alloc)->la_bm_off = cluster_off;
-	LOCAL_ALLOC(alloc)->la_bm_bits = cluster_count;
-	/* just in case... In the future when we find space ourselves,
-	 * we don't have to get all contiguous -- but we'll have to
-	 * set all previously used bits in bitmap and update
-	 * la_bits_set before setting the bits in the main bitmap. */
-	LOCAL_ALLOC(alloc)->la_bits_set = 0;
-	memset(LOCAL_ALLOC(alloc)->la_bitmap, 0,
-	       LOCAL_ALLOC(alloc)->la_size);
-
-	LOG_TRACE_STR("New window allocated:");
-	LOG_TRACE_ARGS("window la_bm_off = %u\n",
-		       LOCAL_ALLOC(alloc)->la_bm_off);
-	LOG_TRACE_ARGS("window la_bm_bits = %u\n",
-		       LOCAL_ALLOC(alloc)->la_bm_bits);
-
-bail:
-	LOG_EXIT_STATUS(status);
-	return(status);
-} /* ocfs_local_alloc_new_window */
-
-/*
  * This essentially does the same thing as sync_local_to_main, but
  * without a journal handle -- used during shutdown and recovery.
  */
@@ -894,6 +833,67 @@
 	return(status);
 }
 
+/*
+ * ocfs_local_alloc_new_window
+ *
+ * pass it the bitmap lock in lock_bh if you have it. 
+ */
+static int ocfs_local_alloc_new_window(ocfs_super *osb, 
+				       ocfs_journal_handle *handle,
+				       ocfs2_alloc_context *ac)
+{
+	int status = 0;
+	u32 cluster_off, cluster_count;
+	ocfs2_dinode *alloc = NULL;
+
+	LOG_ENTRY();
+
+	alloc = (ocfs2_dinode *) osb->local_alloc_bh->b_data;
+	if (LOCAL_ALLOC(alloc)->la_bm_bits != 0)
+		LOG_TRACE_STR("asking me to alloc a new window over a"
+			      " non-empty one");
+
+	LOG_TRACE_ARGS("Allocating %u clusters for a new window.\n", 
+		       ocfs_local_alloc_window_bits(osb));
+	/* we used the main bitmap specific reserve function, but we
+	 * set everything up nicely, so there's no reason why we can't
+	 * use the generic claim. */
+	status = ocfs_claim_bits(osb, 
+				 handle, 
+				 ac, 
+				 ocfs_local_alloc_window_bits(osb),
+				 &cluster_off, 
+				 &cluster_count);
+	if (status < 0) {
+		if (status != -ENOSPC)
+			LOG_ERROR_STATUS(status);
+		goto bail;
+	}
+	atomic_inc(&osb->alloc_stats.bitmap_data);
+
+	alloc = (ocfs2_dinode *) osb->local_alloc_bh->b_data;
+
+	LOCAL_ALLOC(alloc)->la_bm_off = cluster_off;
+	LOCAL_ALLOC(alloc)->la_bm_bits = cluster_count;
+	/* just in case... In the future when we find space ourselves,
+	 * we don't have to get all contiguous -- but we'll have to
+	 * set all previously used bits in bitmap and update
+	 * la_bits_set before setting the bits in the main bitmap. */
+	LOCAL_ALLOC(alloc)->la_bits_set = 0;
+	memset(LOCAL_ALLOC(alloc)->la_bitmap, 0,
+	       LOCAL_ALLOC(alloc)->la_size);
+
+	LOG_TRACE_STR("New window allocated:");
+	LOG_TRACE_ARGS("window la_bm_off = %u\n",
+		       LOCAL_ALLOC(alloc)->la_bm_off);
+	LOG_TRACE_ARGS("window la_bm_bits = %u\n",
+		       LOCAL_ALLOC(alloc)->la_bm_bits);
+
+bail:
+	LOG_EXIT_STATUS(status);
+	return(status);
+} /* ocfs_local_alloc_new_window */
+
 /* Note that we do *NOT* lock the local alloc inode here as
  * it's been locked already for us. */
 static int ocfs_local_alloc_slide_window(ocfs_super *osb, 



More information about the Ocfs2-commits mailing list