[Ocfs2-commits] mfasheh commits r1324 - in trunk: . src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Tue Aug 3 14:54:30 CDT 2004
Author: mfasheh
Date: 2004-08-03 13:54:28 -0500 (Tue, 03 Aug 2004)
New Revision: 1324
Modified:
trunk/TODO
trunk/src/file.c
trunk/src/namei.c
Log:
* no more checkpointed transactions! Much of this patch is by
<xiaofeng.ling at intel.com> - I fixed a bug in ocfs_link.
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2004-08-03 18:47:51 UTC (rev 1323)
+++ trunk/TODO 2004-08-03 18:54:28 UTC (rev 1324)
@@ -57,10 +57,6 @@
* move the stuff from /proc/sys/kernel/ocfs2/ to /proc/fs/ocfs2/
-* we should have no more checkpointed / synced transactions
- - the only ones left as of 7/19/04 are: truncate, link,
- symlink and rename. these should be easy to fix.
-
* in ocfs_extend_file (and possibly other places in the code) we read
an inode and get/check some values from it just before taking the
disk lock. We should really be doing that *after* taking the disk lock...
Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c 2004-08-03 18:47:51 UTC (rev 1323)
+++ trunk/src/file.c 2004-08-03 18:54:28 UTC (rev 1324)
@@ -931,6 +931,9 @@
goto leave;
}
+ ocfs_handle_set_checkpoint(handle, 0);
+ ocfs_handle_set_sync(handle, 0);
+
status = ocfs_acquire_lock (osb, OCFS_LKM_EXMODE,
FLAG_FILE_TRUNCATE|FLAG_FILE_UPDATE_OIN,
&bh, inode);
Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c 2004-08-03 18:47:51 UTC (rev 1323)
+++ trunk/src/namei.c 2004-08-03 18:54:28 UTC (rev 1324)
@@ -544,12 +544,9 @@
ocfs_journal_handle *handle = NULL;
struct inode *inode = old_dentry->d_inode;
int err;
- int tmpstat;
struct buffer_head *fe_bh = NULL;
struct buffer_head *parent_fe_bh = NULL;
ocfs2_dinode *fe = NULL;
- int cleanup_parent = 0;
- int cleanup_fe = 0;
ocfs_super *osb = OCFS_SB(dir->i_sb);
LOG_SET_CONTEXT(LINK);
@@ -576,6 +573,9 @@
goto bail;
}
+ ocfs_handle_set_checkpoint(handle, 0);
+ ocfs_handle_set_sync(handle, 0);
+
down_write(&OCFS_I(dir)->ip_io_sem);
/* lock the parent directory */
@@ -588,8 +588,10 @@
LOG_ERROR_STATUS (err);
goto bail;
}
- cleanup_parent = 1;
+ ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE,
+ FLAG_FILE_CREATE|FLAG_DIR, dir);
+
down_write(&OCFS_I(inode)->ip_io_sem);
err = ocfs_acquire_lock (osb, OCFS_LKM_EXMODE,
@@ -601,8 +603,10 @@
LOG_ERROR_STATUS (err);
goto bail;
}
- cleanup_fe = 1;
+ ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE,
+ FLAG_FILE_CREATE|FLAG_FILE_UPDATE_OIN, inode);
+
err = ocfs_journal_access(handle, fe_bh, OCFS_JOURNAL_ACCESS_WRITE);
if (err < 0) {
LOG_ERROR_STATUS(err);
@@ -643,25 +647,6 @@
else if (handle)
ocfs_commit_trans(handle);
- if (cleanup_parent) {
- tmpstat = ocfs_release_lock (osb, OCFS_LKM_EXMODE,
- FLAG_FILE_CREATE | FLAG_DIR, dir);
- if (tmpstat < 0)
- LOG_ERROR_STATUS (tmpstat);
- up_write(&OCFS_I(dir)->ip_io_sem);
-
- }
-
- if (cleanup_fe) {
- tmpstat = ocfs_release_lock(osb, OCFS_LKM_EXMODE,
- FLAG_FILE_CREATE
- | FLAG_FILE_UPDATE_OIN,
- inode);
- if (tmpstat < 0)
- LOG_ERROR_STATUS (tmpstat);
- up_write(&OCFS_I(inode)->ip_io_sem);
- }
-
if (fe_bh)
brelse(fe_bh);
if (parent_fe_bh)
@@ -998,7 +983,6 @@
struct buffer_head *new_dir_bh = NULL;
__u32 oldfe_flags = FLAG_RELEASE_DENTRY | FLAG_FILE_RENAME;
__u32 newfe_flags = FLAG_RELEASE_DENTRY;
- int got_oldlock = 0, got_newlock = 0;
struct ocfs2_dir_entry *old_de = NULL, *new_de = NULL; // dirent for old_dentry
// and new_dentry
struct buffer_head *new_de_bh = NULL, *old_de_bh = NULL; // bhs for above
@@ -1048,7 +1032,8 @@
LOG_ERROR_STATUS(status = -ENOMEM);
goto bail;
}
-
+ ocfs_handle_set_checkpoint(handle, 0);
+ ocfs_handle_set_sync(handle, 0);
/* if old and new are the same, this'll just do one lock. */
status = ocfs_double_lock(osb, handle,
OCFS_LKM_EXMODE,
@@ -1084,8 +1069,9 @@
LOG_ERROR_STATUS(status);
goto finally;
}
- got_oldlock = 1;
+ ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE, oldfe_flags, old_inode);
+
if (S_ISDIR(old_inode->i_mode)) {
status = -EIO;
old_inode_de_bh = ocfs_bread (handle, old_inode, 0, 0, &status, 0);
@@ -1155,8 +1141,11 @@
LOG_ERROR_STATUS(status);
goto finally;
}
- got_newlock = 1;
+ ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE,
+ newfe_flags, new_inode);
+
+
/* if our caching is working right, then after the
* verify_update_inode, newfe->i_nlink ==
* new_inode->i_nlink */
@@ -1294,16 +1283,7 @@
status = 0;
bail:
- if (got_oldlock) {
- ocfs_release_lock(osb, OCFS_LKM_EXMODE, oldfe_flags,
- old_inode);
- }
- if (got_newlock) {
- ocfs_release_lock(osb, OCFS_LKM_EXMODE, newfe_flags,
- new_inode);
- }
-
double_up_write(&OCFS_I(old_dir)->ip_io_sem,
&OCFS_I(new_dir)->ip_io_sem);
up_write(&OCFS_I(old_inode)->ip_io_sem);
@@ -1460,7 +1440,6 @@
struct buffer_head *parent_fe_bh = NULL;
ocfs2_dinode *fe = NULL;
ocfs_journal_handle *handle = NULL;
- int got_lock = 0;
int credits;
LOG_SET_CONTEXT(SYMLINK);
@@ -1501,6 +1480,9 @@
goto bail;
}
+ ocfs_handle_set_checkpoint(handle, 0);
+ ocfs_handle_set_sync(handle, 0);
+
/* lock the parent directory */
status = ocfs_acquire_lock(osb, OCFS_LKM_EXMODE,
FLAG_FILE_CREATE | FLAG_DIR,
@@ -1510,8 +1492,10 @@
LOG_ERROR_STATUS (status);
goto abort_trans;
}
- got_lock = 1;
+ ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE,
+ FLAG_FILE_CREATE|FLAG_DIR, dir);
+
status = ocfs_mknod_locked(osb, dir, dentry,
S_IFLNK | S_IRWXUGO, 0,
&new_fe_bh, parent_fe_bh, handle,
@@ -1574,14 +1558,6 @@
ocfs_commit_trans(handle);
}
- if (got_lock) {
- int tmpstat;
- tmpstat = ocfs_release_lock (osb, OCFS_LKM_EXMODE,
- FLAG_FILE_CREATE | FLAG_DIR, dir);
- if (tmpstat < 0)
- LOG_ERROR_STATUS (tmpstat);
- }
-
bail:
up_write(&OCFS_I(dir)->ip_io_sem);
if (new_fe_bh) {
More information about the Ocfs2-commits
mailing list