patch-2.1.56 linux/fs/ext2/fsync.c
Next file: linux/fs/fat/mmap.c
Previous file: linux/fs/ext2/file.c
Back to the patch index
Back to the overall index
- Lines: 140
- Date:
Mon Sep 15 14:00:16 1997
- Orig file:
v2.1.55/linux/fs/ext2/fsync.c
- Orig date:
Fri Apr 4 08:52:24 1997
diff -u --recursive --new-file v2.1.55/linux/fs/ext2/fsync.c linux/fs/ext2/fsync.c
@@ -38,18 +38,12 @@
static int sync_block (struct inode * inode, u32 * block, int wait)
{
struct buffer_head * bh;
- int tmp;
if (!*block)
return 0;
- tmp = *block;
bh = get_hash_table (inode->i_dev, *block, blocksize);
if (!bh)
return 0;
- if (*block != tmp) {
- brelse (bh);
- return 1;
- }
if (wait && buffer_req(bh) && !buffer_uptodate(bh)) {
brelse (bh);
return -1;
@@ -67,18 +61,12 @@
static int sync_block_swab32 (struct inode * inode, u32 * block, int wait)
{
struct buffer_head * bh;
- int tmp;
if (!le32_to_cpu(*block))
return 0;
- tmp = le32_to_cpu(*block);
bh = get_hash_table (inode->i_dev, le32_to_cpu(*block), blocksize);
if (!bh)
return 0;
- if (le32_to_cpu(*block) != tmp) {
- brelse (bh);
- return 1;
- }
if (wait && buffer_req(bh) && !buffer_uptodate(bh)) {
brelse (bh);
return -1;
@@ -109,11 +97,6 @@
if (rc)
return rc;
*bh = bread (inode->i_dev, tmp, blocksize);
- if (tmp != *iblock) {
- brelse (*bh);
- *bh = NULL;
- return 1;
- }
if (!*bh)
return -1;
return 0;
@@ -133,11 +116,6 @@
if (rc)
return rc;
*bh = bread (inode->i_dev, tmp, blocksize);
- if (tmp != le32_to_cpu(*iblock)) {
- brelse (*bh);
- *bh = NULL;
- return 1;
- }
if (!*bh)
return -1;
return 0;
@@ -153,8 +131,6 @@
for (i = 0; i < EXT2_NDIR_BLOCKS; i++) {
rc = sync_block (inode, inode->u.ext2_i.i_data + i, wait);
- if (rc > 0)
- break;
if (rc)
err = rc;
}
@@ -175,8 +151,6 @@
rc = sync_block_swab32 (inode,
((u32 *) ind_bh->b_data) + i,
wait);
- if (rc > 0)
- break;
if (rc)
err = rc;
}
@@ -199,8 +173,6 @@
rc = sync_block_swab32 (inode,
((u32 *) ind_bh->b_data) + i,
wait);
- if (rc > 0)
- break;
if (rc)
err = rc;
}
@@ -225,8 +197,6 @@
rc = sync_indirect_swab32 (inode,
((u32 *) dind_bh->b_data) + i,
wait);
- if (rc > 0)
- break;
if (rc)
err = rc;
}
@@ -249,8 +219,6 @@
rc = sync_indirect_swab32 (inode,
((u32 *) dind_bh->b_data) + i,
wait);
- if (rc > 0)
- break;
if (rc)
err = rc;
}
@@ -275,8 +243,6 @@
rc = sync_dindirect_swab32 (inode,
((u32 *) tind_bh->b_data) + i,
wait);
- if (rc > 0)
- break;
if (rc)
err = rc;
}
@@ -284,9 +250,15 @@
return err;
}
-int ext2_sync_file (struct inode * inode, struct file * file)
+/*
+ * File may be NULL when we are called. Perhaps we shouldn't
+ * even pass file to fsync ?
+ */
+
+int ext2_sync_file(struct file * file, struct dentry *dentry)
{
int wait, err = 0;
+ struct inode *inode = dentry->d_inode;
if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
S_ISLNK(inode->i_mode)))
@@ -312,5 +284,5 @@
}
skip:
err |= ext2_sync_inode (inode);
- return (err < 0) ? -EIO : 0;
+ return err ? -EIO : 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov