[DRBD-cvs] svn commit by lars - r2989 - in
branches/drbd-8.0-for-linus/drbd: . linux -
376cd1f1a5c72806ce46dead3f53d9c1256629f6 fix C99 // com
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Tue Jul 24 14:51:38 CEST 2007
Author: lars
Date: 2007-07-24 14:51:35 +0200 (Tue, 24 Jul 2007)
New Revision: 2989
Modified:
branches/drbd-8.0-for-linus/drbd/drbd_actlog.c
branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c
branches/drbd-8.0-for-linus/drbd/drbd_int.h
branches/drbd-8.0-for-linus/drbd/drbd_main.c
branches/drbd-8.0-for-linus/drbd/drbd_nl.c
branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
branches/drbd-8.0-for-linus/drbd/drbd_req.c
branches/drbd-8.0-for-linus/drbd/drbd_req.h
branches/drbd-8.0-for-linus/drbd/drbd_worker.c
branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
branches/drbd-8.0-for-linus/drbd/linux/drbd.h
branches/drbd-8.0-for-linus/drbd/linux/drbd_config.h
branches/drbd-8.0-for-linus/drbd/linux/drbd_limits.h
branches/drbd-8.0-for-linus/drbd/linux/drbd_nl.h
branches/drbd-8.0-for-linus/drbd/linux/drbd_tag_magic.h
branches/drbd-8.0-for-linus/drbd/lru_cache.c
branches/drbd-8.0-for-linus/drbd/lru_cache.h
Log:
376cd1f1a5c72806ce46dead3f53d9c1256629f6 fix C99 // comments
Modified: branches/drbd-8.0-for-linus/drbd/drbd_actlog.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_actlog.c 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/drbd_actlog.c 2007-07-24 12:51:35 UTC (rev 2989)
@@ -88,7 +88,7 @@
hardsect = drbd_get_hardsect(bdev->md_bdev);
if (hardsect == 0) hardsect = MD_HARDSECT;
- // in case hardsect != 512 [ s390 only? ]
+ /* in case hardsect != 512 [ s390 only? ] */
if (hardsect != MD_HARDSECT) {
if (!mdev->md_io_tmpp) {
struct page *page = alloc_page(GFP_NOIO);
@@ -154,21 +154,20 @@
return ok;
}
-
+/* I do not believe that all storage medias can guarantee atomic
+ * 512 byte write operations. When the journal is read, only
+ * transactions with correct xor_sums are considered.
+ * sizeof() = 512 byte */
struct __attribute__((packed)) al_transaction {
u32 magic;
u32 tr_number;
- // u32 tr_generation; //TODO
+ /* u32 tr_generation; TODO */
struct __attribute__((packed)) {
u32 pos;
u32 extent; } updates[1 + AL_EXTENTS_PT];
u32 xor_sum;
- // I do not believe that all storage medias can guarantee atomic
- // 512 byte write operations. When the journal is read, only
- // transactions with correct xor_sums are considered.
-}; // sizeof() = 512 byte
+};
-
struct update_odbm_work {
struct drbd_work w;
unsigned int enr;
@@ -195,7 +194,6 @@
if (unlikely(bm_ext!=NULL)) {
if (test_bit(BME_NO_WRITES, &bm_ext->flags)) {
spin_unlock_irq(&mdev->al_lock);
- //INFO("Delaying app write until sync read is done\n");
return 0;
}
}
@@ -235,7 +233,7 @@
wait_event(mdev->al_wait, (al_ext = _al_get(mdev, enr)) );
if (al_ext->lc_number != enr) {
- // We have to do write an transaction to AL.
+ /* We have to do write an transaction to AL. */
unsigned int evicted;
evicted = al_ext->lc_number;
@@ -310,7 +308,7 @@
struct lc_element *updated = ((struct update_al_work*)w)->al_ext;
unsigned int new_enr = ((struct update_al_work*)w)->enr;
- down(&mdev->md_io_mutex); // protects md_io_buffer, al_tr_cycle, ...
+ down(&mdev->md_io_mutex); /* protects md_io_buffer, al_tr_cycle, ... */
buffer = (struct al_transaction*)page_address(mdev->md_io_page);
buffer->magic = __constant_cpu_to_be32(DRBD_MAGIC);
@@ -346,8 +344,6 @@
buffer->xor_sum = cpu_to_be32(xor_sum);
-// warning LGE check outcome of addition u64/sector_t/s32
-// warning LGE "FIXME code missing"
sector = mdev->bc->md.md_offset + mdev->bc->md.al_offset + mdev->al_tr_pos;
if (!drbd_md_sync_page_io(mdev, mdev->bc, sector, WRITE)) {
@@ -385,11 +381,10 @@
sector = bdev->md.md_offset + bdev->md.al_offset + index;
- if (!drbd_md_sync_page_io(mdev, bdev, sector, READ)) {
- // Dont process error normally as this is done before
- // disk is atached!
+ /* Dont process error normally,
+ * as this is done before disk is atached! */
+ if (!drbd_md_sync_page_io(mdev, bdev, sector, READ))
return -1;
- }
rv = ( be32_to_cpu(b->magic) == DRBD_MAGIC );
@@ -423,7 +418,7 @@
down(&mdev->md_io_mutex);
buffer = page_address(mdev->md_io_page);
- // Find the valid transaction in the log
+ /* Find the valid transaction in the log */
for(i = 0;i<=mx;i++) {
rv = drbd_al_read_tr(mdev, bdev, buffer, i);
if (rv == 0) continue;
@@ -432,7 +427,7 @@
return 0;
}
cnr = be32_to_cpu(buffer->tr_number);
- // INFO("index %d valid tnr=%d\n",i,cnr);
+ /* INFO("index %d valid tnr=%d\n",i,cnr); */
if (cnr == -1) overflow = 1;
@@ -453,11 +448,8 @@
return 1;
}
- // Read the valid transactions.
- // INFO("Reading from %d to %d.\n",from,to);
-
- /* this should better be handled by a for loop, no?
- */
+ /* Read the valid transactions.
+ * INFO("Reading from %d to %d.\n",from,to); */
i = from;
while(1) {
int j, pos;
@@ -485,7 +477,6 @@
if (extent_nr == LC_FREE) continue;
- //if (j<3) INFO("T%03d S%03d=E%06d\n",trn,pos,extent_nr);
lc_set(mdev->act_log, extent_nr, pos);
active_extents++;
}
@@ -569,7 +560,7 @@
sector_t on_disk_sector = enr + mdev->bc->md.md_offset + mdev->bc->md.bm_offset;
int offset;
- // check if that enr is already covered by an already created bio.
+ /* check if that enr is already covered by an already created bio. */
while( (bio = bios[i]) ) {
if (bio->bi_sector == on_disk_sector) return 0;
i++;
@@ -679,12 +670,12 @@
drbd_blk_run_queue(bdev_get_queue(mdev->bc->md_bdev));
- // In case we did not submit a single IO do not wait for
- // them to complete. ( Because we would wait forever here. )
- //
- // In case we had IOs and they are already complete, there
- // is not point in waiting anyways.
- // Therefore this if () ...
+ /* In case we did not submit a single IO do not wait for
+ * them to complete. ( Because we would wait forever here. )
+ *
+ * In case we had IOs and they are already complete, there
+ * is not point in waiting anyways.
+ * Therefore this if () ... */
if (atomic_read(&wc.count)) wait_for_completion(&wc.io_done);
dec_local(mdev);
@@ -694,7 +685,7 @@
return;
free_bios_submit_one_by_one:
- // free everything by calling the endio callback directly.
+ /* free everything by calling the endio callback directly. */
for(i = 0;i<nr_elements;i++) {
if (bios[i]==NULL) break;
bios[i]->bi_size = 0;
@@ -824,8 +815,8 @@
MUST_HOLD(&mdev->al_lock);
D_ASSERT(atomic_read(&mdev->local_cnt));
- // I simply assume that a sector/size pair never crosses
- // a 16 MB extent border. (Currently this is true...)
+ /* I simply assume that a sector/size pair never crosses
+ * a 16 MB extent border. (Currently this is true...) */
enr = BM_SECT_TO_EXT(sector);
ext = (struct bm_extent *) lc_get(mdev->resync, enr);
@@ -840,17 +831,17 @@
(unsigned long long)sector,
ext->lce.lc_number, ext->rs_left, ext->rs_failed, count);
dump_stack();
- // FIXME brrrgs. should never happen!
+ /* FIXME brrrgs. should never happen! */
drbd_force_state(mdev, NS(conn, Disconnecting));
return;
}
} else {
- //WARN("Counting bits in %d (resync LRU small?)\n",enr);
- // This element should be in the cache
- // since drbd_rs_begin_io() pulled it already in.
-
- // OR an application write finished, and therefore
- // we set something in this area in sync.
+ /* Normally this element should be in the cache,
+ * since drbd_rs_begin_io() pulled it already in.
+ *
+ * But maybe an application write finished, and we set
+ * something in outside the resync lru_cache in sync.
+ */
int rs_left = drbd_bm_e_weight(mdev, enr);
if (ext->flags != 0) {
WARN("changing resync lce: %d[%u;%02lx]"
@@ -870,7 +861,7 @@
lc_changed(mdev->resync, &ext->lce);
}
lc_put(mdev->resync, &ext->lce);
- // no race, we are within the al_lock!
+ /* no race, we are within the al_lock! */
if (ext->rs_left == ext->rs_failed) {
ext->rs_failed = 0;
@@ -950,7 +941,7 @@
if (drbd_bm_clear_bit(mdev, bnr)) count++;
}
if (count) {
- // we need the lock for drbd_try_clear_on_disk_bm
+ /* we need the lock for drbd_try_clear_on_disk_bm */
if (jiffies - mdev->rs_mark_time > HZ*10) {
/* should be roling marks, but we estimate only anyways. */
if ( mdev->rs_mark_left != drbd_bm_total_weight(mdev) &&
@@ -1039,7 +1030,6 @@
spin_lock_irq(&mdev->al_lock);
if (mdev->resync_locked > mdev->resync->nr_elements-3) {
- //WARN("bme_get() does not lock all elements\n");
spin_unlock_irq(&mdev->al_lock);
return NULL;
}
@@ -1063,9 +1053,8 @@
WARN("Have to wait for element"
" (resync LRU too small?)\n");
}
- if (rs_flags & LC_DIRTY) {
- BUG(); // WARN("Ongoing RS update (???)\n");
- }
+ /* WARN("Ongoing RS update (???)\n"); */
+ BUG_ON(rs_flags & LC_DIRTY);
}
return bm_ext;
@@ -1223,9 +1212,8 @@
WARN("Have to wait for element"
" (resync LRU too small?)\n");
}
- if (rs_flags & LC_DIRTY) {
- BUG(); // WARN("Ongoing RS update (???)\n");
- }
+ /* WARN("Ongoing RS update (???)\n"); */
+ BUG_ON(rs_flags & LC_DIRTY);
goto try_again;
}
if (bm_ext->lce.lc_number != enr) {
@@ -1316,11 +1304,12 @@
spin_lock_irq(&mdev->al_lock);
- if (inc_local_if_state(mdev, Failed)) { // Makes sure ->resync is there.
+ if (inc_local_if_state(mdev, Failed)) {
+ /* ok, ->resync is there. */
for(i = 0;i<mdev->resync->nr_elements;i++) {
bm_ext = (struct bm_extent*) lc_entry(mdev->resync, i);
if (bm_ext->lce.lc_number == LC_FREE) continue;
- bm_ext->lce.refcnt = 0; // Rude but ok.
+ bm_ext->lce.refcnt = 0; /* Rude but ok. */
bm_ext->rs_left = 0;
clear_bit(BME_LOCKED, &bm_ext->flags);
clear_bit(BME_NO_WRITES, &bm_ext->flags);
@@ -1352,7 +1341,8 @@
spin_lock_irq(&mdev->al_lock);
- if (inc_local_if_state(mdev, Failed)) { // Makes sure ->resync is there.
+ if (inc_local_if_state(mdev, Failed)) {
+ /* ok, ->resync is there. */
for(i = 0;i<mdev->resync->nr_elements;i++) {
bm_ext = (struct bm_extent*) lc_entry(mdev->resync, i);
if (bm_ext->lce.lc_number == LC_FREE) continue;
Modified: branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c 2007-07-24 12:51:35 UTC (rev 2989)
@@ -26,10 +26,7 @@
#include <linux/bitops.h>
#include <linux/vmalloc.h>
-#include <linux/string.h> // for memset
-#include <linux/hardirq.h> /* for D_ASSERT(in_interrupt()) */
-
-
+#include <linux/string.h>
#include <linux/drbd.h>
#include "drbd_int.h"
@@ -55,9 +52,6 @@
* or wether I want it to do all the sector<->bit calculation in here.
*/
-// warning LGE "verify all spin_lock_irq here, and their call path"
-// warning LGE "and change to irqsave where applicable"
-// warning LGE "so we don't accidentally nest spin_lock_irq()"
/*
* NOTE
* Access to the *bm is protected by bm_lock.
@@ -93,114 +87,62 @@
* rather change the granularity to 16k or 64k or something.
* (that implies other problems, however...)
*/
- unsigned long bm_fo; // next offset for drbd_bm_find_next
- unsigned long bm_set; // nr of set bits; THINK maybe atomic_t ?
+ unsigned long bm_fo; /* next offset for drbd_bm_find_next */
+ unsigned long bm_set; /* nr of set bits; THINK maybe atomic_t? */
unsigned long bm_bits;
size_t bm_words;
sector_t bm_dev_capacity;
- struct semaphore bm_change; // serializes resize operations
+ struct semaphore bm_change; /* serializes resize operations */
atomic_t bm_async_io;
wait_queue_head_t bm_io_wait;
unsigned long bm_flags;
- // { REMOVE
+ /* debugging aid, in case we are still racy somewhere */
unsigned long bm_line;
char *bm_file;
- // }
};
-// { REMOVE once we serialize all state changes properly
-#define D_BUG_ON(x) ERR_IF(x) { dump_stack(); }
+/* definition of bits in bm_flags */
#define BM_LOCKED 0
-#define BM_MD_IO_ERROR (BITS_PER_LONG-1) // 31? 63?
+#define BM_MD_IO_ERROR (BITS_PER_LONG-1) /* 31? 63? */
-#if 0 // simply disabled for now...
-#define MUST_NOT_BE_LOCKED() do { \
- if (test_bit(BM_LOCKED, &b->bm_flags)) { \
- if (DRBD_ratelimit(5*HZ, 5)) { \
- ERR("%s:%d: bitmap is locked by %s:%lu\n", \
- __FILE__, __LINE__, b->bm_file, b->bm_line); \
- dump_stack(); \
- } \
- } \
-} while (0)
-#define MUST_BE_LOCKED() do { \
- if (!test_bit(BM_LOCKED, &b->bm_flags)) { \
- if (DRBD_ratelimit(5*HZ, 5)) { \
- ERR("%s:%d: bitmap not locked!\n", \
- __FILE__, __LINE__); \
- dump_stack(); \
- } \
- } \
-} while (0)
-#else
-#define MUST_NOT_BE_LOCKED() do {(void)b;} while (0)
-#define MUST_BE_LOCKED() do {(void)b;} while (0)
-#endif
void __drbd_bm_lock(drbd_dev *mdev, char* file, int line)
{
- struct drbd_bitmap *b = mdev->bitmap;
- spin_lock_irq(&b->bm_lock);
- if (!__test_and_set_bit(BM_LOCKED, &b->bm_flags)) {
- b->bm_file = file;
- b->bm_line = line;
- } else if (DRBD_ratelimit(5*HZ, 5)) {
- ERR("%s:%d: bitmap already locked by %s:%lu\n",
- file, line, b->bm_file, b->bm_line);
- /*
- dump_stack();
- ERR("This is no oops, but debug stack trace only.\n");
- ERR("If you get this often, or in reproducable situations, "
- "notify <drbd-devel at linbit.com>\n");
- */
- }
- spin_unlock_irq(&b->bm_lock);
+ struct drbd_bitmap *b = mdev->bitmap;
+ spin_lock_irq(&b->bm_lock);
+ if (!__test_and_set_bit(BM_LOCKED, &b->bm_flags)) {
+ b->bm_file = file;
+ b->bm_line = line;
+ } else if (DRBD_ratelimit(5*HZ, 5)) {
+ ERR("%s:%d: bitmap already locked by %s:%lu\n",
+ file, line, b->bm_file, b->bm_line);
+ /*
+ dump_stack();
+ ERR("This is no oops, but debug stack trace only.\n");
+ ERR("If you get this often, or in reproducable situations, "
+ "notify <drbd-devel at linbit.com>\n");
+ */
+ }
+ spin_unlock_irq(&b->bm_lock);
}
+
void drbd_bm_unlock(drbd_dev *mdev)
{
- struct drbd_bitmap *b = mdev->bitmap;
- spin_lock_irq(&b->bm_lock);
- if (!__test_and_clear_bit(BM_LOCKED, &mdev->bitmap->bm_flags)) {
- ERR("bitmap not locked in bm_unlock\n");
- } else {
- /* FIXME if we got a "is already locked" previously,
- * we unlock here even though we actually MUST NOT do so... */
- b->bm_file = NULL;
- b->bm_line = -1;
- }
- spin_unlock_irq(&b->bm_lock);
+ struct drbd_bitmap *b = mdev->bitmap;
+ spin_lock_irq(&b->bm_lock);
+ if (!__test_and_clear_bit(BM_LOCKED, &mdev->bitmap->bm_flags)) {
+ ERR("bitmap not locked in bm_unlock\n");
+ } else {
+ /* FIXME if we got a "is already locked" previously,
+ * we unlock here even though we actually MUST NOT do so... */
+ b->bm_file = NULL;
+ b->bm_line = -1;
+ }
+ spin_unlock_irq(&b->bm_lock);
}
-#if 0
-// has been very helpful to indicate that rs_total and rs_left have been
-// used in a non-smp safe way...
-#define BM_PARANOIA_CHECK() do { \
- D_ASSERT(b->bm[b->bm_words] == DRBD_MAGIC); \
- D_ASSERT(b->bm_dev_capacity == drbd_get_capacity(mdev->this_bdev)); \
- if ( (b->bm_set != mdev->rs_total) && \
- (b->bm_set != mdev->rs_left) ) { \
- if ( DRBD_ratelimit(5*HZ, 5) ) { \
- ERR("%s:%d: ?? bm_set=%lu; rs_total=%lu, rs_left=%lu\n", \
- __FILE__ , __LINE__ , \
- b->bm_set, mdev->rs_total, mdev->rs_left ); \
- } \
- } \
-} while (0)
-#else
-#define BM_PARANOIA_CHECK() do { \
- D_ASSERT(b->bm[b->bm_words] == DRBD_MAGIC); \
- if (b->bm_dev_capacity != drbd_get_capacity(mdev->this_bdev)) { \
- ERR("%s:%d: bm_dev_capacity:%llu drbd_get_capacity:%llu\n", \
- __FILE__, __LINE__, \
- (unsigned long long) b->bm_dev_capacity, \
- (unsigned long long) drbd_get_capacity(mdev->this_bdev));\
- } \
-} while (0)
-#endif
-// }
-
#if DUMP_MD >= 3
/* debugging aid */
STATIC void bm_end_info(drbd_dev *mdev, const char* where)
@@ -243,7 +185,7 @@
int drbd_bm_init(drbd_dev *mdev)
{
struct drbd_bitmap *b = mdev->bitmap;
- D_BUG_ON(b);
+ WARN_ON(b);
b = kzalloc(sizeof(struct drbd_bitmap), GFP_KERNEL);
if (!b)
return -ENOMEM;
@@ -270,7 +212,7 @@
/* FIXME I think we should explicitly change the device size to zero
* before this...
*
- D_BUG_ON(mdev->bitmap->bm);
+ WARN_ON(mdev->bitmap->bm);
*/
vfree(mdev->bitmap->bm);
kfree(mdev->bitmap);
@@ -365,7 +307,6 @@
int err = 0, growing;
ERR_IF(!b) return -ENOMEM;
- MUST_BE_LOCKED();
ERR_IF (down_trylock(&b->bm_change)) {
down(&b->bm_change);
@@ -424,16 +365,17 @@
}
spin_lock_irq(&b->bm_lock);
obm = b->bm;
- // brgs. move several MB within spinlock...
- // FIXME this should go into userspace!
+ /* brgs. move several MB within spinlock...
+ * FIXME this should go into userspace! */
if (obm) {
bm_set_surplus(b);
D_ASSERT(b->bm[b->bm_words] == DRBD_MAGIC);
memcpy(nbm, obm, min_t(size_t, b->bm_words, words)*sizeof(long));
}
growing = words > b->bm_words;
- if (growing) { // set all newly allocated bits
- // start at -1, just to be sure.
+ if (growing) {
+ /* set all newly allocated bits
+ * start at -1, just to be sure. */
memset( nbm + (b->bm_words?:1)-1 , 0xff,
(words - ((b->bm_words?:1)-1)) * sizeof(long) );
b->bm_set += bits - b->bm_bits;
@@ -450,7 +392,7 @@
INFO("resync bitmap: bits=%lu words=%lu\n", bits, words);
}
free_obm:
- vfree(obm); // vfree(NULL) is noop
+ vfree(obm); /* vfree(NULL) is noop */
out:
up(&b->bm_change);
return err;
@@ -471,7 +413,6 @@
unsigned long flags;
ERR_IF(!b) return 0;
- // MUST_BE_LOCKED(); well. yes. but ...
spin_lock_irqsave(&b->bm_lock, flags);
s = b->bm_set;
@@ -484,13 +425,6 @@
{
struct drbd_bitmap *b = mdev->bitmap;
ERR_IF(!b) return 0;
-
- /* FIXME
- * actually yes. really. otherwise it could just change its size ...
- * but it triggers all the time...
- * MUST_BE_LOCKED();
- */
-
return b->bm_words;
}
@@ -508,14 +442,11 @@
if (number == 0) return;
ERR_IF(!b) return;
ERR_IF(!b->bm) return;
- D_BUG_ON(offset >= b->bm_words);
- D_BUG_ON(offset+number > b->bm_words);
- D_BUG_ON(number > PAGE_SIZE/sizeof(long));
+ WARN_ON(offset >= b->bm_words);
+ WARN_ON(offset+number > b->bm_words);
+ WARN_ON(number > PAGE_SIZE/sizeof(long));
- MUST_BE_LOCKED();
-
spin_lock_irq(&b->bm_lock);
- // BM_PARANOIA_CHECK(); no.
bm = b->bm + offset;
while(n--) {
bits = hweight_long(*bm);
@@ -549,14 +480,11 @@
if (number == 0) return;
ERR_IF(!b) return;
ERR_IF(!b->bm) return;
- D_BUG_ON(offset >= b->bm_words);
- D_BUG_ON(offset+number > b->bm_words);
- D_BUG_ON(number > PAGE_SIZE/sizeof(long));
+ WARN_ON(offset >= b->bm_words);
+ WARN_ON(offset+number > b->bm_words);
+ WARN_ON(number > PAGE_SIZE/sizeof(long));
- MUST_BE_LOCKED();
-
spin_lock_irq(&b->bm_lock);
- // BM_PARANOIA_CHECK(); no.
bm = b->bm + offset;
while(n--) {
bits = hweight_long(*bm);
@@ -592,7 +520,7 @@
(offset+number > b->bm_words) ||
(number > PAGE_SIZE/sizeof(long)) ||
(number <= 0) ) {
- // yes, there is "%z", but that gives compiler warnings...
+ /* yes, there is "%z", but that gives compiler warnings... */
ERR("offset=%lu number=%lu bm_words=%lu\n",
(unsigned long) offset,
(unsigned long) number,
@@ -600,10 +528,7 @@
return;
}
- // MUST_BE_LOCKED(); yes. but not neccessarily globally...
-
spin_lock_irq(&b->bm_lock);
- BM_PARANOIA_CHECK();
bm = b->bm + offset;
while(number--) *buffer++ = cpu_to_lel(*bm++);
spin_unlock_irq(&b->bm_lock);
@@ -616,10 +541,7 @@
ERR_IF(!b) return;
ERR_IF(!b->bm) return;
- MUST_BE_LOCKED();
-
spin_lock_irq(&b->bm_lock);
- BM_PARANOIA_CHECK();
memset(b->bm, 0xff, b->bm_words*sizeof(long));
bm_clear_surplus(b);
b->bm_set = b->bm_bits;
@@ -696,12 +618,10 @@
sector_t on_disk_sector = mdev->bc->md.md_offset + mdev->bc->md.bm_offset + enr;
int bm_words, num_words, offset, err = 0;
- // MUST_BE_LOCKED(); not neccessarily global ...
-
down(&mdev->md_io_mutex);
if (drbd_md_sync_page_io(mdev, mdev->bc, on_disk_sector, READ)) {
bm_words = drbd_bm_words(mdev);
- offset = S2W(enr); // word offset into bitmap
+ offset = S2W(enr); /* word offset into bitmap */
num_words = min(S2W(1), bm_words - offset);
#if DUMP_MD >= 3
INFO("read_sect: sector=%lus offset=%u num_words=%u\n",
@@ -770,8 +690,6 @@
char ppb[10];
int err = 0;
- MUST_BE_LOCKED();
-
bm_words = drbd_bm_words(mdev);
num_pages = (bm_words*sizeof(long) + PAGE_SIZE-1) >> PAGE_SHIFT;
@@ -834,7 +752,7 @@
int err = 0;
if (b->bm) {
- // bitmap size > 0
+ /* bitmap size > 0 */
err = drbd_bm_rw(mdev, READ);
if (err == 0)
@@ -856,11 +774,9 @@
sector_t on_disk_sector = enr + mdev->bc->md.md_offset + mdev->bc->md.bm_offset;
int bm_words, num_words, offset, err = 0;
- // MUST_BE_LOCKED(); not neccessarily global...
-
down(&mdev->md_io_mutex);
bm_words = drbd_bm_words(mdev);
- offset = S2W(enr); // word offset into bitmap
+ offset = S2W(enr); /* word offset into bitmap */
num_words = min(S2W(1), bm_words - offset);
#if DUMP_MD >= 3
INFO("write_sect: sector=%lu offset=%u num_words=%u\n",
@@ -908,10 +824,7 @@
ERR_IF(!b) return;
ERR_IF(!b->bm) return;
- MUST_BE_LOCKED(); \
-
spin_lock_irq(&b->bm_lock);
- BM_PARANOIA_CHECK();
memset(b->bm, 0, b->bm_words*sizeof(long));
b->bm_set = 0;
spin_unlock_irq(&b->bm_lock);
@@ -923,10 +836,7 @@
ERR_IF(!b) return;
- MUST_BE_LOCKED();
-
spin_lock_irq(&b->bm_lock);
- BM_PARANOIA_CHECK();
b->bm_fo = 0;
spin_unlock_irq(&b->bm_lock);
@@ -946,7 +856,6 @@
ERR_IF(!b->bm) return i;
spin_lock_irq(&b->bm_lock);
- BM_PARANOIA_CHECK();
if (b->bm_fo < b->bm_bits) {
i = find_next_bit(b->bm, b->bm_bits, b->bm_fo);
} else if (b->bm_fo > b->bm_bits) {
@@ -967,7 +876,6 @@
struct drbd_bitmap *b = mdev->bitmap;
spin_lock_irq(&b->bm_lock);
- BM_PARANOIA_CHECK();
b->bm_fo = min_t(unsigned long, i, b->bm_bits);
@@ -980,7 +888,9 @@
return mdev->bitmap->bm_fo == 0;
}
-// THINK maybe the D_BUG_ON(i<0)s in set/clear/test should be not that strict?
+/*
+ * THINK maybe the WARN_ON(i<0)s in set/clear/test should be not that strict?
+ */
/* returns previous bit state
* wants bitnr, NOT sector.
@@ -1004,8 +914,6 @@
*/
spin_lock_irq(&b->bm_lock);
- BM_PARANOIA_CHECK();
- MUST_NOT_BE_LOCKED();
ERR_IF (bitnr >= b->bm_bits) {
ERR("bitnr=%lu bm_bits=%lu\n", bitnr, b->bm_bits);
i = 0;
@@ -1028,8 +936,6 @@
ERR_IF(!b->bm) return 1;
spin_lock(&b->bm_lock);
- BM_PARANOIA_CHECK();
- MUST_NOT_BE_LOCKED();
for (bitnr = s; bitnr <=e; bitnr++) {
ERR_IF (bitnr >= b->bm_bits) {
ERR("bitnr=%lu bm_bits=%lu\n", bitnr, b->bm_bits);
@@ -1054,8 +960,6 @@
ERR_IF(!b->bm) return 0;
spin_lock_irqsave(&b->bm_lock, flags);
- BM_PARANOIA_CHECK();
- MUST_NOT_BE_LOCKED();
ERR_IF (bitnr >= b->bm_bits) {
ERR("bitnr=%lu bm_bits=%lu\n", bitnr, b->bm_bits);
i = 0;
@@ -1091,7 +995,6 @@
ERR_IF(!b->bm) return 0;
spin_lock_irq(&b->bm_lock);
- BM_PARANOIA_CHECK();
if (bitnr < b->bm_bits) {
i = test_bit(bitnr, b->bm) ? 1 : 0;
} else if (bitnr == b->bm_bits) {
@@ -1128,7 +1031,6 @@
ERR_IF(!b) return 0;
ERR_IF(!b->bm) return 0;
spin_lock_irqsave(&b->bm_lock, flags);
- BM_PARANOIA_CHECK();
s = S2W(enr);
e = min((size_t)S2W(enr+1), b->bm_words);
@@ -1156,10 +1058,7 @@
ERR_IF(!b) return 0;
ERR_IF(!b->bm) return 0;
- MUST_BE_LOCKED();
-
spin_lock_irq(&b->bm_lock);
- BM_PARANOIA_CHECK();
weight = b->bm_set;
s = al_enr * BM_WORDS_PER_AL_EXT;
Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h 2007-07-24 12:51:35 UTC (rev 2989)
@@ -39,7 +39,7 @@
#include <net/tcp.h>
#include "lru_cache.h"
-// module parameter, defined in drbd_main.c
+/* module parameter, defined in drbd_main.c */
extern int minor_count;
extern int allow_oos;
@@ -86,13 +86,13 @@
*/
#define DRBD_SIGKILL SIGHUP
+/* All EEs on the free list should have ID_VACANT (== 0)
+ * freshly allocated EEs get !ID_VACANT (== 1)
+ * so if it says "cannot dereference null pointer at adress 0x00000001",
+ * it is most likely one of these :( */
#define ID_SYNCER (-1ULL)
-#define ID_VACANT 0 // All EEs on the free list should have this value
- // freshly allocated EEs get !ID_VACANT (== 1)
- // so if it says "cannot dereference null
- // pointer at adress 0x00000001, it is most
- // probably one of these :(
-#define is_syncer_block_id(id) ((id)==ID_SYNCER)
+#define ID_VACANT 0
+#define is_syncer_block_id(id) ((id) == ID_SYNCER)
struct Drbd_Conf;
typedef struct Drbd_Conf drbd_dev;
@@ -113,7 +113,7 @@
* Some Message Macros
*************************/
-// handy macro: DUMPP(somepointer)
+/* handy macro: DUMPP(somepointer) */
#define DUMPP(A) ERR( #A " = %p in %s:%d\n", (A), __FILE__, __LINE__);
#define DUMPLU(A) ERR( #A " = %lu in %s:%d\n", (unsigned long)(A), __FILE__, __LINE__);
#define DUMPLLU(A) ERR( #A " = %llu in %s:%d\n", (unsigned long long)(A), __FILE__, __LINE__);
@@ -136,8 +136,8 @@
#define D_DUMPI(A)
#endif
-// Info: do not remove the spaces around the "," before ##
-// Otherwise this is not portable from gcc-2.95 to gcc-3.3
+/* Info: do not remove the spaces around the "," before ##
+ * Otherwise this is not portable from gcc-2.95 to gcc-3.3 */
#define PRINTK(level, fmt, args...) \
printk(level DEVICE_NAME "%d: " fmt, \
mdev->minor , ##args)
@@ -194,15 +194,15 @@
_b; \
}))
-// Defines to control fault insertion
+/* Defines to control fault insertion */
enum {
- DRBD_FAULT_MD_WR = 0,
- DRBD_FAULT_MD_RD,
- DRBD_FAULT_RS_WR,
+ DRBD_FAULT_MD_WR = 0, /* meta data write */
+ DRBD_FAULT_MD_RD, /* read */
+ DRBD_FAULT_RS_WR, /* resync */
DRBD_FAULT_RS_RD,
- DRBD_FAULT_DT_WR,
+ DRBD_FAULT_DT_WR, /* data */
DRBD_FAULT_DT_RD,
- DRBD_FAULT_DT_RA, // READA = Read ahead
+ DRBD_FAULT_DT_RA, /* data read ahead */
DRBD_FAULT_MAX,
};
@@ -222,9 +222,9 @@
#endif
#include <linux/stringify.h>
-// integer division, round _UP_ to the next integer
+/* integer division, round _UP_ to the next integer */
#define div_ceil(A, B) ( (A)/(B) + ((A)%(B) ? 1 : 0) )
-// usual integer division
+/* usual integer division */
#define div_floor(A, B) ( (A)/(B) )
/*
@@ -260,7 +260,8 @@
((x) ? (((x)->magic ^ DRBD_MAGIC) == (long)(x)):0))
/* drbd_meta-data.c (still in drbd_main.c) */
-#define DRBD_MD_MAGIC (DRBD_MAGIC+4) // 4th incarnation of the disk layout.
+/* 4th incarnation of the disk layout. */
+#define DRBD_MD_MAGIC (DRBD_MAGIC+4)
extern struct Drbd_Conf **minor_table;
@@ -270,15 +271,15 @@
typedef enum {
Data,
- DataReply, // Response to DataRequest
- RSDataReply, // Response to RSDataRequest
+ DataReply, /* Response to DataRequest */
+ RSDataReply, /* Response to RSDataRequest */
Barrier,
ReportBitMap,
BecomeSyncTarget,
BecomeSyncSource,
- UnplugRemote, // Used at various times to hint the peer to hurry up
- DataRequest, // Used to ask for a data block
- RSDataRequest, // Used to ask for a data block
+ UnplugRemote, /* Used at various times to hint the peer */
+ DataRequest, /* Used to ask for a data block */
+ RSDataRequest, /* Used to ask for a data block for resync */
SyncParam,
ReportProtocol,
ReportUUIDs,
@@ -289,29 +290,30 @@
AuthResponse,
StateChgRequest,
- Ping, // These are sent on the meta socket...
+ /* These are sent on the meta socket... */
+ Ping,
PingAck,
- RecvAck, // Used in protocol B
- WriteAck, // Used in protocol C
- RSWriteAck, // Is a WriteAck, additionally call set_in_sync().
- DiscardAck, // Used in protocol C, two-primaries conflict detection
- NegAck, // Sent if local disk is unusable
- NegDReply, // Local disk is broken...
- NegRSDReply, // Local disk is broken...
+ RecvAck, /* Used in protocol B */
+ WriteAck, /* Used in protocol C */
+ RSWriteAck, /* Is a WriteAck, additionally call set_in_sync(). */
+ DiscardAck, /* Used in proto C, two-primaries conflict detection */
+ NegAck, /* Sent if local disk is unusable */
+ NegDReply, /* Local disk is broken... */
+ NegRSDReply, /* Local disk is broken... */
BarrierAck,
StateChgReply,
MAX_CMD,
- MayIgnore = 0x100, // Flag only to test if (cmd > MayIgnore) ...
+ MayIgnore = 0x100, /* Flag to test if (cmd > MayIgnore) ... */
MAX_OPT_CMD,
/* FIXME
* to get a more useful error message with drbd-8 <-> drbd 0.7.x,
* these could be reimplemented as special case of HandShake. */
- HandShakeM = 0xfff1, // First Packet on the MetaSock
- HandShakeS = 0xfff2, // First Packet on the Socket
+ HandShakeM = 0xfff1, /* First Packet on the MetaSock */
+ HandShakeS = 0xfff2, /* First Packet on the Socket */
- HandShake = 0xfffe // FIXED for the next century!
+ HandShake = 0xfffe /* FIXED for the next century! */
} Drbd_Packet_Cmd;
static inline const char* cmdname(Drbd_Packet_Cmd cmd)
@@ -385,10 +387,10 @@
typedef struct {
u32 magic;
u16 command;
- u16 length; // bytes of data after this header
+ u16 length; /* bytes of data after this header */
char payload[0];
} __attribute((packed)) Drbd_Header;
-// 8 bytes. packet FIXED for the next century!
+/* 8 bytes. packet FIXED for the next century! */
/*
* short commands, packets without payload, plain Drbd_Header:
@@ -411,8 +413,8 @@
typedef struct {
Drbd_Header head;
- u64 sector; // 64 bits sector number
- u64 block_id; // Used in protocol B&C for the address of the req.
+ u64 sector; /* 64 bits sector number */
+ u64 block_id; /* to identify the request in protocol B&C */
u32 seq_num;
u32 dp_flags;
} __attribute((packed)) Drbd_Data_Packet;
@@ -439,7 +441,7 @@
u64 sector;
u64 block_id;
u32 blksize;
- u32 pad; //make sure packet is a multiple of 8 Byte
+ u32 pad; /* to multiple of 8 Byte */
} __attribute((packed)) Drbd_BlockRequest_Packet;
/*
@@ -452,7 +454,7 @@
*/
typedef struct {
- Drbd_Header head; // 8 bytes
+ Drbd_Header head; /* 8 bytes */
u32 protocol_version;
u32 feature_flags;
@@ -462,12 +464,12 @@
u64 reserverd[8];
} __attribute((packed)) Drbd_HandShake_Packet;
-// 80 bytes, FIXED for the next century
+/* 80 bytes, FIXED for the next century */
typedef struct {
Drbd_Header head;
- u32 barrier; // barrier number _handle_ only
- u32 pad; // make sure packet is a multiple of 8 Byte
+ u32 barrier; /* barrier number _handle_ only */
+ u32 pad; /* to multiple of 8 Byte */
} __attribute((packed)) Drbd_Barrier_Packet;
typedef struct {
@@ -503,10 +505,10 @@
typedef struct {
Drbd_Header head;
- u64 d_size; // size of disk
- u64 u_size; // user requested size
- u64 c_size; // current exported size
- u32 max_segment_size; // Maximal size of a BIO
+ u64 d_size; /* size of disk */
+ u64 u_size; /* user requested size */
+ u64 c_size; /* current exported size */
+ u32 max_segment_size; /* Maximal size of a BIO */
u32 queue_order_type;
} __attribute((packed)) Drbd_Sizes_Packet;
@@ -628,10 +630,10 @@
struct drbd_barrier {
struct drbd_work w;
- struct list_head requests; // requests before
- struct drbd_barrier *next; // pointer to the next barrier
- unsigned int br_number; // the barriers identifier.
- int n_req; // number of requests attached before this barrier
+ struct list_head requests; /* requests before */
+ struct drbd_barrier *next; /* pointer to the next barrier */
+ unsigned int br_number; /* the barriers identifier. */
+ int n_req; /* number of requests attached before this barrier */
};
typedef struct drbd_request drbd_request_t;
@@ -678,30 +680,30 @@
/* global flag bits */
enum {
- ISSUE_BARRIER, // next Data is preceeded by a Barrier
- SIGNAL_ASENDER, // whether asender wants to be interrupted
- SEND_PING, // whether asender should send a ping asap
- WRITE_ACK_PENDING, // so BarrierAck won't overtake WriteAck
- WORK_PENDING, // completion flag for drbd_disconnect
- STOP_SYNC_TIMER, // tell timer to cancel itself
- UNPLUG_QUEUED, // only relevant with kernel 2.4
- UNPLUG_REMOTE, // whether sending a "UnplugRemote" makes sense
- MD_DIRTY, // current gen counts and flags not yet on disk
- DISCARD_CONCURRENT, // Set on one node, cleared on the peer!
- USE_DEGR_WFC_T, // Use degr-wfc-timeout instead of wfc-timeout.
- CLUSTER_ST_CHANGE, // Cluster wide state change going on...
+ ISSUE_BARRIER, /* next Data is preceeded by a Barrier */
+ SIGNAL_ASENDER, /* whether asender wants to be interrupted */
+ SEND_PING, /* whether asender should send a ping asap */
+ WRITE_ACK_PENDING, /* so BarrierAck won't overtake WriteAck */
+ WORK_PENDING, /* completion flag for drbd_disconnect */
+ STOP_SYNC_TIMER, /* tell timer to cancel itself */
+ UNPLUG_QUEUED, /* only relevant with kernel 2.4 */
+ UNPLUG_REMOTE, /* whether sending a "UnplugRemote" makes sense */
+ MD_DIRTY, /* current gen counts and flags not yet on disk */
+ DISCARD_CONCURRENT, /* Set on one node, cleared on the peer! */
+ USE_DEGR_WFC_T, /* Use degr-wfc-timeout instead of wfc-timeout. */
+ CLUSTER_ST_CHANGE, /* Cluster wide state change going on... */
CL_ST_CHG_SUCCESS,
CL_ST_CHG_FAIL,
- CRASHED_PRIMARY, // This node was a crashed primary. Gets
- // cleared when the state.conn goes into
- // Connected state.
- WRITE_BM_AFTER_RESYNC // A kmalloc() during resync failed
+ CRASHED_PRIMARY, /* This node was a crashed primary.
+ * Gets cleared when the state.conn
+ * goes into Connected state. */
+ WRITE_BM_AFTER_RESYNC /* A kmalloc() during resync failed */
};
-struct drbd_bitmap; // opaque for Drbd_Conf
+struct drbd_bitmap; /* opaque for Drbd_Conf */
-// TODO sort members for performance
-// MAYBE group them further
+/* TODO sort members for performance
+ * MAYBE group them further */
/* THINK maybe we actually want to use the default "event/%s" worker threads
* or similar in linux 2.6, which uses per cpu data and threads.
@@ -712,8 +714,8 @@
*/
struct drbd_work_queue {
struct list_head q;
- struct semaphore s; // producers up it, worker down()s it
- spinlock_t q_lock; // to protect the list.
+ struct semaphore s; /* producers up it, worker down()s it */
+ spinlock_t q_lock; /* to protect the list. */
};
/* If Philipp agrees, we remove the "mutex", and make_request will only
@@ -725,8 +727,10 @@
struct drbd_work_queue work;
struct semaphore mutex;
struct socket *socket;
- Drbd_Polymorph_Packet sbuf; // this way we get our
- Drbd_Polymorph_Packet rbuf; // send/receive buffers off the stack
+ /* this way we get our
+ * send/receive buffers off the stack */
+ Drbd_Polymorph_Packet sbuf;
+ Drbd_Polymorph_Packet rbuf;
};
struct drbd_md {
@@ -747,7 +751,7 @@
*/
};
-// for sync_conf and other types...
+/* for sync_conf and other types... */
#define PACKET(name, number, fields) struct name { fields };
#define INTEGER(pn, pr, member) int member;
#define INT64(pn, pr, member) __u64 member;
@@ -772,18 +776,18 @@
unsigned long flags;
/* configured by drbdsetup */
- struct net_conf *net_conf; // protected by inc_net() and dec_net()
+ struct net_conf *net_conf; /* protected by inc_net() and dec_net() */
struct syncer_conf sync_conf;
- struct drbd_backing_dev *bc; // protected by inc_local() dec_local()
+ struct drbd_backing_dev *bc; /* protected by inc_local() dec_local() */
sector_t p_size; /* partner's disk size */
request_queue_t *rq_queue;
struct block_device *this_bdev;
struct gendisk *vdisk;
- struct drbd_socket data; // for data/barrier/cstate/parameter packets
- struct drbd_socket meta; // for ping/ack (metadata) packets
- volatile unsigned long last_received; // in jiffies, either socket
+ struct drbd_socket data; /* data/barrier/cstate/parameter packets */
+ struct drbd_socket meta; /* ping/ack (metadata) packets */
+ volatile unsigned long last_received; /* in jiffies, either socket */
volatile unsigned int ko_count;
struct drbd_work resync_work,
unplug_work,
@@ -791,77 +795,91 @@
struct timer_list resync_timer;
struct timer_list md_sync_timer;
- drbd_state_t new_state_tmp; // Used after attach while negotiating new disk state.
+ drbd_state_t new_state_tmp; /* Used after attach while negotiating new disk state. */
drbd_state_t state;
wait_queue_head_t misc_wait;
- wait_queue_head_t state_wait; // upon each state change.
+ wait_queue_head_t state_wait; /* upon each state change. */
unsigned int send_cnt;
unsigned int recv_cnt;
unsigned int read_cnt;
unsigned int writ_cnt;
unsigned int al_writ_cnt;
unsigned int bm_writ_cnt;
- atomic_t ap_bio_cnt; // Requests we need to complete
- atomic_t ap_pending_cnt; // AP data packets on the wire, ack expected
- atomic_t rs_pending_cnt; // RS request/data packets on the wire
- atomic_t unacked_cnt; // Need to send replys for
- atomic_t local_cnt; // Waiting for local disk to signal completion
- atomic_t net_cnt; // Users of net_conf
+ atomic_t ap_bio_cnt; /* Requests we need to complete */
+ atomic_t ap_pending_cnt; /* AP data packets on the wire, ack expected */
+ atomic_t rs_pending_cnt; /* RS request/data packets on the wire */
+ atomic_t unacked_cnt; /* Need to send replys for */
+ atomic_t local_cnt; /* Waiting for local disk to signal completion */
+ atomic_t net_cnt; /* Users of net_conf */
spinlock_t req_lock;
struct drbd_barrier* unused_spare_barrier; /* for pre-allocation */
struct drbd_barrier* newest_barrier;
struct drbd_barrier* oldest_barrier;
struct hlist_head * tl_hash;
unsigned int tl_hash_s;
- // sector_t rs_left; // blocks not up-to-date [unit BM_BLOCK_SIZE]
- // moved into bitmap->bm_set
- unsigned long rs_total; // blocks to sync in this run [unit BM_BLOCK_SIZE]
- unsigned long rs_failed; // number of sync IOs that failed in this run
- unsigned long rs_start; // Syncer's start time [unit jiffies]
- unsigned long rs_paused; // cumulated time in PausedSyncX state [unit jiffies]
- unsigned long rs_mark_left;// block not up-to-date at mark [unit BM_BLOCK_SIZE]
- unsigned long rs_mark_time;// marks's time [unit jiffies]
+
+ /* blocks to sync in this run [unit BM_BLOCK_SIZE] */
+ unsigned long rs_total;
+ /* number of sync IOs that failed in this run */
+ unsigned long rs_failed;
+ /* Syncer's start time [unit jiffies] */
+ unsigned long rs_start;
+ /* cumulated time in PausedSyncX state [unit jiffies] */
+ unsigned long rs_paused;
+ /* block not up-to-date at mark [unit BM_BLOCK_SIZE] */
+ unsigned long rs_mark_left;
+ /* marks's time [unit jiffies] */
+ unsigned long rs_mark_time;
+
struct Drbd_thread receiver;
struct Drbd_thread worker;
struct Drbd_thread asender;
struct drbd_bitmap* bitmap;
- struct lru_cache* resync; // Used to track operations of resync...
- unsigned int resync_locked; // Number of locked elements in resync LRU
- unsigned int resync_wenr; // resync extent number waiting for application requests
+
+ /* Used to track operations of resync... */
+ struct lru_cache* resync;
+ /* Number of locked elements in resync LRU */
+ unsigned int resync_locked;
+ /* resync extent number waiting for application requests */
+ unsigned int resync_wenr;
+
int open_cnt;
u64 *p_uuid;
/* FIXME clean comments, restructure so it is more obvious which
* members are protected by what */
unsigned int epoch_size;
- struct list_head active_ee; // IO in progress
- struct list_head sync_ee; // IO in progress
- struct list_head done_ee; // send ack
- struct list_head read_ee; // IO in progress
- struct list_head net_ee; // zero-copy network send in progress
- struct hlist_head * ee_hash; // is proteced by req_lock!
+ struct list_head active_ee; /* IO in progress */
+ struct list_head sync_ee; /* IO in progress */
+ struct list_head done_ee; /* send ack */
+ struct list_head read_ee; /* IO in progress */
+ struct list_head net_ee; /* zero-copy network send in progress */
+ struct hlist_head *ee_hash; /* is proteced by req_lock! */
unsigned int ee_hash_s;
- struct Tl_epoch_entry * last_write_w_barrier; // ee_lock, single thread
- int next_barrier_nr; // ee_lock, single thread
- struct hlist_head * app_reads_hash; // is proteced by req_lock
+
+ /* this one is protected by ee_lock, single thread */
+ struct Tl_epoch_entry *last_write_w_barrier;
+
+ int next_barrier_nr;
+ struct hlist_head *app_reads_hash; /* is proteced by req_lock */
struct list_head resync_reads;
atomic_t pp_in_use;
wait_queue_head_t ee_wait;
- struct page *md_io_page; // one page buffer for md_io
- struct page *md_io_tmpp; // in case hardsect != 512 [ s390 only? ]
- struct semaphore md_io_mutex; // protects the md_io_buffer
+ struct page *md_io_page; /* one page buffer for md_io */
+ struct page *md_io_tmpp; /* for hardsect != 512 [s390 only?] */
+ struct semaphore md_io_mutex; /* protects the md_io_buffer */
spinlock_t al_lock;
wait_queue_head_t al_wait;
- struct lru_cache* act_log; // activity log
+ struct lru_cache* act_log; /* activity log */
unsigned int al_tr_number;
int al_tr_cycle;
- int al_tr_pos; // position of the next transaction in the journal
+ int al_tr_pos; /* position of the next transaction in the journal */
struct crypto_hash* cram_hmac_tfm;
wait_queue_head_t seq_wait;
atomic_t packet_seq;
unsigned int peer_seq;
spinlock_t peer_seq_lock;
int minor;
- unsigned long comm_bm_set; // communicated number of set bits.
+ unsigned long comm_bm_set; /* communicated number of set bits. */
};
static inline drbd_dev *minor_to_mdev(int minor)
@@ -908,7 +926,7 @@
* function declarations
*************************/
-// drbd_main.c
+/* drbd_main.c */
enum chg_state_flags {
ChgStateHard = 1,
@@ -974,10 +992,10 @@
extern int drbd_io_error(drbd_dev* mdev, int forcedetach);
extern void drbd_mdev_cleanup(drbd_dev *mdev);
-// drbd_meta-data.c (still in drbd_main.c)
+/* drbd_meta-data.c (still in drbd_main.c) */
extern void drbd_md_sync(drbd_dev *mdev);
extern int drbd_md_read(drbd_dev *mdev, struct drbd_backing_dev * bdev);
-// maybe define them below as inline?
+/* maybe define them below as inline? */
extern void drbd_uuid_set(drbd_dev *mdev, int idx, u64 val);
extern void _drbd_uuid_set(drbd_dev *mdev, int idx, u64 val);
extern void drbd_uuid_new_current(drbd_dev *mdev);
@@ -992,18 +1010,18 @@
* either at the end of the backing device
* or on a seperate meta data device. */
-#define MD_RESERVED_SECT ( 128LU << 11 ) // 128 MB, unit sectors
-// The following numbers are sectors
-#define MD_AL_OFFSET 8 // 8 Sectors after start of meta area
-#define MD_AL_MAX_SIZE 64 // = 32 kb LOG ~ 3776 extents ~ 14 GB Storage
-#define MD_BM_OFFSET (MD_AL_OFFSET + MD_AL_MAX_SIZE) //Allows up to about 3.8TB
+#define MD_RESERVED_SECT ( 128LU << 11 ) /* 128 MB, unit sectors */
+/* The following numbers are sectors */
+#define MD_AL_OFFSET 8 /* 8 Sectors after start of meta area */
+#define MD_AL_MAX_SIZE 64 /* = 32 kb LOG ~ 3776 extents ~ 14 GB Storage */
+#define MD_BM_OFFSET (MD_AL_OFFSET + MD_AL_MAX_SIZE) /* Allows up to about 3.8TB */
-#define MD_HARDSECT_B 9 // Since the smalles IO unit is usually 512 byte
+#define MD_HARDSECT_B 9 /* Since the smalles IO unit is usually 512 byte */
#define MD_HARDSECT (1<<MD_HARDSECT_B)
-// activity log
-#define AL_EXTENTS_PT ((MD_HARDSECT-12)/8-1) // 61 ; Extents per 512B sector
-#define AL_EXTENT_SIZE_B 22 // One extent represents 4M Storage
+/* activity log */
+#define AL_EXTENTS_PT ((MD_HARDSECT-12)/8-1) /* 61 ; Extents per 512B sector */
+#define AL_EXTENT_SIZE_B 22 /* One extent represents 4M Storage */
#define AL_EXTENT_SIZE (1<<AL_EXTENT_SIZE_B)
#if BITS_PER_LONG == 32
@@ -1018,19 +1036,19 @@
#error "LN2 of BITS_PER_LONG unknown!"
#endif
-// resync bitmap
-// 16MB sized 'bitmap extent' to track syncer usage
+/* resync bitmap */
+/* 16MB sized 'bitmap extent' to track syncer usage */
struct bm_extent {
struct lc_element lce;
- int rs_left; //number of bits set (out of sync) in this extent.
- int rs_failed; // number of failed resync requests in this extent.
+ int rs_left; /* number of bits set (out of sync) in this extent. */
+ int rs_failed; /* number of failed resync requests in this extent. */
unsigned long flags;
};
-#define BME_NO_WRITES 0 // bm_extent.flags: no more requests on this one!
-#define BME_LOCKED 1 // bm_extent.flags: syncer active on this one.
+#define BME_NO_WRITES 0 /* bm_extent.flags: no more requests on this one! */
+#define BME_LOCKED 1 /* bm_extent.flags: syncer active on this one. */
-// drbd_bitmap.c
+/* drbd_bitmap.c */
/*
* We need to store one bit for a block.
* Example: 1GB disk @ 4096 byte blocks ==> we need 32 KB bitmap.
@@ -1038,11 +1056,11 @@
* Bit 1 ==> local node thinks this block needs to be synced.
*/
-#define BM_BLOCK_SIZE_B 12 // 4k per bit
+#define BM_BLOCK_SIZE_B 12 /* 4k per bit */
#define BM_BLOCK_SIZE (1<<BM_BLOCK_SIZE_B)
/* (9+3) : 512 bytes @ 8 bits; representing 16M storage
* per sector of on disk bitmap */
-#define BM_EXT_SIZE_B (BM_BLOCK_SIZE_B + MD_HARDSECT_B + 3 ) // = 24
+#define BM_EXT_SIZE_B (BM_BLOCK_SIZE_B + MD_HARDSECT_B + 3 ) /* = 24 */
#define BM_EXT_SIZE (1<<BM_EXT_SIZE_B)
#if (BM_EXT_SIZE_B != 24) || (BM_BLOCK_SIZE_B != 12)
@@ -1140,10 +1158,10 @@
extern void drbd_bm_set_find(drbd_dev *mdev, unsigned long i);
extern unsigned long drbd_bm_total_weight(drbd_dev *mdev);
extern int drbd_bm_rs_done(drbd_dev *mdev);
-// for receive_bitmap
+/* for receive_bitmap */
extern void drbd_bm_merge_lel (drbd_dev *mdev, size_t offset, size_t number,
unsigned long* buffer);
-// for _drbd_send_bitmap and drbd_bm_write_sect
+/* for _drbd_send_bitmap and drbd_bm_write_sect */
extern void drbd_bm_get_lel (drbd_dev *mdev, size_t offset, size_t number,
unsigned long* buffer);
/*
@@ -1158,7 +1176,7 @@
extern void _drbd_bm_recount_bits(drbd_dev *mdev, char* file, int line);
#define drbd_bm_recount_bits(mdev) _drbd_bm_recount_bits(mdev, __FILE__, __LINE__ )
-// drbd_main.c
+/* drbd_main.c */
/* needs to be included here,
* because of kmem_cache_t weirdness */
@@ -1170,14 +1188,14 @@
extern mempool_t *drbd_request_mempool;
extern mempool_t *drbd_ee_mempool;
-extern struct page* drbd_pp_pool; // drbd's page pool
+extern struct page* drbd_pp_pool; /* drbd's page pool */
extern spinlock_t drbd_pp_lock;
extern int drbd_pp_vacant;
extern wait_queue_head_t drbd_pp_wait;
extern drbd_dev *drbd_new_device(int minor);
-// Dynamic tracing framework
+/* Dynamic tracing framework */
#ifdef ENABLE_DYNAMIC_TRACE
extern int trace_type;
@@ -1227,12 +1245,12 @@
} \
} while (0)
-// Buffer printing support
-// DbgPrintFlags: used for Flags arg to DbgPrintBuffer
-// - DBGPRINT_BUFFADDR; if set, each line starts with the
-// virtual address of the line being output. If clear,
-// each line starts with the offset from the beginning
-// of the buffer.
+/* Buffer printing support
+ * DbgPrintFlags: used for Flags arg to DbgPrintBuffer
+ * - DBGPRINT_BUFFADDR; if set, each line starts with the
+ * virtual address of the line being output. If clear,
+ * each line starts with the offset from the beginning
+ * of the buffer. */
typedef enum {
DBGPRINT_BUFFADDR = 0x0001,
} DbgPrintFlags;
@@ -1243,7 +1261,7 @@
const void *buffer, const void *buffer_va,
unsigned int length);
-// Bio printing support
+/* Bio printing support */
extern void _dump_bio(drbd_dev *mdev, struct bio *bio, int complete);
static inline void dump_bio(drbd_dev *mdev, struct bio *bio, int complete) {
@@ -1252,7 +1270,7 @@
);
}
-// Packet dumping support
+/* Packet dumping support */
extern void _dump_packet(drbd_dev *mdev, struct socket *sock,
int recv, Drbd_Polymorph_Packet *p, char* file, int line);
@@ -1274,14 +1292,14 @@
#define dump_packet(ignored...) ((void)0)
#endif
-// drbd_req
+/* drbd_req */
extern int drbd_make_request_26(request_queue_t *q, struct bio *bio);
extern int drbd_read_remote(drbd_dev *mdev, drbd_request_t *req);
extern int drbd_merge_bvec(request_queue_t *, struct bio *, struct bio_vec *);
extern int is_valid_ar_handle(drbd_request_t *, sector_t);
-// drbd_nl.c
+/* drbd_nl.c */
extern char* ppsize(char* buf, unsigned long long size);
extern sector_t drbd_new_dev_size(struct Drbd_Conf*, struct drbd_backing_dev*);
extern int drbd_determin_dev_size(drbd_dev*);
@@ -1293,17 +1311,17 @@
extern long drbd_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg);
extern int drbd_khelper(drbd_dev *mdev, char* cmd);
-// drbd_worker.c
+/* drbd_worker.c */
extern int drbd_worker(struct Drbd_thread *thi);
extern void drbd_alter_sa(drbd_dev *mdev, int na);
extern void drbd_start_resync(drbd_dev *mdev, drbd_conns_t side);
extern void resume_next_sg(drbd_dev* mdev);
extern void suspend_other_sg(drbd_dev* mdev);
extern int drbd_resync_finished(drbd_dev *mdev);
-// maybe rather drbd_main.c ?
+/* maybe rather drbd_main.c ? */
extern int drbd_md_sync_page_io(drbd_dev *mdev, struct drbd_backing_dev *bdev,
sector_t sector, int rw);
-// worker callbacks
+/* worker callbacks */
extern int w_req_cancel_conflict (drbd_dev *, struct drbd_work *, int);
extern int w_read_retry_remote (drbd_dev *, struct drbd_work *, int);
extern int w_e_end_data_req (drbd_dev *, struct drbd_work *, int);
@@ -1320,7 +1338,7 @@
extern void resync_timer_fn(unsigned long data);
-// drbd_receiver.c
+/* drbd_receiver.c */
extern int drbd_release_ee(drbd_dev* mdev, struct list_head* list);
extern struct Tl_epoch_entry* drbd_alloc_ee(drbd_dev *mdev,
u64 id,
@@ -1362,13 +1380,13 @@
#endif
}
-// drbd_proc.c
+/* drbd_proc.c */
extern struct proc_dir_entry *drbd_proc;
extern struct file_operations drbd_proc_fops;
extern const char* conns_to_name(drbd_conns_t s);
extern const char* roles_to_name(drbd_role_t s);
-// drbd_actlog.c
+/* drbd_actlog.c */
extern void drbd_al_begin_io(struct Drbd_Conf *mdev, sector_t sector);
extern void drbd_al_complete_io(struct Drbd_Conf *mdev, sector_t sector);
extern void drbd_rs_complete_io(struct Drbd_Conf *mdev, sector_t sector);
@@ -1389,7 +1407,7 @@
extern void drbd_al_shrink(struct Drbd_Conf *mdev);
-// drbd_nl.c
+/* drbd_nl.c */
void drbd_nl_cleanup(void);
int __init drbd_nl_init(void);
Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c 2007-07-24 12:51:35 UTC (rev 2989)
@@ -93,35 +93,33 @@
int fault_rate;
int fault_count;
int fault_devs;
-module_param(enable_faults, int, 0664); // bitmap of enabled faults
-module_param(fault_rate, int, 0664); // fault rate % value - applies to all enabled faults
-module_param(fault_count, int, 0664); // count of faults inserted
-module_param(fault_devs, int, 0644); // bitmap of devices to insert faults on
+module_param(enable_faults, int, 0664); /* bitmap of enabled faults */
+module_param(fault_rate, int, 0664); /* fault rate % value - applies to all enabled faults */
+module_param(fault_count, int, 0664); /* count of faults inserted */
+module_param(fault_devs, int, 0644); /* bitmap of devices to insert faults on */
#endif
-// module parameter, defined
+/* module parameter, defined */
int minor_count = 32;
int allow_oos = 0;
#ifdef ENABLE_DYNAMIC_TRACE
-int trace_type = 0; // Bitmap of trace types to enable
-int trace_level = 0; // Current trace level
-int trace_devs = 0; // Bitmap of devices to trace
+int trace_type = 0; /* Bitmap of trace types to enable */
+int trace_level = 0; /* Current trace level */
+int trace_devs = 0; /* Bitmap of devices to trace */
module_param(trace_level, int, 0644);
module_param(trace_type, int, 0644);
module_param(trace_devs, int, 0644);
#endif
-
-// Module parameter for setting the user mode helper program
-// to run. Default is /sbin/drbdadm
-
+/* Module parameter for setting the user mode helper program
+ * to run. Default is /sbin/drbdadm */
char usermode_helper[80] = "/sbin/drbdadm";
module_param_string(usermode_helper, usermode_helper, sizeof(usermode_helper), 0644);
-// global panic flag
+/* global panic flag */
volatile int drbd_did_panic = 0;
/* in 2.6.x, our device mapping and config info contains our virtual gendisks
@@ -340,11 +338,11 @@
if (ok) WARN("Notified peer that my disk is broken.\n");
else ERR("Sending state in drbd_io_error() failed\n");
- // Make sure we try to flush meta-data to disk - we come
- // in here because of a local disk error so it might fail
- // but we still need to try -- both because the error might
- // be in the data portion of the disk and because we need
- // to ensure the md-sync-timer is stopped if running.
+ /* Make sure we try to flush meta-data to disk - we come
+ * in here because of a local disk error so it might fail
+ * but we still need to try -- both because the error might
+ * be in the data portion of the disk and because we need
+ * to ensure the md-sync-timer is stopped if running. */
drbd_md_sync(mdev);
/* Releasing the backing device is done in after_state_ch() */
@@ -419,7 +417,7 @@
rv = is_valid_state(mdev, ns);
if (rv==SS_Success) {
rv = is_valid_state_transition(mdev, ns, os);
- if (rv==SS_Success) rv = 0; // cont waiting, otherwise fail.
+ if (rv==SS_Success) rv = 0; /* cont waiting, otherwise fail. */
}
}
spin_unlock_irqrestore(&mdev->req_lock, flags);
@@ -465,7 +463,7 @@
wait_event(mdev->state_wait, (rv = _req_st_cond(mdev, mask, val)));
if (rv < SS_Success) {
- // nearly dead code.
+ /* nearly dead code. */
drbd_state_unlock(mdev);
if (f & ChgStateVerbose) print_st_err(mdev, os, ns, rv);
return rv;
@@ -872,9 +870,9 @@
state change. This function might sleep */
if (fp == Stonith && ns.susp) {
- // case1: The outdate peer handler is successfull:
- // case2: The connection was established again:
- if ( (os.pdsk > Outdated && ns.pdsk <= Outdated) || // case1
+ /* case1: The outdate peer handler is successfull:
+ * case2: The connection was established again: */
+ if ( (os.pdsk > Outdated && ns.pdsk <= Outdated) ||
(os.conn < Connected && ns.conn >= Connected) ) {
tl_clear(mdev);
spin_lock_irq(&mdev->req_lock);
@@ -883,7 +881,7 @@
spin_unlock_irq(&mdev->req_lock);
}
}
- // Do not change the order of the if above and below...
+ /* Do not change the order of the if above and below... */
if (os.conn != WFBitMapS && ns.conn == WFBitMapS) {
/* compare with drbd_make_request_common,
* wait_event and inc_ap_bio.
@@ -892,9 +890,9 @@
wait_event(mdev->misc_wait,
mdev->state.conn != WFBitMapS ||
!atomic_read(&mdev->ap_bio_cnt));
- drbd_bm_lock(mdev); // {
+ drbd_bm_lock(mdev);
drbd_send_bitmap(mdev);
- drbd_bm_unlock(mdev); // }
+ drbd_bm_unlock(mdev);
}
/* Lost contact to peer's copy of the data */
@@ -939,7 +937,7 @@
/* Last part of the attaching process ... */
if ( ns.conn >= Connected &&
os.disk == Attaching && ns.disk == Negotiating ) {
- drbd_send_sizes(mdev); // to start sync...
+ drbd_send_sizes(mdev); /* to start sync... */
drbd_send_uuids(mdev);
drbd_send_state(mdev);
}
@@ -961,7 +959,7 @@
if ( ( os.conn != StartingSyncT && ns.conn == StartingSyncT ) ||
( os.conn != StartingSyncS && ns.conn == StartingSyncS ) ) {
- drbd_bm_lock(mdev); // racy...
+ drbd_bm_lock(mdev); /* racy... */
drbd_md_set_flag(mdev, MDF_FullSync);
drbd_md_sync(mdev);
@@ -987,7 +985,7 @@
/* We are invalidating our self... */
if ( os.conn < Connected && ns.conn < Connected &&
os.disk > Inconsistent && ns.disk == Inconsistent ) {
- drbd_bm_lock(mdev); // racy...
+ drbd_bm_lock(mdev); /* racy... */
drbd_md_set_flag(mdev, MDF_FullSync);
drbd_md_sync(mdev);
@@ -1012,24 +1010,24 @@
lc_free(mdev->act_log); mdev->act_log = NULL;
}
- // A resync finished or aborted, wake paused devices...
+ /* A resync finished or aborted, wake paused devices... */
if ( (os.conn > Connected && ns.conn <= Connected) ||
(os.peer_isp && !ns.peer_isp) ||
(os.user_isp && !ns.user_isp) ) {
resume_next_sg(mdev);
}
- // Receiver should clean up itself
+ /* Receiver should clean up itself */
if (os.conn != Disconnecting && ns.conn == Disconnecting) {
drbd_thread_signal(&mdev->receiver);
}
- // Now the receiver finished cleaning up itself, it should die now
+ /* Now the receiver finished cleaning up itself, it should die now */
if (os.conn != StandAlone && ns.conn == StandAlone) {
drbd_thread_stop_nowait(&mdev->receiver);
}
- // Upon network failure, we need to restart the receiver.
+ /* Upon network failure, we need to restart the receiver. */
if ( os.conn > TearDown &&
ns.conn <= TearDown && ns.conn >= Timeout) {
drbd_thread_restart_nowait(&mdev->receiver);
@@ -1072,7 +1070,7 @@
thi->task = current;
smp_mb();
spin_unlock(&thi->t_lock);
- complete(&thi->startstop); // notify: thi->task is set.
+ complete(&thi->startstop); /* notify: thi->task is set. */
while(1) {
retval = thi->function(thi);
@@ -1086,8 +1084,8 @@
smp_mb();
spin_unlock(&thi->t_lock);
- // THINK maybe two different completions?
- complete(&thi->startstop); // notify: thi->task unset.
+ /* THINK maybe two different completions? */
+ complete(&thi->startstop); /* notify: thi->task unset. */
return retval;
}
@@ -1121,13 +1119,13 @@
D_ASSERT(thi->task == NULL);
thi->t_state = Running;
spin_unlock(&thi->t_lock);
- flush_signals(current); // otherw. may get -ERESTARTNOINTR
+ flush_signals(current); /* otherw. may get -ERESTARTNOINTR */
pid = kernel_thread(drbd_thread_setup, (void *) thi, CLONE_FS);
if (pid < 0) {
ERR("Couldn't start thread (%d)\n", pid);
return FALSE;
}
- wait_for_completion(&thi->startstop); // waits until thi->task is set
+ wait_for_completion(&thi->startstop); /* waits until thi->task is set */
D_ASSERT(thi->task);
D_ASSERT(get_t_state(thi) == Running);
} else {
@@ -1304,7 +1302,7 @@
int i;
u64 uuid_flags = 0;
- if (!inc_local_if_state(mdev, Negotiating)) return 1; // ok.
+ if (!inc_local_if_state(mdev, Negotiating)) return 1; /* ok. */
for (i = Current; i < UUID_SIZE; i++) {
/* FIXME howto handle diskless ? */
@@ -1410,7 +1408,7 @@
ERR_IF(!mdev->bitmap) return FALSE;
bm_words = drbd_bm_words(mdev);
- p = vmalloc(PAGE_SIZE); // sleeps. cannot fail.
+ p = vmalloc(PAGE_SIZE); /* sleeps. cannot fail. */
buffer = (unsigned long*)p->payload;
if (drbd_md_test_flag(mdev->bc, MDF_FullSync)) {
@@ -1539,8 +1537,8 @@
STATIC int we_should_drop_the_connection(drbd_dev *mdev, struct socket *sock)
{
int drop_it;
- // long elapsed = (long)(jiffies - mdev->last_received);
- // DUMPLU(elapsed); // elapsed ignored for now.
+ /* long elapsed = (long)(jiffies - mdev->last_received); */
+ /* DUMPLU(elapsed); // elapsed ignored for now. */
drop_it = mdev->meta.socket == sock
|| !mdev->asender.task
@@ -1650,7 +1648,7 @@
}
len -= sent;
offset += sent;
- // FIXME test "last_received" ...
+ /* FIXME test "last_received" ... */
} while(len > 0 /* THINK && mdev->cstate >= Connected*/);
set_fs(oldfs);
@@ -1786,7 +1784,7 @@
if (!sock) return -1000;
- // THINK if (signal_pending) return ... ?
+ /* THINK if (signal_pending) return ... ? */
iov.iov_base = buf;
iov.iov_len = size;
@@ -1839,7 +1837,7 @@
if (DRBD_ratelimit(5*HZ, 5)) {
DBG("Got a signal in drbd_send(,%c,)!\n",
sock == mdev->meta.socket ? 'm' : 's');
- // dump_stack();
+ /* dump_stack(); */
}
#endif
flush_signals(current);
@@ -1949,7 +1947,7 @@
{
mdev->sync_conf.after = DRBD_AFTER_DEF;
mdev->sync_conf.rate = DRBD_RATE_DEF;
- mdev->sync_conf.al_extents = DRBD_AL_EXTENTS_DEF; // 512 MB active set
+ mdev->sync_conf.al_extents = DRBD_AL_EXTENTS_DEF; /* 512 MB active set */
mdev->state = (drbd_state_t){ { Secondary,
Unknown,
StandAlone,
@@ -1960,8 +1958,8 @@
void drbd_init_set_defaults(drbd_dev *mdev)
{
- // the memset(,0,) did most of this
- // note: only assignments, no allocation in here
+ /* the memset(,0,) did most of this.
+ * note: only assignments, no allocation in here */
#ifdef PARANOIA
SET_MDEV_MAGIC(mdev);
@@ -2090,7 +2088,7 @@
drbd_set_my_capacity(mdev, 0);
drbd_bm_resize(mdev, 0);
- // just in case
+ /* just in case */
drbd_free_resources(mdev);
/*
@@ -2143,13 +2141,13 @@
const int number = (DRBD_MAX_SEGMENT_SIZE/PAGE_SIZE) * minor_count;
int i;
- // prepare our caches and mempools
+ /* prepare our caches and mempools */
drbd_request_mempool = NULL;
drbd_ee_cache = NULL;
drbd_request_cache = NULL;
drbd_pp_pool = NULL;
- // caches
+ /* caches */
drbd_request_cache = drbd_kmem_cache_create(
"drbd_req_cache", sizeof(drbd_request_t),
0, 0, NULL);
@@ -2162,7 +2160,7 @@
if (drbd_ee_cache == NULL)
goto Enomem;
- // mempools
+ /* mempools */
drbd_request_mempool = mempool_create( number,
mempool_alloc_slab, mempool_free_slab, drbd_request_cache);
if (drbd_request_mempool == NULL)
@@ -2173,7 +2171,7 @@
if (drbd_request_mempool == NULL)
goto Enomem;
- // drbd's page pool
+ /* drbd's page pool */
spin_lock_init(&drbd_pp_lock);
for (i = 0;i< number;i++) {
@@ -2187,7 +2185,7 @@
return 0;
Enomem:
- drbd_destroy_mempools(); // in case we allocated some
+ drbd_destroy_mempools(); /* in case we allocated some */
return -ENOMEM;
}
@@ -2335,20 +2333,20 @@
add_disk(disk);
mdev->this_bdev = bdget(MKDEV(DRBD_MAJOR, minor));
- // we have no partitions. we contain only ourselves.
+ /* we have no partitions. we contain only ourselves. */
mdev->this_bdev->bd_contains = mdev->this_bdev;
blk_queue_make_request(q, drbd_make_request_26);
blk_queue_merge_bvec(q, drbd_merge_bvec);
- q->queue_lock = &mdev->req_lock; // needed since we use
- // plugging on a queue, that actually has no requests!
+ q->queue_lock = &mdev->req_lock; /* needed since we use */
+ /* plugging on a queue, that actually has no requests! */
q->unplug_fn = drbd_unplug_fn;
mdev->md_io_page = alloc_page(GFP_KERNEL);
if (!mdev->md_io_page) goto Enomem;
if (drbd_bm_init(mdev)) goto Enomem;
- // no need to lock access, we are still initializing the module.
+ /* no need to lock access, we are still initializing the module. */
if (!tl_init(mdev)) goto Enomem;
mdev->app_reads_hash = kzalloc(APP_R_HSIZE*sizeof(void*), GFP_KERNEL);
@@ -2411,7 +2409,7 @@
init_waitqueue_head(&drbd_pp_wait);
- drbd_proc = NULL; // play safe for drbd_cleanup
+ drbd_proc = NULL; /* play safe for drbd_cleanup */
minor_table = kzalloc(sizeof(drbd_dev *)*minor_count, GFP_KERNEL);
if (!minor_table) goto Enomem;
@@ -2442,11 +2440,11 @@
printk(KERN_INFO DEVICE_NAME": registered as block device major %d\n", DRBD_MAJOR);
printk(KERN_INFO DEVICE_NAME": minor_table @ 0x%p\n", minor_table);
- return 0; // Success!
+ return 0; /* Success! */
Enomem:
drbd_cleanup();
- if (err == -ENOMEM) // currently always the case
+ if (err == -ENOMEM) /* currently always the case */
printk(KERN_ERR DEVICE_NAME ": ran out of memory\n");
else
printk(KERN_ERR DEVICE_NAME ": initialization failure\n");
@@ -2494,18 +2492,18 @@
/* meta data management */
struct meta_data_on_disk {
- u64 la_size; // last agreed size.
- u64 uuid[UUID_SIZE]; // UUIDs.
+ u64 la_size; /* last agreed size. */
+ u64 uuid[UUID_SIZE]; /* UUIDs. */
u64 device_uuid;
u64 reserved_u64_1;
- u32 flags; // MDF
+ u32 flags; /* MDF */
u32 magic;
u32 md_size_sect;
- u32 al_offset; // offset to this block
- u32 al_nr_extents; // important for restoring the AL
- // `-- act_log->nr_elements <-- sync_conf.al_extents
- u32 bm_offset; // offset to the bitmap, from here
- u32 bm_bytes_per_bit; // BM_BLOCK_SIZE
+ u32 al_offset; /* offset to this block */
+ u32 al_nr_extents; /* important for restoring the AL */
+ /* `-- act_log->nr_elements <-- sync_conf.al_extents */
+ u32 bm_offset; /* offset to the bitmap, from here */
+ u32 bm_bytes_per_bit; /* BM_BLOCK_SIZE */
u32 reserved_u32[4];
} __attribute((packed));
@@ -2523,8 +2521,8 @@
if (!test_and_clear_bit(MD_DIRTY, &mdev->flags)) return;
del_timer(&mdev->md_sync_timer);
- // We use here Failed and not Attaching because we try to write
- // metadata even if we detach due to a disk failure!
+ /* We use here Failed and not Attaching because we try to write
+ * metadata even if we detach due to a disk failure! */
if (!inc_local_if_state(mdev, Failed)) return;
INFO("Writing meta data super block now.\n");
@@ -2569,7 +2567,8 @@
drbd_io_error(mdev, TRUE);
}
- // Update mdev->bc->md.la_size_sect, since we updated it on metadata.
+ /* Update mdev->bc->md.la_size_sect,
+ * since we updated it on metadata. */
mdev->bc->md.la_size_sect = drbd_get_capacity(mdev->this_bdev);
up(&mdev->md_io_mutex);
@@ -2797,8 +2796,8 @@
}
#ifdef DRBD_ENABLE_FAULTS
-// Fault insertion support including random number generator shamelessly
-// stolen from kernel/rcutorture.c
+/* Fault insertion support including random number generator shamelessly
+ * stolen from kernel/rcutorture.c */
struct fault_random_state {
unsigned long state;
unsigned long count;
@@ -2929,7 +2928,7 @@
const unsigned char *p;
int count;
- // verify size parameter
+ /* verify size parameter */
if (size != sizeof(char) && size != sizeof(short) && size != sizeof(int)) {
printk(KERN_DEBUG "drbd_print_buffer: ERROR invalid size %d\n", size);
return;
@@ -2938,40 +2937,40 @@
sizemask = size-1;
field_width = size*2;
- // Adjust start/end to be on appropriate boundary for size
+ /* Adjust start/end to be on appropriate boundary for size */
buffer = (const char *)((long)buffer & ~sizemask);
pend = (const unsigned char *)(((long)buffer + length + sizemask) & ~sizemask);
if (flags & DBGPRINT_BUFFADDR) {
- // Move start back to nearest multiple of line size if printing address
- // This results in nicely formatted output with addresses being on
- // line size (16) byte boundaries
+ /* Move start back to nearest multiple of line size,
+ * if printing address. This results in nicely formatted output
+ * with addresses being on line size (16) byte boundaries */
pstart = (const unsigned char *)((long)buffer & ~(LINE_SIZE-1));
} else {
pstart = (const unsigned char *)buffer;
}
- // Set value of start VA to print if addresses asked for
+ /* Set value of start VA to print if addresses asked for */
pstart_va = (const unsigned char *)buffer_va - ((const unsigned char *)buffer-pstart);
- // Calculate end position to nicely align right hand side
+ /* Calculate end position to nicely align right hand side */
pend_str = pstart + (((pend-pstart) + LINE_SIZE-1) & ~(LINE_SIZE-1));
- // Init strings
+ /* Init strings */
*pbytes = *pascii = '\0';
- // Start at beginning of first line
+ /* Start at beginning of first line */
p = pstart;
count = 0;
while (p < pend_str) {
if (p < (const unsigned char *)buffer || p >= pend) {
- // Before start of buffer or after end- print spaces
+ /* Before start of buffer or after end- print spaces */
pbytes += sprintf(pbytes, "%*c ", field_width, ' ');
pascii += sprintf(pascii, "%*c", size, ' ');
p += size;
} else {
- // Add hex and ascii to strings
+ /* Add hex and ascii to strings */
int val;
switch (size) {
default:
@@ -2997,7 +2996,7 @@
count++;
if (count == LINE_ENTRIES || p >= pend_str) {
- // Null terminate and print record
+ /* Null terminate and print record */
*pascii = '\0';
printk(KERN_DEBUG "%s%8.8lx: %*s|%*s|\n",
prefix,
@@ -3006,13 +3005,13 @@
LINE_ENTRIES*(field_width+1), bytes_str,
LINE_SIZE, ascii_str);
- // Move onto next line
+ /* Move onto next line */
pstart_va += (p-pstart);
pstart = p;
count = 0;
offset+= LINE_SIZE;
- // Re-init strings
+ /* Re-init strings */
pbytes = bytes_str;
pascii = ascii_str;
*pbytes = *pascii = '\0';
@@ -3180,7 +3179,7 @@
}
}
-// Debug routine to dump info about bio
+/* Debug routine to dump info about bio */
void _dump_bio(drbd_dev *mdev, struct bio *bio, int complete)
{
Modified: branches/drbd-8.0-for-linus/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_nl.c 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c 2007-07-24 12:51:35 UTC (rev 2989)
@@ -45,7 +45,7 @@
char *drbd_m_holder = "Hands off! this is DRBD's meta data device.";
-// Generate the tag_list to struct functions
+/* Generate the tag_list to struct functions */
#define PACKET(name, number, fields) \
int name ## _from_tags (drbd_dev *mdev, unsigned short* tags, struct name * arg) \
{ \
@@ -85,7 +85,7 @@
break;
#include "linux/drbd_nl.h"
-// Generate the struct to tag_list functions
+/* Generate the struct to tag_list functions */
#define PACKET(name, number, fields) \
unsigned short* \
name ## _to_tags (drbd_dev *mdev, struct name * arg, unsigned short* tags) \
@@ -121,7 +121,7 @@
void drbd_nl_send_reply(struct cn_msg *, int);
char *nl_packet_name(int packet_type) {
-// Generate packet type strings
+/* Generate packet type strings */
#define PACKET(name, number, fields) \
[ P_ ## name ] = # name,
#define INTEGER Argh!
@@ -241,7 +241,7 @@
drbd_disks_t nps;
if (new_role == Primary) {
- request_ping(mdev); // Detect a dead peer ASAP
+ request_ping(mdev); /* Detect a dead peer ASAP */
}
mask.i = 0; mask.role = role_mask;
@@ -289,14 +289,14 @@
continue;
}
if (r == SS_TwoPrimaries) {
- // Maybe the peer is detected as dead very soon...
+ /* Maybe the peer is detected as dead very soon... */
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout((mdev->net_conf->ping_timeo+1)*HZ/10);
- if (try == 1) try++; // only a single retry in this case.
+ if (try == 1) try++; /* only a single retry in this case. */
continue;
}
if (r < SS_Success) {
- r = drbd_request_state(mdev, mask, val); // Be verbose.
+ r = drbd_request_state(mdev, mask, val); /* Be verbose. */
if (r < SS_Success) goto fail;
}
break;
@@ -416,7 +416,7 @@
bdev->md.md_offset = drbd_md_ss__(mdev, bdev);
/* al size is still fixed */
bdev->md.al_offset = -MD_AL_MAX_SIZE;
- //LGE FIXME max size check missing.
+ /* LGE FIXME max size check missing. */
/* we need (slightly less than) ~ this much bitmap sectors: */
md_size_sect = drbd_get_capacity(bdev->backing_bdev);
md_size_sect = ALIGN(md_size_sect, BM_SECT_PER_EXT);
@@ -436,7 +436,7 @@
char* ppsize(char* buf, unsigned long long size)
{
- // Needs 9 bytes at max.
+ /* Needs 9 bytes at max. */
static char units[] = { 'K', 'M', 'G', 'T', 'P', 'E' };
int base = 0;
while (size >= 10000 ) {
@@ -452,7 +452,7 @@
*/
int drbd_determin_dev_size(struct Drbd_Conf* mdev)
{
- sector_t prev_first_sect, prev_size; // previous meta location
+ sector_t prev_first_sect, prev_size; /* previous meta location */
sector_t la_size;
sector_t size;
char ppb[10];
@@ -466,7 +466,7 @@
prev_size = mdev->bc->md.md_size_sect;
la_size = mdev->bc->md.la_size_sect;
- // TODO: should only be some assert here, not (re)init...
+ /* TODO: should only be some assert here, not (re)init... */
drbd_md_set_sector_offsets(mdev, mdev->bc);
size = drbd_new_dev_size(mdev, mdev->bc);
@@ -489,7 +489,7 @@
}
rv = err;
}
- // racy, see comments above.
+ /* racy, see comments above. */
drbd_set_my_capacity(mdev, size);
mdev->bc->md.la_size_sect = size;
INFO("size = %s (%llu KB)\n", ppsize(ppb, size>>1),
@@ -499,7 +499,7 @@
la_size_changed = (la_size != mdev->bc->md.la_size_sect);
- //LGE: flexible device size!! is this the right thing to test?
+ /* LGE: flexible device size!! is this the right thing to test? */
md_moved = prev_first_sect != drbd_md_first_sector(mdev->bc)
|| prev_size != mdev->bc->md.md_size_sect;
@@ -510,9 +510,10 @@
if (la_size_changed || md_moved) {
if ( inc_local_if_state(mdev, Attaching) ) {
- drbd_al_shrink(mdev); // All extents inactive.
- rv = drbd_bm_write(mdev); // write bitmap
- // Write mdev->la_size to on disk.
+ drbd_al_shrink(mdev);
+ /* All extents inactive now...
+ * write bitmap, then mdev->la_size to disk */
+ rv = drbd_bm_write(mdev);
drbd_md_mark_dirty(mdev);
dec_local(mdev);
}
@@ -526,10 +527,10 @@
sector_t
drbd_new_dev_size(struct Drbd_Conf* mdev, struct drbd_backing_dev *bdev)
{
- sector_t p_size = mdev->p_size; // partner's disk size.
- sector_t la_size = bdev->md.la_size_sect; // last agreed size.
- sector_t m_size; // my size
- sector_t u_size = bdev->dc.disk_size; // size requested by user.
+ sector_t p_size = mdev->p_size; /* partner's disk size. */
+ sector_t la_size = bdev->md.la_size_sect; /* last agreed size. */
+ sector_t m_size; /* my size */
+ sector_t u_size = bdev->dc.disk_size; /* size requested by user. */
sector_t size = 0;
m_size = drbd_get_max_capacity(bdev);
@@ -614,7 +615,7 @@
} else {
if (t) lc_free(t);
}
- drbd_md_mark_dirty(mdev); //we changed mdev->act_log->nr_elemens
+ drbd_md_mark_dirty(mdev); /* we changed mdev->act_log->nr_elemens */
return 0;
}
@@ -622,7 +623,7 @@
{
request_queue_t * const q = mdev->rq_queue;
request_queue_t * const b = mdev->bc->backing_bdev->bd_disk->queue;
- //unsigned int old_max_seg_s = q->max_segment_size;
+ /* unsigned int old_max_seg_s = q->max_segment_size; */
if (b->merge_bvec_fn && !mdev->bc->dc.use_bmbv)
max_seg_s = PAGE_SIZE;
@@ -646,12 +647,11 @@
q->seg_boundary_mask = PAGE_SIZE-1;
blk_queue_stack_limits(q, b);
- // KERNEL BUG. in ll_rw_blk.c
- // t->max_segment_size = min(t->max_segment_size,b->max_segment_size);
- // should be
- // t->max_segment_size = min_not_zero(...,...)
-
- // workaround here:
+ /* KERNEL BUG. in ll_rw_blk.c ??
+ * t->max_segment_size = min(t->max_segment_size,b->max_segment_size);
+ * should be
+ * t->max_segment_size = min_not_zero(...,...)
+ * workaround here: */
if (q->max_segment_size == 0) q->max_segment_size = max_seg_s;
MTRACE(TraceTypeRq, TraceLvlSummary,
@@ -683,7 +683,7 @@
struct drbd_nl_cfg_reply *reply)
{
enum ret_codes retcode;
- struct drbd_backing_dev* nbc = NULL; // new_backing_conf
+ struct drbd_backing_dev* nbc = NULL; /* new_backing_conf */
struct inode *inode, *inode2;
struct lru_cache* resync_lru = NULL;
drbd_state_t ns, os;
@@ -808,36 +808,10 @@
goto release_bdev2_fail;
}
-// warning LGE checks below no longer valid
-// --- rewrite
-#if 0
- if (drbd_get_capacity(nbc->backing_bdev) >= (sector_t)DRBD_MAX_SECTORS) {
- retcode = LDDeviceTooLarge;
- goto release_bdev2_fail;
- }
+/* TODO check whether backing device size is within plausible limits */
- if (nbc->dc.meta_dev_idx == -1) i = 1;
- else i = nbc->dc.meta_dev_idx+1;
-
- /* for internal, we need to check agains <= (then we have a drbd with
- * zero size, but meta data...) to be on the safe side, I require 32MB
- * minimal data storage area for drbd with internal meta data (thats
- * 160 total). if someone wants to use that small devices, she can use
- * drbd 0.6 anyways...
- *
- * FIXME this is arbitrary and needs to be reconsidered as soon as we
- * move to flexible size meta data.
- */
- if ( drbd_get_capacity(nbc->md_bdev) < 2*MD_RESERVED_SIZE*i
- + (nbc->dc.meta_dev_idx == -1) ? (1<<16) : 0 )
- {
- retcode = MDDeviceTooSmall;
- goto release_bdev2_fail;
- }
-#endif
-// -- up to here
-
- // Make sure the new disk is big enough
+ /* Make sure the new disk is big enough
+ * (we may currently be Primary with no local disk...) */
if (drbd_get_capacity(nbc->backing_bdev) <
drbd_get_capacity(mdev->this_bdev) ) {
retcode = LDDeviceTooSmall;
@@ -855,13 +829,13 @@
goto force_diskless;
}
- // Since we are diskless, fix the AL first...
+ /* Since we are diskless, fix the AL first... */
if (drbd_check_al_size(mdev)) {
retcode = KMallocFailed;
goto force_diskless;
}
- // Prevent shrinking of consistent devices !
+ /* Prevent shrinking of consistent devices ! */
if (drbd_md_test_flag(nbc, MDF_Consistent) &&
drbd_new_dev_size(mdev, nbc) < nbc->md.la_size_sect) {
retcode = LDDeviceTooSmall;
@@ -921,7 +895,7 @@
set_bit(USE_DEGR_WFC_T, &mdev->flags);
}
- drbd_bm_lock(mdev); // racy...
+ drbd_bm_lock(mdev); /* racy... */
drbd_determin_dev_size(mdev);
if (drbd_md_test_flag(mdev->bc, MDF_FullSync)) {
@@ -1165,7 +1139,6 @@
((char*)new_conf->shared_secret)[SHARED_SECRET_MAX-1] = 0;
#if 0
-FIXME LGE
/* for the connection loss logic in drbd_recv
* I _need_ the resulting timeo in jiffies to be
* non-zero and different
@@ -1177,8 +1150,8 @@
* sock_{send,recv}msg returns -EINTR,
* if the timeout expires, -EAGAIN.
*/
- // unlikely: someone disabled the timeouts ...
- // just put some huge values in there.
+ /* unlikely: someone disabled the timeouts ...
+ * just put some huge values in there. */
if (!new_conf->ping_int)
new_conf->ping_int = MAX_SCHEDULE_TIMEOUT/HZ;
if (!new_conf->timeout)
@@ -1232,22 +1205,22 @@
{
int retcode;
- retcode = _drbd_request_state(mdev, NS(conn, Disconnecting), 0); // silently.
+ retcode = _drbd_request_state(mdev, NS(conn, Disconnecting), 0); /* silently. */
if (retcode == SS_NothingToDo) goto done;
else if (retcode == SS_AlreadyStandAlone) goto done;
else if (retcode == SS_PrimaryNOP) {
- // Our statche checking code wants to see the peer outdated.
+ /* Our statche checking code wants to see the peer outdated. */
retcode = drbd_request_state(mdev, NS2(conn, Disconnecting,
pdsk, Outdated));
} else if (retcode == SS_CW_FailedByPeer) {
- // The peer probabely wants to see us outdated.
+ /* The peer probabely wants to see us outdated. */
retcode = _drbd_request_state(mdev, NS2(conn, Disconnecting,
disk, Outdated), 0);
if (retcode == SS_IsDiskLess) {
- // We are diskless and our peer wants to outdate us.
- // So, simply go away, and let the peer try to
- // outdate us with its 'outdate-peer' handler later.
+ /* We are diskless and our peer wants to outdate us.
+ * So, simply go away, and let the peer try to
+ * outdate us with its 'outdate-peer' handler later. */
retcode = drbd_request_state(mdev, NS(conn, StandAlone));
}
}
@@ -1303,7 +1276,7 @@
drbd_bm_unlock(mdev);
dec_local(mdev);
if (mdev->state.conn == Connected) {
- drbd_send_uuids(mdev); // to start sync...
+ drbd_send_uuids(mdev); /* to start sync... */
drbd_send_sizes(mdev);
}
@@ -1338,19 +1311,19 @@
retcode = SyncAfterInvalid;
goto fail;
}
- odev = minor_to_mdev(sc.after); // check against loops in
+ odev = minor_to_mdev(sc.after); /* check against loops in */
while(1) {
if (odev == mdev) {
retcode = SyncAfterCycle;
goto fail;
}
- if (odev->sync_conf.after == -1) break; // no cycles.
+ if (odev->sync_conf.after == -1) break; /* no cycles. */
odev = minor_to_mdev(odev->sync_conf.after);
}
}
ERR_IF (sc.rate < 1) sc.rate = 1;
- ERR_IF (sc.al_extents < 7) sc.al_extents = 127; // arbitrary minimum
+ ERR_IF (sc.al_extents < 7) sc.al_extents = 127; /* arbitrary minimum */
#define AL_MAX ((MD_AL_MAX_SIZE-1) * AL_EXTENTS_PT)
if (sc.al_extents > AL_MAX) {
ERR("sc.al_extents > %d\n", AL_MAX);
@@ -1511,7 +1484,7 @@
tl = reply->tag_list;
if (inc_local(mdev)) {
- // This is a hand crafted add tag ;)
+ /* This is a hand crafted add tag ;) */
*tl++ = T_uuids;
*tl++ = UUID_SIZE*sizeof(u64);
memcpy(tl, mdev->bc->md.uuid, UUID_SIZE*sizeof(u64));
@@ -1535,7 +1508,7 @@
tl = reply->tag_list;
- // This is a hand crafted add tag ;)
+ /* This is a hand crafted add tag ;) */
*tl++ = T_use_degraded;
*tl++ = sizeof(char);
*((char*)tl) = test_bit(USE_DEGR_WFC_T, &mdev->flags) ? 1 : 0 ;
@@ -1651,8 +1624,8 @@
reply->packet_type = cm->reply_body_size ? nlp->packet_type : P_nl_after_last_packet;
reply->minor = nlp->drbd_minor;
- reply->ret_code = NoError; // Might by modified by cm->function.
- // reply->tag_list; might be modified by cm->fucntion.
+ reply->ret_code = NoError; /* Might by modified by cm->function. */
+ /* reply->tag_list; might be modified by cm->fucntion. */
rr = cm->function(mdev, nlp, reply);
@@ -1676,7 +1649,7 @@
module_put(THIS_MODULE);
}
-atomic_t drbd_nl_seq = ATOMIC_INIT(2); // two.
+atomic_t drbd_nl_seq = ATOMIC_INIT(2); /* two. */
void drbd_bcast_state(drbd_dev *mdev)
{
@@ -1688,7 +1661,7 @@
struct drbd_nl_cfg_reply* reply = (struct drbd_nl_cfg_reply*)cn_reply->data;
unsigned short *tl = reply->tag_list;
- // WARN("drbd_bcast_state() got called\n");
+ /* WARN("drbd_bcast_state() got called\n"); */
tl = get_state_to_tags(mdev, (struct get_state*)&mdev->state, tl);
*tl++ = TT_END; /* Close the tag list */
@@ -1697,7 +1670,7 @@
cn_reply->id.val = CN_VAL_DRBD;
cn_reply->seq = atomic_add_return(1, &drbd_nl_seq);
- cn_reply->ack = 0; // not used here.
+ cn_reply->ack = 0; /* not used here. */
cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
(int)((char*)tl - (char*)reply->tag_list);
cn_reply->flags = 0;
@@ -1722,7 +1695,7 @@
unsigned short *tl = reply->tag_list;
int str_len;
- // WARN("drbd_bcast_state() got called\n");
+ /* WARN("drbd_bcast_state() got called\n"); */
str_len = strlen(helper_name)+1;
*tl++ = T_helper;
@@ -1735,7 +1708,7 @@
cn_reply->id.val = CN_VAL_DRBD;
cn_reply->seq = atomic_add_return(1, &drbd_nl_seq);
- cn_reply->ack = 0; // not used here.
+ cn_reply->ack = 0; /* not used here. */
cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
(int)((char*)tl - (char*)reply->tag_list);
cn_reply->flags = 0;
@@ -1785,7 +1758,7 @@
cn_reply->id.val = CN_VAL_DRBD;
cn_reply->seq = atomic_add_return(1, &drbd_nl_seq);
- cn_reply->ack = 0; // not used here.
+ cn_reply->ack = 0; /* not used here. */
cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
(int)((char*)tl - (char*)reply->tag_list);
cn_reply->flags = 0;
Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c 2007-07-24 12:51:35 UTC (rev 2989)
@@ -417,7 +417,7 @@
INFO("Process EE on done_ee sec=%llus size=%u ee=%p\n",
(unsigned long long)e->sector, e->size, e);
);
- // list_del not necessary, next/prev members not touched
+ /* list_del not necessary, next/prev members not touched */
if (e->w.cb(mdev, &e->w, 0) == 0) ok = 0;
drbd_free_ee(mdev, e);
}
@@ -578,7 +578,7 @@
/* signal came in, or peer/link went down,
* after we read a partial message
*/
- // D_ASSERT(signal_pending(current));
+ /* D_ASSERT(signal_pending(current)); */
break;
}
};
@@ -722,10 +722,10 @@
msock = NULL;
do {
- for(try = 0;;) { // 3 tries, this should take less than a second!
+ for(try = 0;;) { /* 3 tries, this should take less than a second! */
s = drbd_try_connect(mdev);
if (s || ++try >= 3) break;
- // give the other side time to call bind() & listen()
+ /* give the other side time to call bind() & listen() */
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(HZ / 10);
}
@@ -791,7 +791,7 @@
msock->sk->sk_allocation = GFP_NOIO;
sock->sk->sk_priority = TC_PRIO_BULK;
- // FIXME fold to limits. should be done in drbd_ioctl
+ /* FIXME fold to limits. should be done in drbd_ioctl */
sock->sk->sk_sndbuf = mdev->net_conf->sndbuf_size;
sock->sk->sk_rcvbuf = mdev->net_conf->sndbuf_size;
/* NOT YET ...
@@ -1021,7 +1021,7 @@
drbd_set_in_sync(mdev, sector, e->size);
ok = drbd_send_ack(mdev, RSWriteAck, e);
} else {
- // Record failure to sync
+ /* Record failure to sync */
drbd_rs_failed_io(mdev, sector, e->size);
ok = drbd_send_ack(mdev, NegAck, e);
@@ -1163,7 +1163,7 @@
{
struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
sector_t sector = e->sector;
- // unsigned int epoch_size;
+ /* unsigned int epoch_size; */
int ok = 1, pcmd;
if (mdev->net_conf->wire_protocol == DRBD_PROT_C) {
@@ -1271,7 +1271,7 @@
return ret;
}
-// mirrored write
+/* mirrored write */
STATIC int receive_Data(drbd_dev *mdev, Drbd_Header* h)
{
sector_t sector;
@@ -1282,7 +1282,7 @@
unsigned int epoch_size = 0;
u32 dp_flags;
- // FIXME merge this code dups into some helper function
+ /* FIXME merge this code dups into some helper function */
header_size = sizeof(*p) - sizeof(*h);
data_size = h->length - header_size;
@@ -1305,7 +1305,7 @@
spin_unlock(&mdev->peer_seq_lock);
drbd_send_ack_dp(mdev, NegAck, p);
- mdev->epoch_size++; // spin lock ?
+ mdev->epoch_size++; /* spin lock ? */
return drbd_drain_block(mdev, data_size);
}
@@ -1538,12 +1538,12 @@
drbd_send_ack(mdev, RecvAck, e);
break;
case DRBD_PROT_A:
- // nothing to do
+ /* nothing to do */
break;
}
if (mdev->state.pdsk == Diskless) {
- // In case we have the only disk of the cluster,
+ /* In case we have the only disk of the cluster, */
drbd_set_out_of_sync(mdev, e->sector, e->size);
e->flags |= EE_CALL_AL_COMPLETE_IO;
drbd_al_begin_io(mdev, e->sector);
@@ -1698,7 +1698,7 @@
if ( ch_self < ch_peer ) rv = -1;
else if (ch_self > ch_peer) rv = 1;
else /* ( ch_self == ch_peer ) */ {
- // Well, then use something else.
+ /* Well, then use something else. */
rv = test_bit(DISCARD_CONCURRENT, &mdev->flags) ? -1 : 1;
}
break;
@@ -1834,13 +1834,13 @@
(peer == UUID_JUST_CREATED || peer == (u64)0) ) return 2;
*rule_nr = 4;
- if (self == peer) { // Common power [off|failure]
- int rct, dc; // roles at crash time
+ if (self == peer) { /* Common power [off|failure] */
+ int rct, dc; /* roles at crash time */
rct = (test_bit(CRASHED_PRIMARY, &mdev->flags) ? 1 : 0) +
( mdev->p_uuid[UUID_FLAGS] & 2 );
- // lowest bit is set when we were primary
- // next bit (weight 2) is set when peer was primary
+ /* lowest bit is set when we were primary,
+ * next bit (weight 2) is set when peer was primary */
MTRACE(TraceTypeUuid, TraceLvlMetrics, DUMPI(rct); );
@@ -1986,12 +1986,12 @@
return conn_mask;
}
- if (hg < 0 && // by intention we do not use mydisk here.
+ if (hg < 0 && /* by intention we do not use mydisk here. */
mdev->state.role == Primary && mdev->state.disk >= Consistent ) {
switch(mdev->net_conf->rr_conflict) {
case CallHelper:
drbd_khelper(mdev, "pri-lost");
- // fall through
+ /* fall through */
case Disconnect:
ERR("I shall become SyncTarget, but I am primary!\n");
drbd_force_state(mdev, NS(conn, Disconnecting));
@@ -2016,9 +2016,9 @@
drbd_md_sync(mdev);
}
- if (hg > 0) { // become sync source.
+ if (hg > 0) { /* become sync source. */
rv = WFBitMapS;
- } else if (hg < 0) { // become sync target
+ } else if (hg < 0) { /* become sync target */
rv = WFBitMapT;
} else {
rv = Connected;
@@ -2036,18 +2036,18 @@
/* returns 1 if invalid */
STATIC int cmp_after_sb(enum after_sb_handler peer, enum after_sb_handler self)
{
- // DiscardRemote - DiscardLocal is valid
+ /* DiscardRemote - DiscardLocal is valid */
if ( (peer == DiscardRemote && self == DiscardLocal) ||
(self == DiscardRemote && peer == DiscardLocal) ) return 0;
- // any other things with DiscardRemote or DiscardLocal are invalid
+ /* any other things with DiscardRemote or DiscardLocal are invalid */
if ( peer == DiscardRemote || peer == DiscardLocal ||
self == DiscardRemote || self == DiscardLocal ) return 1;
- // everything else is valid if they are equal on both sides.
+ /* everything else is valid if they are equal on both sides. */
if (peer == self) return 0;
- // everything es is invalid.
+ /* everything es is invalid. */
return 1;
}
@@ -2115,7 +2115,7 @@
if (drbd_recv(mdev, h->payload, h->length) != h->length)
return FALSE;
- // XXX harmless race with ioctl ...
+ /* XXX harmless race with ioctl ... */
mdev->sync_conf.rate = be32_to_cpu(p->rate);
return ok;
@@ -2181,7 +2181,7 @@
(unsigned long)mdev->bc->dc.disk_size);
}
- // Never shrink a device with usable data.
+ /* Never shrink a device with usable data. */
if (drbd_new_dev_size(mdev, mdev->bc) <
drbd_get_capacity(mdev->this_bdev) &&
mdev->state.disk >= Outdated ) {
@@ -2197,7 +2197,7 @@
mdev->p_size = p_size;
if (inc_local(mdev)) {
- drbd_bm_lock(mdev); // {
+ drbd_bm_lock(mdev);
/*
* you may get a flip-flop connection established/connection loss,
* in case both really have different usize uppon first connect!
@@ -2205,10 +2205,10 @@
***/
drbd_determin_dev_size(mdev);
- drbd_bm_unlock(mdev); // }
+ drbd_bm_unlock(mdev);
dec_local(mdev);
} else {
- // I am diskless, need to accept the peer's size.
+ /* I am diskless, need to accept the peer's size. */
drbd_set_my_capacity(mdev, p_size);
}
@@ -2237,8 +2237,8 @@
if (mdev->state.conn > WFReportParams) {
if ( be64_to_cpu(p->c_size) !=
drbd_get_capacity(mdev->this_bdev) ) {
- // we have different sizes, probabely peer
- // needs to know my new size...
+ /* we have different sizes, probabely peer
+ * needs to know my new size... */
drbd_send_sizes(mdev);
}
}
@@ -2281,7 +2281,7 @@
[StartingSyncS] = StartingSyncT,
[StartingSyncT] = StartingSyncS,
- [Disconnecting] = TearDown, // NetworkFailure,
+ [Disconnecting] = TearDown, /* NetworkFailure, */
[conn_mask] = conn_mask,
};
@@ -2377,11 +2377,11 @@
if (oconn > WFReportParams) {
if (nconn > Connected && peer_state.conn <= Connected) {
- // we want resync, peer has not yet decided to sync...
+ /* we want resync, peer has not yet decided to sync... */
drbd_send_uuids(mdev);
drbd_send_state(mdev);
} else if (nconn == Connected && peer_state.disk == Negotiating) {
- // peer is waiting for us to respond...
+ /* peer is waiting for us to respond... */
drbd_send_state(mdev);
}
}
@@ -2393,7 +2393,7 @@
mdev->net_conf->want_lose = 0;
/* FIXME assertion for (gencounts do not diverge) */
- drbd_md_sync(mdev); // update connected indicator, la_size, ...
+ drbd_md_sync(mdev); /* update connected indicator, la_size, ... */
return TRUE;
}
@@ -2405,7 +2405,7 @@
wait_event( mdev->misc_wait,
mdev->state.conn < Connected || mdev->state.conn == WFSyncUUID);
- // D_ASSERT( mdev->state.conn == WFSyncUUID );
+ /* D_ASSERT( mdev->state.conn == WFSyncUUID ); */
ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
if (drbd_recv(mdev, h->payload, h->length) != h->length)
@@ -2435,7 +2435,7 @@
unsigned long *buffer;
int ok = FALSE;
- drbd_bm_lock(mdev); // {
+ drbd_bm_lock(mdev);
bm_words = drbd_bm_words(mdev);
bm_i = 0;
@@ -2471,14 +2471,14 @@
ok = TRUE;
out:
- drbd_bm_unlock(mdev); // }
+ drbd_bm_unlock(mdev);
vfree(buffer);
return ok;
}
STATIC int receive_skip(drbd_dev *mdev, Drbd_Header *h)
{
- // TODO zero copy sink :)
+ /* TODO zero copy sink :) */
static char sink[128];
int size, want, r;
@@ -2498,7 +2498,7 @@
STATIC int receive_UnplugRemote(drbd_dev *mdev, Drbd_Header *h)
{
if (mdev->state.disk >= Inconsistent) drbd_kick_lo(mdev);
- return TRUE; // cannot fail.
+ return TRUE; /* cannot fail. */
}
typedef int (*drbd_cmd_handler_f)(drbd_dev*, Drbd_Header*);
@@ -2507,16 +2507,16 @@
[Data] = receive_Data,
[DataReply] = receive_DataReply,
[RSDataReply] = receive_RSDataReply,
- [RecvAck] = NULL, // via msock: got_RecvAck,
- [WriteAck] = NULL, // via msock: got_WriteAck,
+ [RecvAck] = NULL, /* via msock: got_RecvAck, */
+ [WriteAck] = NULL, /* via msock: got_WriteAck, */
[Barrier] = receive_Barrier_no_tcq,
- [BarrierAck] = NULL, // via msock: got_BarrierAck,
+ [BarrierAck] = NULL, /* via msock: got_BarrierAck, */
[ReportBitMap] = receive_bitmap,
- [Ping] = NULL, // via msock: got_Ping,
- [PingAck] = NULL, // via msock: got_PingAck,
+ [Ping] = NULL, /* via msock: got_Ping, */
+ [PingAck] = NULL, /* via msock: got_PingAck, */
[UnplugRemote] = receive_UnplugRemote,
[DataRequest] = receive_DataRequest,
- [RSDataRequest] = receive_DataRequest, //receive_RSDataRequest,
+ [RSDataRequest] = receive_DataRequest, /* receive_RSDataRequest, */
[SyncParam] = receive_SyncParam,
[ReportProtocol] = receive_protocol,
[ReportUUIDs] = receive_uuids,
@@ -2689,7 +2689,7 @@
spin_lock_irq(&mdev->req_lock);
os = mdev->state;
if (os.conn >= Unconnected) {
- // Do not restart in case we are Disconnecting
+ /* Do not restart in case we are Disconnecting */
ns = os;
ns.conn = Unconnected;
rv = _drbd_set_state(mdev, ns, ChgStateVerbose);
@@ -2747,7 +2747,7 @@
*/
int drbd_send_handshake(drbd_dev *mdev)
{
- // ASSERT current == mdev->receiver ...
+ /* ASSERT current == mdev->receiver ... */
Drbd_HandShake_Packet *p = &mdev->data.sbuf.HandShake;
int ok;
@@ -2778,7 +2778,7 @@
*/
STATIC int drbd_do_handshake(drbd_dev *mdev)
{
- // ASSERT current == mdev->receiver ...
+ /* ASSERT current == mdev->receiver ... */
Drbd_HandShake_Packet *p = &mdev->data.rbuf.HandShake;
const int expect = sizeof(Drbd_HandShake_Packet)-sizeof(Drbd_Header);
int rv;
@@ -3033,7 +3033,7 @@
drbd_disconnect(mdev);
- // Ensure that the thread state fits to our connection state.
+ /* Ensure that the thread state fits to our connection state. */
if (mdev->state.conn == Unconnected) {
ERR_IF( mdev->receiver.t_state != Restarting )
drbd_thread_restart_nowait(&mdev->receiver);
@@ -3074,7 +3074,7 @@
STATIC int got_PingAck(drbd_dev *mdev, Drbd_Header* h)
{
- // restore idle timeout
+ /* restore idle timeout */
mdev->meta.socket->sk->sk_rcvtimeo = mdev->net_conf->ping_int*HZ;
return TRUE;
@@ -3187,7 +3187,7 @@
_req_mod(req, neg_acked, 0);
spin_unlock_irq(&mdev->req_lock);
-// warning LGE "ugly and wrong"
+ /* "ugly and wrong" but what can we do !? */
drbd_khelper(mdev, "pri-on-incon-degr");
return TRUE;
@@ -3346,7 +3346,7 @@
expect = sizeof(Drbd_Header);
cmd = -1;
}
- } //while
+ }
if (0) {
err:
Modified: branches/drbd-8.0-for-linus/drbd/drbd_req.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_req.c 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.c 2007-07-24 12:51:35 UTC (rev 2989)
@@ -59,7 +59,7 @@
conns_to_name(mdev->state.conn));
}
-//#define VERBOSE_REQUEST_CODE
+/* #define VERBOSE_REQUEST_CODE */
#if defined(VERBOSE_REQUEST_CODE) || defined(ENABLE_DYNAMIC_TRACE)
void _print_req_mod(drbd_request_t *req, drbd_req_event_t what)
{
@@ -727,7 +727,7 @@
if (mdev->state.disk == UpToDate) return 1;
if (mdev->state.disk >= Outdated) return 0;
if (mdev->state.disk < Inconsistent) return 0;
- // state.disk == Inconsistent We will have a look at the BitMap
+ /* state.disk == Inconsistent We will have a look at the BitMap */
nr_sectors = drbd_get_capacity(mdev->this_bdev);
esector = sector + (size>>9) -1;
@@ -817,16 +817,13 @@
* local io stack.
*/
-/* XXX SHARED DISK mode
- * think this over again for two primaries */
-
local = 0;
bio_put(req->private_bio);
req->private_bio = NULL;
dec_local(mdev);
}
}
- remote = !local && mdev->state.pdsk >= UpToDate;//Consistent;
+ remote = !local && mdev->state.pdsk >= UpToDate;
}
/* If we have a disk, but a READA request is mapped to remote,
@@ -1028,7 +1025,7 @@
*/
static int drbd_fail_request_early(drbd_dev* mdev, int is_write)
{
- // Unconfigured
+ /* Unconfigured */
if (mdev->state.conn == Disconnecting &&
mdev->state.disk == Diskless)
return 1;
@@ -1086,7 +1083,6 @@
*/
D_ASSERT(bio->bi_size > 0);
D_ASSERT( (bio->bi_size & 0x1ff) == 0);
- // D_ASSERT(bio->bi_size <= q->max_segment_size); // wrong.
D_ASSERT(bio->bi_idx == 0);
/* to make some things easier, force allignment of requests within the
@@ -1145,7 +1141,7 @@
int drbd_merge_bvec(request_queue_t *q, struct bio *bio, struct bio_vec *bvec)
{
struct Drbd_Conf* mdev = (drbd_dev*) q->queuedata;
- unsigned int bio_offset = (unsigned int)bio->bi_sector << 9; // 32 bit
+ unsigned int bio_offset = (unsigned int)bio->bi_sector << 9; /* 32 bit */
unsigned int bio_size = bio->bi_size;
int limit, backing_limit;
Modified: branches/drbd-8.0-for-linus/drbd/drbd_req.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_req.h 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.h 2007-07-24 12:51:35 UTC (rev 2989)
@@ -101,7 +101,7 @@
connection_lost_while_pending,
recv_acked_by_peer,
write_acked_by_peer,
- write_acked_by_peer_and_sis, // and set_in_sync
+ write_acked_by_peer_and_sis, /* and set_in_sync */
conflict_discarded_by_peer,
neg_acked,
barrier_acked, /* in protocol A and B */
Modified: branches/drbd-8.0-for-linus/drbd/drbd_worker.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_worker.c 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/drbd_worker.c 2007-07-24 12:51:35 UTC (rev 2989)
@@ -34,7 +34,7 @@
#include <linux/wait.h>
#include <linux/mm.h>
#include <linux/drbd_config.h>
-#include <linux/mm_inline.h> // for the page_count macro on RH/Fedora
+#include <linux/mm_inline.h>
#include <linux/slab.h>
#include <linux/random.h>
@@ -133,7 +133,7 @@
e = bio->bi_private;
mdev = e->mdev;
- // see above
+ /* see above */
if (bio->bi_size) return 1;
if (!error && !uptodate) {
/* strange behaviour of some lower level drivers...
@@ -200,7 +200,7 @@
drbd_req_event_t what;
int uptodate = bio_flagged(bio, BIO_UPTODATE);
- // see above
+ /* see above */
if (bio->bi_size) return 1;
if (!error && !uptodate) {
/* strange behaviour of some lower level drivers...
@@ -233,8 +233,8 @@
* a "we are diskless" param packet anyways, and the peer
* will then set the FullSync bit in the meta data ...
*/
- // NOTE: mdev->bc can be NULL by the time we get here!
- //D_ASSERT(mdev->bc->dc.on_io_error != PassOn);
+ /* NOTE: mdev->bc can be NULL by the time we get here! */
+ /* D_ASSERT(mdev->bc->dc.on_io_error != PassOn); */
/* the only way this callback is scheduled is from _req_may_be_done,
* when it is done and had a local write error, see comments there */
@@ -274,7 +274,7 @@
{
ERR_IF(cancel) return 1;
ERR("resync inactive, but callback triggered??\n");
- return 1; // Simply ignore this!
+ return 1; /* Simply ignore this! */
}
void resync_timer_fn(unsigned long data)
@@ -366,7 +366,6 @@
}
if (unlikely(drbd_bm_test_bit(mdev, bit) == 0 )) {
- //INFO("Block got synced while in drbd_rs_begin_io()\n");
drbd_rs_complete_io(mdev, sector);
goto next_sector;
}
@@ -389,11 +388,11 @@
if (size + BM_BLOCK_SIZE > max_segment_size)
break;
- // Be always aligned
+ /* Be always aligned */
if (sector & ((1<<(align+3))-1) )
break;
- // do not cross extent boundaries
+ /* do not cross extent boundaries */
if (( (bit+1) & BM_BLOCKS_PER_BM_EXT_MASK ) == 0)
break;
/* now, is it actually dirty, after all?
@@ -461,14 +460,14 @@
int dstate, pdstate;
struct drbd_work *w;
- // Remove all elements from the resync LRU. Since future actions
- // might set bits in the (main) bitmap, then the entries in the
- // resync LRU would be wrong.
+ /* Remove all elements from the resync LRU. Since future actions
+ * might set bits in the (main) bitmap, then the entries in the
+ * resync LRU would be wrong. */
if (drbd_rs_del_all(mdev)) {
- // In case this is not possible now, most probabely because
- // there are RSDataReply Packets lingering on the worker's
- // queue (or even the read operations for those packets
- // is not finished by now). Retry in 100ms.
+ /* In case this is not possible now, most probabely because
+ * there are RSDataReply Packets lingering on the worker's
+ * queue (or even the read operations for those packets
+ * is not finished by now). Retry in 100ms. */
drbd_kick_lo(mdev);
set_current_state(TASK_INTERRUPTIBLE);
@@ -523,8 +522,8 @@
drbd_uuid_set_bm(mdev, 0UL);
if (mdev->p_uuid) {
- // Now the two UUID sets are equal, update what we
- // know of the peer.
+ /* Now the two UUID sets are equal, update what we
+ * know of the peer. */
int i;
for ( i = Current ; i<=History_end ; i++ ) {
mdev->p_uuid[i] = mdev->bc->md.uuid[i];
@@ -633,7 +632,7 @@
drbd_io_error(mdev, FALSE);
- // update resync data with failure
+ /* update resync data with failure */
drbd_rs_failed_io(mdev, e->sector, e->size);
}
@@ -1002,7 +1001,7 @@
spin_unlock_irq(&mdev->data.work.q_lock);
if (!w->cb(mdev, w, mdev->state.conn < Connected )) {
- //WARN("worker: a callback failed! \n");
+ /* WARN("worker: a callback failed! \n"); */
if (mdev->state.conn >= Connected)
drbd_force_state(mdev, NS(conn, NetworkFailure));
}
Modified: branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h 2007-07-24 12:51:35 UTC (rev 2989)
@@ -16,8 +16,7 @@
/* see get_sb_bdev and bd_claim */
extern char* drbd_sec_holder;
-// bi_end_io handlers
-// int (bio_end_io_t) (struct bio *, unsigned int, int);
+/* bi_end_io handlers */
extern int drbd_md_io_complete (struct bio *bio, unsigned int bytes_done, int error);
extern int drbd_endio_read_sec (struct bio *bio, unsigned int bytes_done, int error);
@@ -90,7 +89,7 @@
}
static inline void drbd_bio_kunmap(struct bio *bio)
{
- // do nothing.
+ /* do nothing. */
}
#endif
@@ -111,7 +110,7 @@
*/
static inline void drbd_generic_make_request(drbd_dev *mdev, int rw, int fault_type, struct bio *bio)
{
- bio->bi_rw = rw; // on the receiver side, e->..rw was not yet defined.
+ bio->bi_rw = rw; /* on the receiver side, e->..rw was not yet defined. */
if (!bio->bi_bdev) {
printk(KERN_ERR DEVICE_NAME "%d: drbd_generic_make_request: bio->bi_bdev == NULL\n",
@@ -140,7 +139,7 @@
if (!blk_queue_plugged(q)) {
blk_plug_device(q);
del_timer(&q->unplug_timer);
- // unplugging should not happen automatically...
+ /* unplugging should not happen automatically... */
}
spin_unlock_irq(q->queue_lock);
}
Modified: branches/drbd-8.0-for-linus/drbd/linux/drbd.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/linux/drbd.h 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd.h 2007-07-24 12:51:35 UTC (rev 2989)
@@ -73,7 +73,7 @@
* Or change the API_VERSION, too. */
enum ret_codes {
RetCodeBase = 100,
- NoError, // 101 ...
+ NoError, /* 101 ... */
LAAlreadyInUse,
OAAlreadyInUse,
LDNameInvalid,
@@ -101,7 +101,7 @@
UnknownMandatoryTag,
MinorNotKnown,
StateNotAllowed,
- GotSignal, // EINTR
+ GotSignal, /* EINTR */
NoResizeDuringResync,
APrimaryNodeNeeded,
SyncAfterInvalid,
@@ -123,8 +123,8 @@
typedef enum {
Unknown = 0,
- Primary = 1, // role
- Secondary = 2, // role
+ Primary = 1, /* role */
+ Secondary = 2, /* role */
role_mask = 3,
} drbd_role_t;
@@ -139,25 +139,36 @@
*/
typedef enum {
StandAlone,
- Disconnecting, // Temporal state on the way to StandAlone.
- Unconnected, // >= Unconnected -> inc_net() succeeds
- Timeout, /// These temporal states are all used on the way
- BrokenPipe, /// from >= Connected to Unconnected.
- NetworkFailure, /// The 'disconnect reason' states
- ProtocolError, ///
- TearDown, /// I do not allow to change beween them.
+ Disconnecting, /* Temporal state on the way to StandAlone. */
+ Unconnected, /* >= Unconnected -> inc_net() succeeds */
+
+ /* These temporal states are all used on the way
+ * from >= Connected to Unconnected.
+ * The 'disconnect reason' states
+ * I do not allow to change beween them. */
+ Timeout,
+ BrokenPipe,
+ NetworkFailure,
+ ProtocolError,
+ TearDown,
+
WFConnection,
- WFReportParams, // we have a socket
- Connected, // we have introduced each other
- StartingSyncS, // starting full sync by IOCTL.
- StartingSyncT, // stariing full sync by IOCTL.
+ WFReportParams, /* we have a socket */
+ Connected, /* we have introduced each other */
+ StartingSyncS, /* starting full sync by IOCTL. */
+ StartingSyncT, /* stariing full sync by IOCTL. */
WFBitMapS,
WFBitMapT,
WFSyncUUID,
- SyncSource, // The distance between original state and pause
- SyncTarget, // state must be the same for source and target. (+2)
- PausedSyncS, // All SyncStates are tested with this comparison
- PausedSyncT, // xx >= SyncSource && xx <= PausedSyncT
+
+ /* The distance between original state and pause
+ * state must be the same for source and target. (+2)
+ * All SyncStates are tested with this comparison
+ * xx >= SyncSource && xx <= PausedSyncT */
+ SyncSource,
+ SyncTarget,
+ PausedSyncS,
+ PausedSyncT,
conn_mask = 31
} drbd_conns_t;
@@ -177,16 +188,16 @@
typedef union {
struct {
- unsigned role : 2 ; // 3/4 primary/secondary/unknown
- unsigned peer : 2 ; // 3/4 primary/secondary/unknown
- unsigned conn : 5 ; // 17/32 cstates
- unsigned disk : 4 ; // 8/16 from Diskless to UpToDate
- unsigned pdsk : 4 ; // 8/16 from Diskless to UpToDate
- unsigned susp : 1 ; // 2/2 IO suspended no/yes
- unsigned aftr_isp : 1 ; // isp .. imposed sync pause
+ unsigned role : 2 ; /* 3/4 primary/secondary/unknown */
+ unsigned peer : 2 ; /* 3/4 primary/secondary/unknown */
+ unsigned conn : 5 ; /* 17/32 cstates */
+ unsigned disk : 4 ; /* 8/16 from Diskless to UpToDate */
+ unsigned pdsk : 4 ; /* 8/16 from Diskless to UpToDate */
+ unsigned susp : 1 ; /* 2/2 IO suspended no/yes */
+ unsigned aftr_isp : 1 ; /* isp .. imposed sync pause */
unsigned peer_isp : 1 ;
unsigned user_isp : 1 ;
- unsigned _pad : 11; // 0 unused
+ unsigned _pad : 11; /* 0 unused */
};
unsigned int i;
} drbd_state_t;
@@ -196,7 +207,7 @@
SS_CW_Success = 3,
SS_NothingToDo = 2,
SS_Success = 1,
- SS_UnknownError = 0, // Used to sleep longer in _drbd_request_state
+ SS_UnknownError = 0, /* Used to sleep longer in _drbd_request_state */
SS_TwoPrimaries = -1,
SS_NoUpToDateDisk = -2,
SS_BothInconsistent = -4,
@@ -228,7 +239,7 @@
__MDF_ConnectedInd,
__MDF_FullSync,
__MDF_WasUpToDate,
- __MDF_PeerOutDated // or less/lower.
+ __MDF_PeerOutDated /* or worse (e.g. invalid). */
};
#define MDF_Consistent (1<<__MDF_Consistent)
#define MDF_PrimaryInd (1<<__MDF_PrimaryInd)
@@ -242,9 +253,9 @@
Bitmap,
History_start,
History_end,
- UUID_SIZE, // In the packet we store the number of dirty bits here
- UUID_FLAGS, // In the packet we store flags here.
- EXT_UUID_SIZE // Everything.
+ UUID_SIZE, /* In the packet we store the number of dirty bits here */
+ UUID_FLAGS, /* In the packet we store flags here. */
+ EXT_UUID_SIZE /* Everything. */
};
#define UUID_JUST_CREATED ((__u64)4)
@@ -257,13 +268,13 @@
#define DRBD_MD_INDEX_FLEX_EXT -2
#define DRBD_MD_INDEX_FLEX_INT -3
-// Start of the new netlink/connector stuff
+/* Start of the new netlink/connector stuff */
#define DRBD_NL_CREATE_DEVICE 0x01
#define DRBD_NL_SET_DEFAULTS 0x02
-// The following line should be moved over to linux/connector.h
-// when the time comes
+/* The following line should be moved over to linux/connector.h
+ * when the time comes */
#define CN_IDX_DRBD 0x4
#define CN_VAL_DRBD 0x1
@@ -277,8 +288,8 @@
struct drbd_nl_cfg_reply {
int packet_type;
int minor;
- int ret_code; // enum ret_code or set_st_err_t
- unsigned short tag_list[]; // only used with get_* calls
+ int ret_code; /* enum ret_code or set_st_err_t */
+ unsigned short tag_list[]; /* only used with get_* calls */
};
#endif
Modified: branches/drbd-8.0-for-linus/drbd/linux/drbd_config.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/linux/drbd_config.h 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd_config.h 2007-07-24 12:51:35 UTC (rev 2989)
@@ -20,60 +20,69 @@
#ifndef DRBD_CONFIG_H
#define DRBD_CONFIG_H
-extern const char * drbd_buildtag(void);
+extern const char *drbd_buildtag(void);
#define REL_VERSION "8.0.4"
#define API_VERSION 86
#define PRO_VERSION 86
-// undef if you need the workaround in drbd_receiver
-#define HAVE_UML_TO_VIRT 1
+/* no static functs, improves quality of OOPS traces
+ */
+#define DBG_ALL_SYMBOLS
-#define DBG_ALL_SYMBOLS // no static functs, improves quality of OOPS traces
+/* enables MUST_HOLD macro (assertions for spinlocks)
+#define DBG_SPINLOCKS
+ */
-//#define DBG_SPINLOCKS // enables MUST_HOLD macro (assertions for spinlocks)
-//#define DBG_ASSERTS // drbd_assert_breakpoint() function
-#define DUMP_MD 2 // Dump even all cstate changes (I like it!)
-//#define PARANOIA // some extra checks
+/* drbd_assert_breakpoint() function
+#define DBG_ASSERTS
+ */
-// Dump every hour the usage / not usage of zero copy IO
-//#define SHOW_SENDPAGE_USAGE
+/* Dump all cstate changes */
+#define DUMP_MD 2
-// Define this to enable dynamic tracing controlled by module parameters
-// at run time. This enables ALL use of dynamic tracing including packet
-// and bio dumping, etc
+/* some extra checks
+#define PARANOIA
+ */
+
+/* Dump every hour the usage / not usage of zero copy IO */
+/* #define SHOW_SENDPAGE_USAGE */
+
+/* Define this to enable dynamic tracing controlled by module parameters
+ * at run time. This enables ALL use of dynamic tracing including packet
+ * and bio dumping, etc */
#define ENABLE_DYNAMIC_TRACE
-// You can disable the use of the sendpage() call (= zero copy
-// IO ) If you have the feeling that this might be the cause
-// for troubles.
-// #define DRBD_DISABLE_SENDPAGE
+/* You can disable the use of the sendpage() call (= zero copy IO)
+ * If you have the feeling that this might be the cause for troubles.
+#define DRBD_DISABLE_SENDPAGE
+ */
-// Enable fault insertion code
+/* Enable fault insertion code */
#define DRBD_ENABLE_FAULTS
-// RedHat's 2.6.9 kernels have the gfp_t type. Mainline has this feature
-// since 2.6.16. If you build for RedHat enable the line below.
+/* RedHat's 2.6.9 kernels have the gfp_t type. Mainline has this feature
+ * since 2.6.16. If you build for RedHat enable the line below. */
#define KERNEL_HAS_GFP_T
-// kernel.org has atomic_add_return since 2.6.10. some vendor kernels
-// have it backported, though. Others don't.
+/* kernel.org has atomic_add_return since 2.6.10. some vendor kernels
+ * have it backported, though. Others don't. */
//#define NEED_BACKPORT_OF_ATOMIC_ADD
-// 2.6.something has deprecated kmem_cache_t
-// some older still use it.
-// some have it defined as struct kmem_cache_s, some as struct kmem_cache
+/* 2.6.something has deprecated kmem_cache_t
+ * some older still use it.
+ * some have it defined as struct kmem_cache_s, some as struct kmem_cache */
//#define USE_KMEM_CACHE_S
-// 2.6.something has sock_create_kern (SE-linux security context stuff)
-// some older distribution kernels don't.
+/* 2.6.something has sock_create_kern (SE-linux security context stuff)
+ * some older distribution kernels don't. */
//#define DEFINE_SOCK_CREATE_KERN
-// in older kernels (vanilla < 2.6.16) struct netlink_skb_parms has a
-// member called dst_groups. Later it is called dst_group (without 's').
+/* in older kernels (vanilla < 2.6.16) struct netlink_skb_parms has a
+ * member called dst_groups. Later it is called dst_group (without 's'). */
//#define DRBD_NL_DST_GROUPS
-// in older kernels (vanilla < 2.6.14) is no kzalloc()
+/* in older kernels (vanilla < 2.6.14) is no kzalloc() */
//#define NEED_BACKPORT_OF_KZALLOC
#endif
Modified: branches/drbd-8.0-for-linus/drbd/linux/drbd_limits.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/linux/drbd_limits.h 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd_limits.h 2007-07-24 12:51:35 UTC (rev 2989)
@@ -42,12 +42,12 @@
* more than one minute timeout is not usefull */
#define DRBD_TIMEOUT_MIN 1
#define DRBD_TIMEOUT_MAX 600
-#define DRBD_TIMEOUT_DEF 60 // 6 seconds
+#define DRBD_TIMEOUT_DEF 60 /* 6 seconds */
/* active connection retries when WFConnection */
#define DRBD_CONNECT_INT_MIN 1
#define DRBD_CONNECT_INT_MAX 120
-#define DRBD_CONNECT_INT_DEF 10 //seconds
+#define DRBD_CONNECT_INT_DEF 10 /* seconds */
/* keep-alive probes when idle */
#define DRBD_PING_INT_MIN 1
@@ -90,7 +90,7 @@
/* FIXME allow rate to be zero? */
#define DRBD_RATE_MIN 1
#define DRBD_RATE_MAX 700000
-#define DRBD_RATE_DEF 250 // kb/second
+#define DRBD_RATE_DEF 250 /* kb/second */
/* less than 7 would hit performance unneccessarily.
* 3833 is the largest prime that still does fit
@@ -111,7 +111,7 @@
/* DRBD_MAX_SECTORS */
#define DRBD_DISK_SIZE_SECT_MIN 0
#define DRBD_DISK_SIZE_SECT_MAX ((128LLU*1024*2 - 72)*512LLU*8*8)
-#define DRBD_DISK_SIZE_SECT_DEF 0 // = disabled = no user size...
+#define DRBD_DISK_SIZE_SECT_DEF 0 /* = disabled = no user size... */
#define DRBD_ON_IO_ERROR_DEF PassOn
#define DRBD_FENCING_DEF DontCare
Modified: branches/drbd-8.0-for-linus/drbd/linux/drbd_nl.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/linux/drbd_nl.h 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd_nl.h 2007-07-24 12:51:35 UTC (rev 2989)
@@ -90,8 +90,8 @@
STRING( 38, T_MAY_IGNORE, helper, 32)
)
-// Tag nr 42 already allocated in drbd-8.1 development.
-// Packet numbers 21 and 22 already in drbd-8.1 development.
+/* Tag nr 42 already allocated in drbd-8.1 development.
+ * Packet numbers 21 and 22 already in drbd-8.1 development. */
PACKET(sync_progress, 23,
INTEGER( 43, T_MAY_IGNORE, sync_progress)
Modified: branches/drbd-8.0-for-linus/drbd/linux/drbd_tag_magic.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/linux/drbd_tag_magic.h 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd_tag_magic.h 2007-07-24 12:51:35 UTC (rev 2989)
@@ -4,7 +4,7 @@
#define TT_END 0
#define TT_REMOVED 0xE000
-// declare packet_type enums
+/* declare packet_type enums */
enum packet_types {
#define PACKET(name, number, fields) P_ ## name = number,
#define INTEGER(pn, pr, member)
@@ -15,7 +15,7 @@
P_nl_after_last_packet,
};
-// These struct are used to deduce the size of the tag lists:
+/* These struct are used to deduce the size of the tag lists: */
#define PACKET(name, number, fields) \
struct name ## _tag_len_struct { fields };
#define INTEGER(pn, pr, member) \
@@ -29,7 +29,7 @@
int tag_and_len ## member;
#include "linux/drbd_nl.h"
-// declate tag-list-sizes
+/* declate tag-list-sizes */
const int tag_list_sizes[] = {
#define PACKET(name, number, fields) 2 fields ,
#define INTEGER(pn, pr, member) +4+4
@@ -54,7 +54,7 @@
#define tag_type(T) ((T) & TT_MASK)
#define tag_number(T) ((T) & TN_MASK)
-// declare tag enums
+/* declare tag enums */
#define PACKET(name, number, fields) fields
enum drbd_tags {
#define INTEGER(pn, pr, member) T_ ## member = pn | TT_INTEGER | pr ,
@@ -70,7 +70,7 @@
int max_len;
};
-// declare tag names
+/* declare tag names */
#define PACKET(name, number, fields) fields
const struct tag tag_descriptions[] = {
#define INTEGER(pn, pr, member) [ pn ] = { #member, TT_INTEGER | pr, sizeof(int) },
Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.c 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.c 2007-07-24 12:51:35 UTC (rev 2989)
@@ -27,13 +27,13 @@
#include <linux/bitops.h>
#include <linux/vmalloc.h>
-#include <linux/string.h> // for memset
-#include <linux/seq_file.h> // for seq_printf
+#include <linux/string.h> /* for memset */
+#include <linux/seq_file.h> /* for seq_printf */
#include "lru_cache.h"
#define STATIC static
-// this is developers aid only!
+/* this is developers aid only! */
#define PARANOIA_ENTRY() BUG_ON(test_and_set_bit(__LC_PARANOIA, &lc->flags))
#define PARANOIA_LEAVE() do { clear_bit(__LC_PARANOIA, &lc->flags); smp_mb__after_clear_bit(); } while (0)
#define RETURN(x...) do { PARANOIA_LEAVE(); return x ; } while (0)
@@ -71,7 +71,7 @@
e = lc_entry(lc, i);
e->lc_number = LC_FREE;
list_add(&e->list, &lc->free);
- // memset(,0,) did the rest of init for us
+ /* memset(,0,) did the rest of init for us */
}
}
return lc;
@@ -149,7 +149,7 @@
*/
void lc_del(struct lru_cache* lc, struct lc_element *e)
{
- // FIXME what to do with refcnt != 0 ?
+ /* FIXME what to do with refcnt != 0 ? */
PARANOIA_ENTRY();
BUG_ON(e->refcnt);
list_del(&e->list);
@@ -173,8 +173,8 @@
STATIC int lc_unused_element_available(struct lru_cache* lc)
{
- if (!list_empty(&lc->free)) return 1; // something on the free list
- if (!list_empty(&lc->lru)) return 1; // something to evict
+ if (!list_empty(&lc->free)) return 1; /* something on the free list */
+ if (!list_empty(&lc->lru)) return 1; /* something to evict */
return 0;
}
@@ -224,7 +224,7 @@
if (e) {
++lc->hits;
if (e->refcnt++ == 0) lc->used++;
- list_move(&e->list, &lc->in_use); // Not evictable...
+ list_move(&e->list, &lc->in_use); /* Not evictable... */
RETURN(e);
}
@@ -281,7 +281,7 @@
if (e) {
++lc->hits;
if (e->refcnt++ == 0) lc->used++;
- list_move(&e->list, &lc->in_use); // Not evictable...
+ list_move(&e->list, &lc->in_use); /* Not evictable... */
}
RETURN(e);
}
@@ -312,7 +312,7 @@
BUG_ON(e->refcnt == 0);
BUG_ON(e == lc->changing_element);
if (--e->refcnt == 0) {
- list_move(&e->list, &lc->lru); // move it to the front of LRU.
+ list_move(&e->list, &lc->lru); /* move it to the front of LRU. */
lc->used--;
clear_bit(__LC_STARVING, &lc->flags);
smp_mb__after_clear_bit();
Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.h 2007-07-24 11:50:16 UTC (rev 2988)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.h 2007-07-24 12:51:35 UTC (rev 2989)
@@ -60,7 +60,7 @@
struct lc_element {
struct hlist_node colision;
- struct list_head list; // LRU list or free list
+ struct list_head list; /* LRU list or free list */
unsigned int refcnt;
unsigned int lc_number;
};
@@ -78,17 +78,17 @@
unsigned int used;
unsigned long flags;
unsigned long hits, misses, starving, dirty, changed;
- struct lc_element *changing_element; // just for paranoia
+ struct lc_element *changing_element; /* just for paranoia */
void *lc_private;
const char *name;
struct hlist_head slot[0];
- // hash colision chains here, then element storage.
+ /* hash colision chains here, then element storage. */
};
-// flag-bits for lru_cache
+/* flag-bits for lru_cache */
enum {
__LC_PARANOIA,
__LC_DIRTY,
More information about the drbd-cvs
mailing list