[Ocfs2-commits] jlbec commits r1194 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Jun 22 22:27:21 CDT 2004


Author: jlbec
Date: 2004-06-22 21:27:19 -0500 (Tue, 22 Jun 2004)
New Revision: 1194

Modified:
   trunk/src/alloc.c
   trunk/src/file.c
   trunk/src/file.h
   trunk/src/inode.c
   trunk/src/namei.c
Log:

o Remove the file_off argument from ocfs_extend_file().  It's already
  on the inode.



Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c	2004-06-23 00:34:04 UTC (rev 1193)
+++ trunk/src/alloc.c	2004-06-23 02:27:19 UTC (rev 1194)
@@ -3216,7 +3216,6 @@
 		LOG_TRACE_ARGS("extending the alloc file to %llu\n",
 		       newFileSize + extent);
 		status = ocfs_extend_file(osb, newFileSize + extent, 
-					  OCFS_I(alloc_inode)->ip_blkno << alloc_inode->i_sb->s_blocksize_bits,
 					  handle, alloc_inode, NULL, 1,
 					  NULL);
 		if (status < 0) {
@@ -3233,7 +3232,6 @@
 		
 		LOG_TRACE_ARGS("extending the bitmap file to %llu\n", bitMapSize);
 		status = ocfs_extend_file(osb, bitMapSize,
-					  OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits, 
 					  handle, inode, NULL, 1, bh);
 		if (status < 0) {
 			LOG_ERROR_STATUS (status);

Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c	2004-06-23 00:34:04 UTC (rev 1193)
+++ trunk/src/file.c	2004-06-23 02:27:19 UTC (rev 1194)
@@ -801,7 +801,6 @@
 		     OCFS_I(inode)->ip_alloc_size, newsize);
 		down_write(&OCFS_I(inode)->ip_io_sem);
 		status = ocfs_extend_file(osb, newsize,
-					  OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
 					  NULL, inode, NULL, 0, NULL);
 		up_write(&OCFS_I(inode)->ip_io_sem);
 		if (status < 0) {
@@ -1089,7 +1088,7 @@
 /* ocfs_extend_file()
  *
  */
-int ocfs_extend_file(ocfs_super *osb, __u64 file_size, __u64 file_off,
+int ocfs_extend_file(ocfs_super *osb, __u64 file_size,
 		     ocfs_journal_handle *passed_handle,
 		     struct inode *inode, struct iattr *attr,
 		     int system_file, struct buffer_head *fe_bh)
@@ -1112,8 +1111,8 @@
 	int credits;
 	struct inode *ext_alloc_inode = NULL;
 
-	LOG_ENTRY_ARGS("(off=%llu, file_size=%llu, system=%s)\n",
-		       file_off, file_size, system_file?"yes":"no");
+	LOG_ENTRY_ARGS("(file_size=%llu, system=%s)\n",
+		       file_size, system_file?"yes":"no");
 
 	if (!inode)
 		BUG();
@@ -1124,7 +1123,9 @@
 	if (fe_bh)
 		bh = fe_bh;
 	else {
-		status = ocfs_read_bh (osb, file_off, &bh, OCFS_BH_CACHED, inode);
+		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;
@@ -1135,7 +1136,8 @@
 
 	if (!IS_VALID_FILE_ENTRY(fe)) {
 		printk("fe->signature=%8s\n", fe->i_signature);
-		LOG_ERROR_ARGS ("Invalid fe at offset %llu", file_off);
+		LOG_ERROR_ARGS("Invalid fe at block %llu",
+			       OCFS_I(inode)->ip_blkno);
 		status = -EFAIL;
 		goto leave;
 	}
@@ -1472,7 +1474,7 @@
 			status = ocfs_truncate_file(osb, fileOff, newsize, 
 						    inode);
 		else {
-			status = ocfs_extend_file(osb, newsize, fileOff, NULL, 
+			status = ocfs_extend_file(osb, newsize, NULL, 
 						  inode, attr, 0, NULL);
 			extended = 1;
 		}

Modified: trunk/src/file.h
===================================================================
--- trunk/src/file.h	2004-06-23 00:34:04 UTC (rev 1193)
+++ trunk/src/file.h	2004-06-23 02:27:19 UTC (rev 1194)
@@ -33,10 +33,10 @@
 extern struct file_operations ocfs_dops;
 extern struct inode_operations ocfs_file_iops;
 
-int ocfs_extend_file (ocfs_super * osb, __u64 file_size, __u64 file_off, 
-		      ocfs_journal_handle *passed_handle, 
-		      struct inode *inode, struct iattr *attr, 
-		      int system_file, struct buffer_head *fe_bh);
+int ocfs_extend_file(ocfs_super * osb, __u64 file_size,
+		     ocfs_journal_handle *passed_handle, 
+		     struct inode *inode, struct iattr *attr, 
+		     int system_file, struct buffer_head *fe_bh);
 int ocfs_inode_fill_ext_map(ocfs_super *osb, struct buffer_head *fe_bh,
 			    struct inode *inode);
 int ocfs_inode_notify_open(ocfs_super *osb, struct buffer_head *fe_bh, 

Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c	2004-06-23 00:34:04 UTC (rev 1193)
+++ trunk/src/inode.c	2004-06-23 02:27:19 UTC (rev 1194)
@@ -958,7 +958,6 @@
 
 		*err = ocfs_extend_file(osb, 
 					vbo + vbo_pad, 
-					OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
 				        handle, inode, NULL, 0, NULL);
 		if (*err < 0) {
 			*err = -ENOSPC;
@@ -1067,7 +1066,6 @@
 			       inode->i_ino);
 		down_write(&OCFS_I(inode)->ip_io_sem);
 		err = ocfs_extend_file(osb, vbo + vbo_pad, 
-				       OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
 				       NULL, inode, NULL, 0, NULL);
 		up_write(&OCFS_I(inode)->ip_io_sem);
 		if (err < 0) {
@@ -1334,7 +1332,6 @@
 	if (create && vbo_max > OCFS_I(inode)->ip_alloc_size) {
 		/* WARNING: How much do we really want to extend the file? */
 		status = ocfs_extend_file(osb, vbo_max,
-					  OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits,
 					  NULL, inode, NULL, 0, NULL);
 		if (status < 0) {
 			status = -ENOSPC;

Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c	2004-06-23 00:34:04 UTC (rev 1193)
+++ trunk/src/namei.c	2004-06-23 02:27:19 UTC (rev 1194)
@@ -1373,7 +1373,6 @@
 {
 	ocfs_super *osb = NULL;
 	struct inode *inode = NULL;
-	__u64 file_off;
 	__u64 newsize;
 	int status;
 	struct super_block *sb;
@@ -1421,9 +1420,9 @@
 	}
 
 	/* lock the parent directory */
-	status = ocfs_acquire_lock (osb, OCFS_DLM_ENABLE_CACHE_LOCK,
-				    FLAG_FILE_CREATE | FLAG_DIR, 
-				    &parent_fe_bh, dir);
+	status = ocfs_acquire_lock(osb, OCFS_DLM_ENABLE_CACHE_LOCK,
+				   FLAG_FILE_CREATE | FLAG_DIR, 
+				   &parent_fe_bh, dir);
 	if (status < 0) {
 		if (status != -EINTR)
 			LOG_ERROR_STATUS (status);
@@ -1432,18 +1431,21 @@
 	got_lock = 1;
 
 	status = ocfs_mknod_locked(osb, dir, dentry, 
-				  S_IFLNK | S_IRWXUGO, OCFS_NODEV,
-				  &new_fe_bh, parent_fe_bh, handle, inode);
+ 				   S_IFLNK | S_IRWXUGO, OCFS_NODEV,
+ 				   &new_fe_bh, parent_fe_bh, handle,
+				   inode);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
 		goto abort_trans;
 	}
 
 	fe = (ocfs2_dinode *) new_fe_bh->b_data;
-	file_off = fe->i_blkno << osb->sb->s_blocksize_bits;
-	fe = NULL;
 
-	status = ocfs_extend_file (osb, newsize, file_off, handle, inode, NULL, 0, new_fe_bh);
+	ocfs_populate_inode(inode, fe, 1);
+	ocfs_init_lockres(osb, inode);
+
+	status = ocfs_extend_file(osb, newsize, handle, inode, NULL, 0,
+				  new_fe_bh);
 	if (status < 0) {
 		if (status != -ENOSPC && status != -EINTR) {
 			LOG_ERROR_ARGS ("Failed to extend file to %llu", newsize);
@@ -1454,14 +1456,9 @@
 	}
 	inode->i_rdev = OCFS_NODEV;
 
-	fe = (ocfs2_dinode *) new_fe_bh->b_data;
-	ocfs_populate_inode (inode, fe, 1);
-	fe = NULL;
-
 	inode->i_size = newsize;
 	inode->i_blocks = (newsize + sb->s_blocksize - 1) >> sb->s_blocksize_bits;
 
-	ocfs_init_lockres (osb, inode);
 	status = ocfs_inode_notify_open(osb, new_fe_bh, handle, inode);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);



More information about the Ocfs2-commits mailing list