[Ocfs2-commits] mfasheh commits r1247 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Jul 8 15:22:23 CDT 2004
Author: mfasheh
Date: 2004-07-08 14:22:22 -0500 (Thu, 08 Jul 2004)
New Revision: 1247
Modified:
trunk/src/file.c
trunk/src/file.h
trunk/src/inode.c
trunk/src/inode.h
trunk/src/namei.c
trunk/src/nm.c
Log:
* Performance changes to I/O paths. Here's hoping we don't corrupt data -- please watch for this in the multi-node case.
- get rid of ocfs_flush
- remove most calls of truncate_inode_pages and only do it in the truncate and delete cases
- add a call to sync_inode in the TRUNCATE_PAGES call.
Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c 2004-07-07 21:26:17 UTC (rev 1246)
+++ trunk/src/file.c 2004-07-08 19:22:22 UTC (rev 1247)
@@ -78,7 +78,7 @@
fe->i_mtime = ocfs_get_seconds(attr->ia_mtime);
}
-static inline int ocfs_sync_inode(struct inode *inode)
+int ocfs_sync_inode(struct inode *inode)
{
int status;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
@@ -186,7 +186,6 @@
ocfs_super *osb = NULL;
int have_oin_sem = 0;
struct buffer_head *fe_bh = NULL;
- int truncate_pages = 0;
LOG_ENTRY_ARGS ("(0x%p, 0x%p, '%*s')\n", inode, file,
file->f_dentry->d_name.len,
@@ -202,8 +201,7 @@
if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
down_read (&(OCFS_I(inode)->ip_io_sem));
- status = ocfs_verify_update_inode (osb, inode, &truncate_pages,
- 0);
+ status = ocfs_verify_update_inode (osb, inode, 0);
up_read (&(OCFS_I(inode)->ip_io_sem));
if (status < 0) {
up_write(&OCFS_I(inode)->ip_io_sem);
@@ -395,7 +393,6 @@
up(&recovery_list_sem);
}
up (&(OCFS_I(inode)->ip_sem));
- ocfs_sync_inode(inode);
bail:
if (dec)
@@ -512,26 +509,6 @@
} /* ocfs_inode_fill_ext_map */
/*
- * ocfs_flush()
- *
- */
-static int ocfs_flush(struct file *file)
-{
- int err = 0;
-
- LOG_SET_CONTEXT(FLUSH);
-
- LOG_ENTRY_ARGS ("(0x%p, '%*s')\n", file,
- file->f_dentry->d_name.len, file->f_dentry->d_name.name);
-
- err = ocfs_sync_inode(file->f_dentry->d_inode);
- LOG_EXIT_STATUS (err);
-
- LOG_CLEAR_CONTEXT();
- return (err < 0) ? -EIO : 0;
-} /* ocfs_flush */
-
-/*
* ocfs_sync_file()
*
*/
@@ -683,7 +660,6 @@
int status;
__u64 newsize;
struct super_block *sb = inode->i_sb;
- int needs_trunc = 0;
LOG_SET_CONTEXT(WRITE);
@@ -731,11 +707,8 @@
if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
LOG_TRACE_STR ("OIN_NEEDS_VERIFICATION");
down_read (&(OCFS_I(inode)->ip_io_sem));
- status = ocfs_verify_update_inode (osb, inode, &needs_trunc,
- 0);
+ status = ocfs_verify_update_inode (osb, inode, 0);
up_read (&(OCFS_I(inode)->ip_io_sem));
- if (needs_trunc)
- ocfs_truncate_inode_pages(inode, 0);
if (status < 0) {
LOG_TRACE_STR ("ocfs_verify_update_inode failed");
LOG_TRACE_STR ("TODO: disable volume");
@@ -826,7 +799,7 @@
int ret = 0;
ocfs_super *osb = NULL;
struct inode *inode = filp->f_dentry->d_inode;
- int status = 0, needs_trunc = 0;
+ int status = 0;
LOG_SET_CONTEXT(READ);
@@ -857,11 +830,8 @@
if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
down_read(&OCFS_I(inode)->ip_io_sem);
- status = ocfs_verify_update_inode (osb, inode, &needs_trunc,
- 0);
+ status = ocfs_verify_update_inode (osb, inode, 0);
up_read(&OCFS_I(inode)->ip_io_sem);
- if (needs_trunc)
- ocfs_truncate_inode_pages(inode, 0);
if (status < 0) {
LOG_TRACE_STR ("ocfs_verify_update_inode failed");
LOG_TRACE_STR ("TODO: disable volume");
@@ -898,7 +868,6 @@
.write = ocfs_file_write,
.mmap = generic_file_mmap,
.fsync = ocfs_sync_file,
- .flush = ocfs_flush,
.release = ocfs_file_release,
.open = ocfs_file_open,
.ioctl = ocfs_ioctl,
@@ -927,7 +896,6 @@
{
int status = 0, tmpstat;
ocfs2_dinode *fe = NULL;
- __u32 lockFlags = 0;
int have_disk_lock = 0;
__u64 new_alloc_size;
struct buffer_head *bh = NULL;
@@ -964,9 +932,8 @@
goto leave;
}
- lockFlags = FLAG_FILE_TRUNCATE;
-
- status = ocfs_acquire_lock (osb, OCFS_LKM_EXMODE, lockFlags,
+ status = ocfs_acquire_lock (osb, OCFS_LKM_EXMODE,
+ FLAG_FILE_TRUNCATE|FLAG_FILE_UPDATE_OIN,
&bh, inode);
if (status < 0) {
if (status != -EINTR)
@@ -1031,10 +998,8 @@
ocfs_abort_trans(handle);
if (have_disk_lock) {
- lockFlags |= FLAG_FILE_UPDATE_OIN;
-
tmpstat = ocfs_release_lock (osb, OCFS_LKM_EXMODE,
- lockFlags, bh, inode);
+ FLAG_FILE_TRUNCATE|FLAG_FILE_UPDATE_OIN, bh, inode);
if (tmpstat < 0)
LOG_ERROR_STATUS (tmpstat);
}
@@ -1372,7 +1337,6 @@
ocfs_super *osb = NULL;
struct super_block *sb = inode->i_sb;
int extended = 0;
- int needs_trunc = 0;
LOG_SET_CONTEXT(SETATTR);
@@ -1428,8 +1392,7 @@
if (attr->ia_valid & ATTR_SIZE) {
if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
LOG_TRACE_STR ("OIN_NEEDS_VERIFICATION");
- status = ocfs_verify_update_inode (osb, inode,
- &needs_trunc, 0);
+ status = ocfs_verify_update_inode (osb, inode, 0);
if (status < 0) {
LOG_ERROR_STATUS (status);
LOG_TRACE_STR ("TODO: disable volume");
@@ -1437,8 +1400,6 @@
goto bail;
}
}
- if (needs_trunc)
- ocfs_truncate_inode_pages(inode, 0);
if (inode->i_size > newsize) {
ocfs_truncate_inode_pages(inode, newsize);
Modified: trunk/src/file.h
===================================================================
--- trunk/src/file.h 2004-07-07 21:26:17 UTC (rev 1246)
+++ trunk/src/file.h 2004-07-08 19:22:22 UTC (rev 1247)
@@ -43,6 +43,7 @@
ocfs_journal_handle *handle,
struct inode *inode);
int ocfs_setattr(struct dentry *dentry, struct iattr *attr);
+int ocfs_sync_inode(struct inode *inode);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
int ocfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c 2004-07-07 21:26:17 UTC (rev 1246)
+++ trunk/src/inode.c 2004-07-08 19:22:22 UTC (rev 1247)
@@ -1300,7 +1300,6 @@
int set_new = 0; /* flag */
__u64 new_size; /* In bytes, the size of the contiguous block */
unsigned char blocksize_bits;
- int needs_trunc = 0;
if (!inode || !bh_result) {
LOG_ERROR_STR("ocfs_direct_IO_get_blocks: inode or bh_result is null");
@@ -1312,10 +1311,7 @@
/* make sure we're up to date... */
if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
LOG_TRACE_STR ("ocfs_direct_IO_get_blocks: verify oin.");
- status = ocfs_verify_update_inode (osb, inode, &needs_trunc,
- 0);
- if (needs_trunc)
- ocfs_truncate_inode_pages(inode, 0);
+ status = ocfs_verify_update_inode (osb, inode, 0);
if (status < 0) {
LOG_TRACE_STR ("ocfs_verify_update_inode failed");
ret = -EIO;
@@ -1834,7 +1830,6 @@
{
struct inode *inode = dentry->d_inode;
int status = 0;
- int needs_trunc;
ocfs_super *osb;
LOG_SET_CONTEXT(REVALIDATE);
@@ -1875,7 +1870,7 @@
ocfs_release_lockres(GET_INODE_LOCKRES(inode));
atomic_set(&OCFS_I(inode)->ip_needs_verification, 1);
- status = ocfs_verify_update_inode(osb, inode, &needs_trunc, 0);
+ status = ocfs_verify_update_inode(osb, inode, 0);
if (status < 0) {
LOG_ERROR_STATUS (status);
status = -ENOENT;
@@ -1884,9 +1879,6 @@
bail:
up_read (&(OCFS_I(inode)->ip_io_sem));
- if (needs_trunc)
- ocfs_truncate_inode_pages(inode, 0);
-
no_inode:
LOG_EXIT_STATUS(status);
@@ -1897,7 +1889,7 @@
/*
* ocfs_verify_update_inode()
*/
-int ocfs_verify_update_inode (ocfs_super * osb, struct inode * inode, int *needs_trunc, int lockres_locked)
+int ocfs_verify_update_inode (ocfs_super * osb, struct inode * inode, int lockres_locked)
{
int status = 0;
struct buffer_head *fe_bh = NULL;
@@ -1910,8 +1902,6 @@
OCFS_ASSERT (inode);
- *needs_trunc = 0;
-
/* 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! */
@@ -1998,13 +1988,6 @@
OCFS_SET_INODE_TIME(inode, i_ctime, fe->i_ctime);
OCFS_SET_INODE_TIME(inode, i_atime, fe->i_atime);
OCFS_SET_INODE_TIME(inode, i_mtime, fe->i_mtime);
- if (!S_ISDIR (inode->i_mode) &&
- (OCFS_I(inode)->ip_alloc_size !=
- (__s64)((u64)fe->i_clusters << osb->s_clustersize_bits) ||
- inode->i_size != (__s64) fe->i_size ||
- OCFS_I(inode)->ip_chng_seq_num != DISK_LOCK(fe)->dl_seq_num)) {
- *needs_trunc = 1;
- }
if (S_ISCHR(fe->i_mode) ||
S_ISBLK(fe->i_mode) ||
Modified: trunk/src/inode.h
===================================================================
--- trunk/src/inode.h 2004-07-07 21:26:17 UTC (rev 1246)
+++ trunk/src/inode.h 2004-07-08 19:22:22 UTC (rev 1247)
@@ -46,8 +46,8 @@
ssize_t ocfs_rw_direct(int rw, struct file *filp, char *buf,
size_t size, loff_t *offp);
void ocfs_sync_blockdev(struct super_block *sb);
-int ocfs_verify_update_inode(ocfs_super *osb, struct inode *inode,
- int *needs_trunc, int lockres_locked);
+int ocfs_verify_update_inode(ocfs_super *osb, struct inode *inode,
+ int lockres_locked);
#ifdef AIO_ENABLED
int ocfs_kvec_read(struct file *file, kvec_cb_t cb, size_t size, loff_t pos);
Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c 2004-07-07 21:26:17 UTC (rev 1246)
+++ trunk/src/namei.c 2004-07-08 19:22:22 UTC (rev 1247)
@@ -658,7 +658,6 @@
if (tmpstat < 0)
LOG_ERROR_STATUS (tmpstat);
up_write(&OCFS_I(inode)->ip_io_sem);
-
}
if (fe_bh)
@@ -1039,7 +1038,6 @@
struct buffer_head *new_dir_bh = NULL;
__u32 oldfe_flags = FLAG_RELEASE_DENTRY | FLAG_FILE_RENAME;
__u32 newfe_flags = FLAG_RELEASE_DENTRY;
- int needs_trunc = 0;
int got_oldlock = 0, got_newlock = 0;
struct ocfs2_dir_entry *old_de = NULL, *new_de = NULL; // dirent for old_dentry
// and new_dentry
@@ -1202,10 +1200,7 @@
/* 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,
- &needs_trunc, 0);
- if (needs_trunc)
- ocfs_truncate_inode_pages(new_inode, 0);
+ status = ocfs_verify_update_inode (osb, new_inode, 0);
LOG_TRACE_ARGS("aha rename over existing... new_de=%p "
"new_blkno=%llu newfebh=%p bhblocknr=%llu\n",
Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c 2004-07-07 21:26:17 UTC (rev 1246)
+++ trunk/src/nm.c 2004-07-08 19:22:22 UTC (rev 1247)
@@ -48,6 +48,7 @@
#include "volcfg.h"
#include "vote.h"
#include "extmap.h"
+#include "file.h"
#include "ocfs_journal.h"
#include "buffer_head_io.h"
@@ -506,7 +507,7 @@
vote_type = INVALID_REQUEST;
goto done;
}
-
+
if (flags & FLAG_FILE_DELETE) {
if (flags & FLAG_RELEASE_LOCK)
vote_type = DELETE_RELEASE;
@@ -517,7 +518,11 @@
} else if (flags & FLAG_FILE_RELEASE_CACHE)
vote_type = RELEASE_CACHE;
else if (flags & FLAG_FILE_UPDATE_OIN) {
- vote_type = UPDATE_OIN_INODE;
+ if ((flags & FLAG_FILE_TRUNCATE) &&
+ (flags & FLAG_ACQUIRE_LOCK))
+ vote_type = TRUNCATE_PAGES;
+ else
+ vote_type = UPDATE_OIN_INODE;
} else if (flags & FLAG_TRUNCATE_PAGES) {
vote_type = TRUNCATE_PAGES;
} else if (lockres->master_node_num == osb->node_num) {
@@ -717,7 +722,6 @@
ocfs_dlm_msg *dlm_msg = (comm_vote ? ctxt->u.dlm_msg : NULL);
__s16 node_num = ctxt->node_num;
__u64 lock_id, seq_num;
- int needs_trunc = 0;
ocfs_node_map disk_map;
LOG_ENTRY_ARGS ("(0x%p, 0x%p)\n", osb, ctxt);
@@ -854,12 +858,9 @@
case UPDATE_OIN_INODE:
LOG_TRACE_STR("UPDATE_OIN_INODE");
atomic_set(&OCFS_I(inode)->ip_needs_verification, 1);
- tmpstat = ocfs_verify_update_inode(osb, inode,
- &needs_trunc, 1);
+ tmpstat = ocfs_verify_update_inode(osb, inode, 1);
if (tmpstat < 0)
LOG_ERROR_STATUS (tmpstat);
- if (needs_trunc)
- ocfs_truncate_inode_pages(inode, 0);
vote_response = FLAG_VOTE_OIN_UPDATED;
break;
@@ -900,15 +901,10 @@
LOG_TRACE_STR("DELETE_ACQUIRE");
atomic_set(&OCFS_I(inode)->ip_needs_verification, 1);
- tmpstat = ocfs_verify_update_inode(osb, inode,
- &needs_trunc,
- 1);
+ tmpstat = ocfs_verify_update_inode(osb, inode, 1);
if (tmpstat < 0)
LOG_ERROR_STATUS (tmpstat);
- if (needs_trunc)
- ocfs_truncate_inode_pages(inode, 0);
-
LOG_TRACE_ARGS("DELETE vote on inode %lu, read "
"lnk_cnt = %u\n", inode->i_ino,
inode->i_nlink);
@@ -955,6 +951,7 @@
#else
fsync_inode_buffers (inode);
#endif
+ ocfs_truncate_inode_pages(inode, 0);
/* Alright, for the YES case, we're done here. */
break;
@@ -1058,6 +1055,8 @@
#endif
#endif
+#warning do we need a truncate_inode_pages here?
+
/* nobody currently owns the lock so fastpath it */
if (vote_type == CHANGE_MASTER)
lockres->master_node_num = node_num;
@@ -1204,6 +1203,13 @@
case TRUNCATE_PAGES:
LOG_TRACE_STR("TRUNCATE_PAGES");
if(inode) {
+ status = ocfs_sync_inode(inode);
+ if (status < 0) {
+ LOG_ERROR_STATUS(status);
+ vote_response = FLAG_VOTE_UPDATE_RETRY;
+ break;
+ }
+
ocfs_truncate_inode_pages(inode, 0);
ocfs_extent_map_destroy(&OCFS_I(inode)->ip_ext_map);
ocfs_extent_map_init(&OCFS_I(inode)->ip_ext_map);
More information about the Ocfs2-commits
mailing list