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
fs_noerr(void)39 fs_noerr(void)
40 {
41 	return 0;
42 }
43 
44 /*
45  * Operation unsupported under this file system.
46  */
47 int
fs_nosys(void)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
fs_noval(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
fs_tosspages(bhv_desc_t * bdp,xfs_off_t first,xfs_off_t last,int fiopt)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
fs_flushinval_pages(bhv_desc_t * bdp,xfs_off_t first,xfs_off_t last,int fiopt)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_fdatasync(ip->i_mapping);
97 		fsync_inode_data_buffers(ip);
98 		filemap_fdatawait(ip->i_mapping);
99 
100 		truncate_inode_pages(ip->i_mapping, first);
101 	}
102 }
103 
104 /*
105  * vnode pcache layer for vnode_flush_pages.
106  * 'last' parameter unused but left in for IRIX compatibility
107  */
108 int
fs_flush_pages(bhv_desc_t * bdp,xfs_off_t first,xfs_off_t last,uint64_t flags,int fiopt)109 fs_flush_pages(
110 	bhv_desc_t	*bdp,
111 	xfs_off_t	first,
112 	xfs_off_t	last,
113 	uint64_t	flags,
114 	int		fiopt)
115 {
116 	vnode_t		*vp = BHV_TO_VNODE(bdp);
117 	struct inode	*ip = LINVFS_GET_IP(vp);
118 
119 	if (VN_CACHED(vp)) {
120 		filemap_fdatasync(ip->i_mapping);
121 		fsync_inode_data_buffers(ip);
122 		filemap_fdatawait(ip->i_mapping);
123 	}
124 
125 	return 0;
126 }
127