Commit | Line | Data |
---|---|---|
1da177e4 | 1 | /* |
7d4fb40a | 2 | * Copyright (c) 2000-2002,2005-2006 Silicon Graphics, Inc. |
7b718769 | 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 | 17 | */ |
1da177e4 | 18 | #include "xfs.h" |
993386c1 | 19 | #include "xfs_vnodeops.h" |
993386c1 | 20 | #include "xfs_bmap_btree.h" |
993386c1 | 21 | #include "xfs_inode.h" |
1da177e4 | 22 | |
7d4fb40a NS |
23 | int fs_noerr(void) { return 0; } |
24 | int fs_nosys(void) { return ENOSYS; } | |
25 | void fs_noval(void) { return; } | |
1da177e4 | 26 | |
1da177e4 | 27 | void |
993386c1 CH |
28 | xfs_tosspages( |
29 | xfs_inode_t *ip, | |
1da177e4 LT |
30 | xfs_off_t first, |
31 | xfs_off_t last, | |
32 | int fiopt) | |
33 | { | |
a8b3acd5 | 34 | struct address_space *mapping = ip->i_vnode->i_mapping; |
1da177e4 | 35 | |
a8b3acd5 CH |
36 | if (mapping->nrpages) |
37 | truncate_inode_pages(mapping, first); | |
1da177e4 LT |
38 | } |
39 | ||
d3cf2094 | 40 | int |
993386c1 CH |
41 | xfs_flushinval_pages( |
42 | xfs_inode_t *ip, | |
1da177e4 LT |
43 | xfs_off_t first, |
44 | xfs_off_t last, | |
45 | int fiopt) | |
46 | { | |
a8b3acd5 | 47 | struct address_space *mapping = ip->i_vnode->i_mapping; |
d3cf2094 | 48 | int ret = 0; |
1da177e4 | 49 | |
a8b3acd5 | 50 | if (mapping->nrpages) { |
b3aea4ed | 51 | xfs_iflags_clear(ip, XFS_ITRUNCATED); |
a8b3acd5 | 52 | ret = filemap_write_and_wait(mapping); |
d3cf2094 | 53 | if (!ret) |
a8b3acd5 | 54 | truncate_inode_pages(mapping, first); |
1da177e4 | 55 | } |
d3cf2094 | 56 | return ret; |
1da177e4 LT |
57 | } |
58 | ||
1da177e4 | 59 | int |
993386c1 CH |
60 | xfs_flush_pages( |
61 | xfs_inode_t *ip, | |
1da177e4 LT |
62 | xfs_off_t first, |
63 | xfs_off_t last, | |
64 | uint64_t flags, | |
65 | int fiopt) | |
66 | { | |
a8b3acd5 | 67 | struct address_space *mapping = ip->i_vnode->i_mapping; |
d3cf2094 LM |
68 | int ret = 0; |
69 | int ret2; | |
1da177e4 | 70 | |
a8b3acd5 | 71 | if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) { |
b3aea4ed | 72 | xfs_iflags_clear(ip, XFS_ITRUNCATED); |
a8b3acd5 | 73 | ret = filemap_fdatawrite(mapping); |
ee34807a | 74 | if (flags & XFS_B_ASYNC) |
d3cf2094 | 75 | return ret; |
a8b3acd5 | 76 | ret2 = filemap_fdatawait(mapping); |
d3cf2094 LM |
77 | if (!ret) |
78 | ret = ret2; | |
1da177e4 | 79 | } |
d3cf2094 | 80 | return ret; |
1da177e4 | 81 | } |