[Ocfs2-commits] mfasheh commits r1424 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Sep 3 18:45:49 CDT 2004
Author: mfasheh
Date: 2004-09-03 18:45:47 -0500 (Fri, 03 Sep 2004)
New Revision: 1424
Modified:
trunk/src/alloc.c
trunk/src/super.c
Log:
* don't stomp a journalled buffer on local alloc shutdown.
Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c 2004-09-03 23:04:40 UTC (rev 1423)
+++ trunk/src/alloc.c 2004-09-03 23:45:47 UTC (rev 1424)
@@ -4088,14 +4088,15 @@
* local_alloc_bh is optional. If not passed, we will simply use the
* one off osb. If you do pass it however, be warned that it *will* be
* returned brelse'd and NULL'd out.*/
-void ocfs_shutdown_local_alloc(ocfs_super *osb, int sync)
+void ocfs_shutdown_local_alloc(ocfs_super *osb)
{
int status;
ocfs2_dinode *alloc = NULL;
ocfs_bitmap_free_head *f = NULL;
struct buffer_head *bh = NULL;
+ ocfs_journal_handle *handle = NULL;
- LOG_ENTRY_ARGS("(sync = %s)", sync ? "true" : "false");
+ LOG_ENTRY();
if (!osb->have_local_alloc)
goto bail;
@@ -4105,29 +4106,47 @@
status = ocfs_sync_local_from_shutdown(osb, &f, bh, 0);
if (status < 0)
LOG_ERROR_STATUS(status);
- else if (f)
- ocfs_process_bitmap_free_head(osb, f);
- if (f) {
- ocfs_free_bitmap_free_head(f);
- f = NULL;
+ handle = ocfs_start_trans(osb, NULL, 1);
+ if (!handle) {
+ LOG_ERROR_STATUS(-ENOMEM);
+ goto bail;
}
+ ocfs_handle_set_always_commits(handle, 1);
+ status = ocfs_journal_access(handle, bh, OCFS_JOURNAL_ACCESS_WRITE);
+ if (status < 0) {
+ LOG_ERROR_STATUS(status);
+ goto bail;
+ }
+
alloc = (ocfs2_dinode *) bh->b_data;
ocfs_clear_local_alloc(alloc);
- if (sync) {
- status = ocfs_write_bh(osb, bh, OCFS_BH_IGNORE_JBD, NULL);
- if (status < 0)
- LOG_ERROR_STATUS(status);
+ status = ocfs_journal_dirty(handle, bh);
+ if (status < 0) {
+ LOG_ERROR_STATUS(status);
+ goto bail;
}
brelse(bh);
+ ocfs_commit_trans(handle);
+ handle = NULL;
+
osb->local_alloc_bh = NULL;
osb->have_local_alloc = 0;
+ if (f)
+ ocfs_process_bitmap_free_head(osb, f);
+
bail:
+ if (handle)
+ ocfs_commit_trans(handle);
+
+ if (f)
+ ocfs_free_bitmap_free_head(f);
+
LOG_EXIT();
return;
} /* ocfs_shutdown_local_alloc */
Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c 2004-09-03 23:04:40 UTC (rev 1423)
+++ trunk/src/super.c 2004-09-03 23:45:47 UTC (rev 1424)
@@ -1130,7 +1130,7 @@
}
#endif
- ocfs_shutdown_local_alloc(osb, 1);
+ ocfs_shutdown_local_alloc(osb);
ocfs_journal_shutdown(osb);
/* unset the mounted flag -- we're done with the journal and
More information about the Ocfs2-commits
mailing list