Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=3cb07500ec76da... Commit: 3cb07500ec76da42ff56fbbb01eca50e5358c10e Parent: 6f85923316e5b1504a231cd7c8bde5bb6a059506 Author: Bob Peterson rpeterso@redhat.com AuthorDate: Thu Feb 21 09:33:24 2013 -0700 Committer: Bob Peterson rpeterso@redhat.com CommitterDate: Fri May 17 14:30:57 2013 -0500
libgfs2: allow dir_split_leaf to receive a leaf buffer
This is a small performance improvement. Rather than having function dir_split_leaf read in the leaf to be split, this patch lets the buffer_head to be passed in from the calling function, which has it read in anyway.
rhbz#902920 --- gfs2/libgfs2/fs_ops.c | 9 ++++----- gfs2/libgfs2/libgfs2.h | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c index 5417efb..f88c48f 100644 --- a/gfs2/libgfs2/fs_ops.c +++ b/gfs2/libgfs2/fs_ops.c @@ -865,9 +865,10 @@ void gfs2_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out) die("gfs2_put_leaf_nr: Bad internal write.\n"); }
-void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex, uint64_t leaf_no) +void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex, uint64_t leaf_no, + struct gfs2_buffer_head *obh) { - struct gfs2_buffer_head *nbh, *obh; + struct gfs2_buffer_head *nbh; struct gfs2_leaf *nleaf, *oleaf; struct gfs2_dirent *dent, *prev = NULL, *next = NULL, *new; uint32_t start, len, half_len, divider; @@ -891,7 +892,6 @@ void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex, uint64_t leaf_no) nleaf = (struct gfs2_leaf *)nbh->b_data; nleaf->lf_dirent_format = cpu_to_be32(GFS2_FORMAT_DE);
- obh = bread(dip->i_sbd, leaf_no); oleaf = (struct gfs2_leaf *)obh->b_data;
len = 1 << (dip->i_di.di_depth - be16_to_cpu(oleaf->lf_depth)); @@ -970,7 +970,6 @@ void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex, uint64_t leaf_no) bmodified(dip->i_bh);
bmodified(obh); /* Need to do this in case nothing was moved */ - brelse(obh); bmodified(nbh); brelse(nbh); } @@ -1114,8 +1113,8 @@ restart: if (dirent_alloc(dip, bh, len, &dent)) {
if (be16_to_cpu(leaf->lf_depth) < dip->i_di.di_depth) { + dir_split_leaf(dip, lindex, leaf_no, bh); brelse(bh); - dir_split_leaf(dip, lindex, leaf_no); goto restart;
} else if (dip->i_di.di_depth < GFS2_DIR_MAX_DEPTH) { diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h index 9e3de8a..8354a14 100644 --- a/gfs2/libgfs2/libgfs2.h +++ b/gfs2/libgfs2/libgfs2.h @@ -401,7 +401,7 @@ extern void gfs2_get_leaf_nr(struct gfs2_inode *dip, uint32_t index, uint64_t *leaf_out); extern void gfs2_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out); extern void dir_split_leaf(struct gfs2_inode *dip, uint32_t lindex, - uint64_t leaf_no); + uint64_t leaf_no, struct gfs2_buffer_head *obh); extern void gfs2_free_block(struct gfs2_sbd *sdp, uint64_t block); extern int gfs2_freedi(struct gfs2_sbd *sdp, uint64_t block); extern int gfs2_get_leaf(struct gfs2_inode *dip, uint64_t leaf_no,
cluster-commits@lists.stg.fedorahosted.org