[Ocfs2-commits] mfasheh commits r853 - in trunk/src: . inc
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon Apr 19 14:47:41 CDT 2004
Author: mfasheh
Date: 2004-04-19 13:47:39 -0500 (Mon, 19 Apr 2004)
New Revision: 853
Modified:
trunk/src/dcache.c
trunk/src/file.c
trunk/src/inc/ocfs.h
trunk/src/inode.c
trunk/src/namei.c
trunk/src/nm.c
Log:
* move main_res from oin to inode_private_data. oin is now an empty structure
* mark ocfs_inode_private by commenting which fields are protected by which locks
Modified: trunk/src/dcache.c
===================================================================
--- trunk/src/dcache.c 2004-04-19 18:07:19 UTC (rev 852)
+++ trunk/src/dcache.c 2004-04-19 18:47:39 UTC (rev 853)
@@ -96,12 +96,12 @@
}
/* hit the disk */
/* TODO: optimize */
- ocfs_down_sem (&(oin->main_res), true);
+ ocfs_down_sem (&(OCFS_I(inode)->main_res), true);
OCFS_I(inode)->needs_verification = true;
tmpstat = ocfs_verify_update_inode(osb, inode, &needs_trunc);
if (tmpstat < 0)
LOG_ERROR_STATUS (tmpstat);
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
if (needs_trunc)
ocfs_truncate_inode_pages(inode, 0);
goto bail;
Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c 2004-04-19 18:07:19 UTC (rev 852)
+++ trunk/src/file.c 2004-04-19 18:47:39 UTC (rev 853)
@@ -121,7 +121,7 @@
* inode, and therefore we are given the oin too */
down(&inode->i_sem);
oin = GET_INODE_OIN(inode);
- oin_sem = &(oin->main_res);
+ oin_sem = &(OCFS_I(inode)->main_res);
ocfs_down_sem (oin_sem, true);
bAcquiredOIN = true;
@@ -346,13 +346,13 @@
oin = GET_INODE_OIN(inode);
- ocfs_down_sem (&(oin->main_res), true);
+ ocfs_down_sem (&(OCFS_I(inode)->main_res), true);
OCFS_I(inode)->open_hndl_cnt--;
if (!OCFS_I(inode)->open_hndl_cnt)
last_close = true;
if (OCFS_I(inode)->oin_flags & OCFS_OIN_ROOT_DIRECTORY) {
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
goto bail;
}
@@ -369,7 +369,7 @@
if (OCFS_I(inode)->oin_flags & OCFS_OIN_NEEDS_DELETION ||
OCFS_I(inode)->oin_flags & OCFS_OIN_IN_USE) {
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
LOG_ERROR_STR("Not deleting lockrse on a last close! eek!");
goto bail;
}
@@ -380,7 +380,7 @@
OCFS_I(inode)->lock_res = NULL;
}
}
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
ocfs_sync_inode(inode);
if (last_close) {
@@ -654,9 +654,9 @@
if (OCFS_I(inode)->needs_verification) {
LOG_TRACE_STR ("OIN_NEEDS_VERIFICATION");
- ocfs_down_sem (&(oin->main_res), true);
+ ocfs_down_sem (&(OCFS_I(inode)->main_res), true);
status = ocfs_verify_update_inode (osb, inode, &needs_trunc);
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
if (needs_trunc)
ocfs_truncate_inode_pages(inode, 0);
if (status < 0) {
@@ -783,9 +783,9 @@
}
if (OCFS_I(inode)->needs_verification) {
- ocfs_down_sem (&(oin->main_res), true);
+ ocfs_down_sem (&(OCFS_I(inode)->main_res), true);
status = ocfs_verify_update_inode (osb, inode, &needs_trunc);
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
if (needs_trunc)
ocfs_truncate_inode_pages(inode, 0);
if (status < 0) {
@@ -915,7 +915,7 @@
oin = GET_INODE_OIN(inode);
if (oin)
- ocfs_down_sem(&oin->main_res, true);
+ ocfs_down_sem(&OCFS_I(inode)->main_res, true);
fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
@@ -929,7 +929,7 @@
HILO(file_size));
OCFS_BH_PUT_DATA(bh);
if (oin)
- ocfs_up_sem(&oin->main_res);
+ ocfs_up_sem(&OCFS_I(inode)->main_res);
status = -EINVAL;
LOG_ERROR_STATUS(status);
goto leave;
@@ -942,7 +942,7 @@
if (status < 0) {
OCFS_BH_PUT_DATA(bh);
if (oin)
- ocfs_up_sem(&oin->main_res);
+ ocfs_up_sem(&OCFS_I(inode)->main_res);
LOG_ERROR_STATUS (status);
goto leave;
}
@@ -963,7 +963,7 @@
status = ocfs_journal_dirty(handle, bh);
if (status < 0) {
if (oin)
- ocfs_up_sem(&oin->main_res);
+ ocfs_up_sem(&OCFS_I(inode)->main_res);
LOG_ERROR_STATUS (status);
goto leave;
}
@@ -971,13 +971,13 @@
/* second try for the oin... */
if (!oin && inode_data_is_oin(inode)) {
oin = GET_INODE_OIN(inode);
- ocfs_down_sem(&oin->main_res, true);
+ ocfs_down_sem(&OCFS_I(inode)->main_res, true);
}
if (oin) {
/* if we updated correctly then we can update the OIN */
OCFS_I(inode)->alloc_size = new_alloc_size;
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
}
leave:
@@ -1190,9 +1190,9 @@
fileEntry->alloc_size += actualLength;
if (oin) {
- ocfs_down_sem (&(oin->main_res), true);
+ ocfs_down_sem (&(OCFS_I(inode)->main_res), true);
OCFS_I(inode)->alloc_size = fileEntry->alloc_size;
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
}
/* no need to do OCFS_SECTOR_ALIGN once the allocation size is correct. */
@@ -1344,19 +1344,19 @@
}
if (attr->ia_valid & ATTR_SIZE) {
- ocfs_down_sem (&(oin->main_res), true);
+ ocfs_down_sem (&(OCFS_I(inode)->main_res), true);
if (OCFS_I(inode)->needs_verification) {
LOG_TRACE_STR ("OIN_NEEDS_VERIFICATION");
status = ocfs_verify_update_inode (osb, inode, &needs_trunc);
if (status < 0) {
LOG_ERROR_STATUS (status);
LOG_TRACE_STR ("TODO: disable volume");
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
error = -EIO;
goto bail;
}
}
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
if (needs_trunc)
ocfs_truncate_inode_pages(inode, 0);
@@ -1376,13 +1376,13 @@
}
if (oin != NULL) {
- ocfs_down_sem (&(oin->main_res), true);
+ ocfs_down_sem (&(OCFS_I(inode)->main_res), true);
if (inode->i_size > newsize) {
ocfs_delete_all_extent_maps(osb, inode);
}
inode->i_size = newsize;
inode->i_blocks = (newsize + sb->s_blocksize) >> sb->s_blocksize_bits;
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
}
}
@@ -1484,9 +1484,9 @@
if (oin == ((ocfs_super *)(OCFS_GENERIC_SB_P(sb)))->oin_root_dir)
goto bail;
- ocfs_down_sem (&(oin->main_res), true);
+ ocfs_down_sem (&(OCFS_I(inode)->main_res), true);
status = ocfs_verify_update_inode (osb, inode, &needs_trunc);
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
if (needs_trunc)
ocfs_truncate_inode_pages(inode, 0);
if (status < 0)
Modified: trunk/src/inc/ocfs.h
===================================================================
--- trunk/src/inc/ocfs.h 2004-04-19 18:07:19 UTC (rev 852)
+++ trunk/src/inc/ocfs.h 2004-04-19 18:47:39 UTC (rev 853)
@@ -1725,7 +1725,7 @@
struct _ocfs_inode
{
- ocfs_sem main_res;
+ int empty;
};
/* OCFS2 Inode Private Data
@@ -1734,31 +1734,37 @@
* of locks and does several checks, so you're safe reading these values
* if any of the following is true:
* 1) you have i_sem
- * 2) you have oin->main_res
- * 3) oin->open_hndl_cnt > 0
+ * 2) you have main_res
+ * 3) open_hndl_cnt > 0
*/
typedef struct _ocfs_inode_private
{
/* always valid, just a simple back pointer. */
- struct inode *inode;
+ struct inode *inode;
- /* protected by main_res */
- ocfs_inode oin;
- __u32 open_hndl_cnt;
- bool needs_verification;
- struct list_head recovery_list;
- __u64 chng_seq_num;
- ocfs_extent_map map;
- __u32 num_extends;
- struct semaphore inode_extend_sem;
- ocfs_lock_res *lock_res;
- __s64 alloc_size;
- __u32 oin_flags;
+ __u64 voteoff;
+ __u64 feoff;
- __u64 voteoff;
- __u64 feoff;
- atomic_t i_clean_buffer_seq;
- __u32 flags; /* see below */
+ ocfs_inode oin;
+
+ ocfs_sem main_res;
+ /* These fields are protected by main_res */
+ __u32 open_hndl_cnt;
+ bool needs_verification;
+ __u64 chng_seq_num;
+ ocfs_extent_map map;
+ ocfs_lock_res *lock_res;
+ __s64 alloc_size;
+ __u32 oin_flags;
+
+ /* inode_extend_sem locks out extends on behalf of other nodes. */
+ struct semaphore inode_extend_sem;
+
+ struct list_head recovery_list; /* protected by recovery_list_sem */
+ __u32 num_extends; /* protected by oin_num_ext_lock */
+
+ atomic_t i_clean_buffer_seq;
+ __u32 flags; /* see below */
} ocfs_inode_private;
/* has this inode been deleted, either from this node or from another node. */
Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c 2004-04-19 18:07:19 UTC (rev 852)
+++ trunk/src/inode.c 2004-04-19 18:47:39 UTC (rev 853)
@@ -200,7 +200,7 @@
/* Init OIN (or old OIN) stuff. */
// oin->obj_id.type = OCFS_TYPE_OIN;
// oin->obj_id.size = sizeof (ocfs_inode);
- ocfs_init_sem (&(oin->main_res));
+ 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;
@@ -812,7 +812,7 @@
list_del(&OCFS_I(inode)->recovery_list);
up(&recovery_list_sem);
- ocfs_del_sem (&(oin->main_res));
+ ocfs_del_sem (&(OCFS_I(inode)->main_res));
OCFS_CLEAR_FLAG (OCFS_I(inode)->oin_flags, OCFS_INITIALIZED_MAIN_RESOURCE);
/* clean out the oin ... why?! */
@@ -931,14 +931,14 @@
HILO (newsize));
if (unlock)
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
status = ocfs_extend_file (osb, newsize,
GET_INODE_FEOFF(inode), NULL,
inode, NULL);
if (unlock)
- ocfs_down_sem (&(oin->main_res), true);
+ ocfs_down_sem (&(OCFS_I(inode)->main_res), true);
}
if (status < 0) {
@@ -1064,7 +1064,7 @@
}
if (!(OCFS_I(inode)->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO)) {
- ocfs_down_sem (&(oin->main_res), true);
+ ocfs_down_sem (&(OCFS_I(inode)->main_res), true);
oin_locked = true;
}
@@ -1094,7 +1094,7 @@
err = -EIO;
if (oin_locked && !(OCFS_I(inode)->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO)) {
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
}
LOG_EXIT_LONG (err);
Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c 2004-04-19 18:07:19 UTC (rev 852)
+++ trunk/src/namei.c 2004-04-19 18:47:39 UTC (rev 853)
@@ -626,9 +626,9 @@
}
spin_unlock(&oin_num_ext_lock);
- ocfs_down_sem (&(oin->main_res), true);
+ ocfs_down_sem (&(OCFS_I(inode)->main_res), true);
OCFS_SET_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_DELETE_ON_CLOSE);
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
if (fileOff != -1)
status = ocfs_fe_smash (osb, parentOff, 0, fileOff,
@@ -640,10 +640,10 @@
LOG_ERROR_STATUS(status);
if (oin) {
- ocfs_down_sem (&(oin->main_res), true);
+ ocfs_down_sem (&(OCFS_I(inode)->main_res), true);
OCFS_CLEAR_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_DELETE_ON_CLOSE);
OCFS_CLEAR_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_IN_USE);
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
}
goto bail;
}
@@ -977,11 +977,11 @@
if (!(OCFS_I(new_dentry->d_inode)->oin_flags & OCFS_OIN_IN_TEARDOWN) &&
!(OCFS_I(new_dentry->d_inode)->oin_flags & OCFS_OIN_DELETE_ON_CLOSE)) {
/* OIN exists and it's not marked for deletion! */
- ocfs_down_sem (&(newOIN->main_res), true);
+ ocfs_down_sem (&(OCFS_I(new_dentry->d_inode)->main_res), true);
OCFS_SET_FLAG (OCFS_I(new_dentry->d_inode)->oin_flags,
OCFS_OIN_IN_USE);
status = ocfs_verify_update_inode (osb, new_dentry->d_inode, &needs_trunc);
- ocfs_up_sem (&(newOIN->main_res));
+ ocfs_up_sem (&(OCFS_I(new_dentry->d_inode)->main_res));
delete_target_oin = true;
if (needs_trunc)
ocfs_truncate_inode_pages(new_inode, 0);
@@ -1157,13 +1157,13 @@
* verify_update_oin, which reads fe_off from the
* inode, but doesn't always have i_sem. */
if (oldOIN)
- ocfs_down_sem(&oldOIN->main_res, true);
+ ocfs_down_sem(&OCFS_I(old_dentry->d_inode)->main_res, true);
status = ocfs_insert_file(osb, tmpfe, new_dir_bh, &insert_bh,
handle, old_dir, old_inode);
if (status < 0) {
if (oldOIN)
- ocfs_up_sem(&oldOIN->main_res);
+ ocfs_up_sem(&OCFS_I(old_dentry->d_inode)->main_res);
up(&old_inode->i_sem);
LOG_ERROR_STATUS (status);
goto finally;
@@ -1173,7 +1173,7 @@
old_inode);
if (status < 0) {
if (oldOIN)
- ocfs_up_sem(&oldOIN->main_res);
+ ocfs_up_sem(&OCFS_I(old_dentry->d_inode)->main_res);
up(&old_inode->i_sem);
LOG_ERROR_STATUS (status);
goto finally;
@@ -1199,7 +1199,7 @@
tmpfe->this_sector);
}
if (oldOIN)
- ocfs_up_sem(&oldOIN->main_res);
+ ocfs_up_sem(&OCFS_I(old_dentry->d_inode)->main_res);
up(&old_inode->i_sem);
} else {
/* Ok, we're moving inside of the same directory --
Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c 2004-04-19 18:07:19 UTC (rev 852)
+++ trunk/src/nm.c 2004-04-19 18:47:39 UTC (rev 853)
@@ -941,12 +941,12 @@
case UPDATE_OIN_INODE:
LOG_TRACE_STR("UPDATE_OIN_INODE");
- ocfs_down_sem (&(oin->main_res), true);
+ ocfs_down_sem (&(OCFS_I(inode)->main_res), true);
OCFS_I(inode)->needs_verification = true;
tmpstat = ocfs_verify_update_inode(osb, inode, &needs_trunc);
if (tmpstat < 0)
LOG_ERROR_STATUS (tmpstat);
- ocfs_up_sem (&(oin->main_res));
+ ocfs_up_sem (&(OCFS_I(inode)->main_res));
if (needs_trunc) {
if (inode)
ocfs_truncate_inode_pages(inode, 0);
@@ -963,7 +963,7 @@
vote_response = FLAG_VOTE_NODE;
if (oin) {
- oin_sem = &(oin->main_res);
+ oin_sem = &(OCFS_I(inode)->main_res);
ocfs_down_sem (oin_sem, true);
OCFS_I(inode)->needs_verification = true;
tmpstat = ocfs_verify_update_inode(osb, inode, &needs_trunc);
More information about the Ocfs2-commits
mailing list