Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
7b718769 NS |
2 | * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. |
3 | * All Rights Reserved. | |
1da177e4 | 4 | * |
7b718769 NS |
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 | |
1da177e4 LT |
7 | * published by the Free Software Foundation. |
8 | * | |
7b718769 NS |
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. | |
1da177e4 | 13 | * |
7b718769 NS |
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 | |
1da177e4 LT |
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); | |
ec86dc02 | 60 | struct inode *ip = vn_to_inode(vp); |
1da177e4 LT |
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); | |
ec86dc02 | 79 | struct inode *ip = vn_to_inode(vp); |
1da177e4 LT |
80 | |
81 | if (VN_CACHED(vp)) { | |
28fd1298 | 82 | filemap_write_and_wait(ip->i_mapping); |
1da177e4 LT |
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); | |
ec86dc02 | 101 | struct inode *ip = vn_to_inode(vp); |
1da177e4 LT |
102 | |
103 | if (VN_CACHED(vp)) { | |
104 | filemap_fdatawrite(ip->i_mapping); | |
ee34807a NS |
105 | if (flags & XFS_B_ASYNC) |
106 | return 0; | |
1da177e4 LT |
107 | filemap_fdatawait(ip->i_mapping); |
108 | } | |
109 | ||
110 | return 0; | |
111 | } |