[Ocfs2-commits] mfasheh commits r885 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Apr 29 19:55:48 CDT 2004
Author: mfasheh
Date: 2004-04-29 18:55:47 -0500 (Thu, 29 Apr 2004)
New Revision: 885
Modified:
trunk/src/alloc.c
trunk/src/dir.c
trunk/src/sysfile.c
Log:
* clean up some writes that were only happening as a result of the now
gone first mount code.
Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c 2004-04-29 19:21:20 UTC (rev 884)
+++ trunk/src/alloc.c 2004-04-29 23:55:47 UTC (rev 885)
@@ -695,15 +695,14 @@
LOG_ENTRY ();
if (extent_header_bh) {
- if (handle) {
- status = ocfs_journal_access(handle, extent_header_bh,
- OCFS_JOURNAL_ACCESS_WRITE);
+ status = ocfs_journal_access(handle, extent_header_bh,
+ OCFS_JOURNAL_ACCESS_WRITE);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto finally;
- }
+ if (status < 0) {
+ LOG_ERROR_STATUS(status);
+ goto finally;
}
+
extent_header = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(extent_header_bh); /* write */
bh_locked = 1;
}
@@ -744,14 +743,13 @@
/* zero them all out */
for(i = 0; i < numSectorsAlloc; i++) {
- if (handle) {
- status = ocfs_journal_access(handle, header_bhs[i],
- OCFS_JOURNAL_ACCESS_CREATE);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto finally;
- }
+ status = ocfs_journal_access(handle, header_bhs[i],
+ OCFS_JOURNAL_ACCESS_CREATE);
+ if (status < 0) {
+ LOG_ERROR_STATUS(status);
+ goto finally;
}
+
buff = OCFS_BH_GET_DATA_WRITE(header_bhs[i]); /* write */
memset(buff, 0, osb->sect_size);
set_buffer_uptodate(header_bhs[i]);
@@ -813,17 +811,8 @@
OCFS_BH_PUT_DATA(header_bhs[i]);
}
- if (handle) {
- for(i = 0; i < numSectorsAlloc; i++) {
- status = ocfs_journal_dirty(handle, header_bhs[i]);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto finally;
- }
- }
- } else {
- /* Write the extents to disk */
- status = ocfs_write_bhs(osb, header_bhs, numSectorsAlloc, 0, inode);
+ for(i = 0; i < numSectorsAlloc; i++) {
+ status = ocfs_journal_dirty(handle, header_bhs[i]);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -838,10 +827,8 @@
OCFS_BH_PUT_DATA(extent_header_bh);
bh_locked = 0;
extent_header = NULL;
- if (handle)
- status = ocfs_journal_dirty(handle, extent_header_bh);
- else
- status = ocfs_write_bh(osb, extent_header_bh, 0, inode);
+
+ status = ocfs_journal_dirty(handle, extent_header_bh);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto finally;
@@ -857,14 +844,13 @@
LOG_ERROR_STATUS (status);
goto finally;
}
- if (handle) {
- status = ocfs_journal_access(handle, bh,
+ status = ocfs_journal_access(handle, bh,
OCFS_JOURNAL_ACCESS_WRITE);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto finally;
- }
+ if (status < 0) {
+ LOG_ERROR_STATUS(status);
+ goto finally;
}
+
extent_header = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(bh); /* write */
if (!IS_VALID_EXTENT_HEADER(extent_header)) {
OCFS_BH_PUT_DATA(bh);
@@ -886,10 +872,7 @@
up_hdr_node_ptr = extent_header->up_hdr_node_ptr;
OCFS_BH_PUT_DATA(bh);
- if (handle)
- status = ocfs_journal_dirty(handle, bh);
- else
- status = ocfs_write_bh(osb, bh, 0, inode);
+ status = ocfs_journal_dirty(handle, bh);
if (status < 0) {
brelse(bh);
LOG_ERROR_STATUS (status);
@@ -1104,13 +1087,11 @@
goto finally;
}
- if (handle) {
- status = ocfs_journal_access(handle, bh,
- OCFS_JOURNAL_ACCESS_WRITE);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto finally;
- }
+ status = ocfs_journal_access(handle, bh,
+ OCFS_JOURNAL_ACCESS_WRITE);
+ if (status < 0) {
+ LOG_ERROR_STATUS (status);
+ goto finally;
}
ext = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(bh); /* write */
@@ -1124,10 +1105,7 @@
ext->next_data_ext = lastExtentPtr;
OCFS_BH_PUT_DATA(bh);
- if (handle)
- status = ocfs_journal_dirty(handle, bh);
- else
- status = ocfs_write_bh(osb, bh, 0, inode);
+ status = ocfs_journal_dirty(handle, bh);
brelse(bh);
if (status < 0) {
LOG_ERROR_STATUS (status);
@@ -1151,23 +1129,18 @@
break;
}
- if (handle) {
- status = ocfs_journal_access(handle, bh,
+ status = ocfs_journal_access(handle, bh,
OCFS_JOURNAL_ACCESS_WRITE);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto finally;
- }
+ if (status < 0) {
+ LOG_ERROR_STATUS (status);
+ goto finally;
}
ext = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(bh); /* write */
ext->up_hdr_node_ptr = new_up_hdr_ptr;
OCFS_BH_PUT_DATA(bh);
- if (handle)
- status = ocfs_journal_dirty(handle, bh);
- else
- status = ocfs_write_bh(osb, bh, 0, inode);
+ status = ocfs_journal_dirty(handle, bh);
brelse(bh);
bh = NULL;
if (status < 0)
@@ -1291,12 +1264,11 @@
/* See if we can merge the extents and just increase
* the length */
if (k >= 0 && OCFS_EXTENT_MERGEABLE (&(extent->extents[k]), actualDiskOffset)) {
- if (handle) {
- OCFS_BH_PUT_DATA(extent_bh);
- ocfs_journal_access(handle, extent_bh,
- OCFS_JOURNAL_ACCESS_WRITE);
- extent = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(extent_bh); /* write */ /* journal_access */
- }
+ OCFS_BH_PUT_DATA(extent_bh);
+ ocfs_journal_access(handle, extent_bh,
+ OCFS_JOURNAL_ACCESS_WRITE);
+ extent = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(extent_bh); /* write */ /* journal_access */
+
extent->extents[k].num_bytes += actualLength;
status = 0;
UpdateParent = true;
@@ -1308,12 +1280,11 @@
if (k != OCFS_MAX_DATA_EXTENTS) {
/* we can just add next extent */
- if (handle) {
- OCFS_BH_PUT_DATA(extent_bh);
- ocfs_journal_access(handle, extent_bh,
- OCFS_JOURNAL_ACCESS_WRITE);
- extent = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(extent_bh); /* write */ /* journal access */
- }
+ OCFS_BH_PUT_DATA(extent_bh);
+ ocfs_journal_access(handle, extent_bh,
+ OCFS_JOURNAL_ACCESS_WRITE);
+ extent = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(extent_bh); /* write */ /* journal access */
+
extent->extents[k].file_off = FileEntry->alloc_size;
extent->extents[k].num_bytes = actualLength;
extent->extents[k].disk_off = actualDiskOffset;
@@ -1387,12 +1358,10 @@
goto finally;
}
- if (handle) {
- OCFS_BH_PUT_DATA(extent_bh);
- ocfs_journal_access(handle, extent_bh,
- OCFS_JOURNAL_ACCESS_WRITE);
- extent = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(extent_bh); /* write */ /* journal access */
- }
+ OCFS_BH_PUT_DATA(extent_bh);
+ ocfs_journal_access(handle, extent_bh,
+ OCFS_JOURNAL_ACCESS_WRITE);
+ extent = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(extent_bh); /* write */ /* journal access */
extent->next_data_ext = newExtentOff;
FileEntry->last_ext_ptr = newExtentOff;
@@ -1406,10 +1375,7 @@
/* gotta put it away to write it ;) */
OCFS_BH_PUT_DATA(extent_bh);
extent = NULL;
- if (handle)
- status = ocfs_journal_dirty(handle, extent_bh);
- else
- status = ocfs_write_bh(osb, extent_bh, 0, inode);
+ status = ocfs_journal_dirty(handle, extent_bh);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto finally;
@@ -1434,14 +1400,12 @@
LOG_ERROR_STATUS (status);
goto finally;
}
- if (handle) {
- status = ocfs_journal_access(handle,
- extent_header_bh,
+
+ status = ocfs_journal_access(handle, extent_header_bh,
OCFS_JOURNAL_ACCESS_WRITE);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto finally;
- }
+ if (status < 0) {
+ LOG_ERROR_STATUS(status);
+ goto finally;
}
extent_header = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(extent_header_bh); /* write */
@@ -1464,11 +1428,8 @@
OCFS_BH_PUT_DATA(extent_header_bh);
extent_header = NULL;
- if (handle)
- status = ocfs_journal_dirty(handle,
- extent_header_bh);
- else
- status= ocfs_write_bh(osb, extent_header_bh,0, inode);
+
+ status = ocfs_journal_dirty(handle, extent_header_bh);
if (status < 0) {
goto finally;
}
@@ -3127,10 +3088,8 @@
}
foundBit = prevFileSize * 8;
- /* only delay lock release if we have a handle,
- * otherwise the extend wasn't journalled. */
- if (handle)
- delay_lockrel = true;
+
+ delay_lockrel = true;
}
LOG_TRACE_ARGS ("byte offset=%d\n", foundBit);
Modified: trunk/src/dir.c
===================================================================
--- trunk/src/dir.c 2004-04-29 19:21:20 UTC (rev 884)
+++ trunk/src/dir.c 2004-04-29 23:55:47 UTC (rev 885)
@@ -695,15 +695,6 @@
dir->index_dirty = 0;
OCFS_BH_PUT_DATA(arr[0]);
-
- if (!handle) {
- status = ocfs_write_dir_node (osb, arr, -1, dir_inode,
- NULL);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto leave;
- }
- }
} else
OCFS_BH_PUT_DATA(arr[0]);
Modified: trunk/src/sysfile.c
===================================================================
--- trunk/src/sysfile.c 2004-04-29 19:21:20 UTC (rev 884)
+++ trunk/src/sysfile.c 2004-04-29 23:55:47 UTC (rev 885)
@@ -296,13 +296,11 @@
OCFS_BH_PUT_DATA(fe_bh);
fe = NULL;
- if (handle) {
- status = ocfs_journal_access(handle, fe_bh,
- OCFS_JOURNAL_ACCESS_WRITE);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto leave;
- }
+ status = ocfs_journal_access(handle, fe_bh,
+ OCFS_JOURNAL_ACCESS_WRITE);
+ if (status < 0) {
+ LOG_ERROR_STATUS (status);
+ goto leave;
}
if (FileSize > alloc_size) {
@@ -381,11 +379,8 @@
OCFS_BH_PUT_DATA(fe_bh);
fe = NULL;
- if (handle)
- status = ocfs_journal_dirty(handle, fe_bh);
- else
- status = ocfs_write_bh(osb, fe_bh, 0, NULL);
+ status = ocfs_journal_dirty(handle, fe_bh);
if (status < 0)
LOG_ERROR_STATUS (status);
More information about the Ocfs2-commits
mailing list