[DRBD-cvs] svn commit by lars - r2990 - branches/drbd-8.0-for-linus/drbd - f278e43a436d3486d397010377c7a08c48e9b58f fix many 'brac

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Tue Jul 24 15:06:55 CEST 2007


Author: lars
Date: 2007-07-24 15:06:52 +0200 (Tue, 24 Jul 2007)
New Revision: 2990

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_proc.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_worker.c
Log:
f278e43a436d3486d397010377c7a08c48e9b58f fix many 'braces are not necessary' complaints, but leave some where I think they improve readability


Modified: branches/drbd-8.0-for-linus/drbd/drbd_actlog.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 12:51:35 UTC (rev 2989)
+++ branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 13:06:52 UTC (rev 2990)
@@ -131,11 +131,11 @@
 	     (unsigned long long)sector, rw ? "WRITE" : "READ");
 #endif
 
-	if (sector < drbd_md_first_sector(bdev)  || sector > drbd_md_last_sector(bdev)) {
+	if (sector < drbd_md_first_sector(bdev) ||
+	    sector > drbd_md_last_sector(bdev))
 		ALERT("%s [%d]:%s(,%llus,%s) out of range md access!\n",
 		     current->comm, current->pid, __func__,
 		     (unsigned long long)sector, rw ? "WRITE" : "READ");
-	}
 
 	ok = _drbd_md_sync_page_io(mdev, bdev, iop, sector, rw, hardsect);
 	if (unlikely(!ok)) {
@@ -238,9 +238,8 @@
 
 		evicted = al_ext->lc_number;
 
-		if (mdev->state.conn < Connected && evicted != LC_FREE) {
-			drbd_bm_write_sect(mdev, evicted/AL_EXT_PER_BM_SECT );
-		}
+		if (mdev->state.conn < Connected && evicted != LC_FREE)
+			drbd_bm_write_sect(mdev, evicted/AL_EXT_PER_BM_SECT);
 
 		/* drbd_al_write_transaction(mdev,al_ext,enr);
 		   generic_make_request() are serialized on the
@@ -289,9 +288,8 @@
 		return;
 	}
 
-	if ( lc_put(mdev->act_log, extent) == 0 ) {
+	if (lc_put(mdev->act_log, extent) == 0)
 		wake_up(&mdev->al_wait);
-	}
 
 	spin_unlock_irqrestore(&mdev->al_lock, flags);
 }
@@ -351,9 +349,9 @@
 		drbd_io_error(mdev, TRUE);
 	}
 
-	if ( ++mdev->al_tr_pos > div_ceil(mdev->act_log->nr_elements, AL_EXTENTS_PT) ) {
+	if (++mdev->al_tr_pos > div_ceil(mdev->act_log->nr_elements, AL_EXTENTS_PT))
 		mdev->al_tr_pos = 0;
-	}
+
 	D_ASSERT(mdev->al_tr_pos < MD_AL_MAX_SIZE);
 	mdev->al_tr_number++;
 
@@ -388,9 +386,8 @@
 
 	rv = ( be32_to_cpu(b->magic) == DRBD_MAGIC );
 
-	for(i = 0;i<AL_EXTENTS_PT+1;i++) {
+	for(i = 0;i<AL_EXTENTS_PT+1;i++)
 		xor_sum ^= be32_to_cpu(b->updates[i].extent);
-	}
 	rv &= (xor_sum == be32_to_cpu(b->xor_sum));
 
 	return rv;
@@ -492,9 +489,8 @@
 
 	mdev->al_tr_number = to_tnr+1;
 	mdev->al_tr_pos = to;
-	if ( ++mdev->al_tr_pos > div_ceil(mdev->act_log->nr_elements, AL_EXTENTS_PT) ) {
+	if (++mdev->al_tr_pos > div_ceil(mdev->act_log->nr_elements, AL_EXTENTS_PT))
 		mdev->al_tr_pos = 0;
-	}
 
 	/* ok, we are done with it */
 	up(&mdev->md_io_mutex);
@@ -520,20 +516,19 @@
 	int uptodate = bio_flagged(bio, BIO_UPTODATE);
 
 	if (bio->bi_size) return 1;
-	if (!error && !uptodate) {
-		/* strange behaviour of some lower level drivers...
-		 * fail the request by clearing the uptodate flag,
-		 * but do not return any error?!
-		 * do we want to WARN() on this? */
+
+	/* strange behaviour of some lower level drivers...
+	 * fail the request by clearing the uptodate flag,
+	 * but do not return any error?!
+	 * do we want to WARN() on this? */
+	if (!error && !uptodate)
 		error = -EIO;
-	}
 
 	drbd_chk_io_error(mdev, error, TRUE);
 	if (error && wc->error == 0) wc->error = error;
 
-	if (atomic_dec_and_test(&wc->count)) {
+	if (atomic_dec_and_test(&wc->count))
 		complete(&wc->io_done);
-	}
 
 	page = bio->bi_io_vec[0].bv_page;
 	if (page) put_page(page);
@@ -589,10 +584,9 @@
 			 kmap(*page) + *page_offset );
 	kunmap(*page);
 
-	if (bio_add_page(bio, *page, MD_HARDSECT, *page_offset)!=MD_HARDSECT) {
-		/* no memory leak, page gets cleaned up by caller */
+	/* no memory leak, page gets cleaned up by caller */
+	if (bio_add_page(bio, *page, MD_HARDSECT, *page_offset)!=MD_HARDSECT)
 		return -EINVAL;
-	}
 
 	if (!allocated_page) get_page(*page);
 
@@ -916,13 +910,12 @@
 	/* we clear it (in sync).
 	 * round up start sector, round down end sector.  we make sure we only
 	 * clear full, alligned, BM_BLOCK_SIZE (4K) blocks */
-	if (unlikely(esector < BM_SECT_PER_BIT-1)) {
+	if (unlikely(esector < BM_SECT_PER_BIT-1))
 		return;
-	} else if (unlikely(esector == (nr_sectors-1))) {
+	if (unlikely(esector == (nr_sectors-1)))
 		ebnr = lbnr;
-	} else {
+	else
 		ebnr = BM_SECT_TO_BIT(esector - (BM_SECT_PER_BIT-1));
-	}
 	sbnr = BM_SECT_TO_BIT(sector + BM_SECT_PER_BIT-1);
 
 	MTRACE(TraceTypeResync, TraceLvlMetrics,
@@ -1049,11 +1042,9 @@
 	if (wakeup) wake_up(&mdev->al_wait);
 
 	if (!bm_ext) {
-		if (rs_flags & LC_STARVING) {
+		if (rs_flags & LC_STARVING)
 			WARN("Have to wait for element"
 			     " (resync LRU too small?)\n");
-		}
-		/* WARN("Ongoing RS update (???)\n"); */
 		BUG_ON(rs_flags & LC_DIRTY);
 	}
 
@@ -1185,9 +1176,8 @@
 	}
 	bm_ext = (struct bm_extent*)lc_try_get(mdev->resync, enr);
 	if (bm_ext) {
-		if (test_bit(BME_LOCKED, &bm_ext->flags)) {
+		if (test_bit(BME_LOCKED, &bm_ext->flags))
 			goto proceed;
-		}
 		if (!test_and_set_bit(BME_NO_WRITES, &bm_ext->flags)) {
 			mdev->resync_locked++;
 		} else {
@@ -1208,11 +1198,9 @@
 		bm_ext = (struct bm_extent*)lc_get(mdev->resync, enr);
 		if (!bm_ext) {
 			const unsigned long rs_flags = mdev->resync->flags;
-			if (rs_flags & LC_STARVING) {
+			if (rs_flags & LC_STARVING)
 				WARN("Have to wait for element"
 				     " (resync LRU too small?)\n");
-			}
-			/* WARN("Ongoing RS update (???)\n"); */
 			BUG_ON(rs_flags & LC_DIRTY);
 			goto try_again;
 		}
@@ -1410,13 +1398,12 @@
 	/*
 	 * round up start sector, round down end sector.  we make sure we only
 	 * handle full, alligned, BM_BLOCK_SIZE (4K) blocks */
-	if (unlikely(esector < BM_SECT_PER_BIT-1)) {
+	if (unlikely(esector < BM_SECT_PER_BIT-1))
 		return;
-	} else if (unlikely(esector == (nr_sectors-1))) {
+	if (unlikely(esector == (nr_sectors-1)))
 		ebnr = lbnr;
-	} else {
+	else
 		ebnr = BM_SECT_TO_BIT(esector - (BM_SECT_PER_BIT-1));
-	}
 	sbnr = BM_SECT_TO_BIT(sector + BM_SECT_PER_BIT-1);
 
 	if (sbnr > ebnr) return;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 12:51:35 UTC (rev 2989)
+++ branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 13:06:52 UTC (rev 2990)
@@ -248,13 +248,11 @@
 	const unsigned long mask = (1UL << (b->bm_bits & (BITS_PER_LONG-1))) -1;
 	size_t w = b->bm_bits >> LN2_BPL;
 
-	if (w < b->bm_words) {
+	if (w < b->bm_words)
 		b->bm[w++] |= ~mask;
-	}
 
-	if (w < b->bm_words) {
+	if (w < b->bm_words)
 		b->bm[w++] = ~(0UL);
-	}
 }
 
 STATIC unsigned long bm_count_bits(struct drbd_bitmap * b, int just_read)
@@ -555,13 +553,13 @@
 
 	if (bio->bi_size)
 		return 1;
-	if (!error && !uptodate) {
-		/* strange behaviour of some lower level drivers...
-		 * fail the request by clearing the uptodate flag,
-		 * but do not return any error?!
-		 * do we want to WARN() on this? */
+
+	/* strange behaviour of some lower level drivers...
+	 * fail the request by clearing the uptodate flag,
+	 * but do not return any error?!
+	 * do we want to WARN() on this? */
+	if (!error && !uptodate)
 		error = -EIO;
-	}
 
 	if (error) {
 		/* doh. what now?
@@ -673,9 +671,8 @@
 		/* all pages */
 		bm = b->bm;
 	}
-	for (; bm < end; bm++) {
+	for (; bm < end; bm++)
 		*bm = cpu_to_lel(*bm);
-	}
 }
 # endif
 /* lel_to_cpu == cpu_to_lel */
@@ -707,10 +704,9 @@
 	atomic_set(&b->bm_async_io, num_pages);
 	__clear_bit(BM_MD_IO_ERROR, &b->bm_flags);
 
-	for (i = 0; i < num_pages; i++) {
-		/* let the layers below us try to merge these bios... */
+	/* let the layers below us try to merge these bios... */
+	for (i = 0; i < num_pages; i++)
 		drbd_bm_page_io_async(mdev, b, i, rw);
-	}
 
 	drbd_blk_run_queue(bdev_get_queue(mdev->bc->md_bdev));
 	wait_event(b->bm_io_wait, atomic_read(&b->bm_async_io) == 0);
@@ -727,7 +723,8 @@
 	now = jiffies;
 	if (rw == WRITE) {
 		bm_lel_to_cpu(b);
-	} else /* rw == READ */ {
+	} else {
+		/* rw == READ */
 		/* just read, if neccessary adjust endianness */
 		b->bm_set = bm_count_bits(b, 1);
 		INFO("recounting of set bits took additional %lu jiffies\n",
@@ -782,9 +779,8 @@
 	INFO("write_sect: sector=%lu offset=%u num_words=%u\n",
 			enr, offset, num_words);
 #endif
-	if (num_words < S2W(1)) {
+	if (num_words < S2W(1))
 		memset(page_address(mdev->md_io_page), 0, MD_HARDSECT);
-	}
 	drbd_bm_get_lel( mdev, offset, num_words,
 			 page_address(mdev->md_io_page) );
 	if (!drbd_md_sync_page_io(mdev, mdev->bc, on_disk_sector, WRITE)) {
@@ -856,11 +852,11 @@
 	ERR_IF(!b->bm) return i;
 
 	spin_lock_irq(&b->bm_lock);
-	if (b->bm_fo < b->bm_bits) {
+	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) {
+	else if (b->bm_fo > b->bm_bits)
 		ERR("bm_fo=%lu bm_bits=%lu\n", b->bm_fo, b->bm_bits);
-	}
+
 	if (i >= b->bm_bits) {
 		i = -1UL;
 		b->bm_fo = 0;
@@ -999,7 +995,7 @@
 		i = test_bit(bitnr, b->bm) ? 1 : 0;
 	} else if (bitnr == b->bm_bits) {
 		i = -1;
-	} else /* (bitnr > b->bm_bits) */ {
+	} else { /* (bitnr > b->bm_bits) */
 		ERR("bitnr=%lu > bm_bits=%lu\n", bitnr, b->bm_bits);
 		i = 0;
 	}
@@ -1071,9 +1067,8 @@
 		n = e-s;
 		memset(b->bm+s, -1, n*sizeof(long));
 		b->bm_set += n*BITS_PER_LONG - count;
-		if (e == b->bm_words) {
+		if (e == b->bm_words)
 			b->bm_set -= bm_clear_surplus(b);
-		}
 	} else {
 		ERR("start offset (%d) too large in drbd_bm_ALe_set_all\n", s);
 	}

Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 12:51:35 UTC (rev 2989)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 13:06:52 UTC (rev 2990)
@@ -1608,9 +1608,8 @@
 }
 
 static inline void wake_asender(drbd_dev *mdev) {
-	if (test_bit(SIGNAL_ASENDER, &mdev->flags)) {
+	if (test_bit(SIGNAL_ASENDER, &mdev->flags))
 		force_sig(DRBD_SIG, mdev->asender.task);
-	}
 }
 
 static inline void request_ping(drbd_dev *mdev) {
@@ -1734,9 +1733,8 @@
 
 static inline void dec_net(drbd_dev* mdev)
 {
-	if (atomic_dec_and_test(&mdev->net_cnt)) {
+	if (atomic_dec_and_test(&mdev->net_cnt))
 		wake_up(&mdev->misc_wait);
-	}
 }
 
 /**
@@ -1761,9 +1759,8 @@
 
 static inline void dec_local(drbd_dev* mdev)
 {
-	if (atomic_dec_and_test(&mdev->local_cnt)) {
+	if (atomic_dec_and_test(&mdev->local_cnt))
 		wake_up(&mdev->misc_wait);
-	}
 	D_ASSERT(atomic_read(&mdev->local_cnt)>=0);
 }
 /**
@@ -1776,9 +1773,8 @@
 
 	atomic_inc(&mdev->local_cnt);
 	io_allowed = (mdev->state.disk >= mins );
-	if (!io_allowed) {
+	if (!io_allowed)
 		dec_local(mdev);
-	}
 	return io_allowed;
 }
 static inline int inc_local(drbd_dev* mdev)

Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 12:51:35 UTC (rev 2989)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 13:06:52 UTC (rev 2990)
@@ -326,10 +326,10 @@
 		return 1;
 
 	spin_lock_irqsave(&mdev->req_lock, flags);
-	if ( (send = (mdev->state.disk == Failed)) ) {
+	send = (mdev->state.disk == Failed);
+	if (send)
 		_drbd_set_state(_NS(mdev, disk, Diskless),
 				ChgStateHard|ScheduleAfter);
-	}
 	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
 	if (!send) return ok;
@@ -347,9 +347,8 @@
 
 	/* Releasing the backing device is done in after_state_ch() */
 
-	if (eh == CallIOEHelper) {
+	if (eh == CallIOEHelper)
 		drbd_khelper(mdev, "local-io-error");
-	}
 
 	return ok;
 }
@@ -615,17 +614,15 @@
 
 	/* Dissalow Network errors to configure a device's network part */
 	if ( (ns.conn >= Timeout && ns.conn <= TearDown ) &&
-	    os.conn <= Disconnecting ) {
+	    os.conn <= Disconnecting )
 		ns.conn = os.conn;
-	}
 
 	/* Dissalow network errors (+TearDown) to overwrite each other.
 	   Dissalow network errors to overwrite the Disconnecting state. */
 	if ( ( (os.conn >= Timeout && os.conn <= TearDown)
 	      || os.conn == Disconnecting ) &&
-	    ns.conn >= Timeout && ns.conn <= TearDown ) {
+	    ns.conn >= Timeout && ns.conn <= TearDown )
 		ns.conn = os.conn;
-	}
 
 	if (ns.conn < Connected) {
 		ns.peer_isp = 0;
@@ -634,9 +631,8 @@
 		     ns.pdsk < Inconsistent ) ns.pdsk = DUnknown;
 	}
 
-	if (ns.conn <= Disconnecting && ns.disk == Diskless) {
+	if (ns.conn <= Disconnecting && ns.disk == Diskless)
 		ns.pdsk = DUnknown;
-	}
 
 	if ( ns.conn > Connected && (ns.disk <= Failed || ns.pdsk <= Failed )) {
 		warn_sync_abort = 1;
@@ -661,9 +657,8 @@
 			WARN("Implicit set disk state Inconsistent!\n");
 			break;
 		}
-		if (os.disk == Outdated && ns.disk == UpToDate) {
+		if (os.disk == Outdated && ns.disk == UpToDate)
 			WARN("Implicit set disk from Outdate to UpToDate\n");
-		}
 	}
 
 	if ( ns.conn >= Connected &&
@@ -684,9 +679,8 @@
 			WARN("Implicit set pdsk Inconsistent!\n");
 			break;
 		}
-		if (os.pdsk == Outdated && ns.pdsk == UpToDate) {
+		if (os.pdsk == Outdated && ns.pdsk == UpToDate)
 			WARN("Implicit set pdsk from Outdate to UpToDate\n");
-		}
 	}
 
 	/* Connection breaks down before we finished "Negotiating" */
@@ -695,13 +689,11 @@
 		ns.pdsk = mdev->new_state_tmp.pdsk;
 	}
 
-	if (fp == Stonith) {
-		if (ns.role == Primary &&
-		   ns.conn < Connected &&
-		   ns.pdsk > Outdated ) {
+	if (fp == Stonith &&
+	    (ns.role == Primary &&
+	     ns.conn < Connected &&
+	     ns.pdsk > Outdated))
 			ns.susp = 1;
-		}
-	}
 
 	if (ns.aftr_isp || ns.peer_isp || ns.user_isp) {
 		if (ns.conn == SyncSource) ns.conn = PausedSyncS;
@@ -738,9 +730,8 @@
 		return rv;
 	}
 
-	if (warn_sync_abort) {
+	if (warn_sync_abort)
 		WARN("Resync aborted.\n");
-	}
 
 #if DUMP_MD >= 2
 	{
@@ -785,9 +776,8 @@
 	    (ns.conn == PausedSyncT || ns.conn == PausedSyncS) ) {
 		INFO("Resync suspended\n");
 		mdev->rs_mark_time = jiffies;
-		if (ns.conn == PausedSyncT) {
+		if (ns.conn == PausedSyncT)
 			set_bit(STOP_SYNC_TIMER, &mdev->flags);
-		}
 	}
 
 	if ( os.disk == Diskless && os.conn == StandAlone &&
@@ -834,9 +824,8 @@
 
 	if ( (os.conn != Connected && ns.conn == Connected) ) {
 		clear_bit(CRASHED_PRIMARY, &mdev->flags);
-		if (mdev->p_uuid) {
+		if (mdev->p_uuid)
 			mdev->p_uuid[UUID_FLAGS] &= ~((u64)2);
-		}
 	}
 
 	fp = DontCare;
@@ -925,17 +914,15 @@
 
 	if (ns.pdsk < Inconsistent) {
 		/* Diskless Peer becomes primary */
-		if (os.peer == Secondary && ns.peer == Primary) {
+		if (os.peer == Secondary && ns.peer == Primary)
 			drbd_uuid_new_current(mdev);
-		}
 		/* Diskless Peer becomes secondary */
-		if (os.peer == Primary && ns.peer == Secondary) {
+		if (os.peer == Primary && ns.peer == Secondary)
 			drbd_al_to_on_disk_bm(mdev);
-		}
 	}
 
 	/* Last part of the attaching process ... */
-	if ( ns.conn >= Connected && 
+	if ( ns.conn >= Connected &&
 	     os.disk == Attaching && ns.disk == Negotiating ) {
 		drbd_send_sizes(mdev);  /* to start sync... */
 		drbd_send_uuids(mdev);
@@ -943,17 +930,15 @@
 	}
 
 	/* We want to pause/continue resync, tell peer. */
-	if ( ns.conn >= Connected && 
+	if ( ns.conn >= Connected &&
 	     (( os.aftr_isp != ns.aftr_isp ) ||
-	      ( os.user_isp != ns.user_isp )) ) {
+	      ( os.user_isp != ns.user_isp )) )
 		drbd_send_state(mdev);
-	}
 
 	/* In case one of the isp bits got set, suspend other devices. */
 	if ( ( !os.aftr_isp && !os.peer_isp && !os.user_isp) &&
-	     ( ns.aftr_isp || ns.peer_isp || ns.user_isp) ) {
+	     ( ns.aftr_isp || ns.peer_isp || ns.user_isp) )
 		suspend_other_sg(mdev);
-	}
 
 	/* We are in the progress to start a full sync... */
 	if ( ( os.conn != StartingSyncT && ns.conn == StartingSyncT ) ||
@@ -977,7 +962,7 @@
 			_drbd_set_state(_NS(mdev, conn, WFSyncUUID),
 					ChgStateVerbose | ScheduleAfter );
 			spin_unlock_irq(&mdev->req_lock);
-		} else /* StartingSyncS */ {
+		} else { /* StartingSyncS */
 			drbd_start_resync(mdev, SyncSource);
 		}
 	}
@@ -1013,35 +998,29 @@
 	/* 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) ) {
+	     (os.user_isp && !ns.user_isp) )
 		resume_next_sg(mdev);
-	}
 
 	/* Receiver should clean up itself */
-	if (os.conn != Disconnecting && ns.conn == Disconnecting) {
+	if (os.conn != Disconnecting && ns.conn == Disconnecting)
 		drbd_thread_signal(&mdev->receiver);
-	}
 
 	/* Now the receiver finished cleaning up itself, it should die now */
-	if (os.conn != StandAlone && ns.conn == StandAlone) {
+	if (os.conn != StandAlone && ns.conn == StandAlone)
 		drbd_thread_stop_nowait(&mdev->receiver);
-	}
 
 	/* Upon network failure, we need to restart the receiver. */
 	if ( os.conn > TearDown &&
-	     ns.conn <= TearDown && ns.conn >= Timeout) {
+	     ns.conn <= TearDown && ns.conn >= Timeout)
 		drbd_thread_restart_nowait(&mdev->receiver);
-	}
 
-	if (os.conn == StandAlone && ns.conn == Unconnected) {
+	if (os.conn == StandAlone && ns.conn == Unconnected)
 		drbd_thread_start(&mdev->receiver);
-	}
 
 	if ( os.disk == Diskless && os.conn <= Disconnecting &&
 	     (ns.disk > Diskless || ns.conn >= Unconnected) ) {
-		if (!drbd_thread_start(&mdev->worker)) {
+		if (!drbd_thread_start(&mdev->worker))
 			module_put(THIS_MODULE);
-		}
 	}
 
 	/* FIXME what about Primary, Diskless, and then losing
@@ -1051,9 +1030,8 @@
 	 * after which we probably won't survive the next
 	 * request from the upper layers ... BOOM again :( */
 	if ( (os.disk > Diskless || os.conn > StandAlone) &&
-	     ns.disk == Diskless && ns.conn == StandAlone ) {
+	     ns.disk == Diskless && ns.conn == StandAlone )
 		drbd_thread_stop_nowait(&mdev->worker);
-	}
 }
 
 
@@ -1187,9 +1165,8 @@
 		return;
 	}
 
-	if (thi->task != current) {
+	if (thi->task != current)
 		force_sig(DRBD_SIGKILL, thi->task);
-	}
 
 	spin_unlock(&thi->t_lock);
 }
@@ -1212,10 +1189,9 @@
 	sent = drbd_send(mdev, sock, h, size, msg_flags);
 
 	ok = ( sent == size );
-	if (!ok) {
+	if (!ok)
 		ERR("short sent %s size=%d sent=%d\n",
 		    cmdname(cmd), (int)size, sent);
-	}
 	return ok;
 }
 
@@ -1238,13 +1214,12 @@
 
 	/* drbd_disconnect() could have called drbd_free_sock()
 	 * while we were waiting in down()... */
-	if (likely(sock != NULL)) {
+	if (likely(sock != NULL))
 		ok = _drbd_send_cmd(mdev, sock, cmd, h, size, 0);
-	}
 
-	if (use_data_socket) {
+	if (use_data_socket)
 		up(&mdev->data.mutex);
-	} else
+	else
 		up(&mdev->meta.mutex);
 	return ok;
 }
@@ -1304,12 +1279,9 @@
 
 	if (!inc_local_if_state(mdev, Negotiating)) return 1; /* ok. */
 
-	for (i = Current; i < UUID_SIZE; i++) {
-		/* FIXME howto handle diskless ? */
-		p.uuid[i] = mdev->bc
-			? cpu_to_be64(mdev->bc->md.uuid[i])
-			: 0;
-	}
+	/* FIXME howto handle diskless ? */
+	for (i = Current; i < UUID_SIZE; i++)
+		p.uuid[i] = mdev->bc ? cpu_to_be64(mdev->bc->md.uuid[i]) : 0;
 
 	mdev->comm_bm_set = drbd_bm_total_weight(mdev);
 	p.uuid[UUID_SIZE] = cpu_to_be64(mdev->comm_bm_set);
@@ -1432,9 +1404,8 @@
 	do {
 		num_words = min_t(size_t, BM_PACKET_WORDS, bm_words-bm_i );
 		want = num_words * sizeof(long);
-		if (want) {
+		if (want)
 			drbd_bm_get_lel(mdev, bm_i, num_words, buffer);
-		}
 		ok = _drbd_send_cmd(mdev, mdev->data.socket, ReportBitMap,
 				   p, sizeof(*p) + want, 0);
 		bm_i += num_words;
@@ -1664,10 +1635,9 @@
 	struct bio_vec *bvec;
 	int i;
 	__bio_for_each_segment(bvec, bio, i, 0) {
-		if (! _drbd_send_page(mdev, bvec->bv_page, bvec->bv_offset,
-				      bvec->bv_len) ) {
+		if (!_drbd_send_page(mdev, bvec->bv_page,
+				     bvec->bv_offset, bvec->bv_len))
 			return 0;
-		}
 	}
 
 	return 1;
@@ -1694,27 +1664,23 @@
 	p.seq_num  = cpu_to_be32( req->seq_num =
 				  atomic_add_return(1, &mdev->packet_seq) );
 	dp_flags = 0;
-	if (req->master_bio->bi_rw & BIO_RW_BARRIER) {
+	if (req->master_bio->bi_rw & BIO_RW_BARRIER)
 		dp_flags |= DP_HARDBARRIER;
-	}
-	if (req->master_bio->bi_rw & BIO_RW_SYNC) {
+	if (req->master_bio->bi_rw & BIO_RW_SYNC)
 		dp_flags |= DP_RW_SYNC;
-	}
 	if (mdev->state.conn >= SyncSource &&
-	   mdev->state.conn <= PausedSyncT) {
+	   mdev->state.conn <= PausedSyncT)
 		dp_flags |= DP_MAY_SET_IN_SYNC;
-	}
 
 	p.dp_flags = cpu_to_be32(dp_flags);
 	dump_packet(mdev, mdev->data.socket, 0, (void*)&p, __FILE__, __LINE__);
 	set_bit(UNPLUG_REMOTE, &mdev->flags);
 	ok = sizeof(p) == drbd_send(mdev, mdev->data.socket, &p, sizeof(p), MSG_MORE);
 	if (ok) {
-		if (mdev->net_conf->wire_protocol == DRBD_PROT_A) {
+		if (mdev->net_conf->wire_protocol == DRBD_PROT_A)
 			ok = _drbd_send_bio(mdev, req->master_bio);
-		} else {
+		else
 			ok = _drbd_send_zc_bio(mdev, req->master_bio);
-		}
 	}
 
 	drbd_put_data_sock(mdev);
@@ -1879,11 +1845,10 @@
 	/* to have a stable mdev->state.role and no race with updating open_cnt */
 
 	if (mdev->state.role != Primary) {
-		if (file->f_mode & FMODE_WRITE) {
+		if (file->f_mode & FMODE_WRITE)
 			rv = -EROFS;
-		} else if (!allow_oos) {
+		else if (!allow_oos)
 			rv = -EMEDIUMTYPE;
-		}
 	}
 
 	if (!rv) mdev->open_cnt++;
@@ -2388,9 +2353,8 @@
 #endif
 	}
 
-	if ( (err = drbd_nl_init()) ) {
-		return err;
-	}
+	err = drbd_nl_init();
+	if (err) return err;
 
 	err = register_blkdev(DRBD_MAJOR, DEVICE_NAME);
 	if (err) {
@@ -2680,11 +2644,10 @@
 void _drbd_uuid_set(drbd_dev *mdev, int idx, u64 val)
 {
 	if (idx == Current) {
-		if (mdev->state.role == Primary) {
+		if (mdev->state.role == Primary)
 			val |= 1;
-		} else {
+		else
 			val &= ~((u64)1);
-		}
 	}
 
 	mdev->bc->md.uuid[idx] = val;
@@ -2719,11 +2682,10 @@
 		);
 
 	get_random_bytes(&mdev->bc->md.uuid[Current], sizeof(u64));
-	if (mdev->state.role == Primary) {
+	if (mdev->state.role == Primary)
 		mdev->bc->md.uuid[Current] |= 1;
-	} else {
+	else
 		mdev->bc->md.uuid[Current] &= ~((u64)1);
-	}
 
 	MTRACE(TraceTypeUuid, TraceLvlSummary,
 	       drbd_print_uuid(mdev, Current);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 12:51:35 UTC (rev 2989)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 13:06:52 UTC (rev 2990)
@@ -216,9 +216,8 @@
 		drbd_request_state(mdev, NS(disk, Outdated));
 		break;
 	case 7:
-		if (fp != Stonith) {
+		if (fp != Stonith)
 			ERR("outdate-peer() = 7 && fencing != Stonith !!!\n");
-		}
 		nps = Outdated;
 		break;
 	default:
@@ -240,9 +239,8 @@
 	drbd_state_t mask, val;
 	drbd_disks_t nps;
 
-	if (new_role == Primary) {
+	if (new_role == Primary)
 		request_ping(mdev); /* Detect a dead peer ASAP */
-	}
 
 	mask.i = 0; mask.role = role_mask;
 	val.i  = 0; val.role  = new_role;
@@ -321,7 +319,7 @@
 
 	if (new_role == Secondary) {
 		set_disk_ro(mdev->vdisk, TRUE );
-		if ( inc_local(mdev) ) {
+		if (inc_local(mdev)) {
 			mdev->bc->md.uuid[Current] &= ~(u64)1;
 			dec_local(mdev);
 		}
@@ -331,16 +329,12 @@
 			dec_net(mdev);
 		}
 		set_disk_ro(mdev->vdisk, FALSE );
-		/* why?? what for??
-		mdev->this_bdev->bd_disk = mdev->vdisk;
-		 */
-
-		if ( inc_local(mdev) ) {
-			if ( ( ( mdev->state.conn < Connected ||
-				 mdev->state.pdsk <= Failed ) &&
-			       mdev->bc->md.uuid[Bitmap] == 0) || forced ) {
+		if (inc_local(mdev)) {
+			if ( ((mdev->state.conn < Connected ||
+			       mdev->state.pdsk <= Failed)
+			      && mdev->bc->md.uuid[Bitmap] == 0) || forced)
 				drbd_uuid_new_current(mdev);
-			}
+
 			mdev->bc->md.uuid[Current] |=  (u64)1;
 			dec_local(mdev);
 		}
@@ -548,17 +542,15 @@
 		}
 	}
 
-	if (size == 0) {
+	if (size == 0)
 		ERR("Both nodes diskless!\n");
-	}
 
 	if (u_size) {
-		if (u_size<<1 > size) {
+		if (u_size<<1 > size)
 			ERR("Requested disk size is too big (%lu > %lu)\n",
 			    (unsigned long)u_size, (unsigned long)size>>1);
-		} else {
+		else
 			size = u_size<<1;
-		}
 	}
 
 	return size;
@@ -604,9 +596,8 @@
 			in_use += e->refcnt;
 		}
 	}
-	if (!in_use) {
+	if (!in_use)
 		mdev->act_log = n;
-	}
 	spin_unlock_irq(&mdev->al_lock);
 	if (in_use) {
 		ERR("Activity log still in use!\n");
@@ -663,10 +654,9 @@
 	       DUMPI(q->seg_boundary_mask);
 	       );
 
-	if (b->merge_bvec_fn) {
+	if (b->merge_bvec_fn)
 		WARN("Backing device's merge_bvec_fn() = %p\n",
 		     b->merge_bvec_fn);
-	}
 	INFO("max_segment_size ( = BIO size ) = %u\n", q->max_segment_size);
 
 	if (q->backing_dev_info.ra_pages != b->backing_dev_info.ra_pages) {
@@ -818,16 +808,14 @@
 		goto release_bdev2_fail;
 	}
 
-	if ((retcode = drbd_request_state(mdev, NS(disk, Attaching))) < SS_Success ) {
+	if ((retcode = drbd_request_state(mdev, NS(disk, Attaching))) < SS_Success )
 		goto release_bdev2_fail;
-	}
 
 	drbd_md_set_sector_offsets(mdev, nbc);
 
 	retcode = drbd_md_read(mdev, nbc);
-	if (retcode != NoError) {
+	if (retcode != NoError)
 		goto force_diskless;
-	}
 
 	/* Since we are diskless, fix the AL first... */
 	if (drbd_check_al_size(mdev)) {
@@ -857,11 +845,10 @@
 	nbc = NULL;
 	resync_lru = NULL;
 
-	if (drbd_md_test_flag(mdev->bc, MDF_PrimaryInd)) {
+	if (drbd_md_test_flag(mdev->bc, MDF_PrimaryInd))
 		set_bit(CRASHED_PRIMARY, &mdev->flags);
-	} else {
+	else
 		clear_bit(CRASHED_PRIMARY, &mdev->flags);
-	}
 
 	mdev->send_cnt = 0;
 	mdev->recv_cnt = 0;
@@ -891,9 +878,8 @@
 	clear_bit(USE_DEGR_WFC_T, &mdev->flags);
 	if ( mdev->state.role != Primary &&
 	     drbd_md_test_flag(mdev->bc, MDF_PrimaryInd) &&
-	    !drbd_md_test_flag(mdev->bc, MDF_ConnectedInd) ) {
+	    !drbd_md_test_flag(mdev->bc, MDF_ConnectedInd) )
 		set_bit(USE_DEGR_WFC_T, &mdev->flags);
-	}
 
 	drbd_bm_lock(mdev); /* racy... */
 	drbd_determin_dev_size(mdev);
@@ -930,23 +916,20 @@
 	   otherwise into Consistent state.
 	*/
 	if (drbd_md_test_flag(mdev->bc, MDF_Consistent)) {
-		if (drbd_md_test_flag(mdev->bc, MDF_WasUpToDate)) {
+		if (drbd_md_test_flag(mdev->bc, MDF_WasUpToDate))
 			ns.disk = Consistent;
-		} else {
+		else
 			ns.disk = Outdated;
-		}
 	} else {
 		ns.disk = Inconsistent;
 	}
 
-	if (drbd_md_test_flag(mdev->bc, MDF_PeerOutDated)) {
+	if (drbd_md_test_flag(mdev->bc, MDF_PeerOutDated))
 		ns.pdsk = Outdated;
-	}
 
 	if ( ns.disk == Consistent &&
-	    ( ns.pdsk == Outdated || mdev->bc->dc.fencing == DontCare ) ) {
+	    ( ns.pdsk == Outdated || mdev->bc->dc.fencing == DontCare ) )
 		ns.disk = UpToDate;
-	}
 
 	/* All tests on MDF_PrimaryInd, MDF_ConnectedInd,
 	   MDF_Consistent and MDF_WasUpToDate must happen before
@@ -966,9 +949,8 @@
 	spin_unlock_irq(&mdev->req_lock);
 	if (rv==SS_Success) after_state_ch(mdev, os, ns, ChgStateVerbose);
 
-	if (rv < SS_Success) {
+	if (rv < SS_Success)
 		goto unlock_bm;
-	}
 
 	drbd_bm_unlock(mdev);
 
@@ -1086,13 +1068,13 @@
 		if (!odev || odev == mdev) continue;
 		if ( inc_net(odev)) {
 			if ( M_ADDR(new_conf) == M_ADDR(odev->net_conf) &&
-			    M_PORT(new_conf) == M_PORT(odev->net_conf) ) {
+			    M_PORT(new_conf) == M_PORT(odev->net_conf) )
 				retcode = LAAlreadyInUse;
-			}
+
 			if (O_ADDR(new_conf) == O_ADDR(odev->net_conf) &&
-			   O_PORT(new_conf) == O_PORT(odev->net_conf) ) {
+			   O_PORT(new_conf) == O_PORT(odev->net_conf) )
 				retcode = OAAlreadyInUse;
-			}
+
 			dec_net(odev);
 			if (retcode != NoError) goto fail;
 		}
@@ -1180,9 +1162,8 @@
 		mdev->ee_hash = new_ee_hash;
 	}
 
-	if (mdev->cram_hmac_tfm) {
+	if (mdev->cram_hmac_tfm)
 		crypto_free_hash(mdev->cram_hmac_tfm);
-	}
 	mdev->cram_hmac_tfm = tfm;
 
 	retcode = drbd_request_state(mdev, NS(conn, Unconnected));
@@ -1217,12 +1198,12 @@
 		/* 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. */
+
+		/* if we are diskless and our peer wants to outdate us,
+		 * simply go away, and let the peer try to outdate us with its
+		 * 'outdate-peer' handler later. */
+		if (retcode == SS_IsDiskLess)
 			retcode = drbd_request_state(mdev, NS(conn, StandAlone));
-		}
 	}
 
 	if (retcode < SS_Success) goto fail;
@@ -1419,11 +1400,11 @@
 
 	spin_lock_irq(&mdev->req_lock);
 	os = mdev->state;
-	if (mdev->state.disk < Outdated) {
+	if (mdev->state.disk < Outdated)
 		retcode = -999;
-	} else {
+	else
 		retcode = _drbd_set_state(_NS(mdev, disk, Outdated), ChgStateVerbose);
-	}
+
 	ns = mdev->state;
 	spin_unlock_irq(&mdev->req_lock);
 	if (retcode==SS_Success) after_state_ch(mdev, os, ns, ChgStateVerbose);
@@ -1638,9 +1619,9 @@
 	TRACE(TraceTypeNl, TraceLvlSummary, nl_trace_reply(cn_reply););
 
 	rr = cn_netlink_send(cn_reply, CN_IDX_DRBD, GFP_KERNEL);
-	if (rr && rr != -ESRCH) {
+	if (rr && rr != -ESRCH)
 		printk(KERN_INFO DEVICE_NAME " cn_netlink_send()=%d\n", rr);
-	}
+
 	kfree(cn_reply);
 	module_put(THIS_MODULE);
 	return;
@@ -1829,8 +1810,7 @@
 	TRACE(TraceTypeNl, TraceLvlSummary, nl_trace_reply(cn_reply););
 
 	rr = cn_netlink_send(cn_reply, CN_IDX_DRBD, GFP_KERNEL);
-	if (rr && rr != -ESRCH) {
+	if (rr && rr != -ESRCH)
 		printk(KERN_INFO DEVICE_NAME " cn_netlink_send()=%d\n", rr);
-	}
 }
 

Modified: branches/drbd-8.0-for-linus/drbd/drbd_proc.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_proc.c	2007-07-24 12:51:35 UTC (rev 2989)
+++ branches/drbd-8.0-for-linus/drbd/drbd_proc.c	2007-07-24 13:06:52 UTC (rev 2990)
@@ -100,15 +100,14 @@
 	res = 1000L - res;
 	seq_printf(seq, "sync'ed:%3lu.%lu%% ", res / 10, res % 10);
 	/* if more than 1 GB display in MB */
-	if (mdev->rs_total > 0x100000L) {
+	if (mdev->rs_total > 0x100000L)
 		seq_printf(seq, "(%lu/%lu)M\n\t",
 			    (unsigned long) Bit2KB(rs_left) >> 10,
 			    (unsigned long) Bit2KB(mdev->rs_total) >> 10 );
-	} else {
+	else
 		seq_printf(seq, "(%lu/%lu)K\n\t",
 			    (unsigned long) Bit2KB(rs_left),
 			    (unsigned long) Bit2KB(mdev->rs_total) );
-	}
 
 	/* see drivers/md/md.c
 	 * We do not want to overflow, so the order of operands and
@@ -238,15 +237,15 @@
 			);
 		}
 		if ( mdev->state.conn == SyncSource ||
-		     mdev->state.conn == SyncTarget ) {
+		     mdev->state.conn == SyncTarget )
 			drbd_syncer_progress(mdev, seq);
-		}
-		if (mdev->resync) {
+
+		if (mdev->resync)
 			lc_printf_stats(seq, mdev->resync);
-		}
-		if (mdev->act_log) {
+
+		if (mdev->act_log)
 			lc_printf_stats(seq, mdev->act_log);
-		}
+
 #if 0
 		if (mdev->resync) {
 			lc_dump(mdev->resync, seq, "rs_left",

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 12:51:35 UTC (rev 2989)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 13:06:52 UTC (rev 2990)
@@ -274,11 +274,10 @@
 			    (unsigned long long)sector, data_size, ds);
 
 			q = bdev_get_queue(bio->bi_bdev);
-			if (q->merge_bvec_fn) {
+			if (q->merge_bvec_fn)
 				ERR("merge_bvec_fn() = %d\n",
-				    q->merge_bvec_fn(q, bio, 
+				    q->merge_bvec_fn(q, bio,
 					  &bio->bi_io_vec[bio->bi_vcnt]));
-			}
 
 			/* dump more of the bio. */
 			DUMPI(bio->bi_max_vecs);
@@ -445,10 +444,10 @@
 		le = mdev->done_ee.next;
 		list_del(le);
 		e = list_entry(le, struct Tl_epoch_entry, w.list);
-		if (mdev->net_conf->wire_protocol == DRBD_PROT_C ||
-		   is_syncer_block_id(e->block_id)) {
+		if (mdev->net_conf->wire_protocol == DRBD_PROT_C
+		|| is_syncer_block_id(e->block_id))
 			++n;
-		}
+
 		if (!hlist_unhashed(&e->colision)) hlist_del_init(&e->colision);
 		drbd_free_ee(mdev, e);
 	}
@@ -693,9 +692,8 @@
 
 	rr = drbd_recv_short(mdev, sock, h, sizeof(*h));
 
-	if ( rr==sizeof(*h) && h->magic==BE_DRBD_MAGIC ) {
+	if (rr == sizeof(*h) && h->magic == BE_DRBD_MAGIC)
 		return be16_to_cpu(h->command);
-	}
 
 	return 0xffff;
 }
@@ -972,10 +970,9 @@
  * requests.  don't use unacked_cnt, so we speed up proto A and B, too. */
 static void maybe_kick_lo(drbd_dev *mdev)
 {
-	if (atomic_read(&mdev->local_cnt) >= mdev->net_conf->unplug_watermark ) {
-		/* FIXME hysteresis ?? */
+	/* FIXME hysteresis ?? */
+	if (atomic_read(&mdev->local_cnt) >= mdev->net_conf->unplug_watermark)
 		drbd_kick_lo(mdev);
-	}
 }
 
 STATIC int recv_dless_read(drbd_dev *mdev, drbd_request_t *req,
@@ -1320,15 +1317,14 @@
 	e->w.cb = e_end_block;
 
 	dp_flags = be32_to_cpu(p->dp_flags);
-	if (dp_flags & DP_HARDBARRIER) {
+	if (dp_flags & DP_HARDBARRIER)
 		e->private_bio->bi_rw |= BIO_RW_BARRIER;
-	}
-	if (dp_flags & DP_RW_SYNC) {
+
+	if (dp_flags & DP_RW_SYNC)
 		e->private_bio->bi_rw |= BIO_RW_SYNC;
-	}
-	if (dp_flags & DP_MAY_SET_IN_SYNC) {
+
+	if (dp_flags & DP_MAY_SET_IN_SYNC)
 		e->flags |= EE_MAY_SET_IN_SYNC;
-	}
 
 	/* I'm the receiver, I do hold a net_cnt reference. */
 	if (!mdev->net_conf->two_primaries) {
@@ -1959,17 +1955,14 @@
 	}
 
 	if (hg == -100) {
-		if (mdev->net_conf->want_lose && !(mdev->p_uuid[UUID_FLAGS]&1)){
+		if (mdev->net_conf->want_lose && !(mdev->p_uuid[UUID_FLAGS]&1))
 			hg = -1;
-		}
-		if (!mdev->net_conf->want_lose && (mdev->p_uuid[UUID_FLAGS]&1)){
+		if (!mdev->net_conf->want_lose && (mdev->p_uuid[UUID_FLAGS]&1))
 			hg = 1;
-		}
 
-		if ( abs(hg) < 100 ) {
+		if ( abs(hg) < 100 )
 			WARN("Split-Brain detected, manually solved. Sync from %s node\n",
 			     (hg < 0) ? "peer":"this");
-		}
 	}
 
 	if (hg == -100) {
@@ -2008,9 +2001,8 @@
 
 		drbd_bm_set_all(mdev);
 
-		if (unlikely(drbd_bm_write(mdev) < 0)) {
+		if (unlikely(drbd_bm_write(mdev) < 0))
 			return conn_mask;
-		}
 
 		drbd_md_clear_flag(mdev, MDF_FullSync);
 		drbd_md_sync(mdev);
@@ -2133,10 +2125,9 @@
 	sector_t d;
 	if (a == 0 || b == 0) return;
 	d = (a > b) ? (a - b) : (b - a);
-	if ( d > (a>>3) || d > (b>>3)) {
+	if ( d > (a>>3) || d > (b>>3))
 		WARN("Considerable difference in %s: %llus vs. %llus\n", s,
 		     (unsigned long long)a, (unsigned long long)b);
-	}
 }
 
 STATIC int receive_sizes(drbd_dev *mdev, Drbd_Header *h)
@@ -2166,12 +2157,11 @@
 		warn_if_differ_considerably(mdev, "user requested size",
 					    p_usize, mdev->bc->dc.disk_size);
 
-		if (mdev->state.conn == WFReportParams) {
-			/* this is first connect, or an otherwise expected
-			   param exchange.  choose the minimum */
+		/* if this is the first connect, or an otherwise expected
+		 * param exchange, choose the minimum */
+		if (mdev->state.conn == WFReportParams)
 			p_usize = min_not_zero((sector_t)mdev->bc->dc.disk_size,
 					     p_usize);
-		}
 
 		my_usize = mdev->bc->dc.disk_size;
 
@@ -2226,9 +2216,8 @@
 
 	if (inc_local(mdev)) {
 		max_seg_s = be32_to_cpu(p->max_segment_size);
-		if (max_seg_s != mdev->rq_queue->max_segment_size) {
+		if (max_seg_s != mdev->rq_queue->max_segment_size)
 			drbd_setup_queue_param(mdev, max_seg_s);
-		}
 
 		drbd_setup_order_type(mdev, be32_to_cpu(p->queue_order_type));
 		dec_local(mdev);
@@ -2258,9 +2247,8 @@
 
 	p_uuid = kmalloc(sizeof(u64)*EXT_UUID_SIZE, GFP_KERNEL);
 
-	for (i = Current; i < EXT_UUID_SIZE; i++) {
+	for (i = Current; i < EXT_UUID_SIZE; i++)
 		p_uuid[i] = be64_to_cpu(p->uuid[i]);
-	}
 
 	if (mdev->p_uuid) kfree(mdev->p_uuid);
 	mdev->p_uuid = p_uuid;
@@ -2386,9 +2374,8 @@
 		}
 	}
 
-	if (rv==SS_Success) {
+	if (rv==SS_Success)
 		after_state_ch(mdev, os, ns, ChgStateVerbose | ChgStateHard);
-	}
 
 	mdev->net_conf->want_lose = 0;
 
@@ -2695,9 +2682,8 @@
 		rv = _drbd_set_state(mdev, ns, ChgStateVerbose);
 	}
 	spin_unlock_irq(&mdev->req_lock);
-	if (rv == SS_Success) {
+	if (rv == SS_Success)
 		after_state_ch(mdev, os, ns, ChgStateVerbose);
-	}
 
 	if (os.conn == Disconnecting) {
 		wait_event( mdev->misc_wait, atomic_read(&mdev->net_cnt) == 0 );
@@ -2988,10 +2974,9 @@
 
 	rv = ! memcmp(response, right_response, resp_size);
 
-	if (rv) {
+	if (rv)
 		INFO("Peer authenticated using %d bytes of '%s' HMAC\n",
 		     resp_size, mdev->net_conf->cram_hmac_alg);
-	}
 
  fail:
 	if (peers_ch) kfree(peers_ch);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_req.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 12:51:35 UTC (rev 2989)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 13:06:52 UTC (rev 2990)
@@ -123,14 +123,11 @@
 		 * (local only or remote failed).
 		 * Other places where we set out-of-sync:
 		 * READ with local io-error */
-		if (!(s & RQ_NET_OK) || !(s & RQ_LOCAL_OK)) {
+		if (!(s & RQ_NET_OK) || !(s & RQ_LOCAL_OK))
 			drbd_set_out_of_sync(mdev, req->sector, req->size);
-		}
 
-		if ( (s & RQ_NET_OK) && (s & RQ_LOCAL_OK) &&
-		    (s & RQ_NET_SIS) ) {
+		if ((s & RQ_NET_OK) && (s & RQ_LOCAL_OK) && (s & RQ_NET_SIS))
 			drbd_set_in_sync(mdev, req->sector, req->size);
-		}
 
 		/* one might be tempted to move the drbd_al_complete_io
 		 * to the local io completion callback drbd_endio_pri.
@@ -297,10 +294,9 @@
 		if (!hlist_unhashed(&req->colision)) hlist_del(&req->colision);
 		else D_ASSERT((s & RQ_NET_MASK) == 0);
 
-		if (rw == WRITE) {
-			/* for writes we need to do some extra housekeeping */
+		/* for writes we need to do some extra housekeeping */
+		if (rw == WRITE)
 			_about_to_complete_local_write(mdev, req);
-		}
 
 		/* FIXME not yet implemented...
 		 * in case we got "suspended" (on_disconnect: freeze io)
@@ -438,9 +434,8 @@
 	drbd_dev *mdev = req->mdev;
 	MUST_HOLD(&mdev->req_lock);
 
-	if (error && ( bio_rw(req->master_bio) != READA ) ) {
+	if (error && (bio_rw(req->master_bio) != READA))
 		ERR("got an _req_mod() errno of %d\n", error);
-	}
 
 	print_req_mod(req, what);
 
@@ -504,9 +499,9 @@
 		break;
 
 	case read_completed_with_error:
-		if (bio_rw(req->master_bio) != READA) {
+		if (bio_rw(req->master_bio) != READA)
 			drbd_set_out_of_sync(mdev, req->sector, req->size);
-		}
+
 		req->rq_state |= RQ_LOCAL_COMPLETED;
 		req->rq_state &= ~RQ_LOCAL_PENDING;
 
@@ -883,9 +878,8 @@
 		remote = (mdev->state.pdsk == UpToDate ||
 			    ( mdev->state.pdsk == Inconsistent &&
 			      mdev->state.conn >= Connected ) );
-		if (!remote) {
+		if (!remote)
 			WARN("lost connection while grabbing the req_lock!\n");
-		}
 		if (!(local || remote)) {
 			ERR("IO ERROR: neither local nor remote disk\n");
 			spin_unlock_irq(&mdev->req_lock);
@@ -1050,9 +1044,8 @@
 	 */
 	if ( mdev->state.disk < UpToDate &&
 	     mdev->state.conn < Connected) {
-		if (DRBD_ratelimit(5*HZ, 5)) {
+		if (DRBD_ratelimit(5*HZ, 5))
 			ERR("Sorry, I have no access to good data anymore.\n");
-		}
 		/*
 		 * FIXME suspend, loop waiting on cstate wait?
 		 */

Modified: branches/drbd-8.0-for-linus/drbd/drbd_worker.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 12:51:35 UTC (rev 2989)
+++ branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 13:06:52 UTC (rev 2990)
@@ -296,9 +296,8 @@
 	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
 	/* harmless race: list_empty outside data.work.q_lock */
-	if (list_empty(&mdev->resync_work.list) && queue) {
+	if (list_empty(&mdev->resync_work.list) && queue)
 		drbd_queue_work(&mdev->data.work, &mdev->resync_work);
-	}
 }
 
 #define SLEEP_TIME (HZ/10)
@@ -321,15 +320,13 @@
 		return 0;
 	}
 
-	if (mdev->state.conn != SyncTarget) {
+	if (mdev->state.conn != SyncTarget)
 		ERR("%s in w_make_resync_request\n", conns_to_name(mdev->state.conn));
-	}
 
         number = SLEEP_TIME*mdev->sync_conf.rate / ((BM_BLOCK_SIZE/1024)*HZ);
 
-	if (atomic_read(&mdev->rs_pending_cnt)>number) {
+	if (atomic_read(&mdev->rs_pending_cnt)>number)
 		goto requeue;
-	}
 	number -= atomic_read(&mdev->rs_pending_cnt);
 
 	if (!inc_local(mdev)) {
@@ -509,9 +506,8 @@
 		    mdev->state.conn == PausedSyncT) {
 			if (mdev->p_uuid) {
 				int i;
-				for ( i = Bitmap ; i<=History_end ; i++ ) {
+				for (i = Bitmap ; i<=History_end ; i++)
 					_drbd_uuid_set(mdev, i, mdev->p_uuid[i]);
-				}
 				drbd_uuid_set(mdev, Bitmap, mdev->bc->md.uuid[Current]);
 				_drbd_uuid_set(mdev, Current, mdev->p_uuid[Current]);
 			} else {
@@ -525,9 +521,8 @@
 			/* Now the two UUID sets are equal, update what we
 			 * know of the peer. */
 			int i;
-			for ( i = Current ; i<=History_end ; i++ ) {
+			for (i = Current ; i<=History_end ; i++)
 				mdev->p_uuid[i] = mdev->bc->md.uuid[i];
-			}
 		}
 	}
 
@@ -583,7 +578,7 @@
 	dec_unacked(mdev);
 
 	spin_lock_irq(&mdev->req_lock);
-	if ( drbd_bio_has_active_page(e->private_bio) ) {
+	if (drbd_bio_has_active_page(e->private_bio)) {
 		/* This might happen if sendpage() has not finished */
 		list_add_tail(&e->w.list, &mdev->net_ee);
 	} else {
@@ -639,7 +634,7 @@
 	dec_unacked(mdev);
 
 	spin_lock_irq(&mdev->req_lock);
-	if ( drbd_bio_has_active_page(e->private_bio) ) {
+	if (drbd_bio_has_active_page(e->private_bio)) {
 		/* This might happen if sendpage() has not finished */
 		list_add_tail(&e->w.list, &mdev->net_ee);
 	} else {
@@ -795,12 +790,12 @@
 	int i, rv = 0;
 
 	for (i = 0; i < minor_count; i++) {
-		if ( !(odev = minor_to_mdev(i)) ) continue;
-		if (! _drbd_may_sync_now(odev)) {
+		odev = minor_to_mdev(i);
+		if (!odev) continue;
+		if (!_drbd_may_sync_now(odev))
 			rv |= ( _drbd_set_state(_NS(odev, aftr_isp, 1),
 						ChgStateHard|ScheduleAfter)
 				!= SS_NothingToDo ) ;
-		}
 	}
 
 	return rv;
@@ -820,11 +815,10 @@
 	for (i = 0; i < minor_count; i++) {
 		if ( !(odev = minor_to_mdev(i)) ) continue;
 		if (odev->state.aftr_isp) {
-			if (_drbd_may_sync_now(odev)) {
+			if (_drbd_may_sync_now(odev))
 				rv |= ( _drbd_set_state(_NS(odev, aftr_isp, 0),
 							ChgStateHard|ScheduleAfter)
 					!= SS_NothingToDo ) ;
-			}
 		}
 	}
 	return rv;
@@ -901,11 +895,10 @@
 
 	ns.conn = side;
 
-	if (side == SyncTarget) {
+	if (side == SyncTarget)
 		ns.disk = Inconsistent;
-	} else /* side == SyncSource */ {
+	else /* side == SyncSource */
 		ns.pdsk = Inconsistent;
-	}
 
 	r = _drbd_set_state(mdev, ns, ChgStateVerbose);
 	ns = mdev->state;



More information about the drbd-cvs mailing list