[DRBD-cvs] svn commit by phil - r2152 - trunk/user - Fixing the fix
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Tue Apr 18 22:05:31 CEST 2006
Author: phil
Date: 2006-04-18 22:05:31 +0200 (Tue, 18 Apr 2006)
New Revision: 2152
Modified:
trunk/user/drbdmeta.c
Log:
Fixing the fix
Modified: trunk/user/drbdmeta.c
===================================================================
--- trunk/user/drbdmeta.c 2006-04-18 19:43:24 UTC (rev 2151)
+++ trunk/user/drbdmeta.c 2006-04-18 20:05:31 UTC (rev 2152)
@@ -814,7 +814,7 @@
unsigned long long words;
int shift;
- shift = 9 - int_ln2(bytes_per_bit);
+ shift = int_ln2(bytes_per_bit) - 9;
bits = ALIGN(sectors, 8) >> shift;
words = ALIGN(bits, 64) >> LN2_BPL;
@@ -915,11 +915,14 @@
cfg->al_offset = cfg->md_offset + cfg->md.al_offset * 512;
cfg->bm_offset = cfg->md_offset + cfg->md.bm_offset * 512;
+ words = bm_words(cfg->md.la_sect, cfg->md.bm_bytes_per_bit);
+ cfg->bm_bytes = words * sizeof(long);
+
#define max(x,y) ((x) > (y) ? (x) : (y))
// For the case that someone modified la_sect by hand..
cfg->bm_mmaped_length =
max((u64)(cfg->md.md_size_sect - MD_BM_OFFSET_07)*512,
- (u64)bm_words(cfg->md.la_sect, cfg->md.bm_bytes_per_bit)<<(LN2_BPL-3));
+ (u64)cfg->bm_bytes);
//fprintf(stderr,"al_offset: "U64" (%d)\n", cfg->al_offset, cfg->md.al_offset);
//fprintf(stderr,"bm_offset: "U64" (%d)\n", cfg->bm_offset, cfg->md.bm_offset);
@@ -933,8 +936,6 @@
cfg->on_disk.bm = MMAP(cfg->on_disk.bm, cfg->bm_mmaped_length, PROT_READ | PROT_WRITE,
MAP_SHARED, cfg->md_fd, cfg->bm_offset);
- words = bm_words(cfg->md.la_sect, cfg->md.bm_bytes_per_bit);
- cfg->bm_bytes = words * sizeof(long);
cfg->bits_set =
count_bits((const unsigned long *)cfg->on_disk.bm, words);
More information about the drbd-cvs
mailing list