aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2007-12-11 20:16:09 -0500
committerSteven Whitehouse <swhiteho@redhat.com>2008-01-25 03:14:13 -0500
commitb0d5fd307463405fe1f57494fbb37f810715ed6d (patch)
tree2a627d7362a6db7eea4c388b0e0f0ceed8362fb5 /fs
parent398bbe68321947f6763fbc259a01eb548ce19408 (diff)
[GFS2] Only fetch the dinode once in block_map
Function gfs2_block_map was often looking up the disk inode twice. This optimizes it so that only does it once. Signed-off-by: Bob Peterson <rpeterso@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/bmap.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 49486029edc2..224114166529 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -469,6 +469,7 @@ int gfs2_block_map(struct inode *inode, sector_t lblock,
469 unsigned int maxlen = bh_map->b_size >> inode->i_blkbits; 469 unsigned int maxlen = bh_map->b_size >> inode->i_blkbits;
470 struct metapath mp; 470 struct metapath mp;
471 u64 size; 471 u64 size;
472 struct buffer_head *dibh = NULL;
472 473
473 BUG_ON(maxlen == 0); 474 BUG_ON(maxlen == 0);
474 475
@@ -499,6 +500,8 @@ int gfs2_block_map(struct inode *inode, sector_t lblock,
499 error = gfs2_meta_inode_buffer(ip, &bh); 500 error = gfs2_meta_inode_buffer(ip, &bh);
500 if (error) 501 if (error)
501 goto out_fail; 502 goto out_fail;
503 dibh = bh;
504 get_bh(dibh);
502 505
503 for (x = 0; x < end_of_metadata; x++) { 506 for (x = 0; x < end_of_metadata; x++) {
504 lookup_block(ip, bh, x, &mp, create, &new, &dblock); 507 lookup_block(ip, bh, x, &mp, create, &new, &dblock);
@@ -517,13 +520,8 @@ int gfs2_block_map(struct inode *inode, sector_t lblock,
517 if (boundary) 520 if (boundary)
518 set_buffer_boundary(bh_map); 521 set_buffer_boundary(bh_map);
519 if (new) { 522 if (new) {
520 struct buffer_head *dibh; 523 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
521 error = gfs2_meta_inode_buffer(ip, &dibh); 524 gfs2_dinode_out(ip, dibh->b_data);
522 if (!error) {
523 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
524 gfs2_dinode_out(ip, dibh->b_data);
525 brelse(dibh);
526 }
527 set_buffer_new(bh_map); 525 set_buffer_new(bh_map);
528 goto out_brelse; 526 goto out_brelse;
529 } 527 }
@@ -544,6 +542,8 @@ out_brelse:
544out_ok: 542out_ok:
545 error = 0; 543 error = 0;
546out_fail: 544out_fail:
545 if (dibh)
546 brelse(dibh);
547 bmap_unlock(inode, create); 547 bmap_unlock(inode, create);
548 return error; 548 return error;
549} 549}