diff options
author | Christoph Hellwig <hch@infradead.org> | 2007-08-28 02:12:30 -0400 |
---|---|---|
committer | Tim Shimmin <tes@chook.melbourne.sgi.com> | 2007-10-15 02:54:29 -0400 |
commit | 993386c19afa53fa54d00c7721e56ba820b3400d (patch) | |
tree | 1715fdeb9cc5ea99466e179b54e84b168fd5e127 /fs/xfs/linux-2.6/xfs_fs_subr.c | |
parent | b93bd20cd59eb7ec172f95d08b100fea688d8bcf (diff) |
[XFS] decontaminate vnode operations from behavior details
All vnode ops now take struct xfs_inode pointers and the behaviour related
glue is split out into methods of it's own. This required fixing
xfs_create/mkdir/symlink to not mess with the inode pointer but rather use
a separate boolean for error handling. Thanks to Dave Chinner for that
fix.
SGI-PV: 969608
SGI-Modid: xfs-linux-melb:xfs-kern:29492a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_fs_subr.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_fs_subr.c | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/fs/xfs/linux-2.6/xfs_fs_subr.c b/fs/xfs/linux-2.6/xfs_fs_subr.c index 2eb87cd082af..e2897912fec7 100644 --- a/fs/xfs/linux-2.6/xfs_fs_subr.c +++ b/fs/xfs/linux-2.6/xfs_fs_subr.c | |||
@@ -16,66 +16,80 @@ | |||
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ | 17 | */ |
18 | #include "xfs.h" | 18 | #include "xfs.h" |
19 | #include "xfs_vnodeops.h" | ||
20 | |||
21 | /* | ||
22 | * The following six includes are needed so that we can include | ||
23 | * xfs_inode.h. What a mess.. | ||
24 | */ | ||
25 | #include "xfs_bmap_btree.h" | ||
26 | #include "xfs_inum.h" | ||
27 | #include "xfs_dir2.h" | ||
28 | #include "xfs_dir2_sf.h" | ||
29 | #include "xfs_attr_sf.h" | ||
30 | #include "xfs_dinode.h" | ||
31 | |||
32 | #include "xfs_inode.h" | ||
19 | 33 | ||
20 | int fs_noerr(void) { return 0; } | 34 | int fs_noerr(void) { return 0; } |
21 | int fs_nosys(void) { return ENOSYS; } | 35 | int fs_nosys(void) { return ENOSYS; } |
22 | void fs_noval(void) { return; } | 36 | void fs_noval(void) { return; } |
23 | 37 | ||
24 | void | 38 | void |
25 | fs_tosspages( | 39 | xfs_tosspages( |
26 | bhv_desc_t *bdp, | 40 | xfs_inode_t *ip, |
27 | xfs_off_t first, | 41 | xfs_off_t first, |
28 | xfs_off_t last, | 42 | xfs_off_t last, |
29 | int fiopt) | 43 | int fiopt) |
30 | { | 44 | { |
31 | bhv_vnode_t *vp = BHV_TO_VNODE(bdp); | 45 | bhv_vnode_t *vp = XFS_ITOV(ip); |
32 | struct inode *ip = vn_to_inode(vp); | 46 | struct inode *inode = vn_to_inode(vp); |
33 | 47 | ||
34 | if (VN_CACHED(vp)) | 48 | if (VN_CACHED(vp)) |
35 | truncate_inode_pages(ip->i_mapping, first); | 49 | truncate_inode_pages(inode->i_mapping, first); |
36 | } | 50 | } |
37 | 51 | ||
38 | int | 52 | int |
39 | fs_flushinval_pages( | 53 | xfs_flushinval_pages( |
40 | bhv_desc_t *bdp, | 54 | xfs_inode_t *ip, |
41 | xfs_off_t first, | 55 | xfs_off_t first, |
42 | xfs_off_t last, | 56 | xfs_off_t last, |
43 | int fiopt) | 57 | int fiopt) |
44 | { | 58 | { |
45 | bhv_vnode_t *vp = BHV_TO_VNODE(bdp); | 59 | bhv_vnode_t *vp = XFS_ITOV(ip); |
46 | struct inode *ip = vn_to_inode(vp); | 60 | struct inode *inode = vn_to_inode(vp); |
47 | int ret = 0; | 61 | int ret = 0; |
48 | 62 | ||
49 | if (VN_CACHED(vp)) { | 63 | if (VN_CACHED(vp)) { |
50 | if (VN_TRUNC(vp)) | 64 | if (VN_TRUNC(vp)) |
51 | VUNTRUNCATE(vp); | 65 | VUNTRUNCATE(vp); |
52 | ret = filemap_write_and_wait(ip->i_mapping); | 66 | ret = filemap_write_and_wait(inode->i_mapping); |
53 | if (!ret) | 67 | if (!ret) |
54 | truncate_inode_pages(ip->i_mapping, first); | 68 | truncate_inode_pages(inode->i_mapping, first); |
55 | } | 69 | } |
56 | return ret; | 70 | return ret; |
57 | } | 71 | } |
58 | 72 | ||
59 | int | 73 | int |
60 | fs_flush_pages( | 74 | xfs_flush_pages( |
61 | bhv_desc_t *bdp, | 75 | xfs_inode_t *ip, |
62 | xfs_off_t first, | 76 | xfs_off_t first, |
63 | xfs_off_t last, | 77 | xfs_off_t last, |
64 | uint64_t flags, | 78 | uint64_t flags, |
65 | int fiopt) | 79 | int fiopt) |
66 | { | 80 | { |
67 | bhv_vnode_t *vp = BHV_TO_VNODE(bdp); | 81 | bhv_vnode_t *vp = XFS_ITOV(ip); |
68 | struct inode *ip = vn_to_inode(vp); | 82 | struct inode *inode = vn_to_inode(vp); |
69 | int ret = 0; | 83 | int ret = 0; |
70 | int ret2; | 84 | int ret2; |
71 | 85 | ||
72 | if (VN_DIRTY(vp)) { | 86 | if (VN_DIRTY(vp)) { |
73 | if (VN_TRUNC(vp)) | 87 | if (VN_TRUNC(vp)) |
74 | VUNTRUNCATE(vp); | 88 | VUNTRUNCATE(vp); |
75 | ret = filemap_fdatawrite(ip->i_mapping); | 89 | ret = filemap_fdatawrite(inode->i_mapping); |
76 | if (flags & XFS_B_ASYNC) | 90 | if (flags & XFS_B_ASYNC) |
77 | return ret; | 91 | return ret; |
78 | ret2 = filemap_fdatawait(ip->i_mapping); | 92 | ret2 = filemap_fdatawait(inode->i_mapping); |
79 | if (!ret) | 93 | if (!ret) |
80 | ret = ret2; | 94 | ret = ret2; |
81 | } | 95 | } |