patch-2.4.21 linux-2.4.21/fs/jfs/file.c
Next file: linux-2.4.21/fs/jfs/inode.c
Previous file: linux-2.4.21/fs/jffs2/nodelist.h
Back to the patch index
Back to the overall index
- Lines: 78
- Date:
2003-06-13 07:51:37.000000000 -0700
- Orig file:
linux-2.4.20/fs/jfs/file.c
- Orig date:
2002-11-28 15:53:15.000000000 -0800
diff -urN linux-2.4.20/fs/jfs/file.c linux-2.4.21/fs/jfs/file.c
@@ -26,12 +26,17 @@
extern int jfs_commit_inode(struct inode *, int);
+extern void jfs_truncate(struct inode *);
int jfs_fsync(struct file *file, struct dentry *dentry, int datasync)
{
struct inode *inode = dentry->d_inode;
int rc = 0;
+ /* No need to resync the data at commit time, unless this flag gets
+ * set again */
+ clear_cflag(COMMIT_Syncdata, inode);
+
rc = fsync_inode_data_buffers(inode);
if (!(inode->i_state & I_DIRTY))
@@ -44,59 +49,6 @@
return rc ? -EIO : 0;
}
-/*
- * Guts of jfs_truncate. Called with locks already held. Can be called
- * with directory for truncating directory index table.
- */
-void jfs_truncate_nolock(struct inode *ip, loff_t length)
-{
- loff_t newsize;
- tid_t tid;
-
- ASSERT(length >= 0);
-
- if (test_cflag(COMMIT_Nolink, ip)) {
- xtTruncate(0, ip, length, COMMIT_WMAP);
- return;
- }
-
- do {
- tid = txBegin(ip->i_sb, 0);
-
- /*
- * The commit_sem cannot be taken before txBegin.
- * txBegin may block and there is a chance the inode
- * could be marked dirty and need to be committed
- * before txBegin unblocks
- */
- down(&JFS_IP(ip)->commit_sem);
-
- newsize = xtTruncate(tid, ip, length,
- COMMIT_TRUNCATE | COMMIT_PWMAP);
- if (newsize < 0) {
- txEnd(tid);
- up(&JFS_IP(ip)->commit_sem);
- break;
- }
-
- ip->i_mtime = ip->i_ctime = CURRENT_TIME;
- mark_inode_dirty(ip);
-
- txCommit(tid, 1, &ip, 0);
- txEnd(tid);
- up(&JFS_IP(ip)->commit_sem);
- } while (newsize > length); /* Truncate isn't always atomic */
-}
-
-static void jfs_truncate(struct inode *ip)
-{
- jFYI(1, ("jfs_truncate: size = 0x%lx\n", (ulong) ip->i_size));
-
- IWRITE_LOCK(ip);
- jfs_truncate_nolock(ip, ip->i_size);
- IWRITE_UNLOCK(ip);
-}
-
static int jfs_open(struct inode *inode, struct file *file)
{
int rc;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)