Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 2 | * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc. |
| 3 | * All Rights Reserved. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * published by the Free Software Foundation. |
| 8 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * |
Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 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 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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); |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 60 | struct inode *ip = vn_to_inode(vp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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); |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 79 | struct inode *ip = vn_to_inode(vp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | |
| 81 | if (VN_CACHED(vp)) { |
OGAWA Hirofumi | 28fd129 | 2006-01-08 01:02:14 -0800 | [diff] [blame] | 82 | filemap_write_and_wait(ip->i_mapping); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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); |
Nathan Scott | ec86dc0 | 2006-03-17 17:25:36 +1100 | [diff] [blame] | 101 | struct inode *ip = vn_to_inode(vp); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | |
| 103 | if (VN_CACHED(vp)) { |
| 104 | filemap_fdatawrite(ip->i_mapping); |
Nathan Scott | ee34807 | 2005-11-02 10:32:38 +1100 | [diff] [blame] | 105 | if (flags & XFS_B_ASYNC) |
| 106 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | filemap_fdatawait(ip->i_mapping); |
| 108 | } |
| 109 | |
| 110 | return 0; |
| 111 | } |