aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c11
-rw-r--r--fs/xfs/linux-2.6/xfs_vnode.h5
-rw-r--r--fs/xfs/xfs_vnodeops.c47
3 files changed, 16 insertions, 47 deletions
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 8c43cd2e237a..cbcd40c8c2a0 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -184,15 +184,6 @@ xfs_file_open(
184} 184}
185 185
186STATIC int 186STATIC int
187xfs_file_close(
188 struct file *filp,
189 fl_owner_t id)
190{
191 return -bhv_vop_close(vn_from_inode(filp->f_path.dentry->d_inode), 0,
192 file_count(filp) > 1 ? L_FALSE : L_TRUE, NULL);
193}
194
195STATIC int
196xfs_file_release( 187xfs_file_release(
197 struct inode *inode, 188 struct inode *inode,
198 struct file *filp) 189 struct file *filp)
@@ -436,7 +427,6 @@ const struct file_operations xfs_file_operations = {
436#endif 427#endif
437 .mmap = xfs_file_mmap, 428 .mmap = xfs_file_mmap,
438 .open = xfs_file_open, 429 .open = xfs_file_open,
439 .flush = xfs_file_close,
440 .release = xfs_file_release, 430 .release = xfs_file_release,
441 .fsync = xfs_file_fsync, 431 .fsync = xfs_file_fsync,
442#ifdef HAVE_FOP_OPEN_EXEC 432#ifdef HAVE_FOP_OPEN_EXEC
@@ -458,7 +448,6 @@ const struct file_operations xfs_invis_file_operations = {
458#endif 448#endif
459 .mmap = xfs_file_mmap, 449 .mmap = xfs_file_mmap,
460 .open = xfs_file_open, 450 .open = xfs_file_open,
461 .flush = xfs_file_close,
462 .release = xfs_file_release, 451 .release = xfs_file_release,
463 .fsync = xfs_file_fsync, 452 .fsync = xfs_file_fsync,
464}; 453};
diff --git a/fs/xfs/linux-2.6/xfs_vnode.h b/fs/xfs/linux-2.6/xfs_vnode.h
index 013048a92643..5742d65f0785 100644
--- a/fs/xfs/linux-2.6/xfs_vnode.h
+++ b/fs/xfs/linux-2.6/xfs_vnode.h
@@ -129,10 +129,7 @@ typedef enum bhv_vchange {
129 VCHANGE_FLAGS_IOEXCL_COUNT = 4 129 VCHANGE_FLAGS_IOEXCL_COUNT = 4
130} bhv_vchange_t; 130} bhv_vchange_t;
131 131
132typedef enum { L_FALSE, L_TRUE } lastclose_t;
133
134typedef int (*vop_open_t)(bhv_desc_t *, struct cred *); 132typedef int (*vop_open_t)(bhv_desc_t *, struct cred *);
135typedef int (*vop_close_t)(bhv_desc_t *, int, lastclose_t, struct cred *);
136typedef ssize_t (*vop_read_t)(bhv_desc_t *, struct kiocb *, 133typedef ssize_t (*vop_read_t)(bhv_desc_t *, struct kiocb *,
137 const struct iovec *, unsigned int, 134 const struct iovec *, unsigned int,
138 loff_t *, int, struct cred *); 135 loff_t *, int, struct cred *);
@@ -200,7 +197,6 @@ typedef int (*vop_iflush_t)(bhv_desc_t *, int);
200typedef struct bhv_vnodeops { 197typedef struct bhv_vnodeops {
201 bhv_position_t vn_position; /* position within behavior chain */ 198 bhv_position_t vn_position; /* position within behavior chain */
202 vop_open_t vop_open; 199 vop_open_t vop_open;
203 vop_close_t vop_close;
204 vop_read_t vop_read; 200 vop_read_t vop_read;
205 vop_write_t vop_write; 201 vop_write_t vop_write;
206 vop_splice_read_t vop_splice_read; 202 vop_splice_read_t vop_splice_read;
@@ -245,7 +241,6 @@ typedef struct bhv_vnodeops {
245#define VNHEAD(vp) ((vp)->v_bh.bh_first) 241#define VNHEAD(vp) ((vp)->v_bh.bh_first)
246#define VOP(op, vp) (*((bhv_vnodeops_t *)VNHEAD(vp)->bd_ops)->op) 242#define VOP(op, vp) (*((bhv_vnodeops_t *)VNHEAD(vp)->bd_ops)->op)
247#define bhv_vop_open(vp, cr) VOP(vop_open, vp)(VNHEAD(vp),cr) 243#define bhv_vop_open(vp, cr) VOP(vop_open, vp)(VNHEAD(vp),cr)
248#define bhv_vop_close(vp, f,last,cr) VOP(vop_close, vp)(VNHEAD(vp),f,last,cr)
249#define bhv_vop_read(vp,file,iov,segs,offset,ioflags,cr) \ 244#define bhv_vop_read(vp,file,iov,segs,offset,ioflags,cr) \
250 VOP(vop_read, vp)(VNHEAD(vp),file,iov,segs,offset,ioflags,cr) 245 VOP(vop_read, vp)(VNHEAD(vp),file,iov,segs,offset,ioflags,cr)
251#define bhv_vop_write(vp,file,iov,segs,offset,ioflags,cr) \ 246#define bhv_vop_write(vp,file,iov,segs,offset,ioflags,cr) \
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 5dbca95598e0..2067d0b0a10e 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -77,36 +77,6 @@ xfs_open(
77 return 0; 77 return 0;
78} 78}
79 79
80STATIC int
81xfs_close(
82 bhv_desc_t *bdp,
83 int flags,
84 lastclose_t lastclose,
85 cred_t *credp)
86{
87 bhv_vnode_t *vp = BHV_TO_VNODE(bdp);
88 xfs_inode_t *ip = XFS_BHVTOI(bdp);
89
90 if (XFS_FORCED_SHUTDOWN(ip->i_mount))
91 return XFS_ERROR(EIO);
92
93 if (lastclose != L_TRUE || !VN_ISREG(vp))
94 return 0;
95
96 /*
97 * If we previously truncated this file and removed old data in
98 * the process, we want to initiate "early" writeout on the last
99 * close. This is an attempt to combat the notorious NULL files
100 * problem which is particularly noticable from a truncate down,
101 * buffered (re-)write (delalloc), followed by a crash. What we
102 * are effectively doing here is significantly reducing the time
103 * window where we'd otherwise be exposed to that problem.
104 */
105 if (VUNTRUNCATE(vp) && VN_DIRTY(vp) && ip->i_delayed_blks > 0)
106 return bhv_vop_flush_pages(vp, 0, -1, XFS_B_ASYNC, FI_NONE);
107 return 0;
108}
109
110/* 80/*
111 * xfs_getattr 81 * xfs_getattr
112 */ 82 */
@@ -1566,6 +1536,22 @@ xfs_release(
1566 if (vp->v_vfsp->vfs_flag & VFS_RDONLY) 1536 if (vp->v_vfsp->vfs_flag & VFS_RDONLY)
1567 return 0; 1537 return 0;
1568 1538
1539 if (!XFS_FORCED_SHUTDOWN(ip->i_mount)) {
1540 /*
1541 * If we previously truncated this file and removed old data
1542 * in the process, we want to initiate "early" writeout on
1543 * the last close. This is an attempt to combat the notorious
1544 * NULL files problem which is particularly noticable from a
1545 * truncate down, buffered (re-)write (delalloc), followed by
1546 * a crash. What we are effectively doing here is
1547 * significantly reducing the time window where we'd otherwise
1548 * be exposed to that problem.
1549 */
1550 if (VUNTRUNCATE(vp) && VN_DIRTY(vp) && ip->i_delayed_blks > 0)
1551 bhv_vop_flush_pages(vp, 0, -1, XFS_B_ASYNC, FI_NONE);
1552 }
1553
1554
1569#ifdef HAVE_REFCACHE 1555#ifdef HAVE_REFCACHE
1570 /* If we are in the NFS reference cache then don't do this now */ 1556 /* If we are in the NFS reference cache then don't do this now */
1571 if (ip->i_refcache) 1557 if (ip->i_refcache)
@@ -4681,7 +4667,6 @@ xfs_change_file_space(
4681bhv_vnodeops_t xfs_vnodeops = { 4667bhv_vnodeops_t xfs_vnodeops = {
4682 BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS), 4668 BHV_IDENTITY_INIT(VN_BHV_XFS,VNODE_POSITION_XFS),
4683 .vop_open = xfs_open, 4669 .vop_open = xfs_open,
4684 .vop_close = xfs_close,
4685 .vop_read = xfs_read, 4670 .vop_read = xfs_read,
4686#ifdef HAVE_SPLICE 4671#ifdef HAVE_SPLICE
4687 .vop_splice_read = xfs_splice_read, 4672 .vop_splice_read = xfs_splice_read,