[Ocfs2-commits] jlbec commits r1196 - trunk/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Jun 23 02:48:16 CDT 2004
Author: jlbec
Date: 2004-06-23 01:48:15 -0500 (Wed, 23 Jun 2004)
New Revision: 1196
Modified:
trunk/src/file.c
Log:
o Removed file_off from ocfs_truncate_file() and ocfs_change_file_attrib()
Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c 2004-06-23 02:55:49 UTC (rev 1195)
+++ trunk/src/file.c 2004-06-23 06:48:15 UTC (rev 1196)
@@ -54,8 +54,10 @@
extern struct semaphore recovery_list_sem;
extern spinlock_t oin_num_ext_lock;
-static int ocfs_change_file_attrib (ocfs_super * osb, __u64 file_off, struct iattr *attr, struct inode *inode);
-static int ocfs_truncate_file (ocfs_super * osb, __u64 file_off, __u64 file_size, struct inode *inode);
+static int ocfs_change_file_attrib(ocfs_super *osb, struct iattr *attr,
+ struct inode *inode);
+static int ocfs_truncate_file(ocfs_super *osb, __u64 file_size,
+ struct inode *inode);
static void ocfs_fe_set_attributes(ocfs2_dinode *fe, struct iattr *attr)
@@ -573,7 +575,8 @@
/* ocfs_change_file_attrib()
*
*/
-static int ocfs_change_file_attrib (ocfs_super * osb, __u64 file_off, struct iattr *attr, struct inode *inode)
+static int ocfs_change_file_attrib(ocfs_super *osb, struct iattr *attr,
+ struct inode *inode)
{
int status = 0;
int tmpstat;
@@ -585,7 +588,9 @@
LOG_ENTRY ();
- 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;
@@ -594,7 +599,8 @@
fileEntry = (ocfs2_dinode *) bh->b_data;
if (!IS_VALID_FILE_ENTRY(fileEntry)) {
- LOG_ERROR_ARGS ("Invalid fe at offset %llu", file_off);
+ LOG_ERROR_ARGS("Invalid fe at blkno %llu",
+ OCFS_I(inode)->ip_blkno);
status = -EFAIL;
goto leave;
}
@@ -953,7 +959,8 @@
* ocfs_truncate_file()
*
*/
-static int ocfs_truncate_file (ocfs_super * osb, __u64 file_off, __u64 file_size, struct inode *inode)
+static int ocfs_truncate_file(ocfs_super *osb, __u64 file_size,
+ struct inode *inode)
{
int status = 0, tmpstat;
ocfs2_dinode *fe = NULL;
@@ -963,15 +970,17 @@
struct buffer_head *bh = NULL;
ocfs_journal_handle *handle = NULL;
- LOG_ENTRY_ARGS ("(file_off = %llu, file_size = %llu\n",
- file_off, file_size);
+ LOG_ENTRY_ARGS("(inode = %llu, file_size = %llu\n",
+ OCFS_I(inode)->ip_blkno, file_size);
new_alloc_size = ocfs_align_bytes_to_clusters(osb->sb,
file_size);
LOG_TRACE_ARGS("new_alloc_size = %llu\n", new_alloc_size);
- 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;
@@ -986,7 +995,8 @@
fe = (ocfs2_dinode *) bh->b_data;
if (!IS_VALID_FILE_ENTRY(fe)) {
- LOG_ERROR_ARGS ("Invalid fe at offset %llu", file_off);
+ LOG_ERROR_ARGS("Invalid fe at blkno %llu",
+ OCFS_I(inode)->ip_blkno);
status = -EFAIL;
goto leave;
}
@@ -1390,14 +1400,13 @@
* ocfs_setattr()
*
*/
-int ocfs_setattr (struct dentry *dentry, struct iattr *attr)
+int ocfs_setattr(struct dentry *dentry, struct iattr *attr)
{
struct inode *inode = dentry->d_inode;
int error = 0;
__u64 newsize;
int status;
ocfs_super *osb = NULL;
- __u64 fileOff;
struct super_block *sb = inode->i_sb;
int extended = 0;
int needs_trunc = 0;
@@ -1453,8 +1462,6 @@
goto bail;
/* get the file and parent offsets, and the file oin if present */
- fileOff = OCFS_I(inode)->ip_blkno << inode->i_sb->s_blocksize_bits;
-
if (attr->ia_valid & ATTR_SIZE) {
if (atomic_read(&OCFS_I(inode)->ip_needs_verification)) {
LOG_TRACE_STR ("OIN_NEEDS_VERIFICATION");
@@ -1471,7 +1478,7 @@
ocfs_truncate_inode_pages(inode, 0);
if (inode->i_size > newsize)
- status = ocfs_truncate_file(osb, fileOff, newsize,
+ status = ocfs_truncate_file(osb, newsize,
inode);
else {
status = ocfs_extend_file(osb, newsize, NULL,
@@ -1496,7 +1503,7 @@
status = -EFAIL;
if (!extended) {
- status = ocfs_change_file_attrib(osb, fileOff, attr, inode);
+ status = ocfs_change_file_attrib(osb, attr, inode);
if (status < 0) {
if (status != -EINTR)
LOG_ERROR_STATUS (status);
More information about the Ocfs2-commits
mailing list