* [Cluster-devel] [GFS2 PATCH] GFS2: Use gfs2_rbm_incr in rgblk_free
[not found] <506776947.2903645.1412339823543.JavaMail.zimbra@redhat.com>
@ 2014-10-03 12:38 ` Bob Peterson
2014-10-03 14:23 ` Steven Whitehouse
0 siblings, 1 reply; 2+ messages in thread
From: Bob Peterson @ 2014-10-03 12:38 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
This patch speeds up GFS2 unlink operations by using function
gfs2_rbm_incr rather than continuously calculating the rbm.
Regards,
Bob Peterson
Red Hat File Systems
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 55ef72d..7474c41 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -2097,7 +2097,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart,
u32 blen, unsigned char new_state)
{
struct gfs2_rbm rbm;
- struct gfs2_bitmap *bi;
+ struct gfs2_bitmap *bi, *bi_prev = NULL;
rbm.rgd = gfs2_blk2rgrpd(sdp, bstart, 1);
if (!rbm.rgd) {
@@ -2106,18 +2106,22 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart,
return NULL;
}
+ gfs2_rbm_from_block(&rbm, bstart);
while (blen--) {
- gfs2_rbm_from_block(&rbm, bstart);
bi = rbm_bi(&rbm);
- bstart++;
- if (!bi->bi_clone) {
- bi->bi_clone = kmalloc(bi->bi_bh->b_size,
- GFP_NOFS | __GFP_NOFAIL);
- memcpy(bi->bi_clone + bi->bi_offset,
- bi->bi_bh->b_data + bi->bi_offset, bi->bi_len);
+ if (bi != bi_prev) {
+ if (!bi->bi_clone) {
+ bi->bi_clone = kmalloc(bi->bi_bh->b_size,
+ GFP_NOFS | __GFP_NOFAIL);
+ memcpy(bi->bi_clone + bi->bi_offset,
+ bi->bi_bh->b_data + bi->bi_offset,
+ bi->bi_len);
+ }
+ gfs2_trans_add_meta(rbm.rgd->rd_gl, bi->bi_bh);
+ bi_prev = bi;
}
- gfs2_trans_add_meta(rbm.rgd->rd_gl, bi->bi_bh);
gfs2_setbit(&rbm, false, new_state);
+ gfs2_rbm_incr(&rbm);
}
return rbm.rgd;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Cluster-devel] [GFS2 PATCH] GFS2: Use gfs2_rbm_incr in rgblk_free
2014-10-03 12:38 ` [Cluster-devel] [GFS2 PATCH] GFS2: Use gfs2_rbm_incr in rgblk_free Bob Peterson
@ 2014-10-03 14:23 ` Steven Whitehouse
0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2014-10-03 14:23 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
Looks like a really nice optimisation. Now in the -nmw tree. Thanks,
Steve.
On 03/10/14 13:38, Bob Peterson wrote:
> Hi,
>
> This patch speeds up GFS2 unlink operations by using function
> gfs2_rbm_incr rather than continuously calculating the rbm.
>
> Regards,
>
> Bob Peterson
> Red Hat File Systems
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
> ---
> diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
> index 55ef72d..7474c41 100644
> --- a/fs/gfs2/rgrp.c
> +++ b/fs/gfs2/rgrp.c
> @@ -2097,7 +2097,7 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart,
> u32 blen, unsigned char new_state)
> {
> struct gfs2_rbm rbm;
> - struct gfs2_bitmap *bi;
> + struct gfs2_bitmap *bi, *bi_prev = NULL;
>
> rbm.rgd = gfs2_blk2rgrpd(sdp, bstart, 1);
> if (!rbm.rgd) {
> @@ -2106,18 +2106,22 @@ static struct gfs2_rgrpd *rgblk_free(struct gfs2_sbd *sdp, u64 bstart,
> return NULL;
> }
>
> + gfs2_rbm_from_block(&rbm, bstart);
> while (blen--) {
> - gfs2_rbm_from_block(&rbm, bstart);
> bi = rbm_bi(&rbm);
> - bstart++;
> - if (!bi->bi_clone) {
> - bi->bi_clone = kmalloc(bi->bi_bh->b_size,
> - GFP_NOFS | __GFP_NOFAIL);
> - memcpy(bi->bi_clone + bi->bi_offset,
> - bi->bi_bh->b_data + bi->bi_offset, bi->bi_len);
> + if (bi != bi_prev) {
> + if (!bi->bi_clone) {
> + bi->bi_clone = kmalloc(bi->bi_bh->b_size,
> + GFP_NOFS | __GFP_NOFAIL);
> + memcpy(bi->bi_clone + bi->bi_offset,
> + bi->bi_bh->b_data + bi->bi_offset,
> + bi->bi_len);
> + }
> + gfs2_trans_add_meta(rbm.rgd->rd_gl, bi->bi_bh);
> + bi_prev = bi;
> }
> - gfs2_trans_add_meta(rbm.rgd->rd_gl, bi->bi_bh);
> gfs2_setbit(&rbm, false, new_state);
> + gfs2_rbm_incr(&rbm);
> }
>
> return rbm.rgd;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-03 14:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <506776947.2903645.1412339823543.JavaMail.zimbra@redhat.com>
2014-10-03 12:38 ` [Cluster-devel] [GFS2 PATCH] GFS2: Use gfs2_rbm_incr in rgblk_free Bob Peterson
2014-10-03 14:23 ` Steven Whitehouse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).