Linux-2.6.12-rc2
[safe/jmp/linux-2.6] / fs / xfs / linux-2.6 / xfs_fs_subr.c
1 /*
2  * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of version 2 of the GNU General Public License as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it would be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  *
12  * Further, this software is distributed without any warranty that it is
13  * free of the rightful claim of any third person regarding infringement
14  * or the like.  Any license provided herein, whether implied or
15  * otherwise, applies only to this software file.  Patent licenses, if
16  * any, provided herein do not apply to combinations of this program with
17  * other software, or any other product whatsoever.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write the Free Software Foundation, Inc., 59
21  * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22  *
23  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24  * Mountain View, CA  94043, or:
25  *
26  * http://www.sgi.com
27  *
28  * For further information regarding this notice, see:
29  *
30  * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31  */
32
33 #include "xfs.h"
34
35 /*
36  * Stub for no-op vnode operations that return error status.
37  */
38 int
39 fs_noerr(void)
40 {
41         return 0;
42 }
43
44 /*
45  * Operation unsupported under this file system.
46  */
47 int
48 fs_nosys(void)
49 {
50         return ENOSYS;
51 }
52
53 /*
54  * Stub for inactive, strategy, and read/write lock/unlock.  Does nothing.
55  */
56 /* ARGSUSED */
57 void
58 fs_noval(void)
59 {
60 }
61
62 /*
63  * vnode pcache layer for vnode_tosspages.
64  * 'last' parameter unused but left in for IRIX compatibility
65  */
66 void
67 fs_tosspages(
68         bhv_desc_t      *bdp,
69         xfs_off_t       first,
70         xfs_off_t       last,
71         int             fiopt)
72 {
73         vnode_t         *vp = BHV_TO_VNODE(bdp);
74         struct inode    *ip = LINVFS_GET_IP(vp);
75
76         if (VN_CACHED(vp))
77                 truncate_inode_pages(ip->i_mapping, first);
78 }
79
80
81 /*
82  * vnode pcache layer for vnode_flushinval_pages.
83  * 'last' parameter unused but left in for IRIX compatibility
84  */
85 void
86 fs_flushinval_pages(
87         bhv_desc_t      *bdp,
88         xfs_off_t       first,
89         xfs_off_t       last,
90         int             fiopt)
91 {
92         vnode_t         *vp = BHV_TO_VNODE(bdp);
93         struct inode    *ip = LINVFS_GET_IP(vp);
94
95         if (VN_CACHED(vp)) {
96                 filemap_fdatawrite(ip->i_mapping);
97                 filemap_fdatawait(ip->i_mapping);
98
99                 truncate_inode_pages(ip->i_mapping, first);
100         }
101 }
102
103 /*
104  * vnode pcache layer for vnode_flush_pages.
105  * 'last' parameter unused but left in for IRIX compatibility
106  */
107 int
108 fs_flush_pages(
109         bhv_desc_t      *bdp,
110         xfs_off_t       first,
111         xfs_off_t       last,
112         uint64_t        flags,
113         int             fiopt)
114 {
115         vnode_t         *vp = BHV_TO_VNODE(bdp);
116         struct inode    *ip = LINVFS_GET_IP(vp);
117
118         if (VN_CACHED(vp)) {
119                 filemap_fdatawrite(ip->i_mapping);
120                 filemap_fdatawait(ip->i_mapping);
121         }
122
123         return 0;
124 }