[Ocfs2-tools-devel] [RFC] mkfs.c: code cleanup of initialize_bitmap()
Coly Li
coly.li at suse.de
Sun May 31 20:58:31 PDT 2009
this patch does not make faster execution, just more readable.
1) add a comments for cluster alignment.
2) a minor code cleanup in initialize_bitmap()
Signed-off-by: Coly Li <coly.li at suse.de>
---
mkfs.ocfs2/mkfs.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/mkfs.ocfs2/mkfs.c b/mkfs.ocfs2/mkfs.c
index 048f70f..6acc6e6 100644
--- a/mkfs.ocfs2/mkfs.c
+++ b/mkfs.ocfs2/mkfs.c
@@ -1532,6 +1532,7 @@ initialize_bitmap(State *s, uint32_t bits, uint32_t unit_bits,
c_to_b_bits = s->cluster_size_bits - s->blocksize_bits;
+ /* to the next aligned cluster */
s->first_cluster_group = (OCFS2_SUPER_BLOCK_BLKNO + 1);
s->first_cluster_group += ((1 << c_to_b_bits) - 1);
s->first_cluster_group >>= c_to_b_bits;
@@ -1577,13 +1578,14 @@ initialize_bitmap(State *s, uint32_t bits, uint32_t
unit_bits,
blkno += (uint64_t) s->global_cpg << (s->cluster_size_bits - s->blocksize_bits);
chain++;
if (chain >= recs_per_inode) {
- bitmap->num_chains = recs_per_inode;
chain = 0;
wrapped = 1;
}
}
if (!wrapped)
bitmap->num_chains = chain;
+ else
+ bitmap->num_chains = recs_per_inode;
/* by now, this should be accurate. */
if (bm_record->bi.total_bits != s->volume_size_in_clusters) {
--
Coly Li
SuSE Labs
More information about the Ocfs2-tools-devel
mailing list