blob: 575f2a790f315e9ff84530ea39d4659c1135756e [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Nathan Scott7b718762005-11-02 14:58:39 +11002 * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
3 * All Rights Reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
Nathan Scott7b718762005-11-02 14:58:39 +11005 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 * published by the Free Software Foundation.
8 *
Nathan Scott7b718762005-11-02 14:58:39 +11009 * 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.
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 *
Nathan Scott7b718762005-11-02 14:58:39 +110014 * 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
Linus Torvalds1da177e2005-04-16 15:20:36 -070017 */
18
19#include "xfs.h"
20
21/*
22 * Stub for no-op vnode operations that return error status.
23 */
24int
25fs_noerr(void)
26{
27 return 0;
28}
29
30/*
31 * Operation unsupported under this file system.
32 */
33int
34fs_nosys(void)
35{
36 return ENOSYS;
37}
38
39/*
40 * Stub for inactive, strategy, and read/write lock/unlock. Does nothing.
41 */
42/* ARGSUSED */
43void
44fs_noval(void)
45{
46}
47
48/*
49 * vnode pcache layer for vnode_tosspages.
50 * 'last' parameter unused but left in for IRIX compatibility
51 */
52void
53fs_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);
Nathan Scottec86dc02006-03-17 17:25:36 +110060 struct inode *ip = vn_to_inode(vp);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061
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 */
71void
72fs_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);
Nathan Scottec86dc02006-03-17 17:25:36 +110079 struct inode *ip = vn_to_inode(vp);
Linus Torvalds1da177e2005-04-16 15:20:36 -070080
81 if (VN_CACHED(vp)) {
OGAWA Hirofumi28fd1292006-01-08 01:02:14 -080082 filemap_write_and_wait(ip->i_mapping);
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
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 */
92int
93fs_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);
Nathan Scottec86dc02006-03-17 17:25:36 +1100101 struct inode *ip = vn_to_inode(vp);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102
103 if (VN_CACHED(vp)) {
104 filemap_fdatawrite(ip->i_mapping);
Nathan Scottee348072005-11-02 10:32:38 +1100105 if (flags & XFS_B_ASYNC)
106 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 filemap_fdatawait(ip->i_mapping);
108 }
109
110 return 0;
111}