diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2011-09-21 06:05:16 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2011-10-21 07:39:54 -0400 |
commit | b99b98dc2673a123a73068f16720232d7be7e669 (patch) | |
tree | a191b03e9c054c62777d1b3ab3cae55cbd6e5e01 /fs/gfs2/bmap.c | |
parent | 9ae32429fe036fcfce036ec57b28fc59f3911976 (diff) |
GFS2: Move readahead of metadata during deallocation into its own function
Move the recently added readahead of the indirect pointer
tree during deallocation into its own function in order
that we can use it elsewhere in the future. Also this
fixes the resetting of the "first" variable in the
original patch.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/bmap.c')
-rw-r--r-- | fs/gfs2/bmap.c | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 97b61955850a..41d494d79709 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -269,6 +269,30 @@ static inline __be64 *metapointer(unsigned int height, const struct metapath *mp | |||
269 | return ((__be64 *)(bh->b_data + head_size)) + mp->mp_list[height]; | 269 | return ((__be64 *)(bh->b_data + head_size)) + mp->mp_list[height]; |
270 | } | 270 | } |
271 | 271 | ||
272 | static void gfs2_metapath_ra(struct gfs2_glock *gl, | ||
273 | const struct buffer_head *bh, const __be64 *pos) | ||
274 | { | ||
275 | struct buffer_head *rabh; | ||
276 | const __be64 *endp = (const __be64 *)(bh->b_data + bh->b_size); | ||
277 | const __be64 *t; | ||
278 | |||
279 | for (t = pos; t < endp; t++) { | ||
280 | if (!*t) | ||
281 | continue; | ||
282 | |||
283 | rabh = gfs2_getbuf(gl, be64_to_cpu(*t), CREATE); | ||
284 | if (trylock_buffer(rabh)) { | ||
285 | if (!buffer_uptodate(rabh)) { | ||
286 | rabh->b_end_io = end_buffer_read_sync; | ||
287 | submit_bh(READA | REQ_META, rabh); | ||
288 | continue; | ||
289 | } | ||
290 | unlock_buffer(rabh); | ||
291 | } | ||
292 | brelse(rabh); | ||
293 | } | ||
294 | } | ||
295 | |||
272 | /** | 296 | /** |
273 | * lookup_metapath - Walk the metadata tree to a specific point | 297 | * lookup_metapath - Walk the metadata tree to a specific point |
274 | * @ip: The inode | 298 | * @ip: The inode |
@@ -843,7 +867,7 @@ static int recursive_scan(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
843 | { | 867 | { |
844 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 868 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
845 | struct buffer_head *bh = NULL; | 869 | struct buffer_head *bh = NULL; |
846 | __be64 *top, *bottom, *t2; | 870 | __be64 *top, *bottom; |
847 | u64 bn; | 871 | u64 bn; |
848 | int error; | 872 | int error; |
849 | int mh_size = sizeof(struct gfs2_meta_header); | 873 | int mh_size = sizeof(struct gfs2_meta_header); |
@@ -872,26 +896,9 @@ static int recursive_scan(struct gfs2_inode *ip, struct buffer_head *dibh, | |||
872 | goto out; | 896 | goto out; |
873 | 897 | ||
874 | if (height < ip->i_height - 1) { | 898 | if (height < ip->i_height - 1) { |
875 | struct buffer_head *rabh; | ||
876 | 899 | ||
877 | for (t2 = top; t2 < bottom; t2++, first = 0) { | 900 | gfs2_metapath_ra(ip->i_gl, bh, top); |
878 | if (!*t2) | ||
879 | continue; | ||
880 | 901 | ||
881 | bn = be64_to_cpu(*t2); | ||
882 | rabh = gfs2_getbuf(ip->i_gl, bn, CREATE); | ||
883 | if (trylock_buffer(rabh)) { | ||
884 | if (buffer_uptodate(rabh)) { | ||
885 | unlock_buffer(rabh); | ||
886 | brelse(rabh); | ||
887 | continue; | ||
888 | } | ||
889 | rabh->b_end_io = end_buffer_read_sync; | ||
890 | submit_bh(READA | REQ_META, rabh); | ||
891 | continue; | ||
892 | } | ||
893 | brelse(rabh); | ||
894 | } | ||
895 | for (; top < bottom; top++, first = 0) { | 902 | for (; top < bottom; top++, first = 0) { |
896 | if (!*top) | 903 | if (!*top) |
897 | continue; | 904 | continue; |