diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-11-23 11:16:32 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-11-30 10:36:50 -0500 |
commit | cb4c03131836a55bf95e1c165409244ac6b4f39f (patch) | |
tree | de8bfb4042bec1eb700842eb6c793ce7ed4f4ede /fs/gfs2/meta_io.c | |
parent | a25311c8e0b7071b129ca9a9e49e22eeaf620864 (diff) |
[GFS2] Reduce number of arguments to meta_io.c:getbuf()
Since the superblock and the address_space are determined by the
glock, we might as well just pass that as the argument since all
the callers already have that available.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/meta_io.c')
-rw-r--r-- | fs/gfs2/meta_io.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index fbeba813c973..0e34d9918973 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c | |||
@@ -127,17 +127,17 @@ void gfs2_meta_sync(struct gfs2_glock *gl) | |||
127 | 127 | ||
128 | /** | 128 | /** |
129 | * getbuf - Get a buffer with a given address space | 129 | * getbuf - Get a buffer with a given address space |
130 | * @sdp: the filesystem | 130 | * @gl: the glock |
131 | * @aspace: the address space | ||
132 | * @blkno: the block number (filesystem scope) | 131 | * @blkno: the block number (filesystem scope) |
133 | * @create: 1 if the buffer should be created | 132 | * @create: 1 if the buffer should be created |
134 | * | 133 | * |
135 | * Returns: the buffer | 134 | * Returns: the buffer |
136 | */ | 135 | */ |
137 | 136 | ||
138 | static struct buffer_head *getbuf(struct gfs2_sbd *sdp, struct inode *aspace, | 137 | static struct buffer_head *getbuf(struct gfs2_glock *gl, u64 blkno, int create) |
139 | u64 blkno, int create) | ||
140 | { | 138 | { |
139 | struct address_space *mapping = gl->gl_aspace->i_mapping; | ||
140 | struct gfs2_sbd *sdp = gl->gl_sbd; | ||
141 | struct page *page; | 141 | struct page *page; |
142 | struct buffer_head *bh; | 142 | struct buffer_head *bh; |
143 | unsigned int shift; | 143 | unsigned int shift; |
@@ -150,13 +150,13 @@ static struct buffer_head *getbuf(struct gfs2_sbd *sdp, struct inode *aspace, | |||
150 | 150 | ||
151 | if (create) { | 151 | if (create) { |
152 | for (;;) { | 152 | for (;;) { |
153 | page = grab_cache_page(aspace->i_mapping, index); | 153 | page = grab_cache_page(mapping, index); |
154 | if (page) | 154 | if (page) |
155 | break; | 155 | break; |
156 | yield(); | 156 | yield(); |
157 | } | 157 | } |
158 | } else { | 158 | } else { |
159 | page = find_lock_page(aspace->i_mapping, index); | 159 | page = find_lock_page(mapping, index); |
160 | if (!page) | 160 | if (!page) |
161 | return NULL; | 161 | return NULL; |
162 | } | 162 | } |
@@ -202,7 +202,7 @@ static void meta_prep_new(struct buffer_head *bh) | |||
202 | struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno) | 202 | struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno) |
203 | { | 203 | { |
204 | struct buffer_head *bh; | 204 | struct buffer_head *bh; |
205 | bh = getbuf(gl->gl_sbd, gl->gl_aspace, blkno, CREATE); | 205 | bh = getbuf(gl, blkno, CREATE); |
206 | meta_prep_new(bh); | 206 | meta_prep_new(bh); |
207 | return bh; | 207 | return bh; |
208 | } | 208 | } |
@@ -220,7 +220,7 @@ struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno) | |||
220 | int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, | 220 | int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, |
221 | struct buffer_head **bhp) | 221 | struct buffer_head **bhp) |
222 | { | 222 | { |
223 | *bhp = getbuf(gl->gl_sbd, gl->gl_aspace, blkno, CREATE); | 223 | *bhp = getbuf(gl, blkno, CREATE); |
224 | if (!buffer_uptodate(*bhp)) | 224 | if (!buffer_uptodate(*bhp)) |
225 | ll_rw_block(READ_META, 1, bhp); | 225 | ll_rw_block(READ_META, 1, bhp); |
226 | if (flags & DIO_WAIT) { | 226 | if (flags & DIO_WAIT) { |
@@ -379,11 +379,10 @@ void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh, | |||
379 | void gfs2_meta_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen) | 379 | void gfs2_meta_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen) |
380 | { | 380 | { |
381 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); | 381 | struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); |
382 | struct inode *aspace = ip->i_gl->gl_aspace; | ||
383 | struct buffer_head *bh; | 382 | struct buffer_head *bh; |
384 | 383 | ||
385 | while (blen) { | 384 | while (blen) { |
386 | bh = getbuf(sdp, aspace, bstart, NO_CREATE); | 385 | bh = getbuf(ip->i_gl, bstart, NO_CREATE); |
387 | if (bh) { | 386 | if (bh) { |
388 | struct gfs2_bufdata *bd = bh->b_private; | 387 | struct gfs2_bufdata *bd = bh->b_private; |
389 | 388 | ||
@@ -484,7 +483,7 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num, | |||
484 | spin_unlock(&ip->i_spin); | 483 | spin_unlock(&ip->i_spin); |
485 | 484 | ||
486 | if (!bh) | 485 | if (!bh) |
487 | bh = getbuf(gl->gl_sbd, gl->gl_aspace, num, CREATE); | 486 | bh = getbuf(gl, num, CREATE); |
488 | 487 | ||
489 | if (!bh) | 488 | if (!bh) |
490 | return -ENOBUFS; | 489 | return -ENOBUFS; |
@@ -535,7 +534,6 @@ err: | |||
535 | struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) | 534 | struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) |
536 | { | 535 | { |
537 | struct gfs2_sbd *sdp = gl->gl_sbd; | 536 | struct gfs2_sbd *sdp = gl->gl_sbd; |
538 | struct inode *aspace = gl->gl_aspace; | ||
539 | struct buffer_head *first_bh, *bh; | 537 | struct buffer_head *first_bh, *bh; |
540 | u32 max_ra = gfs2_tune_get(sdp, gt_max_readahead) >> | 538 | u32 max_ra = gfs2_tune_get(sdp, gt_max_readahead) >> |
541 | sdp->sd_sb.sb_bsize_shift; | 539 | sdp->sd_sb.sb_bsize_shift; |
@@ -547,7 +545,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) | |||
547 | if (extlen > max_ra) | 545 | if (extlen > max_ra) |
548 | extlen = max_ra; | 546 | extlen = max_ra; |
549 | 547 | ||
550 | first_bh = getbuf(sdp, aspace, dblock, CREATE); | 548 | first_bh = getbuf(gl, dblock, CREATE); |
551 | 549 | ||
552 | if (buffer_uptodate(first_bh)) | 550 | if (buffer_uptodate(first_bh)) |
553 | goto out; | 551 | goto out; |
@@ -558,7 +556,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) | |||
558 | extlen--; | 556 | extlen--; |
559 | 557 | ||
560 | while (extlen) { | 558 | while (extlen) { |
561 | bh = getbuf(sdp, aspace, dblock, CREATE); | 559 | bh = getbuf(gl, dblock, CREATE); |
562 | 560 | ||
563 | if (!buffer_uptodate(bh) && !buffer_locked(bh)) | 561 | if (!buffer_uptodate(bh) && !buffer_locked(bh)) |
564 | ll_rw_block(READA, 1, &bh); | 562 | ll_rw_block(READA, 1, &bh); |