[Ocfs2-commits] mfasheh commits r850 - in trunk/src: . inc
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Fri Apr 16 22:29:30 CDT 2004
Author: mfasheh
Date: 2004-04-16 21:29:29 -0500 (Fri, 16 Apr 2004)
New Revision: 850
Modified:
trunk/src/alloc.c
trunk/src/dlm.c
trunk/src/extmap.c
trunk/src/file.c
trunk/src/inc/ocfs.h
trunk/src/inc/proto.h
trunk/src/inode.c
trunk/src/journal.c
trunk/src/namei.c
trunk/src/nm.c
trunk/src/oin.c
Log:
* move almost the rest of the ocfs_inode fields to
ocfs_inode_private. The only one left now is main_res.
Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c 2004-04-17 01:47:32 UTC (rev 849)
+++ trunk/src/alloc.c 2004-04-17 02:29:29 UTC (rev 850)
@@ -1458,7 +1458,7 @@
}
finally:
- if ((status == 0) && (oin != NULL)) {
+ if ((status == 0) && (inode != NULL)) {
__s64 Vbo = 0;
__s64 Lbo = 0;
@@ -1474,8 +1474,8 @@
Lbo = actualDiskOffset;
/* Add the Entry to the extent map list */
- if (!ocfs_add_extent_map_entry (osb, &oin->map, Vbo, Lbo,
- actualLength))
+ if (!ocfs_add_extent_map_entry (osb, &OCFS_I(inode)->map, Vbo,
+ Lbo, actualLength))
LOG_ERROR_STATUS (status = -EFAIL);
}
@@ -2483,8 +2483,8 @@
OCFS_ASSERT (inode);
oin = GET_INODE_OIN(inode);
- if (INODE_JOURNAL(inode) || Vbo < oin->alloc_size) {
- if (ocfs_lookup_extent_map_entry (osb, &(oin->map),
+ if (INODE_JOURNAL(inode) || Vbo < OCFS_I(inode)->alloc_size) {
+ if (ocfs_lookup_extent_map_entry (osb, &(OCFS_I(inode)->map),
Vbo, Lbo, &cnt, &NumIndex) && cnt >= sectors) {
status = 0;
goto finally;
@@ -2514,13 +2514,13 @@
if (!INODE_JOURNAL(inode) && Vbo >= (__s64) fe->alloc_size) {
LOG_ERROR_ARGS ("vbo=%u.%u, fe->alloc_sz=%u.%u oin->alloc_size=%u.%u",
HILO (Vbo), HILO (fe->alloc_size),
- HILO (oin->alloc_size));
+ HILO (OCFS_I(inode)->alloc_size));
status = -EFAIL;
goto finally;
}
if (fe->local_ext) {
- status = ocfs_update_extent_map (osb, &oin->map, fe,
+ status = ocfs_update_extent_map (osb, &OCFS_I(inode)->map, fe,
NULL, NULL, LOCAL_EXT);
if (status < 0) {
LOG_ERROR_STATUS (status);
@@ -2538,7 +2538,7 @@
OcfsExtent = (ocfs_extent_group *) OCFS_BH_GET_DATA_READ(ext_bh); /* read */
while (1) {
- status = ocfs_update_extent_map (osb, &oin->map, OcfsExtent,
+ status = ocfs_update_extent_map (osb, &OCFS_I(inode)->map, OcfsExtent,
&localVbo, &remainingLength, NONLOCAL_EXT);
if (status < 0) {
LOG_ERROR_STATUS(status);
@@ -2548,10 +2548,10 @@
if (remainingLength > 0) {
if (!OcfsExtent->next_data_ext) {
LOG_ERROR_ARGS ("vbo=%u.%u, "
- "oin->alloc_size=%u.%u, "
+ "alloc_size=%u.%u, "
" thisext=%u.%u",
HILO(localVbo),
- HILO(oin->alloc_size),
+ HILO(OCFS_I(inode)->alloc_size),
HILO(OcfsExtent->this_ext));
status = -EFAIL;
goto finally;
@@ -2582,7 +2582,7 @@
}
}
- if (ocfs_lookup_extent_map_entry (osb, &(oin->map), Vbo, Lbo, &cnt, &NumIndex) &&
+ if (ocfs_lookup_extent_map_entry (osb, &(OCFS_I(inode)->map), Vbo, Lbo, &cnt, &NumIndex) &&
cnt >= sectors) {
status = 0;
} else
Modified: trunk/src/dlm.c
===================================================================
--- trunk/src/dlm.c 2004-04-17 01:47:32 UTC (rev 849)
+++ trunk/src/dlm.c 2004-04-17 02:29:29 UTC (rev 850)
@@ -957,9 +957,9 @@
}
ocfs_acquire_lockres (lockres);
- oin->oin_flags |= flags;
+ OCFS_I(inode)->oin_flags |= flags;
ocfs_get_lockres (lockres);
- oin->lock_res = lockres;
+ OCFS_I(inode)->lock_res = lockres;
ocfs_release_lockres (lockres);
status = ocfs_wait_for_lock_release (osb, lock_id, 30000, lockres,
@@ -1018,10 +1018,10 @@
ocfs_acquire_lockres (lockres);
- oin->oin_flags |= flags;
- if (oin->lock_res != lockres) {
- ocfs_put_lockres (oin->lock_res);
- oin->lock_res = lockres;
+ OCFS_I(inode)->oin_flags |= flags;
+ if (OCFS_I(inode)->lock_res != lockres) {
+ ocfs_put_lockres (OCFS_I(inode)->lock_res);
+ OCFS_I(inode)->lock_res = lockres;
ocfs_get_lockres (lockres);
}
Modified: trunk/src/extmap.c
===================================================================
--- trunk/src/extmap.c 2004-04-17 01:47:32 UTC (rev 849)
+++ trunk/src/extmap.c 2004-04-17 02:29:29 UTC (rev 850)
@@ -439,7 +439,7 @@
* ocfs_delete_all_extent_maps()
*
*/
-void ocfs_delete_all_extent_maps (ocfs_super *osb, ocfs_inode * oin)
+void ocfs_delete_all_extent_maps (ocfs_super *osb, struct inode * inode)
{
__u32 RunsInExtentMap = 0, ExtentMapIndex, ByteCount = 0;
__s64 Vbo;
@@ -447,15 +447,15 @@
LOG_ENTRY ();
- RunsInExtentMap = oin->map.count;
+ RunsInExtentMap = OCFS_I(inode)->map.count;
for (ExtentMapIndex = 0; ExtentMapIndex < RunsInExtentMap;
ExtentMapIndex++) {
if (ocfs_get_next_extent_map_entry
- (osb, &oin->map, ExtentMapIndex, &Vbo, &Lbo,
+ (osb, &OCFS_I(inode)->map, ExtentMapIndex, &Vbo, &Lbo,
&ByteCount)) {
- ocfs_remove_extent_map_entry (osb, &oin->map, Vbo,
- ByteCount);
+ ocfs_remove_extent_map_entry (osb, &OCFS_I(inode)->map,
+ Vbo, ByteCount);
}
}
Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c 2004-04-17 01:47:32 UTC (rev 849)
+++ trunk/src/file.c 2004-04-17 02:29:29 UTC (rev 850)
@@ -28,7 +28,7 @@
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_FILE
static int ocfs_change_file_attrib (ocfs_super * osb, __u64 parent_off, ocfs_inode * oin, __u64 file_size, __u64 file_off, struct iattr *attr, struct inode *inode);
-static int ocfs_truncate_file (ocfs_super * osb, __u64 file_off, __u64 file_size, ocfs_inode * oin, struct inode *inode);
+static int ocfs_truncate_file (ocfs_super * osb, __u64 file_off, __u64 file_size, struct inode *inode);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#define OCFS_FE_SET_ATTRIBUTES(fe, attr) \
@@ -127,12 +127,12 @@
/* If the in use flag is set, forget about it. This will go
* eventually. */
- if (!(oin->oin_flags & OCFS_OIN_IN_TEARDOWN) &&
- !(oin->oin_flags & OCFS_OIN_DELETE_ON_CLOSE)) {
- OCFS_SET_FLAG (oin->oin_flags, OCFS_OIN_IN_USE);
+ if (!(OCFS_I(inode)->oin_flags & OCFS_OIN_IN_TEARDOWN) &&
+ !(OCFS_I(inode)->oin_flags & OCFS_OIN_DELETE_ON_CLOSE)) {
+ OCFS_SET_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_IN_USE);
bClearInUse = true;
} else {
- if (oin->oin_flags & OCFS_OIN_IN_TEARDOWN)
+ if (OCFS_I(inode)->oin_flags & OCFS_OIN_IN_TEARDOWN)
LOG_ERROR_ARGS ("oin (%p) in teardown", oin);
else
LOG_ERROR_ARGS ("oin (%p) deleted", oin);
@@ -175,7 +175,7 @@
up(&inode->i_sem);
/* yes, hold onto main_res. */
- if (oin->oin_flags & OCFS_OIN_DELETE_ON_CLOSE) {
+ if (OCFS_I(inode)->oin_flags & OCFS_OIN_DELETE_ON_CLOSE) {
LOG_TRACE_STR ("oin has DELETE_ON_CLOSE set, returning DELETE_PENDING");
status = -ENOENT;
goto leave;
@@ -198,31 +198,31 @@
LOG_TRACE_ARGS ("oin->open_hndl_cnt > 0! : %u\n",
OCFS_I(inode)->open_hndl_cnt);
if (!(mode & O_DIRECT)) {
- if ((oin->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO) && !(mode & O_RDONLY)) {
+ if ((OCFS_I(inode)->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO) && !(mode & O_RDONLY)) {
status = -EACCES;
LOG_TRACE_STR("file is already open O_DIRECT, "
"cannot open non O_DIRECT");
goto leave;
}
- OCFS_CLEAR_FLAG(oin->oin_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
+ OCFS_CLEAR_FLAG(OCFS_I(inode)->oin_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
} else if (mode & O_DIRECT) {
- if (!(oin->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO)) {
+ if (!(OCFS_I(inode)->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO)) {
status = -EACCES;
LOG_TRACE_STR("file is already open non " \
"O_DIRECT, cannot open " \
"O_DIRECT");
goto leave;
}
- OCFS_SET_FLAG(oin->oin_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
+ OCFS_SET_FLAG(OCFS_I(inode)->oin_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
}
status = 0;
} else {
- ocfs_extent_map_destroy (&oin->map);
- ocfs_extent_map_init (&oin->map);
+ ocfs_extent_map_destroy (&OCFS_I(inode)->map);
+ ocfs_extent_map_init (&OCFS_I(inode)->map);
if (mode & O_DIRECT)
- OCFS_SET_FLAG(oin->oin_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
+ OCFS_SET_FLAG(OCFS_I(inode)->oin_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
else {
- OCFS_CLEAR_FLAG(oin->oin_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
+ OCFS_CLEAR_FLAG(OCFS_I(inode)->oin_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
truncate_pages = 1;
}
}
@@ -232,9 +232,9 @@
/* We should clear the in use now as we are safe from the case */
/* where the voting thread can vote and we have an open in */
/* progress */
- OCFS_CLEAR_FLAG (oin->oin_flags, OCFS_OIN_IN_USE);
+ OCFS_CLEAR_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_IN_USE);
if (ParentOin)
- OCFS_CLEAR_FLAG (ParentOin->oin_flags, OCFS_OIN_IN_USE);
+ OCFS_CLEAR_FLAG (OCFS_I(parent)->oin_flags, OCFS_OIN_IN_USE);
if (bAcquiredOIN) {
ocfs_up_sem (oin_sem);
@@ -260,7 +260,7 @@
bAcquiredOIN = true;
}
- OCFS_CLEAR_FLAG (oin->oin_flags, OCFS_OIN_IN_USE);
+ OCFS_CLEAR_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_IN_USE);
if (bAcquiredOIN && oin_sem) {
ocfs_up_sem (oin_sem);
@@ -351,7 +351,7 @@
if (!OCFS_I(inode)->open_hndl_cnt)
last_close = true;
- if (oin->oin_flags & OCFS_OIN_ROOT_DIRECTORY) {
+ if (OCFS_I(inode)->oin_flags & OCFS_OIN_ROOT_DIRECTORY) {
ocfs_up_sem (&(oin->main_res));
goto bail;
}
@@ -361,23 +361,23 @@
atomic_read(&dentry->d_count));
if (last_close) {
- ocfs_extent_map_destroy (&oin->map);
- ocfs_extent_map_init (&oin->map);
+ ocfs_extent_map_destroy (&OCFS_I(inode)->map);
+ ocfs_extent_map_init (&OCFS_I(inode)->map);
- if (oin->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO)
- OCFS_CLEAR_FLAG(oin->oin_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
+ if (OCFS_I(inode)->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO)
+ OCFS_CLEAR_FLAG(OCFS_I(inode)->oin_flags, OCFS_OIN_OPEN_FOR_DIRECTIO);
- if (oin->oin_flags & OCFS_OIN_NEEDS_DELETION ||
- oin->oin_flags & OCFS_OIN_IN_USE) {
+ 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));
LOG_ERROR_STR("Not deleting lockrse on a last close! eek!");
goto bail;
}
- if (!oin->lock_res)
+ if (!OCFS_I(inode)->lock_res)
LOG_ERROR_STR("My oin has no lockres!");
else {
- ocfs_put_lockres(oin->lock_res);
- oin->lock_res = NULL;
+ ocfs_put_lockres(OCFS_I(inode)->lock_res);
+ OCFS_I(inode)->lock_res = NULL;
}
}
ocfs_up_sem (&(oin->main_res));
@@ -605,7 +605,7 @@
oin = GET_INODE_OIN(inode);
osb = (ocfs_super *) OCFS_GENERIC_SB_P(inode->i_sb);
- lockres = oin->lock_res;
+ lockres = OCFS_I(inode)->lock_res;
if (lockres == NULL) {
ret = -EIO;
goto bail;
@@ -638,7 +638,7 @@
LOG_TRACE_ARGS ("non O_DIRECT write, fileopencount=%d\n",
OCFS_I(inode)->open_hndl_cnt);
if (OCFS_I(inode)->open_hndl_cnt > 1) {
- if (oin->oin_flags & OCFS_OIN_OPEN_FOR_WRITE) {
+ if (OCFS_I(inode)->oin_flags & OCFS_OIN_OPEN_FOR_WRITE) {
LOG_TRACE_STR
("uh oh! someone else is doing non O_DIRECT writes!\n");
ret = -EIO;
@@ -647,7 +647,7 @@
LOG_TRACE_STR
("there are other readers, but you're the first writer\n");
saAcquired = true;
- OCFS_SET_FLAG(oin->oin_flags, OCFS_OIN_OPEN_FOR_WRITE);
+ OCFS_SET_FLAG(OCFS_I(inode)->oin_flags, OCFS_OIN_OPEN_FOR_WRITE);
}
}
}
@@ -693,7 +693,7 @@
if (writingAtEOF) {
LOG_TRACE_ARGS
("Will need more allocation: have=%u.%u, need=%u.%u\n",
- HI (oin->alloc_size), LO (oin->alloc_size), HI (newsize),
+ HI (OCFS_I(inode)->alloc_size), LO (OCFS_I(inode)->alloc_size), HI (newsize),
LO (newsize));
status = ocfs_extend_file (osb, newsize, GET_INODE_FEOFF(inode), NULL, inode, NULL);
@@ -733,7 +733,7 @@
bail:
if (saAcquired) {
- OCFS_CLEAR_FLAG(oin->oin_flags, OCFS_OIN_OPEN_FOR_WRITE);
+ OCFS_CLEAR_FLAG(OCFS_I(inode)->oin_flags, OCFS_OIN_OPEN_FOR_WRITE);
}
ocfs_put_lockres (lockres);
@@ -821,7 +821,7 @@
* ocfs_truncate_file()
*
*/
-static int ocfs_truncate_file (ocfs_super * osb, __u64 file_off, __u64 file_size, ocfs_inode * oin, struct inode *inode)
+static int ocfs_truncate_file (ocfs_super * osb, __u64 file_off, __u64 file_size, struct inode *inode)
{
int status = 0, tmpstat;
ocfs_file_entry *fe = NULL;
@@ -836,6 +836,7 @@
struct buffer_head *bh = NULL;
int flags = 0;
ocfs_journal_handle *handle = NULL;
+ ocfs_inode *oin = NULL;
LOG_ENTRY_ARGS ("(file_off = %u.%u, file_size = %u.%u\n",
HILO(file_off), HILO(file_size));
@@ -911,8 +912,7 @@
/* alright, we're going to try to get the oin at least twice
* in this function if it hasn't already been passed to
* us.. This is our first try... */
- if (!oin && inode_data_is_oin(inode))
- oin = GET_INODE_OIN(inode);
+ oin = GET_INODE_OIN(inode);
if (oin)
ocfs_down_sem(&oin->main_res, true);
@@ -976,7 +976,7 @@
if (oin) {
/* if we updated correctly then we can update the OIN */
- oin->alloc_size = new_alloc_size;
+ OCFS_I(inode)->alloc_size = new_alloc_size;
ocfs_up_sem (&(oin->main_res));
}
@@ -1191,7 +1191,7 @@
if (oin) {
ocfs_down_sem (&(oin->main_res), true);
- oin->alloc_size = fileEntry->alloc_size;
+ OCFS_I(inode)->alloc_size = fileEntry->alloc_size;
ocfs_up_sem (&(oin->main_res));
}
@@ -1362,7 +1362,7 @@
if (inode->i_size > newsize)
status = ocfs_truncate_file(osb, fileOff, newsize,
- oin, inode);
+ inode);
else {
status = ocfs_extend_file(osb, newsize, fileOff, NULL,
inode, attr);
@@ -1378,7 +1378,7 @@
if (oin != NULL) {
ocfs_down_sem (&(oin->main_res), true);
if (inode->i_size > newsize) {
- ocfs_delete_all_extent_maps(osb, oin);
+ ocfs_delete_all_extent_maps(osb, inode);
}
inode->i_size = newsize;
inode->i_blocks = (newsize + sb->s_blocksize) >> sb->s_blocksize_bits;
Modified: trunk/src/inc/ocfs.h
===================================================================
--- trunk/src/inc/ocfs.h 2004-04-17 01:47:32 UTC (rev 849)
+++ trunk/src/inc/ocfs.h 2004-04-17 02:29:29 UTC (rev 850)
@@ -1752,12 +1752,6 @@
struct _ocfs_inode
{
ocfs_sem main_res;
- struct semaphore extend_sem;
- __u32 num_extends;
- ocfs_lock_res *lock_res;
- ocfs_extent_map map;
- __s64 alloc_size;
- __u32 oin_flags;
};
/* OCFS2 Inode Private Data
@@ -1780,6 +1774,12 @@
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;
Modified: trunk/src/inc/proto.h
===================================================================
--- trunk/src/inc/proto.h 2004-04-17 01:47:32 UTC (rev 849)
+++ trunk/src/inc/proto.h 2004-04-17 02:29:29 UTC (rev 850)
@@ -62,7 +62,7 @@
void ocfs_extent_map_init (ocfs_extent_map * map);
void ocfs_extent_map_destroy (ocfs_extent_map * map);
-void ocfs_delete_all_extent_maps (ocfs_super * osb, ocfs_inode * oin);
+void ocfs_delete_all_extent_maps (ocfs_super * osb, struct inode * oin);
void ocfs_remove_extent_map_entry (ocfs_super * osb, ocfs_extent_map * Map, __s64 Vbo, __u32 ByteCount);
bool ocfs_get_next_extent_map_entry (ocfs_super * osb, ocfs_extent_map * Map, __u32 RunIndex, __s64 * Vbo, __s64 * Lbo, __u32 * SectorCount);
bool ocfs_lookup_extent_map_entry (ocfs_super * osb, ocfs_extent_map * Map, __s64 Vbo, __s64 * Lbo, __u64 * SectorCount, __u32 * Index);
Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c 2004-04-17 01:47:32 UTC (rev 849)
+++ trunk/src/inode.c 2004-04-17 02:29:29 UTC (rev 850)
@@ -201,14 +201,14 @@
// oin->obj_id.type = OCFS_TYPE_OIN;
// oin->obj_id.size = sizeof (ocfs_inode);
ocfs_init_sem (&(oin->main_res));
- init_MUTEX(&(oin->extend_sem));
- OCFS_SET_FLAG (oin->oin_flags, OCFS_INITIALIZED_MAIN_RESOURCE);
+ 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 (&oin->map);
+ ocfs_extent_map_init (&i->map);
INIT_LIST_HEAD(&i->recovery_list);
/* These should be set in read_inode2. */
- oin->alloc_size = 0ULL;
+ i->alloc_size = 0ULL;
i->voteoff = 0ULL;
i->feoff = 0ULL;
@@ -265,11 +265,11 @@
SET_INODE_FEOFF(inode, fe_off);
oin = GET_INODE_OIN(inode);
- oin->alloc_size = fe->alloc_size;
+ OCFS_I(inode)->alloc_size = fe->alloc_size;
OCFS_I(inode)->inode = inode;
OCFS_I(inode)->chng_seq_num = DISK_LOCK_SEQNUM (fe);
if (fe->attribs & OCFS_ATTRIB_DIRECTORY)
- oin->oin_flags |= OCFS_OIN_DIRECTORY;
+ OCFS_I(inode)->oin_flags |= OCFS_OIN_DIRECTORY;
if (create_ino) {
uniq_ino = ocfs_inode_hash_insert(osb, offset, fe_off);
@@ -364,7 +364,7 @@
oin->alloc_size = 0ULL;
OCFS_I(inode)->inode = inode;
OCFS_I(inode)->chng_seq_num = 0ULL;
- oin->oin_flags |= OCFS_OIN_DIRECTORY | OCFS_OIN_ROOT_DIRECTORY;
+ OCFS_I(inode)->oin_flags |= OCFS_OIN_DIRECTORY | OCFS_OIN_ROOT_DIRECTORY;
ocfs_inode_hash_bind(osb, GET_INODE_VOTEOFF(inode), inode);
goto bail;
@@ -494,10 +494,10 @@
SET_INODE_FEOFF(inode, 0);
oin = GET_INODE_OIN(inode);
- oin->alloc_size = 0ULL;
+ OCFS_I(inode)->alloc_size = 0ULL;
OCFS_I(inode)->inode = inode;
OCFS_I(inode)->chng_seq_num = 0ULL;
- oin->oin_flags |= OCFS_OIN_DIRECTORY | OCFS_OIN_ROOT_DIRECTORY;
+ OCFS_I(inode)->oin_flags |= OCFS_OIN_DIRECTORY | OCFS_OIN_ROOT_DIRECTORY;
ocfs_inode_hash_bind(osb, GET_INODE_VOTEOFF(inode), inode);
goto bail;
@@ -794,26 +794,26 @@
goto bail;
}
- OCFS_SET_FLAG (oin->oin_flags, OCFS_OIN_IN_TEARDOWN);
+ OCFS_SET_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_IN_TEARDOWN);
- lockres = oin->lock_res;
+ lockres = OCFS_I(inode)->lock_res;
if (lockres) {
ocfs_acquire_lockres (lockres);
ocfs_release_lockres (lockres);
- oin->lock_res = NULL;
+ OCFS_I(inode)->lock_res = NULL;
ocfs_put_lockres (lockres);
lockres = NULL;
}
- ocfs_extent_map_destroy (&oin->map);
- ocfs_extent_map_init (&oin->map);
+ ocfs_extent_map_destroy (&OCFS_I(inode)->map);
+ ocfs_extent_map_init (&OCFS_I(inode)->map);
down(&recovery_list_sem);
list_del(&OCFS_I(inode)->recovery_list);
up(&recovery_list_sem);
ocfs_del_sem (&(oin->main_res));
- OCFS_CLEAR_FLAG (oin->oin_flags, OCFS_INITIALIZED_MAIN_RESOURCE);
+ OCFS_CLEAR_FLAG (OCFS_I(inode)->oin_flags, OCFS_INITIALIZED_MAIN_RESOURCE);
/* clean out the oin ... why?! */
memset(oin, 0, sizeof(ocfs_inode));
@@ -925,9 +925,10 @@
{
int status = 0;
- if (newsize > oin->alloc_size) {
+ if (newsize > OCFS_I(inode)->alloc_size) {
LOG_TRACE_ARGS ("Extend: have=%u.%u, need=%u.%u\n",
- HILO (oin->alloc_size), HILO (newsize));
+ HILO (OCFS_I(inode)->alloc_size),
+ HILO (newsize));
if (unlock)
ocfs_up_sem (&(oin->main_res));
@@ -1053,7 +1054,7 @@
osb = (ocfs_super *) OCFS_GENERIC_SB_P(inode->i_sb);
vbo = (__s64) iblock << inode->i_sb->s_blocksize_bits;
- if (!INODE_JOURNAL(inode) && vbo >= oin->alloc_size) {
+ if (!INODE_JOURNAL(inode) && vbo >= OCFS_I(inode)->alloc_size) {
LOG_TRACE_STR("Extending allocation");
err = ocfs_extend_allocation(osb, oin, vbo+512, false, inode);
if (err < 0) {
@@ -1062,15 +1063,15 @@
}
}
- if (!(oin->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO)) {
+ if (!(OCFS_I(inode)->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO)) {
ocfs_down_sem (&(oin->main_res), true);
oin_locked = true;
}
len = 1;
- down(&oin->extend_sem);
+ down(&OCFS_I(inode)->inode_extend_sem);
err = ocfs_lookup_file_allocation(osb, vbo, &lbo, len, NULL, inode);
- up(&oin->extend_sem);
+ up(&OCFS_I(inode)->inode_extend_sem);
if (err < 0) {
LOG_ERROR_ARGS ("vbo=%u.%u lbo=%u.%u len=%u", HILO(vbo),
HILO(lbo), len);
@@ -1092,7 +1093,7 @@
if (err < 0)
err = -EIO;
- if (oin_locked && !(oin->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO)) {
+ if (oin_locked && !(OCFS_I(inode)->oin_flags & OCFS_OIN_OPEN_FOR_DIRECTIO)) {
ocfs_up_sem (&(oin->main_res));
}
Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c 2004-04-17 01:47:32 UTC (rev 849)
+++ trunk/src/journal.c 2004-04-17 02:29:29 UTC (rev 850)
@@ -943,15 +943,16 @@
/* we just changed this but extend_system_file doesn't know
* about oins, so we update alloc_size ourselves. */
oin = GET_INODE_OIN(inode);
- oin->alloc_size = alloc_size;
+ OCFS_I(inode)->alloc_size = alloc_size;
status = ocfs_create_update_lock(osb, lock_id, 0, false, inode, NULL);
if (status < 0) {
LOG_ERROR_STATUS(status);
goto done;
}
OCFS_I(inode)->open_hndl_cnt++;
- LOG_TRACE_ARGS("oin->alloc_size = %u.%u\n", HI(oin->alloc_size),
- LO(oin->alloc_size));
+ LOG_TRACE_ARGS("oin->alloc_size = %u.%u\n",
+ HI(OCFS_I(inode)->alloc_size),
+ LO(OCFS_I(inode)->alloc_size));
/* call the kernels journal init function now */
k_journal = journal_init_inode(inode);
@@ -1345,7 +1346,7 @@
goto bail;
}
- map = &(oin->map);
+ map = &(OCFS_I(inode)->map);
spin_lock(&(map->lock));
numruns = map->count;
spin_unlock(&(map->lock));
@@ -1575,7 +1576,7 @@
fe = NULL;
oin = GET_INODE_OIN(inode);
- oin->alloc_size = alloc_size;
+ OCFS_I(inode)->alloc_size = alloc_size;
status = ocfs_create_update_lock(osb, lock_id, 0, false, inode, NULL);
if (status < 0) {
LOG_ERROR_STATUS(status);
Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c 2004-04-17 01:47:32 UTC (rev 849)
+++ trunk/src/namei.c 2004-04-17 02:29:29 UTC (rev 850)
@@ -254,7 +254,7 @@
}
if (ParentOin)
- OCFS_CLEAR_FLAG (ParentOin->oin_flags, OCFS_OIN_IN_USE);
+ OCFS_CLEAR_FLAG (OCFS_I(dir)->oin_flags, OCFS_OIN_IN_USE);
ocfs_populate_inode (inode, fe, mode, NULL, true);
insert_inode_hash (inode);
@@ -274,8 +274,9 @@
/* Insert the OFile on the OIN list */
OCFS_I(inode)->chng_seq_num = DISK_LOCK_SEQNUM (fe);
- if (oin->lock_res != NULL) {
- ocfs_lock_res *tmp_lockres = oin->lock_res;
+
+ if (OCFS_I(inode)->lock_res != NULL) {
+ ocfs_lock_res *tmp_lockres = OCFS_I(inode)->lock_res;
ocfs_acquire_lockres(tmp_lockres);
tmp_lockres->master_node_num = DISK_LOCK_CURRENT_MASTER (fe);
tmp_lockres->lock_type = DISK_LOCK_FILE_LOCK (fe);
@@ -601,10 +602,10 @@
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 (oin && oin->oin_flags & OCFS_OIN_ROOT_DIRECTORY) {
+ } else if (oin && OCFS_I(inode)->oin_flags & OCFS_OIN_ROOT_DIRECTORY) {
LOG_TRACE_STR ("Cannot delete the root directory");
status = -EPERM;
- } else if (oin && oin->oin_flags & OCFS_OIN_DELETE_ON_CLOSE) {
+ } else if (oin && OCFS_I(inode)->oin_flags & OCFS_OIN_DELETE_ON_CLOSE) {
LOG_TRACE_STR ("OCFS_OIN_DELETE_ON_CLOSE set");
status = 0;
do_release = true;
@@ -612,24 +613,23 @@
status = -EFAIL;
do_release = true;
- if (oin) {
- spin_lock(&oin_num_ext_lock);
- if (oin->num_extends) {
- LOG_ERROR_ARGS ("Cannot remove a file with = "
- "%u, pending extends (fileOff "
- "= %u.%u)\n", oin->num_extends,
- HILO(fileOff));
- spin_unlock(&oin_num_ext_lock);
- status = -EBUSY;
- goto bail;
- }
+ spin_lock(&oin_num_ext_lock);
+ if (OCFS_I(inode)->num_extends) {
+ LOG_ERROR_ARGS ("Cannot remove a file with = "
+ "%u, pending extends (fileOff "
+ "= %u.%u)\n",
+ OCFS_I(inode)->num_extends,
+ HILO(fileOff));
spin_unlock(&oin_num_ext_lock);
-
- ocfs_down_sem (&(oin->main_res), true);
- OCFS_SET_FLAG (oin->oin_flags, OCFS_OIN_DELETE_ON_CLOSE);
- ocfs_up_sem (&(oin->main_res));
+ status = -EBUSY;
+ goto bail;
}
+ spin_unlock(&oin_num_ext_lock);
+ ocfs_down_sem (&(oin->main_res), true);
+ OCFS_SET_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_DELETE_ON_CLOSE);
+ ocfs_up_sem (&(oin->main_res));
+
if (fileOff != -1)
status = ocfs_fe_smash (osb, parentOff, 0, fileOff,
NULL, dentry, parentInode);
@@ -641,8 +641,8 @@
if (oin) {
ocfs_down_sem (&(oin->main_res), true);
- OCFS_CLEAR_FLAG (oin->oin_flags, OCFS_OIN_DELETE_ON_CLOSE);
- OCFS_CLEAR_FLAG (oin->oin_flags, OCFS_OIN_IN_USE);
+ 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));
}
goto bail;
@@ -962,7 +962,7 @@
goto bail;
}
spin_lock(&oin_num_ext_lock);
- if (oldOIN->num_extends) {
+ if (OCFS_I(old_dentry->d_inode)->num_extends) {
spin_unlock(&oin_num_ext_lock);
status = -EBUSY;
goto bail;
@@ -972,13 +972,14 @@
/* Don't ever take the main resource for the OIN before this as */
/* Locking hierarchy will be broken */
-
+
if (newOIN) {
- if (!(newOIN->oin_flags & OCFS_OIN_IN_TEARDOWN) &&
- !(newOIN->oin_flags & OCFS_OIN_DELETE_ON_CLOSE)) {
+ 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_SET_FLAG (newOIN->oin_flags, OCFS_OIN_IN_USE);
+ 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));
delete_target_oin = true;
Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c 2004-04-17 01:47:32 UTC (rev 849)
+++ trunk/src/nm.c 2004-04-17 02:29:29 UTC (rev 850)
@@ -29,7 +29,7 @@
/* Tracing */
#define OCFS_DEBUG_CONTEXT OCFS_DEBUG_CONTEXT_NM
-/* for lack of a better name... protects oin->num_extends. */
+/* for lack of a better name... protects inode_private->num_extends. */
spinlock_t oin_num_ext_lock = SPIN_LOCK_UNLOCKED;
struct semaphore recovery_list_sem;
@@ -971,7 +971,7 @@
LOG_ERROR_STATUS (tmpstat);
/* If OIN_IN_USE is set we should go back and retry */
- for (i=0; i<5 && oin->oin_flags & OCFS_OIN_IN_USE; i++) {
+ for (i=0; i<5 && OCFS_I(inode)->oin_flags & OCFS_OIN_IN_USE; i++) {
ocfs_up_sem (oin_sem);
if (needs_trunc) {
ocfs_truncate_inode_pages(inode, 0);
@@ -986,10 +986,10 @@
vote_response = FLAG_VOTE_OIN_ALREADY_INUSE;
} else if (oin) {
spin_lock(&oin_num_ext_lock);
- if (oin->num_extends) {
+ if (OCFS_I(inode)->num_extends) {
vote_response = FLAG_VOTE_OIN_ALREADY_INUSE;
- } else if (!(oin->oin_flags & OCFS_OIN_IN_TEARDOWN)) {
- OCFS_SET_FLAG (oin->oin_flags, OCFS_OIN_NEEDS_DELETION);
+ } else if (!(OCFS_I(inode)->oin_flags & OCFS_OIN_IN_TEARDOWN)) {
+ OCFS_SET_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_NEEDS_DELETION);
ocfs_up_sem (oin_sem);
ocfs_release_lockres (lockres);
ocfs_put_lockres(lockres);
@@ -1327,11 +1327,11 @@
if (oin && (flags & FLAG_ACQUIRE_LOCK)) {
spin_lock(&oin_num_ext_lock);
- if (oin->num_extends < 0)
+ if (OCFS_I(inode)->num_extends < 0)
BUG();
- if (oin->num_extends > 0) {
- oin->num_extends++;
+ if (OCFS_I(inode)->num_extends > 0) {
+ OCFS_I(inode)->num_extends++;
spin_unlock(&oin_num_ext_lock);
} else {
spin_unlock(&oin_num_ext_lock);
@@ -1343,11 +1343,11 @@
* effect of locking out
* lookup_file_allocation on this
* inode. */
- down(&oin->extend_sem);
+ down(&OCFS_I(inode)->inode_extend_sem);
down(&recovery_list_sem);
spin_lock(&oin_num_ext_lock);
- oin->num_extends++;
+ OCFS_I(inode)->num_extends++;
list_add_tail(&OCFS_I(inode)->recovery_list, &osb->lock_recovery_lists[node_num]);
spin_unlock(&oin_num_ext_lock);
up(&recovery_list_sem);
@@ -1355,15 +1355,15 @@
} else if (oin && (flags & FLAG_RELEASE_LOCK)) {
down(&recovery_list_sem);
spin_lock(&oin_num_ext_lock);
- oin->num_extends--;
+ OCFS_I(inode)->num_extends--;
- if (oin->num_extends < 0)
+ if (OCFS_I(inode)->num_extends < 0)
BUG();
- if (!oin->num_extends) {
+ if (!OCFS_I(inode)->num_extends) {
list_del(&OCFS_I(inode)->recovery_list);
- up(&oin->extend_sem);
+ up(&OCFS_I(inode)->inode_extend_sem);
}
spin_unlock(&oin_num_ext_lock);
@@ -1477,11 +1477,11 @@
oin = GET_INODE_OIN(inode);
spin_lock(&oin_num_ext_lock);
- if (oin->num_extends) {
- oin->num_extends = 0;
+ if (OCFS_I(inode)->num_extends) {
+ OCFS_I(inode)->num_extends = 0;
list_del(&OCFS_I(inode)->recovery_list);
INIT_LIST_HEAD(&OCFS_I(inode)->recovery_list);
- up(&oin->extend_sem);
+ up(&OCFS_I(inode)->inode_extend_sem);
} else
LOG_ERROR_STR("oin is in recovery list, but has zero extend counter value!");
Modified: trunk/src/oin.c
===================================================================
--- trunk/src/oin.c 2004-04-17 01:47:32 UTC (rev 849)
+++ trunk/src/oin.c 2004-04-17 02:29:29 UTC (rev 850)
@@ -68,7 +68,7 @@
fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
/* Make sure that what we found is not a directory. */
- if (!(oin->oin_flags & OCFS_OIN_DIRECTORY)) {
+ if (!(OCFS_I(inode)->oin_flags & OCFS_OIN_DIRECTORY)) {
/* Add checks as needed */
if ((fe->sync_flags & OCFS_SYNC_FLAG_MARK_FOR_DELETION) ||
(!(fe->sync_flags & OCFS_SYNC_FLAG_VALID))) {
@@ -79,7 +79,7 @@
LOG_TRACE_STR ("File Entry is invalid");
}
- OCFS_SET_FLAG (oin->oin_flags, OCFS_OIN_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;
@@ -98,25 +98,25 @@
}
if (status < 0) {
LOG_TRACE_STR ("file entry name did not match inode");
- OCFS_SET_FLAG (oin->oin_flags, OCFS_OIN_INVALID);
+ OCFS_SET_FLAG (OCFS_I(inode)->oin_flags, OCFS_OIN_INVALID);
goto leave;
}
- if ((oin->alloc_size != (__s64) fe->alloc_size) ||
+ if ((OCFS_I(inode)->alloc_size != (__s64) fe->alloc_size) ||
(inode->i_size != (__s64) fe->file_size) ||
(OCFS_I(inode)->chng_seq_num != DISK_LOCK_SEQNUM (fe)) ||
inode->i_uid != fe->uid ||
- inode->i_gid != fe->gid || inode->i_mode != fe->prot_bits) {
+ inode->i_gid != fe->gid || inode->i_mode != fe->prot_bits){
- if (oin->alloc_size > (__s64)fe->alloc_size) {
- ocfs_extent_map_destroy (&oin->map);
- ocfs_extent_map_init (&oin->map);
+ if (OCFS_I(inode)->alloc_size > (__s64)fe->alloc_size){
+ ocfs_extent_map_destroy (&OCFS_I(inode)->map);
+ ocfs_extent_map_init (&OCFS_I(inode)->map);
}
LOG_TRACE_STR
("Allocsize, filesize or seq no did not match");
- oin->alloc_size = fe->alloc_size;
+ OCFS_I(inode)->alloc_size = fe->alloc_size;
inode->i_size = fe->file_size;
OCFS_I(inode)->chng_seq_num = DISK_LOCK_SEQNUM (fe);
@@ -129,7 +129,7 @@
OCFS_SET_INODE_TIME(inode, i_atime, fe->modify_time);
OCFS_SET_INODE_TIME(inode, i_mtime, fe->modify_time);
if (!S_ISDIR (inode->i_mode) &&
- (oin->alloc_size != (__s64) fe->alloc_size ||
+ (OCFS_I(inode)->alloc_size != (__s64) fe->alloc_size ||
inode->i_size != (__s64) fe->file_size ||
OCFS_I(inode)->chng_seq_num != DISK_LOCK_SEQNUM (fe))) {
*needs_trunc = 1;
@@ -200,7 +200,8 @@
tempLbo = fe->extents[j].disk_off;
tempSize = fe->extents[j].num_bytes;
- if (!ocfs_add_extent_map_entry (osb, &oin->map,
+ if (!ocfs_add_extent_map_entry (osb,
+ &OCFS_I(inode)->map,
tempVbo, tempLbo,
tempSize))
goto leave;
@@ -209,13 +210,12 @@
}
/* ??? we need to the lock resource before updating it */
- if (oin->lock_res) {
+ if (OCFS_I(inode)->lock_res) {
/* cannot hold bhsem while taking lockres... baaad */
memcpy(&dlock, (ocfs_disk_lock *)fe, sizeof(ocfs_disk_lock));
OCFS_BH_PUT_DATA(fe_bh);
fe = NULL;
-
- lockres = oin->lock_res;
+ lockres = OCFS_I(inode)->lock_res;
ocfs_acquire_lockres(lockres);
lockres->lock_type = DISK_LOCK_FILE_LOCK (&dlock);
lockres->master_node_num = DISK_LOCK_CURRENT_MASTER (&dlock);
@@ -275,14 +275,14 @@
fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
/* why do we update these here? */
- oin->alloc_size = fe->alloc_size;
+ OCFS_I(inode)->alloc_size = fe->alloc_size;
OCFS_I(inode)->chng_seq_num = DISK_LOCK_SEQNUM (fe);
if (fe->this_sector == 0)
LOG_ERROR_STR ("this_sector=0");
OCFS_BH_PUT_DATA(fe_bh);
- flags |= oin->oin_flags;
+ flags |= OCFS_I(inode)->oin_flags;
if (!(flags & OCFS_OIN_ROOT_DIRECTORY)) {
if (local_handle) {
@@ -304,7 +304,7 @@
goto leave;
}
}
- oin->oin_flags |= OCFS_OIN_IN_USE;
+ OCFS_I(inode)->oin_flags |= OCFS_OIN_IN_USE;
leave:
if (local_handle && handle) {
@@ -366,7 +366,7 @@
/* Add the Extent to extent map */
bRet = ocfs_add_extent_map_entry (osb,
- &oin->map,
+ &OCFS_I(inode)->map,
tempVbo,
tempLbo,
tempSize);
@@ -403,7 +403,7 @@
/* Add the Extent to extent map */
bRet =
ocfs_add_extent_map_entry (osb,
- &oin->map,
+ &OCFS_I(inode)->map,
tempVbo,
tempLbo,
tempSize);
More information about the Ocfs2-commits
mailing list