[Ocfs2-commits] mfasheh commits r865 - in trunk/src: . inc
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Apr 23 16:48:24 CDT 2004
Author: mfasheh
Date: 2004-04-23 15:48:22 -0500 (Fri, 23 Apr 2004)
New Revision: 865
Modified:
trunk/src/file.c
trunk/src/inc/ocfs.h
trunk/src/inode.c
trunk/src/namei.c
trunk/src/nm.c
trunk/src/oin.c
Log:
* removed OCFS_OIN_IN_TEARDOWN flag as it is uselesss
* removed OCFS_OIN_INVALID flag as it was only set twice and never checked
* removed OCFS_INITIALIZED_MAIN_RESOURCE from oin_flags and set
OCFS_INODE_INITIALIZED on the flags field instead. This is mostly unused,
but I can see the reasoning behind an initialized flag (for debugging I
suppose).
* removed OCFS_OIN_ROOT_DIRECTORY and used OCFS_ROOT_INODE_NUMBER instead.
* removed all the other oin_flags which weren't even referenced in any
files.
Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c 2004-04-23 18:23:23 UTC (rev 864)
+++ trunk/src/file.c 2004-04-23 20:48:22 UTC (rev 865)
@@ -118,12 +118,8 @@
/* If the in use flag is set, forget about it. This will go
* eventually. */
- if ((OCFS_I(inode)->oin_flags & OCFS_OIN_IN_TEARDOWN) ||
- (OCFS_I(inode)->oin_flags & OCFS_OIN_DELETE_ON_CLOSE)) {
- if (OCFS_I(inode)->oin_flags & OCFS_OIN_IN_TEARDOWN)
- LOG_ERROR_STR ("oin in teardown");
- else
- LOG_ERROR_STR ("oin deleted");
+ if (OCFS_I(inode)->oin_flags & OCFS_OIN_DELETE_ON_CLOSE) {
+ LOG_ERROR_STR ("oin deleted");
up(&inode->i_sem);
goto leave;
}
@@ -313,7 +309,7 @@
if (!OCFS_I(inode)->open_hndl_cnt)
last_close = true;
- if (OCFS_I(inode)->oin_flags & OCFS_OIN_ROOT_DIRECTORY) {
+ if (inode->i_ino == OCFS_ROOT_INODE_NUMBER) {
ocfs_up_sem (&(OCFS_I(inode)->main_res));
goto bail;
}
Modified: trunk/src/inc/ocfs.h
===================================================================
--- trunk/src/inc/ocfs.h 2004-04-23 18:23:23 UTC (rev 864)
+++ trunk/src/inc/ocfs.h 2004-04-23 20:48:22 UTC (rev 865)
@@ -423,20 +423,6 @@
#define LOCK_STATE_IN_VOTING 0x00000004
#define FLAG_READONLY_DROPPING 0x00000008
-/* oin->oin_flags flags */
-#define OCFS_OIN_IN_TEARDOWN (0x00000002)
-#define OCFS_OIN_DIRECTORY (0x00000008)
-#define OCFS_OIN_ROOT_DIRECTORY (0x00000010)
-#define OCFS_OIN_CACHE_UPDATE (0x00000100)
-#define OCFS_OIN_DELETE_ON_CLOSE (0x00000200)
-#define OCFS_OIN_NEEDS_DELETION (0x00000400)
-#define OCFS_INITIALIZED_MAIN_RESOURCE (0x00002000)
-#define OCFS_OIN_INVALID (0x00008000)
-#define OCFS_OIN_IN_USE (0x00020000)
-#define OCFS_OIN_OPEN_FOR_DIRECTIO (0x00100000)
-#define OCFS_OIN_OPEN_FOR_WRITE (0x00200000)
-#define OCFS_OIN_IN_RECOVER_LIST (0x00400000)
-
/* osb->osb_flags flags */
#define OCFS_OSB_FLAGS_BEING_DISMOUNTED (0x00000004)
#define OCFS_OSB_FLAGS_SHUTDOWN (0x00000008)
@@ -1758,10 +1744,22 @@
__u32 flags; /* see below */
} ocfs_inode_private;
+/* Eventually, the 'flags' and 'oin_flags' fields need to be
+ * merged. */
+/* oin_flags flags */
+#define OCFS_OIN_DIRECTORY (0x00000002)
+#define OCFS_OIN_DELETE_ON_CLOSE (0x00000008)
+#define OCFS_OIN_NEEDS_DELETION (0x00000010)
+#define OCFS_OIN_OPEN_FOR_DIRECTIO (0x00000100)
+#define OCFS_OIN_OPEN_FOR_WRITE (0x00000200)
+
+/* 'flags' flags. */
/* has this inode been deleted, either from this node or from another node. */
#define OCFS_INODE_DELETED 0x00000001
/* is this the journal inode? */
#define OCFS_INODE_JOURNAL 0x00000002
+/* set on init_private, cleared on clear_inode */
+#define OCFS_INODE_INITIALIZED 0x00000004
#define GET_INODE_CLEAN_SEQ(i) (atomic_t *)(&(OCFS_I(i)->i_clean_buffer_seq))
Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c 2004-04-23 18:23:23 UTC (rev 864)
+++ trunk/src/inode.c 2004-04-23 20:48:22 UTC (rev 865)
@@ -199,7 +199,6 @@
// oin->obj_id.type = OCFS_TYPE_OIN;
// oin->obj_id.size = sizeof (ocfs_inode);
ocfs_init_sem (&(i->main_res));
- OCFS_SET_FLAG (i->oin_flags, OCFS_INITIALIZED_MAIN_RESOURCE);
init_MUTEX(&(i->inode_extend_sem));
i->open_hndl_cnt = 0;
ocfs_extent_map_init (&i->map);
@@ -210,6 +209,7 @@
i->voteoff = 0ULL;
i->feoff = 0ULL;
+ OCFS_SET_FLAG (i->flags, OCFS_INODE_INITIALIZED);
return 0;
} /* ocfs_inode_init_private */
@@ -358,7 +358,7 @@
OCFS_I(inode)->alloc_size = 0ULL;
OCFS_I(inode)->inode = inode;
OCFS_I(inode)->chng_seq_num = 0ULL;
- OCFS_I(inode)->oin_flags |= OCFS_OIN_DIRECTORY | OCFS_OIN_ROOT_DIRECTORY;
+ OCFS_I(inode)->oin_flags |= OCFS_OIN_DIRECTORY;
ocfs_inode_hash_bind(osb, GET_INODE_VOTEOFF(inode), inode);
goto bail;
@@ -487,7 +487,7 @@
OCFS_I(inode)->alloc_size = 0ULL;
OCFS_I(inode)->inode = inode;
OCFS_I(inode)->chng_seq_num = 0ULL;
- OCFS_I(inode)->oin_flags |= OCFS_OIN_DIRECTORY | OCFS_OIN_ROOT_DIRECTORY;
+ OCFS_I(inode)->oin_flags |= OCFS_OIN_DIRECTORY;
ocfs_inode_hash_bind(osb, GET_INODE_VOTEOFF(inode), inode);
goto bail;
@@ -760,6 +760,8 @@
goto bail;
}
+ OCFS_CLEAR_FLAG (OCFS_I(inode)->flags, OCFS_INODE_INITIALIZED);
+
offset = GET_INODE_VOTEOFF(inode);
if (offset == -1)
BUG();
@@ -780,8 +782,6 @@
goto bail;
}
- OCFS_SET_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_IN_TEARDOWN);
-
lockres = OCFS_I(inode)->lock_res;
if (lockres) {
ocfs_acquire_lockres (lockres);
@@ -799,7 +799,6 @@
up(&recovery_list_sem);
ocfs_del_sem (&(OCFS_I(inode)->main_res));
- OCFS_CLEAR_FLAG (OCFS_I(inode)->oin_flags, OCFS_INITIALIZED_MAIN_RESOURCE);
/* clean out the inode private ... why?! */
memset(inode->u.generic_ip, 0, sizeof(ocfs_inode_private));
Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c 2004-04-23 18:23:23 UTC (rev 864)
+++ trunk/src/namei.c 2004-04-23 20:48:22 UTC (rev 865)
@@ -163,7 +163,6 @@
__u64 parent_off;
__u64 file_off = 0;
__u64 dirnode_off;
- __u32 oinflags;
ocfs_lock_res *lockres = NULL;
ocfs_journal_handle *handle = NULL;
ocfs_super *osb;
@@ -236,7 +235,6 @@
file_off = fe->this_sector;
dirnode_off = fe->extents[0].disk_off;
- oinflags = (S_ISDIR (mode) ? OCFS_OIN_DIRECTORY : 0);
parent_off = GET_INODE_VOTEOFF(dir);
@@ -579,7 +577,7 @@
LOG_TRACE_STR ("dentry is not empty, cannot delete");
} else if (OCFS_I(inode)->open_hndl_cnt > 0) {
LOG_TRACE_ARGS ("Cannot remove an open file (open_hndl_cnt = %u, fileOff = %u.%u, d_count=%u)\n", OCFS_I(inode)->open_hndl_cnt, HILO(fileOff), atomic_read(&dentry->d_count));
- } else if (OCFS_I(inode)->oin_flags & OCFS_OIN_ROOT_DIRECTORY) {
+ } else if (inode->i_ino == OCFS_ROOT_INODE_NUMBER) {
LOG_TRACE_STR ("Cannot delete the root directory");
status = -EPERM;
} else if (OCFS_I(inode)->oin_flags & OCFS_OIN_DELETE_ON_CLOSE) {
@@ -1024,8 +1022,7 @@
/* Locking hierarchy will be broken */
if (new_inode) {
- if (!(OCFS_I(new_inode)->oin_flags & OCFS_OIN_IN_TEARDOWN) &&
- !(OCFS_I(new_inode)->oin_flags & OCFS_OIN_DELETE_ON_CLOSE)) {
+ if (!(OCFS_I(new_inode)->oin_flags & OCFS_OIN_DELETE_ON_CLOSE)) {
/* OIN exists and it's not marked for deletion! */
ocfs_down_sem (&(OCFS_I(new_inode)->main_res), true);
status = ocfs_verify_update_inode (osb, new_inode, &needs_trunc);
Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c 2004-04-23 18:23:23 UTC (rev 864)
+++ trunk/src/nm.c 2004-04-23 20:48:22 UTC (rev 865)
@@ -970,7 +970,7 @@
spin_lock(&oin_num_ext_lock);
if (OCFS_I(inode)->num_extends) {
vote_response = FLAG_VOTE_OIN_ALREADY_INUSE;
- } else if (!(OCFS_I(inode)->oin_flags & OCFS_OIN_IN_TEARDOWN)) {
+ } else {
OCFS_SET_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_NEEDS_DELETION);
ocfs_up_sem (oin_sem);
ocfs_release_lockres (lockres);
Modified: trunk/src/oin.c
===================================================================
--- trunk/src/oin.c 2004-04-23 18:23:23 UTC (rev 864)
+++ trunk/src/oin.c 2004-04-23 20:48:22 UTC (rev 865)
@@ -89,9 +89,6 @@
} else {
LOG_TRACE_STR ("File Entry is invalid");
}
-
- OCFS_SET_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_INVALID);
- /* ?? I think we should remove the oin here from the oin list */
status = -ENOENT;
goto leave;
}
@@ -112,7 +109,6 @@
if (status < 0) {
LOG_TRACE_STR ("file entry name did not match inode");
- OCFS_SET_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_INVALID);
goto leave;
}
@@ -288,7 +284,7 @@
flags |= OCFS_I(inode)->oin_flags;
- if (!(flags & OCFS_OIN_ROOT_DIRECTORY)) {
+ if (inode->i_ino != OCFS_ROOT_INODE_NUMBER) {
if (local_handle) {
handle = ocfs_start_trans(osb, OCFS_OPEN_CREDITS);
if (!handle) {
More information about the Ocfs2-commits
mailing list