[Ocfs2-commits] mfasheh commits r788 - in trunk: . src src/inc
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Mar 18 16:18:43 CST 2004
Author: mfasheh
Date: 2004-03-18 16:18:41 -0600 (Thu, 18 Mar 2004)
New Revision: 788
Modified:
trunk/TODO
trunk/src/alloc.c
trunk/src/file.c
trunk/src/inc/journal.h
trunk/src/inc/proto.h
trunk/src/namei.c
Log:
* Make a one line fix in unlink where we skip the decrement of
inode->i_nlink in case of error now.
* remove some calls to ocfs_clear_buffer_modified in ocfs_fe_smash
that are no longer necessary (will be done in abort_trans nowadays)
* Fix a bug in ocfs_free_directory_block where we weren't catching an
error
* Take one item off the todo list: "revamp the bitmap_free_head
processing to just always happen on the journal handle". Now, we free
bits in commit_trans and abort_trans, depending on how they were put
on the handle.
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2004-03-17 22:16:26 UTC (rev 787)
+++ trunk/TODO 2004-03-18 22:18:41 UTC (rev 788)
@@ -13,10 +13,6 @@
* provide an ocfsmigrate utility to migrate v1 -> v2 and back.
-* revamp the bitmap_free_head processing to just always happen on the
- journal handle, and while we're at it, we can just put the head structures
- on there as a static part of the struct.
-
* finish mkfs to really create a filesystem.
* See about just always having an OIN on the inode... Maybe we can start
Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c 2004-03-17 22:16:26 UTC (rev 787)
+++ trunk/src/alloc.c 2004-03-18 22:18:41 UTC (rev 788)
@@ -49,16 +49,16 @@
static int _squish_extent_entries(ocfs_super *osb, ocfs_alloc_ext *extarr,
__u8 *freeExtent,
- ocfs_bitmap_free_head * free_head,
+ ocfs_journal_handle *handle,
__u64 FileSize, bool flag, struct inode *inode) ;
static int ocfs_fix_extent_group(ocfs_super *osb, struct buffer_head *group_bh, struct inode *inode);
static int ocfs_split_this_tree(ocfs_super * osb,
struct buffer_head *extent_grp_bh,
- ocfs_bitmap_free_head *free_head,
+ ocfs_journal_handle *handle,
ocfs_file_entry *fe,
- ocfs_journal_handle *handle, struct inode *inode);
+ struct inode *inode);
static int ocfs_update_last_ext_ptr(ocfs_super *osb, ocfs_file_entry *fe, struct inode *inode);
@@ -1508,7 +1508,7 @@
* 'flag' seems to be an indicator that (if true) tells us that we already know
* we're gonna have to clear out all of extarr.
*/
-int _squish_extent_entries(ocfs_super *osb, ocfs_alloc_ext *extarr, __u8 *freeExtent, ocfs_bitmap_free_head *free_head, __u64 FileSize, bool flag, struct inode *inode)
+static int _squish_extent_entries(ocfs_super *osb, ocfs_alloc_ext *extarr, __u8 *freeExtent, ocfs_journal_handle *handle, __u64 FileSize, bool flag, struct inode *inode)
{
int status = 0;
bool FirstTime = true;
@@ -1556,7 +1556,10 @@
diskOffsetTobeFreed = doff + bytes;
bitmapOffset = (__u32) ((diskOffsetTobeFreed - dstart) / csize);
}
- status = ocfs_add_to_bitmap_free_head(osb, free_head, numBitsAllocated, bitmapOffset, -1, DISK_ALLOC_VOLUME);
+ status = ocfs_handle_add_commit_bits(handle,
+ numBitsAllocated,
+ bitmapOffset, -1,
+ DISK_ALLOC_VOLUME);
if (status < 0) {
LOG_ERROR_STATUS (status);
break;
@@ -1588,7 +1591,7 @@
*/
/* We can't recurse, so we keep a simple stack of ocfs_extent_groups. */
-int ocfs_kill_this_tree(ocfs_super *osb, struct buffer_head *extent_grp_bh, ocfs_bitmap_free_head *free_head, struct inode *inode)
+int ocfs_kill_this_tree(ocfs_super *osb, struct buffer_head *extent_grp_bh, ocfs_journal_handle *handle, struct inode *inode)
{
int status = -EFAIL;
int i;
@@ -1628,7 +1631,7 @@
ext = &cur_extent->extents[i];
num_sectors = (__u32) (ext->num_bytes / csize);
bitmap_offset = (__u32) ((ext->disk_off - dstart) / csize);
- status = ocfs_add_to_bitmap_free_head(osb, free_head, num_sectors, bitmap_offset, -1, DISK_ALLOC_VOLUME);
+ status = ocfs_handle_add_commit_bits(handle, num_sectors, bitmap_offset, -1, DISK_ALLOC_VOLUME);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
@@ -1681,7 +1684,7 @@
free_meta:
/* Free the metadata associated with this extent group */
- status = ocfs_add_to_bitmap_free_head(osb, free_head, 1, cur_extent->alloc_file_off, cur_extent->alloc_node, DISK_ALLOC_EXTENT_NODE);
+ status = ocfs_handle_add_commit_bits(handle, 1, cur_extent->alloc_file_off, cur_extent->alloc_node, DISK_ALLOC_EXTENT_NODE);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
@@ -1757,8 +1760,8 @@
* TODO: This function can likely be combined with the above, we will try to
* write it so that it can.
* TODO: This function should be split up into a couple smaller ones.
-*/
-static int ocfs_split_this_tree(ocfs_super * osb, struct buffer_head *extent_grp_bh, ocfs_bitmap_free_head *free_head, ocfs_file_entry *fe, ocfs_journal_handle *handle, struct inode *inode)
+ */
+static int ocfs_split_this_tree(ocfs_super * osb, struct buffer_head *extent_grp_bh, ocfs_journal_handle *handle, ocfs_file_entry *fe, struct inode *inode)
{
int status = -EFAIL;
__u64 newsize = fe->alloc_size;
@@ -1809,7 +1812,7 @@
if (ext->file_off >= newsize) {
/* Trim this whole subtree */
status = ocfs_kill_this_tree(osb, tmp_bh2,
- free_head, inode);
+ handle, inode);
if (status < 0) {
OCFS_BH_PUT_DATA(extent_grp_bh);
extent_grp = NULL;
@@ -1883,7 +1886,7 @@
if (ext->file_off >= newsize) {
/* Trim this whole subtree */
status = ocfs_kill_this_tree(osb, tmp_bh,
- free_head, inode);
+ handle, inode);
if (status < 0) {
OCFS_BH_PUT_DATA(extent_grp_bh);
extent_grp = NULL;
@@ -1960,7 +1963,7 @@
* (i.e., split no more ;) */
OCFS_BH_PUT_DATA(bh_stack[tos]);
AllocExtent = NULL;
- status = ocfs_kill_this_tree(osb, bh_stack[tos], free_head, inode);
+ status = ocfs_kill_this_tree(osb, bh_stack[tos], handle, inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
@@ -2023,7 +2026,7 @@
done = true;
goto skip_bitmap_add;
}
- status = ocfs_add_to_bitmap_free_head(osb, free_head, num_sectors, bitmap_offset, -1, DISK_ALLOC_VOLUME);
+ status = ocfs_handle_add_commit_bits(handle, num_sectors, bitmap_offset, -1, DISK_ALLOC_VOLUME);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
@@ -2096,7 +2099,7 @@
LO(AllocExtent->this_ext),
AllocExtent->next_free_ext);
- status = ocfs_add_to_bitmap_free_head(osb, free_head, 1, AllocExtent->alloc_file_off, AllocExtent->alloc_node, DISK_ALLOC_EXTENT_NODE);
+ status = ocfs_handle_add_commit_bits(handle, 1, AllocExtent->alloc_file_off, AllocExtent->alloc_node, DISK_ALLOC_EXTENT_NODE);
if (status < 0) {
LOG_ERROR_STATUS (status);
goto bail;
@@ -2121,7 +2124,7 @@
OCFS_BH_PUT_DATA(bh_stack[tos]);
AllocExtent = NULL;
ocfs_kill_this_tree(osb, bh_stack[tos],
- free_head, inode);
+ handle, inode);
brelse(bh_stack[tos]);
AllocExtent = NULL;
bh_stack[tos] = NULL;
@@ -2340,7 +2343,7 @@
* before leaving this function, but that's pretty much up to the
* caller!
*/
-int ocfs_free_extents_for_truncate (ocfs_super * osb, ocfs_file_entry * FileEntry, ocfs_journal_handle *handle, ocfs_bitmap_free_head *free_head, struct inode *inode)
+int ocfs_free_extents_for_truncate (ocfs_super * osb, ocfs_file_entry * FileEntry, ocfs_journal_handle *handle, struct inode *inode)
{
int status = 0;
struct buffer_head *extent_bh = NULL;
@@ -2353,16 +2356,11 @@
alloc_size = FileEntry->alloc_size;
- if (free_head == NULL) {
- LOG_ERROR_STATUS (status = -ENOMEM);
- goto finally;
- }
-
/* local extents */
if (FileEntry->local_ext) {
status = _squish_extent_entries(osb, FileEntry->extents,
&FileEntry->next_free_ext,
- free_head, alloc_size, false,
+ handle, alloc_size, false,
inode);
if (status < 0) {
LOG_ERROR_STATUS (status);
@@ -2390,7 +2388,7 @@
if (FileEntry->extents[i].file_off >= alloc_size) {
LOG_TRACE_ARGS("Found an entire tree to delete!\n");
- status = ocfs_kill_this_tree(osb, extent_bh, free_head, inode);
+ status = ocfs_kill_this_tree(osb, extent_bh, handle, inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto finally;
@@ -2403,8 +2401,8 @@
} else { /* Ok, we only want part of it. */
LOG_TRACE_ARGS("Splitting this tree!\n");
status = ocfs_split_this_tree(osb, extent_bh,
- free_head, FileEntry,
- handle, inode);
+ handle, FileEntry,
+ inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto finally;
@@ -3139,7 +3137,8 @@
*
*/
int ocfs_free_directory_block (ocfs_super * osb, ocfs_file_entry * fe,
- ocfs_bitmap_free_head *free_head, struct inode *inode)
+ ocfs_journal_handle *handle,
+ struct inode *inode)
{
int status = 0;
struct buffer_head *dir_hdr_bh = NULL;
@@ -3165,16 +3164,20 @@
while ((dirnode->node_disk_off != INVALID_NODE_POINTER) &&
(IS_VALID_DIR_NODE (dirnode))) {
- status = ocfs_add_to_bitmap_free_head(osb, free_head, 1,
+ status = ocfs_handle_add_commit_bits(handle, 1,
dirnode->alloc_file_off,
dirnode->alloc_node,
DISK_ALLOC_DIR_NODE);
- /* LOG_FREE_BITMAP */
currentDirNode = dirnode->next_node_ptr;
OCFS_BH_PUT_DATA(dir_hdr_bh);
dir_hdr_bh = NULL;
dirnode = NULL;
+ if (status < 0) {
+ LOG_ERROR_STATUS(status);
+ goto leave;
+ }
+
if (currentDirNode != INVALID_NODE_POINTER) {
status = ocfs_read_bh(osb, currentDirNode, &dir_hdr_bh,
OCFS_BH_COND_CACHED, inode);
@@ -3205,7 +3208,7 @@
*
*/
int ocfs_free_file_extents (ocfs_super * osb, struct buffer_head *fe_bh,
- ocfs_bitmap_free_head *free_head, struct inode *inode)
+ ocfs_journal_handle *handle, struct inode *inode)
{
int status = 0;
__u32 i;
@@ -3240,9 +3243,9 @@
osb->vol_layout.data_start_off) /
(osb->vol_layout.cluster_size));
- ocfs_add_to_bitmap_free_head(osb, free_head,
- numBitsAllocated, bitmapOffset,
- -1, DISK_ALLOC_VOLUME);
+ ocfs_handle_add_commit_bits(handle, numBitsAllocated,
+ bitmapOffset, -1,
+ DISK_ALLOC_VOLUME);
}
} else {
for (i = 0; i < fe->next_free_ext; i++) {
@@ -3260,7 +3263,7 @@
}
OCFS_BH_PUT_DATA(extent_bh);
extent = NULL;
- status = ocfs_kill_this_tree(osb, extent_bh, free_head, inode);
+ status = ocfs_kill_this_tree(osb, extent_bh, handle, inode);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto leave;
@@ -3551,16 +3554,9 @@
LOG_TRACE_ARGS("window alloc_size = %u\n", alloc->alloc_size);
OCFS_BH_PUT_DATA(osb->local_alloc_bh);
- if (handle->abort_bits)
- LOG_ERROR_STR("Multiple window allocations in a transaction "
- "-- this is illegal!");
- else
- handle->abort_bits = ocfs_alloc_bitmap_free_head();
-
- status = ocfs_add_to_bitmap_free_head(osb, handle->abort_bits,
- cluster_count,
- alloc->bitmap_start, -1,
- DISK_ALLOC_VOLUME);
+ status = ocfs_handle_add_abort_bits(handle, cluster_count,
+ alloc->bitmap_start, -1,
+ DISK_ALLOC_VOLUME);
if (status < 0) {
LOG_ERROR_STATUS(status);
Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c 2004-03-17 22:16:26 UTC (rev 787)
+++ trunk/src/file.c 2004-03-18 22:18:41 UTC (rev 788)
@@ -901,7 +901,6 @@
__u32 csize = osb->vol_layout.cluster_size;
struct buffer_head *bh = NULL;
int flags = 0;
- ocfs_bitmap_free_head *free_head = NULL;
ocfs_journal_handle *handle = NULL;
LOG_ENTRY_ARGS ("(file_off = %u.%u, file_size = %u.%u\n",
@@ -932,14 +931,6 @@
goto leave;
}
- /* we keep our bitmap updates in this structure and process
- * them later. */
- free_head = ocfs_alloc_bitmap_free_head();
- if (free_head == NULL) {
- LOG_ERROR_STATUS (status = -ENOMEM);
- goto leave;
- }
-
lockId = fe->this_sector;
lockFlags = FLAG_FILE_TRUNCATE;
bFileLockAcquired = true;
@@ -1015,7 +1006,7 @@
fe->file_size = file_size;
fe->alloc_size = new_alloc_size;
- status = ocfs_free_extents_for_truncate (osb, fe, handle, free_head, inode);
+ status = ocfs_free_extents_for_truncate (osb, fe, handle, inode);
if (status < 0) {
OCFS_BH_PUT_DATA(bh);
if (oin)
@@ -1058,16 +1049,11 @@
}
leave:
- if (handle && (status == 0)) {
+ if (handle && (status == 0))
ocfs_commit_trans(handle);
- if (free_head)
- ocfs_process_bitmap_free_head(osb, free_head);
- } else if (handle)
+ else if (handle)
ocfs_abort_trans(handle);
- if (free_head)
- ocfs_free_bitmap_free_head(free_head);
-
if (bAcquiredLock) {
if (bFileLockAcquired)
lockFlags |= FLAG_FILE_UPDATE_OIN;
Modified: trunk/src/inc/journal.h
===================================================================
--- trunk/src/inc/journal.h 2004-03-17 22:16:26 UTC (rev 787)
+++ trunk/src/inc/journal.h 2004-03-18 22:18:41 UTC (rev 788)
@@ -195,6 +195,39 @@
(handle)->flags &= ~OCFS_HANDLE_SYNC; \
} while(0)
+/* TODO: turn both of these into static inlines, once the include file
+ * mess is sorted out. */
+#define ocfs_handle_add_commit_bits(handle, len, fileoff, nodenum, type) \
+({ \
+ int rv = 0; \
+ if (!handle->commit_bits) \
+ handle->commit_bits = ocfs_alloc_bitmap_free_head(); \
+ \
+ if (!handle->commit_bits) \
+ rv = -ENOMEM; \
+ else \
+ rv = ocfs_add_to_bitmap_free_head(handle->osb, \
+ handle->commit_bits, \
+ len, fileoff, nodenum, \
+ type); \
+ rv; \
+})
+#define ocfs_handle_add_abort_bits(handle, len, fileoff, nodenum, type) \
+({ \
+ int rv = 0; \
+ if (!handle->abort_bits) \
+ handle->abort_bits = ocfs_alloc_bitmap_free_head(); \
+ \
+ if (!handle->abort_bits) \
+ rv = -ENOMEM; \
+ else \
+ rv = ocfs_add_to_bitmap_free_head(handle->osb, \
+ handle->abort_bits, \
+ len, fileoff, nodenum, \
+ type); \
+ rv; \
+})
+
/*
* Journal Configuration Management:
* These are normally called at mount and unmount time.
Modified: trunk/src/inc/proto.h
===================================================================
--- trunk/src/inc/proto.h 2004-03-17 22:16:26 UTC (rev 787)
+++ trunk/src/inc/proto.h 2004-03-18 22:18:41 UTC (rev 788)
@@ -28,14 +28,14 @@
#define _PROTO_H_
int ocfs_allocate_extent (ocfs_super * osb, ocfs_inode * oin, struct buffer_head *fe_bh, ocfs_journal_handle *handle,__u64 actualDiskOffset, __u64 actualLength, struct inode *inode);
-int ocfs_kill_this_tree(ocfs_super *osb, struct buffer_head *extent_grp_bh, ocfs_bitmap_free_head *free_head, struct inode *inode);
-int ocfs_free_extents_for_truncate (ocfs_super * osb, ocfs_file_entry * FileEntry, ocfs_journal_handle *handle, ocfs_bitmap_free_head *free_head, struct inode *inode);
+int ocfs_kill_this_tree(ocfs_super *osb, struct buffer_head *extent_grp_bh, ocfs_journal_handle *handle, struct inode *inode);
+int ocfs_free_extents_for_truncate (ocfs_super * osb, ocfs_file_entry * FileEntry, ocfs_journal_handle *handle, struct inode *inode);
int ocfs_lookup_file_allocation (ocfs_super * osb, ocfs_inode * oin, __s64 Vbo, __s64 * Lbo, __u32 sectors, u32 *sector_count, struct inode *inode);
int ocfs_get_leaf_extent (ocfs_super * osb, ocfs_file_entry * FileEntry, __s64 Vbo, struct buffer_head **data_extent_bh, struct inode *inode);
int ocfs_find_contiguous_space_from_bitmap (ocfs_super * osb, __u64 file_size, __u64 * cluster_off, __u64 * cluster_count, bool sysfile, struct buffer_head *lock_bh);
int ocfs_alloc_node_block (ocfs_super * osb, __u64 FileSize, __u64 * DiskOffset, __u64 * file_off, __u32 NodeNum, __u32 Type, ocfs_journal_handle *handle);
-int ocfs_free_directory_block (ocfs_super * osb, ocfs_file_entry * fe, ocfs_bitmap_free_head *free_head, struct inode *inode);
-int ocfs_free_file_extents (ocfs_super * osb, struct buffer_head *fe_bh, ocfs_bitmap_free_head *free_head, struct inode *inode);
+int ocfs_free_directory_block (ocfs_super * osb, ocfs_file_entry * fe, ocfs_journal_handle *handle, struct inode *inode);
+int ocfs_free_file_extents (ocfs_super * osb, struct buffer_head *fe_bh, ocfs_journal_handle *handle, struct inode *inode);
int ocfs_wait_for_disk_lock_release (ocfs_super * osb, __u64 offset, __u32 time_to_wait, __u32 lock_type);
Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c 2004-03-17 22:16:26 UTC (rev 787)
+++ trunk/src/namei.c 2004-03-18 22:18:41 UTC (rev 788)
@@ -30,7 +30,7 @@
extern spinlock_t oin_num_ext_lock;
-static int ocfs_fe_smash (ocfs_super * osb, __u64 lock_node_off, __u32 flags, __u64 file_off, ocfs_journal_handle *passed_handle, ocfs_bitmap_free_head **ret_head, struct dentry *dentry, struct inode *parent_inode);
+static int ocfs_fe_smash (ocfs_super * osb, __u64 lock_node_off, __u32 flags, __u64 file_off, ocfs_journal_handle *passed_handle, struct dentry *dentry, struct inode *parent_inode);
static int ocfs_rename_file (ocfs_super * osb, ocfs_journal_handle *handle, __u64 parent_off, struct dentry *dentry, __u64 file_off, struct inode *dir_inode);
static int ocfs_mknod_locked(ocfs_super *osb, struct inode *dir,
struct dentry *dentry, int mode,
@@ -644,7 +644,7 @@
if (fileOff != -1)
status = ocfs_fe_smash (osb, parentOff, 0, fileOff,
- NULL, NULL, dentry, parentInode);
+ NULL, dentry, parentInode);
if (status < 0) {
if (status != -ENOTEMPTY && status != -EPERM &&
@@ -657,9 +657,10 @@
OCFS_CLEAR_FLAG (oin->oin_flags, OCFS_OIN_IN_USE);
ocfs_up_sem (&(oin->main_res));
}
+ goto bail;
}
- if (status >= 0 && oin)
+ if (oin)
ocfs_release_cached_oin (osb, oin);
}
@@ -1107,7 +1108,7 @@
}
status = ocfs_fe_smash (osb, newDirOff, 0,
- tmpoff, handle, &free_head, new_dentry,
+ tmpoff, handle, new_dentry,
new_dir);
if (status < 0) {
/* TODO: we should make this transactional such that */
@@ -1127,7 +1128,7 @@
status = ocfs_fe_smash (osb, oldDirOff,
FLAG_DEL_NAME | FLAG_DEL_INODE,
- oldOffset, handle, NULL, old_dentry,
+ oldOffset, handle, old_dentry,
old_dir);
if (status < 0) {
if (status != -ENOTEMPTY && status != -EINTR &&
@@ -1642,7 +1643,7 @@
* to pass back a bitmap_free_head (if it's not passed as NULL)
*
*/
-static int ocfs_fe_smash (ocfs_super * osb, __u64 lock_node_off, __u32 flags, __u64 file_off, ocfs_journal_handle *passed_handle, ocfs_bitmap_free_head **ret_head, struct dentry *dentry, struct inode *parent_inode)
+static int ocfs_fe_smash (ocfs_super * osb, __u64 lock_node_off, __u32 flags, __u64 file_off, ocfs_journal_handle *passed_handle, struct dentry *dentry, struct inode *parent_inode)
{
int status = 0;
int tmpstat;
@@ -1654,21 +1655,11 @@
struct buffer_head *lock_node_bh = NULL; /* parent locknode */
ocfs_lock_res *parent_lock = NULL;
ocfs_lock_res *file_lock = NULL;
- ocfs_bitmap_free_head *free_head = NULL;
ocfs_journal_handle *handle = NULL;
struct inode *inode = dentry->d_inode;
LOG_ENTRY ();
- if (ret_head)
- *ret_head = NULL;
-
- free_head = ocfs_alloc_bitmap_free_head();
- if (free_head == NULL) {
- LOG_ERROR_STATUS (status = -ENOMEM);
- goto leave;
- }
-
status = ocfs_read_bh(osb, lock_node_off, &lock_node_bh,
OCFS_BH_CACHED, parent_inode);
if (status < 0) {
@@ -1781,7 +1772,6 @@
if (!IS_VALID_DIR_NODE(pLockNode)) {
OCFS_BH_PUT_DATA(lock_bh);
OCFS_BH_PUT_DATA(fe_bh);
- ocfs_clear_buffer_modified(fe_bh);
ocfs_clear_buffer_modified(lock_node_bh);
status = -EIO;
LOG_TRACE_STR("Uhoh, invalid dirnode found!");
@@ -1793,7 +1783,6 @@
if (numused && !(flags & FLAG_DEL_NAME)) {
OCFS_BH_PUT_DATA(fe_bh);
- ocfs_clear_buffer_modified(fe_bh);
ocfs_clear_buffer_modified(lock_node_bh);
status = -ENOTEMPTY;
LOG_TRACE_ARGS("-ENOTEMPY, numused = %u\n", numused);
@@ -1806,7 +1795,6 @@
* doing a rename so skip the 1st part of this function. */
status = 0;
OCFS_BH_PUT_DATA(fe_bh);
- ocfs_clear_buffer_modified(fe_bh);
ocfs_clear_buffer_modified(lock_node_bh);
goto delete_entry;
}
@@ -1826,11 +1814,10 @@
/* Iterate through all the dir nodes for this
* directory and mark them to be freed */
fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
- status = ocfs_free_directory_block (osb, fe, free_head, inode);
+ status = ocfs_free_directory_block (osb, fe, handle, inode);
OCFS_BH_PUT_DATA(fe_bh);
if (status < 0) {
OCFS_BH_PUT_DATA(fe_bh);
- ocfs_clear_buffer_modified(fe_bh);
ocfs_clear_buffer_modified(lock_node_bh);
LOG_ERROR_STATUS (status);
goto leave;
@@ -1838,7 +1825,7 @@
} else {
/* mark all the extents (and extent metadata) for
* this file so we can remove them after commit. */
- status = ocfs_free_file_extents (osb, fe_bh, free_head, inode);
+ status = ocfs_free_file_extents (osb, fe_bh, handle, inode);
if (status < 0) {
ocfs_clear_buffer_modified(fe_bh);
ocfs_clear_buffer_modified(lock_node_bh);
@@ -1872,16 +1859,8 @@
if (local_handle && handle && (status < 0))
ocfs_abort_trans(handle);
- else if (local_handle && handle) {
+ else if (local_handle && handle)
ocfs_commit_trans(handle);
- if (free_head) {
- /* Free the bits from the bitmap now. It's OK
- * if none were marked. */
- status = ocfs_process_bitmap_free_head(osb, free_head);
- if (status < 0)
- LOG_ERROR_STATUS(status);
- }
- }
/* NEW: adding a fake release lock for the dead file entry here */
/* need this to alert dentry-owners on other nodes */
@@ -1907,17 +1886,6 @@
ocfs_put_lockres (parent_lock);
}
- if (free_head) {
- /* we only return a bitmap_free_head if they asked for
- * it and we succeeded. Otherwise we should free it
- * ourselves. */
- if (ret_head && (status == 0))
- *ret_head = free_head;
- else {
- LOG_TRACE_STR("freeing bitmap_free_head");
- ocfs_free_bitmap_free_head(free_head);
- }
- }
if (lock_bh != NULL && lock_bh != fe_bh)
brelse(lock_bh);
More information about the Ocfs2-commits
mailing list