Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / fs / xfs / linux-2.6 / xfs_fs_subr.c
1 /*
2  * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
3  * All Rights Reserved.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it would be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write the Free Software Foundation,
16  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18
19 #include "xfs.h"
20
21 /*
22  * Stub for no-op vnode operations that return error status.
23  */
24 int
25 fs_noerr(void)
26 {
27         return 0;
28 }
29
30 /*
31  * Operation unsupported under this file system.
32  */
33 int
34 fs_nosys(void)
35 {
36         return ENOSYS;
37 }
38
39 /*
40  * Stub for inactive, strategy, and read/write lock/unlock.  Does nothing.
41  */
42 /* ARGSUSED */
43 void
44 fs_noval(void)
45 {
46 }
47
48 /*
49  * vnode pcache layer for vnode_tosspages.
50  * 'last' parameter unused but left in for IRIX compatibility
51  */
52 void
53 fs_tosspages(
54         bhv_desc_t      *bdp,
55         xfs_off_t       first,
56         xfs_off_t       last,
57         int             fiopt)
58 {
59         vnode_t         *vp = BHV_TO_VNODE(bdp);
60         struct inode    *ip = vn_to_inode(vp);
61
62         if (VN_CACHED(vp))
63                 truncate_inode_pages(ip->i_mapping, first);
64 }
65
66
67 /*
68  * vnode pcache layer for vnode_flushinval_pages.
69  * 'last' parameter unused but left in for IRIX compatibility
70  */
71 void
72 fs_flushinval_pages(
73         bhv_desc_t      *bdp,
74         xfs_off_t       first,
75         xfs_off_t       last,
76         int             fiopt)
77 {
78         vnode_t         *vp = BHV_TO_VNODE(bdp);
79         struct inode    *ip = vn_to_inode(vp);
80
81         if (VN_CACHED(vp)) {
82                 filemap_write_and_wait(ip->i_mapping);
83
84                 truncate_inode_pages(ip->i_mapping, first);
85         }
86 }
87
88 /*
89  * vnode pcache layer for vnode_flush_pages.
90  * 'last' parameter unused but left in for IRIX compatibility
91  */
92 int
93 fs_flush_pages(
94         bhv_desc_t      *bdp,
95         xfs_off_t       first,
96         xfs_off_t       last,
97         uint64_t        flags,
98         int             fiopt)
99 {
100         vnode_t         *vp = BHV_TO_VNODE(bdp);
101         struct inode    *ip = vn_to_inode(vp);
102
103         if (VN_CACHED(vp)) {
104                 filemap_fdatawrite(ip->i_mapping);
105                 if (flags & XFS_B_ASYNC)
106                         return 0;
107                 filemap_fdatawait(ip->i_mapping);
108         }
109
110         return 0;
111 }