Commit a8b3acd57e3aaaf73a863a28e0e9f6cca37cd8e3
Committed by
Lachlan McIlroy
1 parent
db0bb7baa1
Exists in
master
and in
20 other branches
[XFS] vnode cleanup in xfs_fs_subr.c
Cleanup the unneeded intermediate vnode step in the flushing helpers and go directly from the xfs_inode to the struct address_space. SGI-PV: 976035 SGI-Modid: xfs-linux-melb:xfs-kern:30530a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Showing 1 changed file with 11 additions and 25 deletions Side-by-side Diff
fs/xfs/linux-2.6/xfs_fs_subr.c
... | ... | @@ -17,18 +17,7 @@ |
17 | 17 | */ |
18 | 18 | #include "xfs.h" |
19 | 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 | 20 | #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 | 21 | #include "xfs_inode.h" |
33 | 22 | |
34 | 23 | int fs_noerr(void) { return 0; } |
35 | 24 | |
... | ... | @@ -42,11 +31,10 @@ |
42 | 31 | xfs_off_t last, |
43 | 32 | int fiopt) |
44 | 33 | { |
45 | - bhv_vnode_t *vp = XFS_ITOV(ip); | |
46 | - struct inode *inode = vn_to_inode(vp); | |
34 | + struct address_space *mapping = ip->i_vnode->i_mapping; | |
47 | 35 | |
48 | - if (VN_CACHED(vp)) | |
49 | - truncate_inode_pages(inode->i_mapping, first); | |
36 | + if (mapping->nrpages) | |
37 | + truncate_inode_pages(mapping, first); | |
50 | 38 | } |
51 | 39 | |
52 | 40 | int |
53 | 41 | |
54 | 42 | |
55 | 43 | |
... | ... | @@ -56,15 +44,14 @@ |
56 | 44 | xfs_off_t last, |
57 | 45 | int fiopt) |
58 | 46 | { |
59 | - bhv_vnode_t *vp = XFS_ITOV(ip); | |
60 | - struct inode *inode = vn_to_inode(vp); | |
47 | + struct address_space *mapping = ip->i_vnode->i_mapping; | |
61 | 48 | int ret = 0; |
62 | 49 | |
63 | - if (VN_CACHED(vp)) { | |
50 | + if (mapping->nrpages) { | |
64 | 51 | xfs_iflags_clear(ip, XFS_ITRUNCATED); |
65 | - ret = filemap_write_and_wait(inode->i_mapping); | |
52 | + ret = filemap_write_and_wait(mapping); | |
66 | 53 | if (!ret) |
67 | - truncate_inode_pages(inode->i_mapping, first); | |
54 | + truncate_inode_pages(mapping, first); | |
68 | 55 | } |
69 | 56 | return ret; |
70 | 57 | } |
71 | 58 | |
72 | 59 | |
73 | 60 | |
... | ... | @@ -77,17 +64,16 @@ |
77 | 64 | uint64_t flags, |
78 | 65 | int fiopt) |
79 | 66 | { |
80 | - bhv_vnode_t *vp = XFS_ITOV(ip); | |
81 | - struct inode *inode = vn_to_inode(vp); | |
67 | + struct address_space *mapping = ip->i_vnode->i_mapping; | |
82 | 68 | int ret = 0; |
83 | 69 | int ret2; |
84 | 70 | |
85 | - if (VN_DIRTY(vp)) { | |
71 | + if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY)) { | |
86 | 72 | xfs_iflags_clear(ip, XFS_ITRUNCATED); |
87 | - ret = filemap_fdatawrite(inode->i_mapping); | |
73 | + ret = filemap_fdatawrite(mapping); | |
88 | 74 | if (flags & XFS_B_ASYNC) |
89 | 75 | return ret; |
90 | - ret2 = filemap_fdatawait(inode->i_mapping); | |
76 | + ret2 = filemap_fdatawait(mapping); | |
91 | 77 | if (!ret) |
92 | 78 | ret = ret2; |
93 | 79 | } |