diff options
author | Dave Chinner <dchinner@redhat.com> | 2012-11-12 06:54:18 -0500 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-11-15 22:34:57 -0500 |
commit | da6958c873ecd846d71fafbfe0f6168bb9c2c99e (patch) | |
tree | 638e8ec75ef0592dd896f74e2b2215af3021bf0a /fs | |
parent | d9392a4bb75503fc2adbb5237c3df940c6467eb2 (diff) |
xfs: Add verifiers to dir2 data readahead.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Phil White <pwhite@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_da_btree.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_da_btree.h | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_data.c | 13 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.c | 11 | ||||
-rw-r--r-- | fs/xfs/xfs_dir2_priv.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_file.c | 4 |
6 files changed, 26 insertions, 12 deletions
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c index 1b84fc50a053..93ebc0fc6dd9 100644 --- a/fs/xfs/xfs_da_btree.c +++ b/fs/xfs/xfs_da_btree.c | |||
@@ -2285,10 +2285,10 @@ xfs_da_reada_buf( | |||
2285 | struct xfs_trans *trans, | 2285 | struct xfs_trans *trans, |
2286 | struct xfs_inode *dp, | 2286 | struct xfs_inode *dp, |
2287 | xfs_dablk_t bno, | 2287 | xfs_dablk_t bno, |
2288 | xfs_daddr_t mappedbno, | ||
2288 | int whichfork, | 2289 | int whichfork, |
2289 | xfs_buf_iodone_t verifier) | 2290 | xfs_buf_iodone_t verifier) |
2290 | { | 2291 | { |
2291 | xfs_daddr_t mappedbno = -1; | ||
2292 | struct xfs_buf_map map; | 2292 | struct xfs_buf_map map; |
2293 | struct xfs_buf_map *mapp; | 2293 | struct xfs_buf_map *mapp; |
2294 | int nmap; | 2294 | int nmap; |
@@ -2296,7 +2296,7 @@ xfs_da_reada_buf( | |||
2296 | 2296 | ||
2297 | mapp = ↦ | 2297 | mapp = ↦ |
2298 | nmap = 1; | 2298 | nmap = 1; |
2299 | error = xfs_dabuf_map(trans, dp, bno, -1, whichfork, | 2299 | error = xfs_dabuf_map(trans, dp, bno, mappedbno, whichfork, |
2300 | &mapp, &nmap); | 2300 | &mapp, &nmap); |
2301 | if (error) { | 2301 | if (error) { |
2302 | /* mapping a hole is not an error, but we don't continue */ | 2302 | /* mapping a hole is not an error, but we don't continue */ |
diff --git a/fs/xfs/xfs_da_btree.h b/fs/xfs/xfs_da_btree.h index 2d1bec4b7595..521b008445ab 100644 --- a/fs/xfs/xfs_da_btree.h +++ b/fs/xfs/xfs_da_btree.h | |||
@@ -231,8 +231,8 @@ int xfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp, | |||
231 | struct xfs_buf **bpp, int whichfork, | 231 | struct xfs_buf **bpp, int whichfork, |
232 | xfs_buf_iodone_t verifier); | 232 | xfs_buf_iodone_t verifier); |
233 | xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *dp, | 233 | xfs_daddr_t xfs_da_reada_buf(struct xfs_trans *trans, struct xfs_inode *dp, |
234 | xfs_dablk_t bno, int whichfork, | 234 | xfs_dablk_t bno, xfs_daddr_t mapped_bno, |
235 | xfs_buf_iodone_t verifier); | 235 | int whichfork, xfs_buf_iodone_t verifier); |
236 | int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno, | 236 | int xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno, |
237 | struct xfs_buf *dead_buf); | 237 | struct xfs_buf *dead_buf); |
238 | 238 | ||
diff --git a/fs/xfs/xfs_dir2_data.c b/fs/xfs/xfs_dir2_data.c index 0ef04f1bf511..1a43c8593c00 100644 --- a/fs/xfs/xfs_dir2_data.c +++ b/fs/xfs/xfs_dir2_data.c | |||
@@ -185,7 +185,7 @@ __xfs_dir2_data_check( | |||
185 | return 0; | 185 | return 0; |
186 | } | 186 | } |
187 | 187 | ||
188 | static void | 188 | void |
189 | xfs_dir2_data_verify( | 189 | xfs_dir2_data_verify( |
190 | struct xfs_buf *bp) | 190 | struct xfs_buf *bp) |
191 | { | 191 | { |
@@ -217,6 +217,17 @@ xfs_dir2_data_read( | |||
217 | XFS_DATA_FORK, xfs_dir2_data_verify); | 217 | XFS_DATA_FORK, xfs_dir2_data_verify); |
218 | } | 218 | } |
219 | 219 | ||
220 | int | ||
221 | xfs_dir2_data_readahead( | ||
222 | struct xfs_trans *tp, | ||
223 | struct xfs_inode *dp, | ||
224 | xfs_dablk_t bno, | ||
225 | xfs_daddr_t mapped_bno) | ||
226 | { | ||
227 | return xfs_da_reada_buf(tp, dp, bno, mapped_bno, | ||
228 | XFS_DATA_FORK, xfs_dir2_data_verify); | ||
229 | } | ||
230 | |||
220 | /* | 231 | /* |
221 | * Given a data block and an unused entry from that block, | 232 | * Given a data block and an unused entry from that block, |
222 | * return the bestfree entry if any that corresponds to it. | 233 | * return the bestfree entry if any that corresponds to it. |
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index 67cc21c2a45d..8a95547d42ac 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c | |||
@@ -972,11 +972,11 @@ xfs_dir2_leaf_readbuf( | |||
972 | */ | 972 | */ |
973 | if (i > mip->ra_current && | 973 | if (i > mip->ra_current && |
974 | map[mip->ra_index].br_blockcount >= mp->m_dirblkfsbs) { | 974 | map[mip->ra_index].br_blockcount >= mp->m_dirblkfsbs) { |
975 | xfs_buf_readahead(mp->m_ddev_targp, | 975 | xfs_dir2_data_readahead(NULL, dp, |
976 | map[mip->ra_index].br_startoff + mip->ra_offset, | ||
976 | XFS_FSB_TO_DADDR(mp, | 977 | XFS_FSB_TO_DADDR(mp, |
977 | map[mip->ra_index].br_startblock + | 978 | map[mip->ra_index].br_startblock + |
978 | mip->ra_offset), | 979 | mip->ra_offset)); |
979 | (int)BTOBB(mp->m_dirblksize), NULL); | ||
980 | mip->ra_current = i; | 980 | mip->ra_current = i; |
981 | } | 981 | } |
982 | 982 | ||
@@ -985,10 +985,9 @@ xfs_dir2_leaf_readbuf( | |||
985 | * use our mapping, but this is a very rare case. | 985 | * use our mapping, but this is a very rare case. |
986 | */ | 986 | */ |
987 | else if (i > mip->ra_current) { | 987 | else if (i > mip->ra_current) { |
988 | xfs_da_reada_buf(NULL, dp, | 988 | xfs_dir2_data_readahead(NULL, dp, |
989 | map[mip->ra_index].br_startoff + | 989 | map[mip->ra_index].br_startoff + |
990 | mip->ra_offset, | 990 | mip->ra_offset, -1); |
991 | XFS_DATA_FORK, NULL); | ||
992 | mip->ra_current = i; | 991 | mip->ra_current = i; |
993 | } | 992 | } |
994 | 993 | ||
diff --git a/fs/xfs/xfs_dir2_priv.h b/fs/xfs/xfs_dir2_priv.h index e0b96e7693ea..daf5d0fc6165 100644 --- a/fs/xfs/xfs_dir2_priv.h +++ b/fs/xfs/xfs_dir2_priv.h | |||
@@ -48,6 +48,8 @@ extern int xfs_dir2_leaf_to_block(struct xfs_da_args *args, | |||
48 | extern int __xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_buf *bp); | 48 | extern int __xfs_dir2_data_check(struct xfs_inode *dp, struct xfs_buf *bp); |
49 | extern int xfs_dir2_data_read(struct xfs_trans *tp, struct xfs_inode *dp, | 49 | extern int xfs_dir2_data_read(struct xfs_trans *tp, struct xfs_inode *dp, |
50 | xfs_dablk_t bno, xfs_daddr_t mapped_bno, struct xfs_buf **bpp); | 50 | xfs_dablk_t bno, xfs_daddr_t mapped_bno, struct xfs_buf **bpp); |
51 | extern int xfs_dir2_data_readahead(struct xfs_trans *tp, struct xfs_inode *dp, | ||
52 | xfs_dablk_t bno, xfs_daddr_t mapped_bno); | ||
51 | 53 | ||
52 | extern struct xfs_dir2_data_free * | 54 | extern struct xfs_dir2_data_free * |
53 | xfs_dir2_data_freeinsert(struct xfs_dir2_data_hdr *hdr, | 55 | xfs_dir2_data_freeinsert(struct xfs_dir2_data_hdr *hdr, |
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index f6dab7da7bcc..400b187595bb 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include "xfs_error.h" | 31 | #include "xfs_error.h" |
32 | #include "xfs_vnodeops.h" | 32 | #include "xfs_vnodeops.h" |
33 | #include "xfs_da_btree.h" | 33 | #include "xfs_da_btree.h" |
34 | #include "xfs_dir2_format.h" | ||
35 | #include "xfs_dir2_priv.h" | ||
34 | #include "xfs_ioctl.h" | 36 | #include "xfs_ioctl.h" |
35 | #include "xfs_trace.h" | 37 | #include "xfs_trace.h" |
36 | 38 | ||
@@ -891,7 +893,7 @@ xfs_dir_open( | |||
891 | */ | 893 | */ |
892 | mode = xfs_ilock_map_shared(ip); | 894 | mode = xfs_ilock_map_shared(ip); |
893 | if (ip->i_d.di_nextents > 0) | 895 | if (ip->i_d.di_nextents > 0) |
894 | xfs_da_reada_buf(NULL, ip, 0, XFS_DATA_FORK, NULL); | 896 | xfs_dir2_data_readahead(NULL, ip, 0, -1); |
895 | xfs_iunlock(ip, mode); | 897 | xfs_iunlock(ip, mode); |
896 | return 0; | 898 | return 0; |
897 | } | 899 | } |