From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel@redhat.com, linux-kernel@vger.kernel.org
Cc: Bob Peterson <rpeterso@redhat.com>,
Steven Whitehouse <swhiteho@redhat.com>
Subject: [PATCH 03/19] GFS2: introduce bi_blocks for optimization
Date: Mon, 4 Nov 2013 11:09:26 +0000 [thread overview]
Message-ID: <1383563382-8535-4-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1383563382-8535-1-git-send-email-swhiteho@redhat.com>
From: Bob Peterson <rpeterso@redhat.com>
This patch introduces a new field in the bitmap structure called
bi_blocks. Its purpose is to save us from constantly multiplying
bi_len by the constant GFS2_NBBY. It also paves the way for more
optimization in a future patch.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 26aabd7..f1a3243 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -71,6 +71,7 @@ struct gfs2_bitmap {
u32 bi_offset;
u32 bi_start;
u32 bi_len;
+ u32 bi_blocks;
};
struct gfs2_rgrpd {
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 7a6fa03..7d64a27 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -262,7 +262,7 @@ static int gfs2_rbm_from_block(struct gfs2_rbm *rbm, u64 block)
rbm->bi = rbm->rgd->rd_bits;
rbm->offset = (u32)(rblock);
/* Check if the block is within the first block */
- if (rbm->offset < rbm->bi->bi_len * GFS2_NBBY)
+ if (rbm->offset < rbm->bi->bi_blocks)
return 0;
/* Adjust for the size diff between gfs2_meta_header and gfs2_rgrp */
@@ -743,18 +743,21 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd)
bi->bi_offset = sizeof(struct gfs2_rgrp);
bi->bi_start = 0;
bi->bi_len = bytes;
+ bi->bi_blocks = bytes * GFS2_NBBY;
/* header block */
} else if (x == 0) {
bytes = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_rgrp);
bi->bi_offset = sizeof(struct gfs2_rgrp);
bi->bi_start = 0;
bi->bi_len = bytes;
+ bi->bi_blocks = bytes * GFS2_NBBY;
/* last block */
} else if (x + 1 == length) {
bytes = bytes_left;
bi->bi_offset = sizeof(struct gfs2_meta_header);
bi->bi_start = rgd->rd_bitbytes - bytes_left;
bi->bi_len = bytes;
+ bi->bi_blocks = bytes * GFS2_NBBY;
/* other blocks */
} else {
bytes = sdp->sd_sb.sb_bsize -
@@ -762,6 +765,7 @@ static int compute_bitstructs(struct gfs2_rgrpd *rgd)
bi->bi_offset = sizeof(struct gfs2_meta_header);
bi->bi_start = rgd->rd_bitbytes - bytes_left;
bi->bi_len = bytes;
+ bi->bi_blocks = bytes * GFS2_NBBY;
}
bytes_left -= bytes;
--
1.7.4.4
next prev parent reply other threads:[~2013-11-04 11:36 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-04 11:09 GFS2: Pre-pull patch posting (merge window) Steven Whitehouse
2013-11-04 11:09 ` [PATCH 01/19] GFS2: d_splice_alias() can't return error Steven Whitehouse
2013-11-04 11:09 ` [PATCH 02/19] GFS2: optimize rbm_from_block wrt bi_start Steven Whitehouse
2013-11-04 11:09 ` Steven Whitehouse [this message]
2013-11-04 11:09 ` [PATCH 04/19] GFS2: Do not reset flags on active reservations Steven Whitehouse
2013-11-04 11:09 ` [PATCH 05/19] GFS2: Introduce rbm field bii Steven Whitehouse
2013-11-04 11:09 ` [PATCH 06/19] GFS2: new function gfs2_rbm_incr Steven Whitehouse
2013-11-04 11:09 ` [PATCH 07/19] GFS2: fix dentry leaks Steven Whitehouse
2013-11-04 11:09 ` [PATCH 08/19] GFS2: Clean up reservation removal Steven Whitehouse
2013-11-04 11:09 ` [PATCH 09/19] GFS2: Add allocation parameters structure Steven Whitehouse
2013-11-04 11:09 ` [PATCH 10/19] GFS2: Speed up starting point selection for block allocation Steven Whitehouse
2013-11-04 11:09 ` [PATCH 11/19] GFS2: Move gfs2_icbit_munge into quota.c Steven Whitehouse
2013-11-04 11:09 ` [PATCH 12/19] GFS2: Remove obsolete quota tunable Steven Whitehouse
2013-11-04 11:09 ` [PATCH 13/19] GFS2: Make two similar quota code fragments into a function Steven Whitehouse
2013-11-04 11:09 ` [PATCH 14/19] GFS2: Inline qd_trylock into gfs2_quota_unlock Steven Whitehouse
2013-11-04 11:09 ` [PATCH 15/19] GFS2: Protect quota sync generation Steven Whitehouse
2013-11-04 11:09 ` [PATCH 16/19] GFS2: Use lockref for glocks Steven Whitehouse
2013-11-04 11:22 ` [PATCH 17/19] GFS2: Use reflink for quota data cache Steven Whitehouse
2013-11-04 11:22 ` [PATCH 18/19] GFS2: Rename quota qd_lru_lock qd_lock Steven Whitehouse
2013-11-04 11:22 ` [PATCH 19/19] GFS2: Use generic list_lru for quota Steven Whitehouse
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1383563382-8535-4-git-send-email-swhiteho@redhat.com \
--to=swhiteho@redhat.com \
--cc=cluster-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rpeterso@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome