diff options
Diffstat (limited to 'fs/gfs2/meta_io.c')
-rw-r--r-- | fs/gfs2/meta_io.c | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index 3912d6a4b1e6..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 | ||
@@ -472,6 +471,9 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num, | |||
472 | struct buffer_head *bh = NULL, **bh_slot = ip->i_cache + height; | 471 | struct buffer_head *bh = NULL, **bh_slot = ip->i_cache + height; |
473 | int in_cache = 0; | 472 | int in_cache = 0; |
474 | 473 | ||
474 | BUG_ON(!gl); | ||
475 | BUG_ON(!sdp); | ||
476 | |||
475 | spin_lock(&ip->i_spin); | 477 | spin_lock(&ip->i_spin); |
476 | if (*bh_slot && (*bh_slot)->b_blocknr == num) { | 478 | if (*bh_slot && (*bh_slot)->b_blocknr == num) { |
477 | bh = *bh_slot; | 479 | bh = *bh_slot; |
@@ -481,7 +483,7 @@ int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num, | |||
481 | spin_unlock(&ip->i_spin); | 483 | spin_unlock(&ip->i_spin); |
482 | 484 | ||
483 | if (!bh) | 485 | if (!bh) |
484 | bh = getbuf(gl->gl_sbd, gl->gl_aspace, num, CREATE); | 486 | bh = getbuf(gl, num, CREATE); |
485 | 487 | ||
486 | if (!bh) | 488 | if (!bh) |
487 | return -ENOBUFS; | 489 | return -ENOBUFS; |
@@ -532,7 +534,6 @@ err: | |||
532 | 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) |
533 | { | 535 | { |
534 | struct gfs2_sbd *sdp = gl->gl_sbd; | 536 | struct gfs2_sbd *sdp = gl->gl_sbd; |
535 | struct inode *aspace = gl->gl_aspace; | ||
536 | struct buffer_head *first_bh, *bh; | 537 | struct buffer_head *first_bh, *bh; |
537 | u32 max_ra = gfs2_tune_get(sdp, gt_max_readahead) >> | 538 | u32 max_ra = gfs2_tune_get(sdp, gt_max_readahead) >> |
538 | sdp->sd_sb.sb_bsize_shift; | 539 | sdp->sd_sb.sb_bsize_shift; |
@@ -544,7 +545,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) | |||
544 | if (extlen > max_ra) | 545 | if (extlen > max_ra) |
545 | extlen = max_ra; | 546 | extlen = max_ra; |
546 | 547 | ||
547 | first_bh = getbuf(sdp, aspace, dblock, CREATE); | 548 | first_bh = getbuf(gl, dblock, CREATE); |
548 | 549 | ||
549 | if (buffer_uptodate(first_bh)) | 550 | if (buffer_uptodate(first_bh)) |
550 | goto out; | 551 | goto out; |
@@ -555,7 +556,7 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl, u64 dblock, u32 extlen) | |||
555 | extlen--; | 556 | extlen--; |
556 | 557 | ||
557 | while (extlen) { | 558 | while (extlen) { |
558 | bh = getbuf(sdp, aspace, dblock, CREATE); | 559 | bh = getbuf(gl, dblock, CREATE); |
559 | 560 | ||
560 | if (!buffer_uptodate(bh) && !buffer_locked(bh)) | 561 | if (!buffer_uptodate(bh) && !buffer_locked(bh)) |
561 | ll_rw_block(READA, 1, &bh); | 562 | ll_rw_block(READA, 1, &bh); |
@@ -571,20 +572,3 @@ out: | |||
571 | return first_bh; | 572 | return first_bh; |
572 | } | 573 | } |
573 | 574 | ||
574 | /** | ||
575 | * gfs2_meta_syncfs - sync all the buffers in a filesystem | ||
576 | * @sdp: the filesystem | ||
577 | * | ||
578 | */ | ||
579 | |||
580 | void gfs2_meta_syncfs(struct gfs2_sbd *sdp) | ||
581 | { | ||
582 | gfs2_log_flush(sdp, NULL); | ||
583 | for (;;) { | ||
584 | gfs2_ail1_start(sdp, DIO_ALL); | ||
585 | if (gfs2_ail1_empty(sdp, DIO_ALL)) | ||
586 | break; | ||
587 | msleep(10); | ||
588 | } | ||
589 | } | ||
590 | |||