Blame view
fs/xfs/xfs_fs_subr.c
2.33 KB
1da177e4c Linux-2.6.12-rc2 |
1 |
/* |
7d4fb40ad [XFS] Start write... |
2 |
* Copyright (c) 2000-2002,2005-2006 Silicon Graphics, Inc. |
7b7187698 [XFS] Update lice... |
3 |
* All Rights Reserved. |
1da177e4c Linux-2.6.12-rc2 |
4 |
* |
7b7187698 [XFS] Update lice... |
5 6 |
* This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as |
1da177e4c Linux-2.6.12-rc2 |
7 8 |
* published by the Free Software Foundation. * |
7b7187698 [XFS] Update lice... |
9 10 11 12 |
* This program is distributed in the hope that it would be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. |
1da177e4c Linux-2.6.12-rc2 |
13 |
* |
7b7187698 [XFS] Update lice... |
14 15 16 |
* You should have received a copy of the GNU General Public License * along with this program; if not, write the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1da177e4c Linux-2.6.12-rc2 |
17 |
*/ |
1da177e4c Linux-2.6.12-rc2 |
18 |
#include "xfs.h" |
993386c19 [XFS] decontamina... |
19 |
#include "xfs_vnodeops.h" |
993386c19 [XFS] decontamina... |
20 |
#include "xfs_bmap_btree.h" |
993386c19 [XFS] decontamina... |
21 |
#include "xfs_inode.h" |
0b1b213fc xfs: event tracin... |
22 |
#include "xfs_trace.h" |
1da177e4c Linux-2.6.12-rc2 |
23 |
|
2e6560929 [XFS] fix error i... |
24 25 26 27 |
/* * note: all filemap functions return negative error codes. These * need to be inverted before returning to the xfs core functions. */ |
1da177e4c Linux-2.6.12-rc2 |
28 |
void |
993386c19 [XFS] decontamina... |
29 30 |
xfs_tosspages( xfs_inode_t *ip, |
1da177e4c Linux-2.6.12-rc2 |
31 32 33 34 |
xfs_off_t first, xfs_off_t last, int fiopt) { |
3ae4c9deb xfs: use range pr... |
35 36 37 |
/* can't toss partial tail pages, so mask them out */ last &= ~(PAGE_SIZE - 1); truncate_inode_pages_range(VFS_I(ip)->i_mapping, first, last - 1); |
1da177e4c Linux-2.6.12-rc2 |
38 |
} |
d3cf20947 [XFS] propogate r... |
39 |
int |
993386c19 [XFS] decontamina... |
40 41 |
xfs_flushinval_pages( xfs_inode_t *ip, |
1da177e4c Linux-2.6.12-rc2 |
42 43 44 45 |
xfs_off_t first, xfs_off_t last, int fiopt) { |
016516462 [XFS] Avoid direc... |
46 |
struct address_space *mapping = VFS_I(ip)->i_mapping; |
d3cf20947 [XFS] propogate r... |
47 |
int ret = 0; |
1da177e4c Linux-2.6.12-rc2 |
48 |
|
0b1b213fc xfs: event tracin... |
49 |
trace_xfs_pagecache_inval(ip, first, last); |
3ae4c9deb xfs: use range pr... |
50 51 52 53 54 |
xfs_iflags_clear(ip, XFS_ITRUNCATED); ret = filemap_write_and_wait_range(mapping, first, last == -1 ? LLONG_MAX : last); if (!ret) truncate_inode_pages_range(mapping, first, last); |
2e6560929 [XFS] fix error i... |
55 |
return -ret; |
1da177e4c Linux-2.6.12-rc2 |
56 |
} |
1da177e4c Linux-2.6.12-rc2 |
57 |
int |
993386c19 [XFS] decontamina... |
58 59 |
xfs_flush_pages( xfs_inode_t *ip, |
1da177e4c Linux-2.6.12-rc2 |
60 61 62 63 64 |
xfs_off_t first, xfs_off_t last, uint64_t flags, int fiopt) { |
016516462 [XFS] Avoid direc... |
65 |
struct address_space *mapping = VFS_I(ip)->i_mapping; |
d3cf20947 [XFS] propogate r... |
66 67 |
int ret = 0; int ret2; |
1da177e4c Linux-2.6.12-rc2 |
68 |
|
3ae4c9deb xfs: use range pr... |
69 70 71 |
xfs_iflags_clear(ip, XFS_ITRUNCATED); ret = -filemap_fdatawrite_range(mapping, first, last == -1 ? LLONG_MAX : last); |
0cadda1c5 xfs: remove dupli... |
72 |
if (flags & XBF_ASYNC) |
a8d770d98 xfs: use xfs_sync... |
73 74 75 76 77 |
return ret; ret2 = xfs_wait_on_pages(ip, first, last); if (!ret) ret = ret2; return ret; |
2e6560929 [XFS] fix error i... |
78 79 80 81 82 83 84 85 86 |
} int xfs_wait_on_pages( xfs_inode_t *ip, xfs_off_t first, xfs_off_t last) { struct address_space *mapping = VFS_I(ip)->i_mapping; |
3ae4c9deb xfs: use range pr... |
87 88 89 90 |
if (mapping_tagged(mapping, PAGECACHE_TAG_WRITEBACK)) { return -filemap_fdatawait_range(mapping, first, last == -1 ? ip->i_size - 1 : last); } |
2e6560929 [XFS] fix error i... |
91 |
return 0; |
1da177e4c Linux-2.6.12-rc2 |
92 |
} |