[Ocfs2-commits] mfasheh commits r1308 - in trunk: . src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Tue Jul 27 21:47:45 CDT 2004
Author: mfasheh
Date: 2004-07-27 20:47:43 -0500 (Tue, 27 Jul 2004)
New Revision: 1308
Modified:
trunk/TODO
trunk/src/file.c
Log:
* don't do dirty reads in truncate_file and change_file_attrib.
Modified: trunk/TODO
===================================================================
--- trunk/TODO 2004-07-27 18:48:49 UTC (rev 1307)
+++ trunk/TODO 2004-07-28 01:47:43 UTC (rev 1308)
@@ -61,11 +61,13 @@
- the only ones left as of 7/19/04 are: truncate, link,
symlink and rename. these should be easy to fix.
-* there are places in the code (ocfs_extend_file, ocfs_truncate_file
- are two good examples) where 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...
+* 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...
+* investigate whether we need to do a verify_update_inode in
+ ocfs_recover_oin_locks as a size change may have occured on the inodes...
+
Post 1.0:
* restartable truncate
Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c 2004-07-27 18:48:49 UTC (rev 1307)
+++ trunk/src/file.c 2004-07-28 01:47:43 UTC (rev 1308)
@@ -553,23 +553,6 @@
LOG_ENTRY ();
- status = ocfs_read_bh(osb,
- OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
- &bh, OCFS_BH_CACHED, inode);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto leave;
- }
-
- fileEntry = (ocfs2_dinode *) bh->b_data;
-
- if (!IS_VALID_FILE_ENTRY(fileEntry)) {
- LOG_ERROR_ARGS("Invalid fe at blkno %llu",
- OCFS_I(inode)->ip_blkno);
- status = -EFAIL;
- goto leave;
- }
-
/* Start a transaction - need a minimal amount of block credits (1) */
handle = ocfs_start_trans(osb, 1);
if (handle == NULL) {
@@ -588,6 +571,15 @@
goto leave;
}
+ fileEntry = (ocfs2_dinode *) bh->b_data;
+
+ if (!IS_VALID_FILE_ENTRY(fileEntry)) {
+ LOG_ERROR_ARGS("Invalid fe at blkno %llu",
+ OCFS_I(inode)->ip_blkno);
+ status = -EFAIL;
+ goto leave;
+ }
+
status = ocfs_journal_access(handle, bh, OCFS_JOURNAL_ACCESS_WRITE);
if (status < 0) {
LOG_ERROR_STATUS(status);
@@ -927,14 +919,6 @@
LOG_TRACE_ARGS("new_alloc_size = %llu\n", new_alloc_size);
- status = ocfs_read_bh(osb,
- OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
- &bh, OCFS_BH_CACHED, inode);
- if (status < 0) {
- LOG_ERROR_STATUS (status);
- goto leave;
- }
-
/* start a journal transaction */
handle = ocfs_start_trans(osb, OCFS_FILE_TRUNCATE_CREDITS);
if (handle == NULL) {
@@ -942,14 +926,6 @@
goto leave;
}
- fe = (ocfs2_dinode *) bh->b_data;
- if (!IS_VALID_FILE_ENTRY(fe)) {
- LOG_ERROR_ARGS("Invalid fe at blkno %llu",
- OCFS_I(inode)->ip_blkno);
- status = -EFAIL;
- goto leave;
- }
-
status = ocfs_acquire_lock (osb, OCFS_LKM_EXMODE,
FLAG_FILE_TRUNCATE|FLAG_FILE_UPDATE_OIN,
&bh, inode);
@@ -962,6 +938,14 @@
FLAG_FILE_TRUNCATE|FLAG_FILE_UPDATE_OIN, bh,
inode, 0);
+ fe = (ocfs2_dinode *) bh->b_data;
+ if (!IS_VALID_FILE_ENTRY(fe)) {
+ LOG_ERROR_ARGS("Invalid fe at blkno %llu",
+ OCFS_I(inode)->ip_blkno);
+ status = -EFAIL;
+ goto leave;
+ }
+
/* add this fe to the journal transaction */
status = ocfs_journal_access(handle, bh, OCFS_JOURNAL_ACCESS_WRITE);
if (status < 0) {
@@ -971,8 +955,6 @@
down(&OCFS_I(inode)->ip_sem);
- fe = (ocfs2_dinode *) bh->b_data;
-
/* the file entry might have changed underneath us (while
* waiting on the lock). make sure the size is still a valid
* one. This really ought to check for other things too, like
@@ -1071,7 +1053,6 @@
goto leave;
}
}
-
fe = (ocfs2_dinode *) bh->b_data;
if (!IS_VALID_FILE_ENTRY(fe)) {
@@ -1087,6 +1068,7 @@
LOG_TRACE_ARGS("current_alloc=%llu, alloc_size=%llu\n",
current_alloc, alloc_size);
+
if (passed_handle == NULL) {
credits = ocfs_calc_extend_credits(osb->sb,
(__u32) alloc_size);
More information about the Ocfs2-commits
mailing list