[Ocfs2-commits] mfasheh commits r1410 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Sep 1 11:22:30 CDT 2004
Author: mfasheh
Date: 2004-09-01 11:22:28 -0500 (Wed, 01 Sep 2004)
New Revision: 1410
Modified:
trunk/src/dlm.c
trunk/src/inode.c
trunk/src/inode.h
trunk/src/journal.c
trunk/src/namei.c
Log:
* Break out the non i/o, non lockres part of ocfs_verify_update_inode
into ocfs_refresh_inode which updates the struct inode from an
ocfs2_dinode.
* Call ocfs_refresh_inode from acquire_lock whenever we have a master
change.
* Call ocfs_refresh_inode from rename instead of ocfs_verify_update_inode.
Modified: trunk/src/dlm.c
===================================================================
--- trunk/src/dlm.c 2004-09-01 01:07:15 UTC (rev 1409)
+++ trunk/src/dlm.c 2004-09-01 16:22:28 UTC (rev 1410)
@@ -40,6 +40,7 @@
#include "alloc.h"
#include "dcache.h"
#include "dlm.h"
+#include "inode.h"
#include "lockres.h"
#include "nm.h"
#include "util.h"
@@ -388,6 +389,13 @@
lockres->uncommitted_holders);
ocfs_release_lockres (lockres); // ocfs_acquire_lock
+ if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
+ ocfs2_dinode *fe = (ocfs2_dinode *) (*bh)->b_data;
+ status = ocfs_refresh_inode(inode, fe);
+ if (status < 0)
+ LOG_ERROR_STATUS(status);
+ status = 0;
+ }
finally:
LOG_EXIT_STATUS (status);
@@ -643,6 +651,8 @@
status = ocfs_update_disk_lock (osb, bh, inode);
if (status < 0)
LOG_ERROR_STATUS (status);
+
+ atomic_set(&OCFS_I(inode)->ip_needs_verification, 1);
}
bail:
Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c 2004-09-01 01:07:15 UTC (rev 1409)
+++ trunk/src/inode.c 2004-09-01 16:22:28 UTC (rev 1410)
@@ -951,53 +951,28 @@
} /* ocfs_inode_revalidate */
/*
- * ocfs_verify_update_inode()
- */
-int ocfs_verify_update_inode (ocfs_super * osb, struct inode * inode, int lockres_locked)
+ * ocfs_refresh_inode
+ *
+ * Updates a struct inode from a disk inode.
+ * does no i/o, only takes ip_sem.
+ */
+int ocfs_refresh_inode(struct inode *inode,
+ ocfs2_dinode *fe)
{
+ ocfs2_extent_list *fel;
int status = 0;
- struct buffer_head *fe_bh = NULL;
- ocfs2_dinode *fe;
- ocfs2_extent_list *fel;
- int drop_ip_sem = 0;
+ u32 j;
+ ocfs_super *osb = OCFS2_SB(inode->i_sb);
- /* We are setting the oin Updated flag in the end. */
- LOG_ENTRY ();
+ down(&OCFS_I(inode)->ip_sem);
- OCFS_ASSERT (inode);
-
- /* This read of feoff from the inode depends on all callers to
- * make sure that unlink or rename can't be change it while we're
- * in here! */
- if (OCFS_I(inode)->ip_blkno == 0) {
- LOG_ERROR_ARGS("inode 0x%lu has zero blkno\n", inode->i_ino);
- status = -EINVAL;
- goto leave;
- }
-
- down(&OCFS_I(inode)->ip_sem);
if (INODE_DELETED(inode)) {
- up(&OCFS_I(inode)->ip_sem);
LOG_TRACE_ARGS("Inode %llu was marked as deleted!",
OCFS_I(inode)->ip_blkno);
status = -ENOENT;
goto leave;
}
- up(&OCFS_I(inode)->ip_sem);
- status = ocfs_read_bh(osb,
- OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
- &fe_bh, OCFS_BH_CACHED, inode);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto leave;
- }
-
- down(&OCFS_I(inode)->ip_sem);
- drop_ip_sem = 1;
-
- fe = (ocfs2_dinode *) fe_bh->b_data;
-
/* Add checks as needed */
if ((fe->i_dtime) || (!(fe->i_flags & OCFS2_VALID_FL))) {
if (fe->i_dtime)
@@ -1030,6 +1005,11 @@
if (OCFS_I(inode)->ip_alloc_size >
(__s64)((u64)fe->i_clusters << osb->s_clustersize_bits)) {
+ LOG_TRACE_ARGS("destroying extent maps for %llu, "
+ "alloc_size = %llu, i_clusters = %u\n",
+ OCFS_I(inode)->ip_blkno,
+ OCFS_I(inode)->ip_alloc_size,
+ fe->i_clusters);
ocfs_extent_map_destroy (&OCFS_I(inode)->ip_ext_map);
ocfs_extent_map_init (&OCFS_I(inode)->ip_ext_map);
}
@@ -1075,9 +1055,6 @@
fel = &fe->id2.i_list;
if (!fel->l_tree_depth) {
- __u32 j;
-
- /* Add the Extents to extent map */
for (j = 0; j < fel->l_next_free_rec; j++) {
if (!ocfs_add_extent_map_entry_from_rec(osb->sb,
&OCFS_I(inode)->ip_ext_map,
@@ -1087,20 +1064,67 @@
}
}
+leave:
+ if (status == 0)
+ atomic_set(&OCFS_I(inode)->ip_needs_verification, 0);
+
up(&OCFS_I(inode)->ip_sem);
- drop_ip_sem = 0;
+ return(status);
+} /* ocfs_refresh_inode */
+
+/*
+ * ocfs_verify_update_inode()
+ */
+int ocfs_verify_update_inode (ocfs_super * osb, struct inode * inode, int lockres_locked)
+{
+ int status = 0;
+ struct buffer_head *fe_bh = NULL;
+ ocfs2_dinode *fe;
+
+ /* We are setting the oin Updated flag in the end. */
+ LOG_ENTRY ();
+
+ OCFS_ASSERT (inode);
+
+ if (OCFS_I(inode)->ip_blkno == 0) {
+ LOG_ERROR_ARGS("inode 0x%lu has zero blkno\n", inode->i_ino);
+ status = -EINVAL;
+ goto leave;
+ }
+
+ down(&OCFS_I(inode)->ip_sem);
+ if (INODE_DELETED(inode)) {
+ up(&OCFS_I(inode)->ip_sem);
+ LOG_TRACE_ARGS("Inode %llu was marked as deleted!",
+ OCFS_I(inode)->ip_blkno);
+ status = -ENOENT;
+ goto leave;
+ }
+ up(&OCFS_I(inode)->ip_sem);
+
+ status = ocfs_read_bh(osb,
+ OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
+ &fe_bh, OCFS_BH_CACHED, inode);
+ if (status < 0) {
+ LOG_ERROR_STATUS (status);
+ goto leave;
+ }
+
+ fe = (ocfs2_dinode *) fe_bh->b_data;
+
+ status = ocfs_refresh_inode(inode, fe);
+ if (status < 0) {
+ LOG_ERROR_STATUS (status);
+ goto leave;
+ }
+
status = ocfs_update_lockres (osb, fe_bh, 0, inode, 0,
lockres_locked);
status = 0;
leave:
- if (status == 0)
- atomic_set(&OCFS_I(inode)->ip_needs_verification, 0);
- if (drop_ip_sem)
- up(&OCFS_I(inode)->ip_sem);
-
if (fe_bh)
brelse(fe_bh);
Modified: trunk/src/inode.h
===================================================================
--- trunk/src/inode.h 2004-09-01 01:07:15 UTC (rev 1409)
+++ trunk/src/inode.h 2004-09-01 16:22:28 UTC (rev 1410)
@@ -48,7 +48,8 @@
void ocfs_sync_blockdev(struct super_block *sb);
int ocfs_verify_update_inode(ocfs_super *osb, struct inode *inode,
int lockres_locked);
-
+int ocfs_refresh_inode(struct inode *inode,
+ ocfs2_dinode *fe);
#ifdef AIO_ENABLED
int ocfs_kvec_read(struct file *file, kvec_cb_t cb, size_t size, loff_t pos);
int ocfs_kvec_write(struct file *file, kvec_cb_t cb, size_t size, loff_t pos);
Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c 2004-09-01 01:07:15 UTC (rev 1409)
+++ trunk/src/journal.c 2004-09-01 16:22:28 UTC (rev 1410)
@@ -1627,13 +1627,6 @@
}
have_disk_lock = 1;
- /* Could we possibly have i_size out of sync? */
- status = ocfs_verify_update_inode(osb, orphan_dir_inode, 0);
- if (status < 0) {
- LOG_ERROR_STATUS(status);
- goto bail;
- }
-
offset = 0;
iter = NULL;
while(offset < orphan_dir_inode->i_size) {
Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c 2004-09-01 01:07:15 UTC (rev 1409)
+++ trunk/src/namei.c 2004-09-01 16:22:28 UTC (rev 1410)
@@ -1142,11 +1142,12 @@
ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE,
newfe_flags, new_inode);
+ newfe = (ocfs2_dinode *) newfe_bh->b_data;
/* if our caching is working right, then after the
* verify_update_inode, newfe->i_nlink ==
* new_inode->i_nlink */
- status = ocfs_verify_update_inode (osb, new_inode, 0);
+ status = ocfs_refresh_inode (new_inode, newfe);
LOG_TRACE_ARGS("aha rename over existing... new_de=%p "
"new_blkno=%llu newfebh=%p bhblocknr=%llu\n",
@@ -1167,7 +1168,6 @@
}
}
- newfe = (ocfs2_dinode *) newfe_bh->b_data;
if (S_ISDIR (new_inode->i_mode))
newfe->i_links_count = 0;
else
@@ -1182,8 +1182,6 @@
}
}
- newfe = NULL;
-
status = ocfs_journal_dirty(handle, newfe_bh);
if (status < 0) {
LOG_ERROR_STATUS (status);
More information about the Ocfs2-commits
mailing list