提交 cb4c0313 编写于 作者: S Steven Whitehouse

[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: NSteven Whitehouse <swhiteho@redhat.com>
上级 a25311c8
...@@ -127,17 +127,17 @@ void gfs2_meta_sync(struct gfs2_glock *gl) ...@@ -127,17 +127,17 @@ void gfs2_meta_sync(struct gfs2_glock *gl)
/** /**
* getbuf - Get a buffer with a given address space * getbuf - Get a buffer with a given address space
* @sdp: the filesystem * @gl: the glock
* @aspace: the address space
* @blkno: the block number (filesystem scope) * @blkno: the block number (filesystem scope)
* @create: 1 if the buffer should be created * @create: 1 if the buffer should be created
* *
* Returns: the buffer * Returns: the buffer
*/ */
static struct buffer_head *getbuf(struct gfs2_sbd *sdp, struct inode *aspace, static struct buffer_head *getbuf(struct gfs2_glock *gl, u64 blkno, int create)
u64 blkno, int create)
{ {
struct address_space *mapping = gl->gl_aspace->i_mapping;
struct gfs2_sbd *sdp = gl->gl_sbd;
struct page *page; struct page *page;
struct buffer_head *bh; struct buffer_head *bh;
unsigned int shift; unsigned int shift;
...@@ -150,13 +150,13 @@ static struct buffer_head *getbuf(struct gfs2_sbd *sdp, struct inode *aspace, ...@@ -150,13 +150,13 @@ static struct buffer_head *getbuf(struct gfs2_sbd *sdp, struct inode *aspace,
if (create) { if (create) {
for (;;) { for (;;) {
page = grab_cache_page(aspace->i_mapping, index); page = grab_cache_page(mapping, index);
if (page) if (page)
break; break;
yield(); yield();
} }
} else { } else {
page = find_lock_page(aspace->i_mapping, index); page = find_lock_page(mapping, index);
if (!page) if (!page)
return NULL; return NULL;
} }
...@@ -202,7 +202,7 @@ static void meta_prep_new(struct buffer_head *bh) ...@@ -202,7 +202,7 @@ static void meta_prep_new(struct buffer_head *bh)
struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno) struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno)
{ {
struct buffer_head *bh; struct buffer_head *bh;
bh = getbuf(gl->gl_sbd, gl->gl_aspace, blkno, CREATE); bh = getbuf(gl, blkno, CREATE);
meta_prep_new(bh); meta_prep_new(bh);
return bh; return bh;
} }
...@@ -220,7 +220,7 @@ struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno) ...@@ -220,7 +220,7 @@ struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl, u64 blkno)
int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags, int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
struct buffer_head **bhp) struct buffer_head **bhp)
{ {
*bhp = getbuf(gl->gl_sbd, gl->gl_aspace, blkno, CREATE); *bhp = getbuf(gl, blkno, CREATE);
if (!buffer_uptodate(*bhp)) if (!buffer_uptodate(*bhp))
ll_rw_block(READ_META, 1, bhp); ll_rw_block(READ_META, 1, bhp);
if (flags & DIO_WAIT) { if (flags & DIO_WAIT) {
...@@ -379,11 +379,10 @@ void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh, ...@@ -379,11 +379,10 @@ void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh,
void gfs2_meta_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen) void gfs2_meta_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen)
{ {
struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
struct inode *aspace = ip->i_gl->gl_aspace;
struct buffer_head *bh; struct buffer_head *bh;
while (blen) { while (blen) {
bh = getbuf(sdp, aspace, bstart, NO_CREATE); bh = getbuf(ip->i_gl, bstart, NO_CREATE);
if (bh) { if (bh) {
struct gfs2_bufdata *bd = bh->b_private; struct gfs2_bufdata *bd = bh->b_private;
...@@ -484,7 +483,7 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num, ...@@ -484,7 +483,7 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num,
spin_unlock(&ip->i_spin); spin_unlock(&ip->i_spin);
if (!bh) if (!bh)
bh = getbuf(gl->gl_sbd, gl->gl_aspace, num, CREATE); bh = getbuf(gl, num, CREATE);
if (!bh) if (!bh)
return -ENOBUFS; return -ENOBUFS;
...@@ -535,7 +534,6 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num, ...@@ -535,7 +534,6 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num,
struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen)
{ {
struct gfs2_sbd *sdp = gl->gl_sbd; struct gfs2_sbd *sdp = gl->gl_sbd;
struct inode *aspace = gl->gl_aspace;
struct buffer_head *first_bh, *bh; struct buffer_head *first_bh, *bh;
u32 max_ra = gfs2_tune_get(sdp, gt_max_readahead) >> u32 max_ra = gfs2_tune_get(sdp, gt_max_readahead) >>
sdp->sd_sb.sb_bsize_shift; 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,7 +545,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen)
if (extlen > max_ra) if (extlen > max_ra)
extlen = max_ra; extlen = max_ra;
first_bh = getbuf(sdp, aspace, dblock, CREATE); first_bh = getbuf(gl, dblock, CREATE);
if (buffer_uptodate(first_bh)) if (buffer_uptodate(first_bh))
goto out; goto out;
...@@ -558,7 +556,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) ...@@ -558,7 +556,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen)
extlen--; extlen--;
while (extlen) { while (extlen) {
bh = getbuf(sdp, aspace, dblock, CREATE); bh = getbuf(gl, dblock, CREATE);
if (!buffer_uptodate(bh) && !buffer_locked(bh)) if (!buffer_uptodate(bh) && !buffer_locked(bh))
ll_rw_block(READA, 1, &bh); ll_rw_block(READA, 1, &bh);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册