aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_file.c
diff options
context:
space:
mode:
authorNathan Scott <nathans@sgi.com>2006-06-09 01:27:16 -0400
committerNathan Scott <nathans@sgi.com>2006-06-09 01:27:16 -0400
commit7d4fb40ad7efe4586d1341d4731377fb4530836f (patch)
treebf802cce6bc60627186b02b71014a683f6cb4a05 /fs/xfs/linux-2.6/xfs_file.c
parent59c1b082f5fff8269565039600a2ef18d48649b5 (diff)
[XFS] Start writeout earlier (on last close) in the case where we have a
truncate down followed by delayed allocation (buffered writes) - worst case scenario for the notorious NULL files problem. This reduces the window where we are exposed to that problem significantly. SGI-PV: 917976 SGI-Modid: xfs-linux-melb:xfs-kern:26100a Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_file.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 7c9f7598807f..97615cc74ef5 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -324,6 +324,17 @@ xfs_file_open(
324} 324}
325 325
326STATIC int 326STATIC int
327xfs_file_close(
328 struct file *filp)
329{
330 vnode_t *vp = vn_from_inode(filp->f_dentry->d_inode);
331 int error;
332
333 VOP_CLOSE(vp, 0, file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL, error);
334 return -error;
335}
336
337STATIC int
327xfs_file_release( 338xfs_file_release(
328 struct inode *inode, 339 struct inode *inode,
329 struct file *filp) 340 struct file *filp)
@@ -349,6 +360,8 @@ xfs_file_fsync(
349 360
350 if (datasync) 361 if (datasync)
351 flags |= FSYNC_DATA; 362 flags |= FSYNC_DATA;
363 if (VN_TRUNC(vp))
364 VUNTRUNCATE(vp);
352 VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error); 365 VOP_FSYNC(vp, flags, NULL, (xfs_off_t)0, (xfs_off_t)-1, error);
353 return -error; 366 return -error;
354} 367}
@@ -578,6 +591,7 @@ const struct file_operations xfs_file_operations = {
578#endif 591#endif
579 .mmap = xfs_file_mmap, 592 .mmap = xfs_file_mmap,
580 .open = xfs_file_open, 593 .open = xfs_file_open,
594 .flush = xfs_file_close,
581 .release = xfs_file_release, 595 .release = xfs_file_release,
582 .fsync = xfs_file_fsync, 596 .fsync = xfs_file_fsync,
583#ifdef HAVE_FOP_OPEN_EXEC 597#ifdef HAVE_FOP_OPEN_EXEC
@@ -602,6 +616,7 @@ const struct file_operations xfs_invis_file_operations = {
602#endif 616#endif
603 .mmap = xfs_file_mmap, 617 .mmap = xfs_file_mmap,
604 .open = xfs_file_open, 618 .open = xfs_file_open,
619 .flush = xfs_file_close,
605 .release = xfs_file_release, 620 .release = xfs_file_release,
606 .fsync = xfs_file_fsync, 621 .fsync = xfs_file_fsync,
607}; 622};