From drbd-cvs at lists.linbit.com  Mon Jul  2 11:54:59 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Mon Jul  2 11:55:10 2007
Subject: [DRBD-cvs] svn commit by phil - r2963 - branches/drbd-8.0/drbd -
	Pointed out by Ernest. The function with side effects n
Message-ID: <20070702095459.97B5540095@garcon1.linbit.com>

Author: phil
Date: 2007-07-02 11:54:58 +0200 (Mon, 02 Jul 2007)
New Revision: 2963

Modified:
   branches/drbd-8.0/drbd/drbd_receiver.c
Log:
Pointed out by Ernest.

The function with side effects needs to be the most right
argument of the && operator.



Modified: branches/drbd-8.0/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0/drbd/drbd_receiver.c	2007-07-02 08:44:22 UTC (rev 2962)
+++ branches/drbd-8.0/drbd/drbd_receiver.c	2007-07-02 09:54:58 UTC (rev 2963)
@@ -2408,8 +2408,8 @@
 	if (nconn == WFReportParams ) nconn = Connected;
 
 	if (mdev->p_uuid && oconn <= Connected &&
-	    inc_local_if_state(mdev,Negotiating) &&
-	    peer_state.disk >= Negotiating) {
+	    peer_state.disk >= Negotiating &&
+	    inc_local_if_state(mdev,Negotiating) ) {
 		nconn=drbd_sync_handshake(mdev,peer_state.role,peer_state.disk);
 		dec_local(mdev);
 

From drbd-cvs at lists.linbit.com  Tue Jul  3 13:51:12 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul  3 13:51:13 2007
Subject: [DRBD-cvs] svn commit by phil - r2964 - branches/drbd-8.0/drbd - A
	hair rising bug in a code path that only gets execute
Message-ID: <20070703115112.2A83440095@garcon1.linbit.com>

Author: phil
Date: 2007-07-03 13:51:11 +0200 (Tue, 03 Jul 2007)
New Revision: 2964

Modified:
   branches/drbd-8.0/drbd/drbd_receiver.c
Log:
A hair rising bug in a code path that only gets executed in 
case we left over an ee where it shold not be at unload time...


Modified: branches/drbd-8.0/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0/drbd/drbd_receiver.c	2007-07-02 09:54:58 UTC (rev 2963)
+++ branches/drbd-8.0/drbd/drbd_receiver.c	2007-07-03 11:51:11 UTC (rev 2964)
@@ -357,6 +357,7 @@
 	spin_lock_irq(&mdev->req_lock);
 	while(!list_empty(list)) {
 		le = list->next;
+		list_del(le);
 		e = list_entry(le, struct Tl_epoch_entry, w.list);
 		drbd_free_ee(mdev,e);
 		count++;

From drbd-cvs at lists.linbit.com  Tue Jul 10 15:46:14 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 10 15:46:20 2007
Subject: [DRBD-cvs] svn commit by phil - r2966 - branches/drbd-8.0/drbd -
	From: "Montrose, Ernest" Hi all, We are seeing a proble
Message-ID: <20070710134614.0DE6440095@garcon1.linbit.com>

Author: phil
Date: 2007-07-10 15:46:08 +0200 (Tue, 10 Jul 2007)
New Revision: 2966

Modified:
   branches/drbd-8.0/drbd/drbd_receiver.c
Log:
From:  "Montrose, Ernest"

Hi all,
We are seeing a problem where while syncing if the sync target detaches
then attempts to attach, both nodes end up in cs:WABitMapT state.  This
happens if both nodes where in Secondary/Secondary state and the dettach
happened on the SyncTarget.

The cause for this was that...

Node1:       C:0:H:H
Node2:       C:0:H:H

upon start of resync an "S" gets created.

sync target: S:0:C:H
sync source: C:S:H:H

but it should be

sync target: S:0:H:H
sync source: C:S:H:H

On the sync target side we got S left of C while on the sync 
source side we had C left of S. This was bad. The should not
appear in different order!

C should be left of S on sync source, and nowhere on the sync
target. (= even further left = in the future )

Ok, I guess the explanation is sufficient incomprehensible ;)

-Phil


Modified: branches/drbd-8.0/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0/drbd/drbd_receiver.c	2007-07-03 12:27:25 UTC (rev 2965)
+++ branches/drbd-8.0/drbd/drbd_receiver.c	2007-07-10 13:46:08 UTC (rev 2966)
@@ -2474,7 +2474,9 @@
 	if (drbd_recv(mdev, h->payload, h->length) != h->length)
 		return FALSE;
 
-	drbd_uuid_set(mdev,Current,be64_to_cpu(p->uuid));
+	/* Here the _drbd_uuid_ functions are right, current should
+	   _not_ be rotated into the history */
+	_drbd_uuid_set(mdev,Current,be64_to_cpu(p->uuid));
 	_drbd_uuid_set(mdev,Bitmap,0UL);
 
 	drbd_start_resync(mdev,SyncTarget);

From drbd-cvs at lists.linbit.com  Thu Jul 12 16:44:03 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Thu Jul 12 16:44:06 2007
Subject: [DRBD-cvs] svn commit by phil - r2967 - branches/drbd-8.0/drbd -
	What is currently the quickest way to OOPS the kernel w
Message-ID: <20070712144403.2C00E40095@garcon1.linbit.com>

Author: phil
Date: 2007-07-12 16:44:02 +0200 (Thu, 12 Jul 2007)
New Revision: 2967

Modified:
   branches/drbd-8.0/drbd/drbd_nl.c
Log:
What is currently the quickest way to OOPS the kernel with 
the help of DRBD ?

  drbdadm detach r0
  drbdadm primary r0
  
Fixed this embarrassing bug.


Modified: branches/drbd-8.0/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0/drbd/drbd_nl.c	2007-07-10 13:46:08 UTC (rev 2966)
+++ branches/drbd-8.0/drbd/drbd_nl.c	2007-07-12 14:44:02 UTC (rev 2967)
@@ -330,10 +330,13 @@
 		mdev->this_bdev->bd_disk = mdev->vdisk;
 		 */
 
-		if ( ( ( mdev->state.conn < Connected ||
-			 mdev->state.pdsk <= Failed ) &&
-		       mdev->bc->md.uuid[Bitmap] == 0) || forced ) {
-			drbd_uuid_new_current(mdev);
+		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);
+			}
+			dec_local(mdev);
 		}
 	}
 

From drbd-cvs at lists.linbit.com  Thu Jul 12 17:45:10 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Thu Jul 12 17:45:12 2007
Subject: [DRBD-cvs] svn commit by phil - r2968 - branches/drbd-8.0/drbd -
	For the discard-younger / discard-older after-sb-0pri p
Message-ID: <20070712154510.E685940095@garcon1.linbit.com>

Author: phil
Date: 2007-07-12 17:45:09 +0200 (Thu, 12 Jul 2007)
New Revision: 2968

Modified:
   branches/drbd-8.0/drbd/drbd_nl.c
Log:
For the discard-younger / discard-older after-sb-0pri policies
to work, we need to follow the node roles more closely.


Modified: branches/drbd-8.0/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0/drbd/drbd_nl.c	2007-07-12 14:44:02 UTC (rev 2967)
+++ branches/drbd-8.0/drbd/drbd_nl.c	2007-07-12 15:45:09 UTC (rev 2968)
@@ -320,6 +320,10 @@
 
 	if (new_role == Secondary) {
 		set_disk_ro(mdev->vdisk, TRUE );
+		if ( inc_local(mdev) ) {
+			mdev->bc->md.uuid[Current] &= ~(u64)1;
+			dec_local(mdev);
+		}
 	} else {
 		if(inc_net(mdev)) {
 			mdev->net_conf->want_lose = 0;
@@ -336,6 +340,7 @@
 			       mdev->bc->md.uuid[Bitmap] == 0) || forced ) {
 				drbd_uuid_new_current(mdev);
 			}
+			mdev->bc->md.uuid[Current] |=  (u64)1;
 			dec_local(mdev);
 		}
 	}
@@ -991,6 +996,13 @@
 	}
 
 	drbd_bm_unlock(mdev);
+
+	if(inc_local_if_state(mdev,Attaching)) {
+		if(mdev->state.role == Primary) mdev->bc->md.uuid[Current] |=  (u64)1;
+		else                            mdev->bc->md.uuid[Current] &= ~(u64)1;
+		dec_local(mdev);
+	}
+
 	drbd_md_sync(mdev);
 
 	reply->ret_code = retcode;

From drbd-cvs at lists.linbit.com  Sat Jul 14 22:56:42 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Sat Jul 14 22:56:44 2007
Subject: [DRBD-cvs] svn commit by lars - r2969 - branches/drbd-8.0/user -
	fixes mainly for parsing a meta-data dump file on resto
Message-ID: <20070714205642.5FA9040095@garcon1.linbit.com>

Author: lars
Date: 2007-07-14 22:56:41 +0200 (Sat, 14 Jul 2007)
New Revision: 2969

Modified:
   branches/drbd-8.0/user/Makefile
   branches/drbd-8.0/user/drbdmeta.c
   branches/drbd-8.0/user/drbdmeta_parser.h
   branches/drbd-8.0/user/drbdmeta_scanner.fl
Log:
fixes mainly for parsing a meta-data dump file on restore-md
* added new verify-dump command,
  which does the same parsing as restore-md,
  without actually touching the on-disk meta-data
* improved the scanner to explicitly match all possible input,
  introduced TK_INVALID, TK_INVALID_CHAR
* let flex count the input lines for us
* be more tolerant: include "\r" in ignored whitespace
* be less tolerant: strings may only be 20 characters long
  and must not include [\r\n]; (there is currently only the version tag,
  which is currently only three chars long)
* improve on the on the scanner and parser error messages:
  up to now we had the embarrasing "Parse error: expected $something.",
  which is not useful at all.  now we get the line number, and the unexpected
  or invalid token reportet as well.
* add fflush(stdout) and indent the SIGSEGV/BUS handler.

CAUTION:
I did not actually restore any meta data yet,
only tested various valid and invalid inputs
with the new verify-dump command. 
Will do real-life tests early next week again...

So it is possible, while unlikely,
that this broke the restore-md functionality further,
due to me being stupid somewhere...


Modified: branches/drbd-8.0/user/Makefile
===================================================================
--- branches/drbd-8.0/user/Makefile	2007-07-12 15:45:09 UTC (rev 2968)
+++ branches/drbd-8.0/user/Makefile	2007-07-14 20:56:41 UTC (rev 2969)
@@ -45,14 +45,15 @@
 drbdadm: $(drbdadm-obj)
 	$(CC) -o $@ $^
 
+# for debugging:
+# 	LANG=C LC_ALL=C flex -d -b -s -odrbdadm_scanner.c drbdadm_scanner.fl
+
 drbdadm_scanner.c: drbdadm_scanner.fl drbdadm_parser.h
 	flex -s -odrbdadm_scanner.c drbdadm_scanner.fl
 
 drbdmeta_scanner.c: drbdmeta_scanner.fl drbdmeta_parser.h
-	flex -odrbdmeta_scanner.c drbdmeta_scanner.fl
+	flex -s -odrbdmeta_scanner.c drbdmeta_scanner.fl
 
-# for debug:	flex -d -s -odrbdadm_scanner.c drbdadm_scanner.fl
-
 drbdsetup: $(drbdsetup-obj)
 	$(CC) -o $@ $^
 

Modified: branches/drbd-8.0/user/drbdmeta.c
===================================================================
--- branches/drbd-8.0/user/drbdmeta.c	2007-07-12 15:45:09 UTC (rev 2968)
+++ branches/drbd-8.0/user/drbdmeta.c	2007-07-14 20:56:41 UTC (rev 2969)
@@ -777,6 +777,7 @@
 int meta_show_gi(struct format *cfg, char **argv, int argc);
 int meta_dump_md(struct format *cfg, char **argv, int argc);
 int meta_restore_md(struct format *cfg, char **argv, int argc);
+int meta_verify_dump_file(struct format *cfg, char **argv, int argc);
 int meta_create_md(struct format *cfg, char **argv, int argc);
 int meta_wipe_md(struct format *cfg, char **argv, int argc);
 int meta_outdate(struct format *cfg, char **argv, int argc);
@@ -791,6 +792,7 @@
 	{"show-gi", 0, meta_show_gi, 1},
 	{"dump-md", 0, meta_dump_md, 1},
 	{"restore-md", "file", meta_restore_md, 1},
+	{"verify-dump", "file", meta_verify_dump_file, 1},
 	{"create-md", 0, meta_create_md, 1},
 	{"wipe-md", 0, meta_wipe_md, 1},
 	{"outdate", 0, meta_outdate, 1},
@@ -1772,15 +1774,90 @@
 	return cfg->ops->close(cfg);
 }
 
-void md_parse_error(const char *etext)
+void md_parse_error(int expected_token, int seen_token,const char *etext)
 {
-	fprintf(stderr,"Parse error '%s' expected.",etext);
+	if (!etext) {
+		switch(expected_token) {
+		/* leading space indicates to strip off "expected" below */
+		default : etext = " invalid/unexpected token!"; break;
+		case 0  : etext = "end of file"; break;
+		case ';': etext = "semicolon (;)"; break;
+		case '{': etext = "opening brace ({)"; break;
+		case '}': etext = "closing brace (})"; break;
+		case TK_BM:
+			etext = "keyword 'bm'"; break;
+		case TK_BM_BYTE_PER_BIT:
+			etext = "keyword 'bm-byte-per-bit'"; break;
+		case TK_DEVICE_UUID:
+			etext = "keyword 'device-uuid'"; break;
+		case TK_FLAGS:
+			etext = "keyword 'flags'"; break;
+		case TK_GC:
+			etext = "keyword 'gc'"; break;
+		case TK_LA_SIZE:
+			etext = "keyword 'la-size-sect'"; break;
+		case TK_TIMES:
+			etext = "keyword 'times'"; break;
+		case TK_UUID:
+			etext = "keyword 'uuid'"; break;
+		case TK_VERSION:
+			etext = "keyword 'version'"; break;
+		case TK_NUM:
+			etext = "number ([0-9], up to 20 digits)"; break;
+		case TK_STRING:
+			etext = "short quoted string "
+			        "(\"..up to 20 characters, no newline..\")";
+				break;
+		case TK_U32:
+			etext = "an 8-digit hex number"; break;
+		case TK_U64:
+			etext = "a 16-digit hex number"; break;
+		}
+	}
+	fflush(stdout);
+	fprintf(stderr,"Parse error in line %u: %s%s",
+		yylineno, etext,
+		(etext[0] == ' ' ? ":" : " expected")
+		);
+
+	switch(seen_token) {
+	case 0:
+		fprintf(stderr, ", but end of file encountered\n"); break;
+
+	case   1 ...  58: /* ord(';') == 58 */
+	case  60 ... 122: /* ord('{') == 123 */
+	case 124:         /* ord('}') == 125 */
+	case 126 ... 257:
+		/* oopsie. these should never be returned! */
+		fprintf(stderr, "; got token value %u (this should never happen!)\n", seen_token); break;
+		break;
+
+	case TK_INVALID_CHAR:
+		fprintf(stderr,"; got invalid input character '\\x%02x' [%c]\n",
+			(unsigned char)yylval.txt[0], yylval.txt[0]);
+		break;
+	case ';': case '{': case '}':
+		fprintf(stderr, ", not '%c'\n", seen_token); break;
+	case TK_NUM:
+	case TK_U32:
+	case TK_U64:
+		fprintf(stderr, ", not some number\n"); break;
+	case TK_INVALID:
+		/* already reported by scanner */
+		fprintf(stderr,"\n"); break;
+	default:
+		fprintf(stderr, ", not '%s'\n", yylval.txt);
+	}
 	exit(10);
 }
 
-#define EXP(TOKEN) if(yylex() != TOKEN) md_parse_error( #TOKEN );
+static void EXP(int expected_token) {
+	int tok = yylex();
+	if (tok != expected_token)
+		md_parse_error(expected_token, tok, NULL);
+}
 
-int meta_restore_md(struct format *cfg, char **argv, int argc)
+int verify_dumpfile_or_restore(struct format *cfg, char **argv, int argc, int parse_only)
 {
 	int i,times;
 	int err;
@@ -1794,7 +1871,7 @@
 		}
 	}
 
-	if (!cfg->ops->open(cfg)) {
+	if (!parse_only && !cfg->ops->open(cfg)) {
 		if (!confirmed("Valid meta-data in place, overwrite?"))
 			return -1;
 	}
@@ -1837,29 +1914,49 @@
 	bm = (le_u64 *)cfg->on_disk.bm;
 	i = 0;
 	while(1) {
-		switch(yylex()) {
+		int tok = yylex();
+		switch(tok) {
 		case TK_U64:
+			EXP(';');
+			/* NOTE:
+			 * even though this EXP(';'); already advanced
+			 * to the next token, yylval will *not* be updated
+			 * for * ';', so it is still valid.
+			 *
+			 * This seemed to be the least ugly way to implement a
+			 * "parse_only" functionality without ugly if-branches
+			 * or the maintenance nightmare of code duplication */
+			if (parse_only) break;
 			bm[i].le = cpu_to_le64(yylval.u64);
 			i++;
-			EXP(';');
 			break;
 		case TK_NUM:
 			EXP(TK_TIMES);
 			times = yylval.u64;
 			EXP(TK_U64);
+			EXP(';');
+			if (parse_only) break;
 			value.le = cpu_to_le64(yylval.u64);
-			EXP(';');
 			while(times--) bm[i++] = value;
 			break;
 		case '}':
 			goto break_loop;
 		default:
-			md_parse_error("TK_U64, TK_NUM or }");
+			md_parse_error(0 /* ignored, since etext is set */,
+				tok, "repeat count, 16-digit hex number, or closing brace (})");
 			goto break_loop;
 		}
 	}
 	break_loop:
 
+	/* there should be no trailing garbage in the input file */
+	EXP(0);
+
+	if (parse_only) {
+		printf("input file parsed ok\n");
+		return 0;
+	}
+
 	err = cfg->ops->md_cpu_to_disk(cfg);
 	err = cfg->ops->close(cfg) || err;
 	if (err) {
@@ -1872,8 +1969,16 @@
 	return 0;
 }
 
-#undef EXP
+int meta_restore_md(struct format *cfg, char **argv, int argc)
+{
+	return verify_dumpfile_or_restore(cfg,argv,argc,0);
+}
 
+int meta_verify_dump_file(struct format *cfg, char **argv, int argc)
+{
+	return verify_dumpfile_or_restore(cfg,argv,argc,1);
+}
+
 int md_convert_07_to_08(struct format *cfg)
 {
 	int i,j=1;
@@ -2446,15 +2551,16 @@
 struct sigaction sa;
 static void signal_handler(int signo)
 {
-  fprintf(stderr,"%s\nThis feels like a bug.\n",
-		  (signo == SIGBUS)
-		  ? "SIGBUS: out of band access to the mmaped area!"
-		  : "SIGSEGV!");
-  fprintf(stderr,"debug hint: last memset: %s:%u: @%p %llu\n"
-		 "Sorry.\n",
-		 last_memset_func, last_memset_line,
-		 last_memset_target, (unsigned long long)last_memset_n);
-  exit(128 | signo);
+	fflush(stdout);
+	fprintf(stderr,"%s\nThis feels like a bug.\n",
+		(signo == SIGBUS)
+		? "SIGBUS: out of band access to the mmaped area!"
+		: "SIGSEGV!");
+	fprintf(stderr,"debug hint: last memset: %s:%u: @%p %llu\n"
+		"Sorry.\n",
+		last_memset_func, last_memset_line,
+		last_memset_target, (unsigned long long)last_memset_n);
+	exit(128 | signo);
 }
 
 int main(int argc, char **argv)

Modified: branches/drbd-8.0/user/drbdmeta_parser.h
===================================================================
--- branches/drbd-8.0/user/drbdmeta_parser.h	2007-07-12 15:45:09 UTC (rev 2968)
+++ branches/drbd-8.0/user/drbdmeta_parser.h	2007-07-14 20:56:41 UTC (rev 2969)
@@ -8,6 +8,7 @@
 #define YY_NO_UNPUT 1
 
 extern YYSTYPE yylval;
+extern int yylineno;
 
 enum yytokentype {
 	TK_STRING = 258,
@@ -23,6 +24,8 @@
 	TK_DEVICE_UUID,
 	TK_TIMES,
 	TK_FLAGS,
+	TK_INVALID,
+	TK_INVALID_CHAR,
 };
 
 /* avoid compiler warnings about implicit declaration */

Modified: branches/drbd-8.0/user/drbdmeta_scanner.fl
===================================================================
--- branches/drbd-8.0/user/drbdmeta_scanner.fl	2007-07-12 15:45:09 UTC (rev 2968)
+++ branches/drbd-8.0/user/drbdmeta_scanner.fl	2007-07-14 20:56:41 UTC (rev 2969)
@@ -4,45 +4,74 @@
 #include "drbdmeta_parser.h"
 
 static void unescape(void);
+static void bad_token(char*);
 
 //#define DP printf("%s ",yytext);
 #define DP
+#define CP yylval.txt=yytext
 #define YY_NO_UNPUT 1
 static void yyunput (int c, register char * yy_bp ) __attribute((unused));
 
 %}
 
 %option noyywrap
+%option yylineno
 
-WS		[ \t\n]
+/* remember to avoid backing up.
+ * tell user about bad/unexpected tokens. */
+
+OP		[{};]
+WS		[ \r\t\n]
 COMMENT		\#[^\n]*
-NUM		[0-9]{1,10}
+
+NUM		[0-9]{1,20}
+NUM_TOO_LONG	{NUM}[0-9]
+
 U64		0x[0-9A-Fa-f]{16}
 U32		0x[0-9A-Fa-f]{8}
-OP		[{};]
-STRING		\"[^\"]*\"
+INVALID_HEX	0x[0-9A-Fa-f]{0,17}
 
+STRING		\"[^\"\r\n]{1,20}\"
+EMPTY_STRING    \"\"?
+INVALID_STRING  \"[^\"\r\n]{1,20}
+
+INVALID_TOKEN	 [-_a-zA-Z0-9]{1,100}
+INVALID_CHAR    [^-_a-zA-Z0-9 \t\r\n\";{}]
+
 %%
 
-{WS}
-{COMMENT}
+{WS}		/* skip silently */
+{COMMENT}	/* skip silently */
 {OP}		DP; return yytext[0];
-{STRING}	unescape(); yylval.txt=yytext; DP; return TK_STRING;
+{STRING}	unescape(); DP; CP; return TK_STRING;
 {U64}		yylval.u64 = strto_u64(yytext, NULL, 16); DP; return TK_U64;
 {U32}		yylval.u64 = strto_u64(yytext, NULL, 16); DP; return TK_U32;
 {NUM}		yylval.u64 = strto_u64(yytext, NULL, 10); DP; return TK_NUM;
-gc		DP; return TK_GC;
-bm		DP; return TK_BM;
-uuid		DP; return TK_UUID;
-version		DP; return TK_VERSION;
-la-size-sect	DP; return TK_LA_SIZE;
-bm-byte-per-bit DP; return TK_BM_BYTE_PER_BIT;
-device-uuid	DP; return TK_DEVICE_UUID;
-times		DP; return TK_TIMES;
-flags		DP; return TK_FLAGS;
+gc		DP; CP; return TK_GC;
+bm		DP; CP; return TK_BM;
+uuid		DP; CP; return TK_UUID;
+version		DP; CP; return TK_VERSION;
+la-size-sect	DP; CP; return TK_LA_SIZE;
+bm-byte-per-bit DP; CP; return TK_BM_BYTE_PER_BIT;
+device-uuid	DP; CP; return TK_DEVICE_UUID;
+times		DP; CP; return TK_TIMES;
+flags		DP; CP; return TK_FLAGS;
 
+{INVALID_STRING} CP; bad_token("invalid string"); return TK_INVALID;
+{EMPTY_STRING}	 CP; bad_token("invalid string"); return TK_INVALID;
+{INVALID_HEX}	 CP; bad_token("invalid hex number (only 8 or 16 hex digits accepted)"); return TK_INVALID;
+{NUM_TOO_LONG}	 CP; bad_token("number too big"); return TK_INVALID;
+{INVALID_TOKEN}	 CP; bad_token("unknown token"); return TK_INVALID;
+{INVALID_CHAR}	 CP; return TK_INVALID_CHAR;
+
 %%
 
+static void bad_token(char *msg)
+{
+	fflush(stdout);
+	fprintf(stderr,"line %u: %s: %s ...\n", yylineno, msg, yytext);
+}
+
 static void unescape(void)
 {
   /* backslash escapes from string */

From drbd-cvs at lists.linbit.com  Wed Jul 18 11:31:14 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Jul 18 11:31:16 2007
Subject: [DRBD-cvs] svn commit by phil - r2970 - branches/drbd-8.0/user - We
	need to expand the common section also for command w
Message-ID: <20070718093114.D801940095@garcon1.linbit.com>

Author: phil
Date: 2007-07-18 11:31:05 +0200 (Wed, 18 Jul 2007)
New Revision: 2970

Modified:
   branches/drbd-8.0/user/drbdadm_main.c
Log:
We need to expand the common section also for command which
does not need a resource name. Simple logic bug. It came
to surface as we recognised that the startup section does
not get expanded for the "drbdadm wait-con-int" command.


Modified: branches/drbd-8.0/user/drbdadm_main.c
===================================================================
--- branches/drbd-8.0/user/drbdadm_main.c	2007-07-14 20:56:41 UTC (rev 2969)
+++ branches/drbd-8.0/user/drbdadm_main.c	2007-07-18 09:31:05 UTC (rev 2970)
@@ -1625,6 +1625,8 @@
   struct adm_cmd *cmd;
   struct d_resource *res,*tmp;
   char *env_drbd_nodename = NULL;
+  int is_dump_xml;
+  int is_dump;
 
   drbdsetup=NULL;
   drbdmeta=NULL;
@@ -1835,14 +1837,15 @@
 
   uc_node(global_options.usage_count);
 
+  is_dump_xml = (cmd->function == adm_dump_xml);
+  is_dump = (is_dump_xml || cmd->function == adm_dump);
+  if (!is_dump || dry_run) expand_common();
+
   if(cmd->res_name_required)
     {
-      int is_dump_xml = (cmd->function == adm_dump_xml);
-      int is_dump = (is_dump_xml || cmd->function == adm_dump);
       if (optind + 1 > argc && !is_dump)
         print_usage_and_exit("missing arguments"); // arguments missing.
 
-      if (!is_dump || dry_run) expand_common();
       global_validate();
       if (!is_dump) {
 	if(!config_valid) exit(E_config_invalid);

From drbd-cvs at lists.linbit.com  Wed Jul 18 11:34:47 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Jul 18 11:34:49 2007
Subject: [DRBD-cvs] svn commit by phil - r2971 - branches/drbd-8.0/user -
	Simon fixed the drbdmeta md-dump parser... 
Message-ID: <20070718093447.C1B5340095@garcon1.linbit.com>

Author: phil
Date: 2007-07-18 11:34:46 +0200 (Wed, 18 Jul 2007)
New Revision: 2971

Modified:
   branches/drbd-8.0/user/drbdmeta.c
Log:
Simon fixed the drbdmeta md-dump parser...


Modified: branches/drbd-8.0/user/drbdmeta.c
===================================================================
--- branches/drbd-8.0/user/drbdmeta.c	2007-07-18 09:31:05 UTC (rev 2970)
+++ branches/drbd-8.0/user/drbdmeta.c	2007-07-18 09:34:46 UTC (rev 2971)
@@ -1931,8 +1931,8 @@
 			i++;
 			break;
 		case TK_NUM:
+			times = yylval.u64;
 			EXP(TK_TIMES);
-			times = yylval.u64;
 			EXP(TK_U64);
 			EXP(';');
 			if (parse_only) break;

From drbd-cvs at lists.linbit.com  Wed Jul 18 13:25:07 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Jul 18 13:25:08 2007
Subject: [DRBD-cvs] svn commit by lars - r2972 - branches/drbd-8.0/user -
	allow only 19 digits for numbers, to avoid potential ov
Message-ID: <20070718112507.7C1B240095@garcon1.linbit.com>

Author: lars
Date: 2007-07-18 13:25:06 +0200 (Wed, 18 Jul 2007)
New Revision: 2972

Modified:
   branches/drbd-8.0/user/drbdmeta_scanner.fl
Log:
allow only 19 digits for numbers, to avoid potential overflow of 64bit int

Modified: branches/drbd-8.0/user/drbdmeta_scanner.fl
===================================================================
--- branches/drbd-8.0/user/drbdmeta_scanner.fl	2007-07-18 09:34:46 UTC (rev 2971)
+++ branches/drbd-8.0/user/drbdmeta_scanner.fl	2007-07-18 11:25:06 UTC (rev 2972)
@@ -24,7 +24,9 @@
 WS		[ \r\t\n]
 COMMENT		\#[^\n]*
 
-NUM		[0-9]{1,20}
+/* 1<<63 is 19 digits. has to be enough.
+ * 20 digits would risk overflow of 64bit unsigned int */
+NUM		[0-9]{1,19}
 NUM_TOO_LONG	{NUM}[0-9]
 
 U64		0x[0-9A-Fa-f]{16}

From drbd-cvs at lists.linbit.com  Wed Jul 18 13:37:40 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Jul 18 13:37:42 2007
Subject: [DRBD-cvs] svn commit by lars - r2973 - branches/drbd-8.0/user -
	bring (still unfinished) drbdmeta rewrite forward to im
Message-ID: <20070718113740.9C49E40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-18 13:37:39 +0200 (Wed, 18 Jul 2007)
New Revision: 2973

Modified:
   branches/drbd-8.0/user/Makefile
   branches/drbd-8.0/user/drbdmeta_unfinished_rewrite.c
Log:
bring (still unfinished) drbdmeta rewrite forward to improved scanner,
make it easier to compile it

Modified: branches/drbd-8.0/user/Makefile
===================================================================
--- branches/drbd-8.0/user/Makefile	2007-07-18 11:25:06 UTC (rev 2972)
+++ branches/drbd-8.0/user/Makefile	2007-07-18 11:37:39 UTC (rev 2973)
@@ -60,9 +60,13 @@
 drbdmeta: $(drbdmeta-obj)
 	$(CC) -o $@ $^
 
+drbdmeta_unfinished_rewrite: CFLAGS += -fno-strict-aliasing
+drbdmeta_unfinished_rewrite: drbdmeta_unfinished_rewrite.o drbdmeta_scanner.o drbdtool_common.o drbd_buildtag.o
+	$(CC) -o $@ $^
+
 clean:
 	rm -f drbdadm_scanner.c drbdmeta_scanner.c
-	rm -f drbdsetup drbdadm drbdmeta *.o
+	rm -f drbdsetup drbdadm drbdmeta drbdmeta_unfinished_rewrite *.o
 	rm -f drbd_buildtag.c drbd_strings.c
 	rm -f *~
 
@@ -95,4 +99,5 @@
 drbdadm_scanner.o:                   drbdadm.h               drbdadm_parser.h
 drbdsetup.o:       drbdtool_common.h           ../drbd/linux/drbd_limits.h
 drbdmeta.o:        drbdtool_common.h drbd_endian.h
+drbdmeta_unfinished_rewrite.o:        drbdtool_common.h drbd_endian.h
 drbdadm_usage_cnt.o: drbdadm.h drbd_endian.h

Modified: branches/drbd-8.0/user/drbdmeta_unfinished_rewrite.c
===================================================================
--- branches/drbd-8.0/user/drbdmeta_unfinished_rewrite.c	2007-07-18 11:25:06 UTC (rev 2972)
+++ branches/drbd-8.0/user/drbdmeta_unfinished_rewrite.c	2007-07-18 11:37:39 UTC (rev 2973)
@@ -593,6 +593,7 @@
 int meta_show_gi(struct format *cfg, char **argv, int argc);
 int meta_dump_md(struct format *cfg, char **argv, int argc);
 int meta_restore_md(struct format *cfg, char **argv, int argc);
+int meta_verify_dump_file(struct format *cfg, char **argv, int argc);
 int meta_create_md(struct format *cfg, char **argv, int argc);
 int meta_wipe_md(struct format *cfg, char **argv, int argc);
 int meta_outdate(struct format *cfg, char **argv, int argc);
@@ -606,6 +607,7 @@
 	{"show-gi", 0, meta_show_gi, 1},
 	{"dump-md", 0, meta_dump_md, 1},
 	{"restore-md", "file", meta_restore_md, 1},
+	{"verify-dump", "file", meta_verify_dump_file, 1},
 	{"create-md", 0, meta_create_md, 1},
 	{"wipe-md", 0, meta_wipe_md, 1},
 	{"outdate", 0, meta_outdate, 1},
@@ -1505,15 +1507,90 @@
 	return cfg->ops->close(cfg);
 }
 
-void md_parse_error(const char *etext)
+void md_parse_error(int expected_token, int seen_token,const char *etext)
 {
-	fprintf(stderr,"Parse error '%s' expected.",etext);
+	if (!etext) {
+		switch(expected_token) {
+		/* leading space indicates to strip off "expected" below */
+		default : etext = " invalid/unexpected token!"; break;
+		case 0  : etext = "end of file"; break;
+		case ';': etext = "semicolon (;)"; break;
+		case '{': etext = "opening brace ({)"; break;
+		case '}': etext = "closing brace (})"; break;
+		case TK_BM:
+			etext = "keyword 'bm'"; break;
+		case TK_BM_BYTE_PER_BIT:
+			etext = "keyword 'bm-byte-per-bit'"; break;
+		case TK_DEVICE_UUID:
+			etext = "keyword 'device-uuid'"; break;
+		case TK_FLAGS:
+			etext = "keyword 'flags'"; break;
+		case TK_GC:
+			etext = "keyword 'gc'"; break;
+		case TK_LA_SIZE:
+			etext = "keyword 'la-size-sect'"; break;
+		case TK_TIMES:
+			etext = "keyword 'times'"; break;
+		case TK_UUID:
+			etext = "keyword 'uuid'"; break;
+		case TK_VERSION:
+			etext = "keyword 'version'"; break;
+		case TK_NUM:
+			etext = "number ([0-9], up to 20 digits)"; break;
+		case TK_STRING:
+			etext = "short quoted string "
+			        "(\"..up to 20 characters, no newline..\")";
+				break;
+		case TK_U32:
+			etext = "an 8-digit hex number"; break;
+		case TK_U64:
+			etext = "a 16-digit hex number"; break;
+		}
+	}
+	fflush(stdout);
+	fprintf(stderr,"Parse error in line %u: %s%s",
+		yylineno, etext,
+		(etext[0] == ' ' ? ":" : " expected")
+		);
+
+	switch(seen_token) {
+	case 0:
+		fprintf(stderr, ", but end of file encountered\n"); break;
+
+	case   1 ...  58: /* ord(';') == 58 */
+	case  60 ... 122: /* ord('{') == 123 */
+	case 124:         /* ord('}') == 125 */
+	case 126 ... 257:
+		/* oopsie. these should never be returned! */
+		fprintf(stderr, "; got token value %u (this should never happen!)\n", seen_token); break;
+		break;
+
+	case TK_INVALID_CHAR:
+		fprintf(stderr,"; got invalid input character '\\x%02x' [%c]\n",
+			(unsigned char)yylval.txt[0], yylval.txt[0]);
+		break;
+	case ';': case '{': case '}':
+		fprintf(stderr, ", not '%c'\n", seen_token); break;
+	case TK_NUM:
+	case TK_U32:
+	case TK_U64:
+		fprintf(stderr, ", not some number\n"); break;
+	case TK_INVALID:
+		/* already reported by scanner */
+		fprintf(stderr,"\n"); break;
+	default:
+		fprintf(stderr, ", not '%s'\n", yylval.txt);
+	}
 	exit(10);
 }
 
-#define EXP(TOKEN) if(yylex() != TOKEN) md_parse_error( #TOKEN );
+static void EXP(int expected_token) {
+	int tok = yylex();
+	if (tok != expected_token)
+		md_parse_error(expected_token, tok, NULL);
+}
 
-int meta_restore_md(struct format *cfg, char **argv, int argc)
+int verify_dumpfile_or_restore(struct format *cfg, char **argv, int argc, int parse_only)
 {
 	int i,times;
 	int err;
@@ -1528,7 +1605,7 @@
 		}
 	}
 
-	if (!cfg->ops->open(cfg)) {
+	if (!parse_only && !cfg->ops->open(cfg)) {
 		if (!confirmed("Valid meta-data in place, overwrite?"))
 			return -1;
 	}
@@ -1572,8 +1649,19 @@
 	i = 0;
 	bm_on_disk_off = cfg->bm_offset;
 	while(1) {
-		switch(yylex()) {
+		int tok = yylex();
+		switch(tok) {
 		case TK_U64:
+			EXP(';');
+			/* NOTE:
+			 * even though this EXP(';'); already advanced
+			 * to the next token, yylval will *not* be updated
+			 * for * ';', so it is still valid.
+			 *
+			 * This seemed to be the least ugly way to implement a
+			 * "parse_only" functionality without ugly if-branches
+			 * or the maintenance nightmare of code duplication */
+			if (parse_only) break;
 			bm[i].le = cpu_to_le64(yylval.u64);
 			if (++i == buffer_size/sizeof(*bm)) {
 				pwrite_or_die(cfg->md_fd, on_disk_buffer,
@@ -1582,14 +1670,14 @@
 				bm_on_disk_off += buffer_size;
 				i = 0;
 			}
-			EXP(';');
 			break;
 		case TK_NUM:
 			EXP(TK_TIMES);
 			times = yylval.u64;
 			EXP(TK_U64);
+			EXP(';');
+			if (parse_only) break;
 			value.le = cpu_to_le64(yylval.u64);
-			EXP(';');
 			while(times--) {
 				bm[i] = value;
 				if (++i == buffer_size/sizeof(*bm)) {
@@ -1604,11 +1692,22 @@
 		case '}':
 			goto break_loop;
 		default:
-			md_parse_error("TK_U64, TK_NUM or }");
+			md_parse_error(0 /* ignored, since etext is set */,
+				tok, "repeat count, 16-digit hex number, or closing brace (})");
 			goto break_loop;
 		}
 	}
 	break_loop:
+
+	/* there should be no trailing garbage in the input file */
+	EXP(0);
+
+	if (parse_only) {
+		printf("input file parsed ok\n");
+		return 0;
+	}
+
+	/* not reached if parse_only */
 	if (i) {
 		size_t s = i * sizeof(*bm);
 		memset(bm+i, 0x00, buffer_size - s);
@@ -1631,8 +1730,16 @@
 	return 0;
 }
 
-#undef EXP
+int meta_restore_md(struct format *cfg, char **argv, int argc)
+{
+	return verify_dumpfile_or_restore(cfg,argv,argc,0);
+}
 
+int meta_verify_dump_file(struct format *cfg, char **argv, int argc)
+{
+	return verify_dumpfile_or_restore(cfg,argv,argc,1);
+}
+
 void md_convert_07_to_08(struct format *cfg)
 {
 	int i,j=1;

From drbd-cvs at lists.linbit.com  Wed Jul 18 18:22:11 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Jul 18 18:22:13 2007
Subject: [DRBD-cvs] svn commit by lars - r2974 - branches/drbd-8.0/user -
	parsed ok, but forgot to extract the value in time :-> 
Message-ID: <20070718162211.1E4ED40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-18 18:22:09 +0200 (Wed, 18 Jul 2007)
New Revision: 2974

Modified:
   branches/drbd-8.0/user/drbdmeta_unfinished_rewrite.c
Log:
parsed ok, but forgot to extract the value in time :->

Modified: branches/drbd-8.0/user/drbdmeta_unfinished_rewrite.c
===================================================================
--- branches/drbd-8.0/user/drbdmeta_unfinished_rewrite.c	2007-07-18 11:37:39 UTC (rev 2973)
+++ branches/drbd-8.0/user/drbdmeta_unfinished_rewrite.c	2007-07-18 16:22:09 UTC (rev 2974)
@@ -1672,8 +1672,8 @@
 			}
 			break;
 		case TK_NUM:
+			times = yylval.u64;
 			EXP(TK_TIMES);
-			times = yylval.u64;
 			EXP(TK_U64);
 			EXP(';');
 			if (parse_only) break;

From drbd-cvs at lists.linbit.com  Thu Jul 19 13:09:31 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Thu Jul 19 13:09:33 2007
Subject: [DRBD-cvs] svn commit by phil - r2975 - in trunk: . drbd drbd/linux
	user - svnp run... 
Message-ID: <20070719110931.5D52240095@garcon1.linbit.com>

Author: phil
Date: 2007-07-19 13:09:26 +0200 (Thu, 19 Jul 2007)
New Revision: 2975

Modified:
   trunk/
   trunk/ROADMAP
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_nl.c
   trunk/drbd/drbd_receiver.c
   trunk/drbd/linux/drbd_nl.h
   trunk/drbd/linux/drbd_tag_magic.h
   trunk/user/Makefile
   trunk/user/drbdadm_main.c
   trunk/user/drbdmeta.c
   trunk/user/drbdmeta_parser.h
   trunk/user/drbdmeta_scanner.fl
   trunk/user/drbdmeta_unfinished_rewrite.c
   trunk/user/drbdsetup.c
Log:
svnp run...



Property changes on: trunk
___________________________________________________________________
Name: propagate:at:1
   - 2950
   + 2974

Modified: trunk/ROADMAP
===================================================================
--- trunk/ROADMAP	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/ROADMAP	2007-07-19 11:09:26 UTC (rev 2975)
@@ -17,7 +17,10 @@
    with broken TSO engines during a clusters test phase. For production
    this should be turned off of course.
 
+5  startup / become primary.
 
+6  allow device,disk and meta-disk to be on resource level...
+
 Open Items from 8.0 (I am not shure if it makes sense to address this at all):
 ===================
 

Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/drbd/drbd_int.h	2007-07-19 11:09:26 UTC (rev 2975)
@@ -50,6 +50,8 @@
 extern int fault_devs;
 #endif
 
+extern char usermode_helper[];
+
 #include <linux/major.h>
 #ifdef DRBD_MAJOR
 # warning "FIXME. DRBD_MAJOR is now officially defined in major.h"

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/drbd/drbd_main.c	2007-07-19 11:09:26 UTC (rev 2975)
@@ -117,6 +117,14 @@
 module_param(trace_devs,int,0644);
 #endif
 
+
+// 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
 volatile int drbd_did_panic = 0;
 

Modified: trunk/drbd/drbd_nl.c
===================================================================
--- trunk/drbd/drbd_nl.c	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/drbd/drbd_nl.c	2007-07-19 11:09:26 UTC (rev 2975)
@@ -80,7 +80,7 @@
 #define STRING(pn,pr,member,len) \
 	case pn: /* D_ASSERT( tag_type(tag) == TT_STRING ); */ \
 		 arg->member ## _len = dlen; \
-		 memcpy(arg->member,tags,dlen); \
+		 memcpy(arg->member,tags,min_t(size_t,dlen,len)); \
 		 break;
 #include "linux/drbd_nl.h"
 
@@ -164,7 +164,7 @@
 int drbd_khelper(drbd_dev *mdev, char* cmd)
 {
 	char mb[12];
-	char *argv[] = {"/sbin/drbdadm", cmd, mb, NULL };
+	char *argv[] = {usermode_helper, cmd, mb, NULL };
 	static char *envp[] = { "HOME=/",
 				"TERM=linux",
 				"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
@@ -172,8 +172,10 @@
 
 	snprintf(mb,12,"minor-%d",mdev_to_minor(mdev));
 
+	INFO("helper command: %s %s\n",usermode_helper,cmd);
+
 	drbd_bcast_ev_helper(mdev,cmd);
-	return call_usermodehelper("/sbin/drbdadm",argv,envp,1);
+	return call_usermodehelper(usermode_helper,argv,envp,1);
 }
 
 drbd_disks_t drbd_try_outdate_peer(drbd_dev *mdev)
@@ -318,6 +320,10 @@
 
 	if (new_role == Secondary) {
 		set_disk_ro(mdev->vdisk, TRUE );
+		if ( inc_local(mdev) ) {
+			mdev->bc->md.uuid[Current] &= ~(u64)1;
+			dec_local(mdev);
+		}
 	} else {
 		if(inc_net(mdev)) {
 			mdev->net_conf->want_lose = 0;
@@ -328,10 +334,14 @@
 		mdev->this_bdev->bd_disk = mdev->vdisk;
 		 */
 
-		if ( ( ( mdev->state.conn < Connected ||
-			 mdev->state.pdsk <= Failed ) &&
-		       mdev->bc->md.uuid[Bitmap] == 0) || forced ) {
-			drbd_uuid_new_current(mdev);
+		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);
 		}
 	}
 
@@ -1001,6 +1011,13 @@
 	}
 
 	drbd_bm_unlock(mdev);
+
+	if(inc_local_if_state(mdev,Attaching)) {
+		if(mdev->state.role == Primary) mdev->bc->md.uuid[Current] |=  (u64)1;
+		else                            mdev->bc->md.uuid[Current] &= ~(u64)1;
+		dec_local(mdev);
+	}
+
 	drbd_md_sync(mdev);
 
 	reply->ret_code = retcode;

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/drbd/drbd_receiver.c	2007-07-19 11:09:26 UTC (rev 2975)
@@ -357,6 +357,7 @@
 	spin_lock_irq(&mdev->req_lock);
 	while(!list_empty(list)) {
 		le = list->next;
+		list_del(le);
 		e = list_entry(le, struct Tl_epoch_entry, w.list);
 		drbd_free_ee(mdev,e);
 		count++;
@@ -2496,8 +2497,8 @@
 	if (nconn == WFReportParams ) nconn = Connected;
 
 	if (mdev->p_uuid && oconn <= Connected &&
-	    inc_local_if_state(mdev,Negotiating) &&
-	    peer_state.disk >= Negotiating) {
+	    peer_state.disk >= Negotiating &&
+	    inc_local_if_state(mdev,Negotiating) ) {
 		nconn=drbd_sync_handshake(mdev,peer_state.role,peer_state.disk);
 		dec_local(mdev);
 
@@ -2561,7 +2562,9 @@
 	if (drbd_recv(mdev, h->payload, h->length) != h->length)
 		return FALSE;
 
-	drbd_uuid_set(mdev,Current,be64_to_cpu(p->uuid));
+	/* Here the _drbd_uuid_ functions are right, current should
+	   _not_ be rotated into the history */
+	_drbd_uuid_set(mdev,Current,be64_to_cpu(p->uuid));
 	_drbd_uuid_set(mdev,Bitmap,0UL);
 
 	drbd_start_resync(mdev,SyncTarget);

Modified: trunk/drbd/linux/drbd_nl.h
===================================================================
--- trunk/drbd/linux/drbd_nl.h	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/drbd/linux/drbd_nl.h	2007-07-19 11:09:26 UTC (rev 2975)
@@ -19,8 +19,8 @@
 
 PACKET(disk_conf, 3,
 	INT64(		2,	T_MAY_IGNORE,	disk_size)
-	STRING(		3,	T_MANDATORY,	backing_dev,	32)
-	STRING(		4,	T_MANDATORY,	meta_dev,	32)
+	STRING(		3,	T_MANDATORY,	backing_dev,	128)
+	STRING(		4,	T_MANDATORY,	meta_dev,	128)
 	INTEGER(	5,	T_MANDATORY,	meta_dev_idx)
 	INTEGER(	6,	T_MAY_IGNORE,	on_io_error)
 	INTEGER(	7,	T_MAY_IGNORE,	fencing)

Modified: trunk/drbd/linux/drbd_tag_magic.h
===================================================================
--- trunk/drbd/linux/drbd_tag_magic.h	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/drbd/linux/drbd_tag_magic.h	2007-07-19 11:09:26 UTC (rev 2975)
@@ -62,15 +62,16 @@
 struct tag {
 	const char* name;
 	int type_n_flags;
+	int max_len;
 };
 
 // declare tag names
 #define PACKET(name, number, fields) fields
 const struct tag tag_descriptions[] = {
-#define INTEGER(pn,pr,member)    [ pn ] = { #member, TT_INTEGER | pr },
-#define INT64(pn,pr,member)      [ pn ] = { #member, TT_INT64   | pr },
-#define BIT(pn,pr,member)        [ pn ] = { #member, TT_BIT     | pr },
-#define STRING(pn,pr,member,len) [ pn ] = { #member, TT_STRING  | pr },
+#define INTEGER(pn,pr,member)    [ pn ] = { #member, TT_INTEGER | pr, sizeof(int)   },
+#define INT64(pn,pr,member)      [ pn ] = { #member, TT_INT64   | pr, sizeof(__u64) },
+#define BIT(pn,pr,member)        [ pn ] = { #member, TT_BIT     | pr, sizeof(int)   },
+#define STRING(pn,pr,member,len) [ pn ] = { #member, TT_STRING  | pr, len           },
 #include "drbd_nl.h"
 };
 

Modified: trunk/user/Makefile
===================================================================
--- trunk/user/Makefile	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/user/Makefile	2007-07-19 11:09:26 UTC (rev 2975)
@@ -45,23 +45,28 @@
 drbdadm: $(drbdadm-obj)
 	$(CC) -o $@ $^
 
+# for debugging:
+# 	LANG=C LC_ALL=C flex -d -b -s -odrbdadm_scanner.c drbdadm_scanner.fl
+
 drbdadm_scanner.c: drbdadm_scanner.fl drbdadm_parser.h
 	flex -s -odrbdadm_scanner.c drbdadm_scanner.fl
 
 drbdmeta_scanner.c: drbdmeta_scanner.fl drbdmeta_parser.h
-	flex -odrbdmeta_scanner.c drbdmeta_scanner.fl
+	flex -s -odrbdmeta_scanner.c drbdmeta_scanner.fl
 
-# for debug:	flex -d -s -odrbdadm_scanner.c drbdadm_scanner.fl
-
 drbdsetup: $(drbdsetup-obj)
 	$(CC) -o $@ $^
 
 drbdmeta: $(drbdmeta-obj)
 	$(CC) -o $@ $^
 
+drbdmeta_unfinished_rewrite: CFLAGS += -fno-strict-aliasing
+drbdmeta_unfinished_rewrite: drbdmeta_unfinished_rewrite.o drbdmeta_scanner.o drbdtool_common.o drbd_buildtag.o
+	$(CC) -o $@ $^
+
 clean:
 	rm -f drbdadm_scanner.c drbdmeta_scanner.c
-	rm -f drbdsetup drbdadm drbdmeta *.o
+	rm -f drbdsetup drbdadm drbdmeta drbdmeta_unfinished_rewrite *.o
 	rm -f drbd_buildtag.c drbd_strings.c
 	rm -f *~
 
@@ -94,4 +99,5 @@
 drbdadm_scanner.o:                   drbdadm.h               drbdadm_parser.h
 drbdsetup.o:       drbdtool_common.h           ../drbd/linux/drbd_limits.h
 drbdmeta.o:        drbdtool_common.h drbd_endian.h
+drbdmeta_unfinished_rewrite.o:        drbdtool_common.h drbd_endian.h
 drbdadm_usage_cnt.o: drbdadm.h drbd_endian.h

Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/user/drbdadm_main.c	2007-07-19 11:09:26 UTC (rev 2975)
@@ -1664,6 +1664,8 @@
   struct adm_cmd *cmd;
   struct d_resource *res,*tmp;
   char *env_drbd_nodename = NULL;
+  int is_dump_xml;
+  int is_dump;
 
   drbdsetup=NULL;
   drbdmeta=NULL;
@@ -1874,14 +1876,15 @@
 
   uc_node(global_options.usage_count);
 
+  is_dump_xml = (cmd->function == adm_dump_xml);
+  is_dump = (is_dump_xml || cmd->function == adm_dump);
+  if (!is_dump || dry_run) expand_common();
+
   if(cmd->res_name_required)
     {
-      int is_dump_xml = (cmd->function == adm_dump_xml);
-      int is_dump = (is_dump_xml || cmd->function == adm_dump);
       if (optind + 1 > argc && !is_dump)
         print_usage_and_exit("missing arguments"); // arguments missing.
 
-      if (!is_dump || dry_run) expand_common();
       global_validate();
       if (!is_dump) {
 	if(!config_valid) exit(E_config_invalid);

Modified: trunk/user/drbdmeta.c
===================================================================
--- trunk/user/drbdmeta.c	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/user/drbdmeta.c	2007-07-19 11:09:26 UTC (rev 2975)
@@ -777,6 +777,7 @@
 int meta_show_gi(struct format *cfg, char **argv, int argc);
 int meta_dump_md(struct format *cfg, char **argv, int argc);
 int meta_restore_md(struct format *cfg, char **argv, int argc);
+int meta_verify_dump_file(struct format *cfg, char **argv, int argc);
 int meta_create_md(struct format *cfg, char **argv, int argc);
 int meta_wipe_md(struct format *cfg, char **argv, int argc);
 int meta_outdate(struct format *cfg, char **argv, int argc);
@@ -791,6 +792,7 @@
 	{"show-gi", 0, meta_show_gi, 1},
 	{"dump-md", 0, meta_dump_md, 1},
 	{"restore-md", "file", meta_restore_md, 1},
+	{"verify-dump", "file", meta_verify_dump_file, 1},
 	{"create-md", 0, meta_create_md, 1},
 	{"wipe-md", 0, meta_wipe_md, 1},
 	{"outdate", 0, meta_outdate, 1},
@@ -1772,15 +1774,90 @@
 	return cfg->ops->close(cfg);
 }
 
-void md_parse_error(const char *etext)
+void md_parse_error(int expected_token, int seen_token,const char *etext)
 {
-	fprintf(stderr,"Parse error '%s' expected.",etext);
+	if (!etext) {
+		switch(expected_token) {
+		/* leading space indicates to strip off "expected" below */
+		default : etext = " invalid/unexpected token!"; break;
+		case 0  : etext = "end of file"; break;
+		case ';': etext = "semicolon (;)"; break;
+		case '{': etext = "opening brace ({)"; break;
+		case '}': etext = "closing brace (})"; break;
+		case TK_BM:
+			etext = "keyword 'bm'"; break;
+		case TK_BM_BYTE_PER_BIT:
+			etext = "keyword 'bm-byte-per-bit'"; break;
+		case TK_DEVICE_UUID:
+			etext = "keyword 'device-uuid'"; break;
+		case TK_FLAGS:
+			etext = "keyword 'flags'"; break;
+		case TK_GC:
+			etext = "keyword 'gc'"; break;
+		case TK_LA_SIZE:
+			etext = "keyword 'la-size-sect'"; break;
+		case TK_TIMES:
+			etext = "keyword 'times'"; break;
+		case TK_UUID:
+			etext = "keyword 'uuid'"; break;
+		case TK_VERSION:
+			etext = "keyword 'version'"; break;
+		case TK_NUM:
+			etext = "number ([0-9], up to 20 digits)"; break;
+		case TK_STRING:
+			etext = "short quoted string "
+			        "(\"..up to 20 characters, no newline..\")";
+				break;
+		case TK_U32:
+			etext = "an 8-digit hex number"; break;
+		case TK_U64:
+			etext = "a 16-digit hex number"; break;
+		}
+	}
+	fflush(stdout);
+	fprintf(stderr,"Parse error in line %u: %s%s",
+		yylineno, etext,
+		(etext[0] == ' ' ? ":" : " expected")
+		);
+
+	switch(seen_token) {
+	case 0:
+		fprintf(stderr, ", but end of file encountered\n"); break;
+
+	case   1 ...  58: /* ord(';') == 58 */
+	case  60 ... 122: /* ord('{') == 123 */
+	case 124:         /* ord('}') == 125 */
+	case 126 ... 257:
+		/* oopsie. these should never be returned! */
+		fprintf(stderr, "; got token value %u (this should never happen!)\n", seen_token); break;
+		break;
+
+	case TK_INVALID_CHAR:
+		fprintf(stderr,"; got invalid input character '\\x%02x' [%c]\n",
+			(unsigned char)yylval.txt[0], yylval.txt[0]);
+		break;
+	case ';': case '{': case '}':
+		fprintf(stderr, ", not '%c'\n", seen_token); break;
+	case TK_NUM:
+	case TK_U32:
+	case TK_U64:
+		fprintf(stderr, ", not some number\n"); break;
+	case TK_INVALID:
+		/* already reported by scanner */
+		fprintf(stderr,"\n"); break;
+	default:
+		fprintf(stderr, ", not '%s'\n", yylval.txt);
+	}
 	exit(10);
 }
 
-#define EXP(TOKEN) if(yylex() != TOKEN) md_parse_error( #TOKEN );
+static void EXP(int expected_token) {
+	int tok = yylex();
+	if (tok != expected_token)
+		md_parse_error(expected_token, tok, NULL);
+}
 
-int meta_restore_md(struct format *cfg, char **argv, int argc)
+int verify_dumpfile_or_restore(struct format *cfg, char **argv, int argc, int parse_only)
 {
 	int i,times;
 	int err;
@@ -1794,7 +1871,7 @@
 		}
 	}
 
-	if (!cfg->ops->open(cfg)) {
+	if (!parse_only && !cfg->ops->open(cfg)) {
 		if (!confirmed("Valid meta-data in place, overwrite?"))
 			return -1;
 	}
@@ -1837,29 +1914,49 @@
 	bm = (le_u64 *)cfg->on_disk.bm;
 	i = 0;
 	while(1) {
-		switch(yylex()) {
+		int tok = yylex();
+		switch(tok) {
 		case TK_U64:
+			EXP(';');
+			/* NOTE:
+			 * even though this EXP(';'); already advanced
+			 * to the next token, yylval will *not* be updated
+			 * for * ';', so it is still valid.
+			 *
+			 * This seemed to be the least ugly way to implement a
+			 * "parse_only" functionality without ugly if-branches
+			 * or the maintenance nightmare of code duplication */
+			if (parse_only) break;
 			bm[i].le = cpu_to_le64(yylval.u64);
 			i++;
-			EXP(';');
 			break;
 		case TK_NUM:
+			times = yylval.u64;
 			EXP(TK_TIMES);
-			times = yylval.u64;
 			EXP(TK_U64);
+			EXP(';');
+			if (parse_only) break;
 			value.le = cpu_to_le64(yylval.u64);
-			EXP(';');
 			while(times--) bm[i++] = value;
 			break;
 		case '}':
 			goto break_loop;
 		default:
-			md_parse_error("TK_U64, TK_NUM or }");
+			md_parse_error(0 /* ignored, since etext is set */,
+				tok, "repeat count, 16-digit hex number, or closing brace (})");
 			goto break_loop;
 		}
 	}
 	break_loop:
 
+	/* there should be no trailing garbage in the input file */
+	EXP(0);
+
+	if (parse_only) {
+		printf("input file parsed ok\n");
+		return 0;
+	}
+
 	err = cfg->ops->md_cpu_to_disk(cfg);
 	err = cfg->ops->close(cfg) || err;
 	if (err) {
@@ -1872,8 +1969,16 @@
 	return 0;
 }
 
-#undef EXP
+int meta_restore_md(struct format *cfg, char **argv, int argc)
+{
+	return verify_dumpfile_or_restore(cfg,argv,argc,0);
+}
 
+int meta_verify_dump_file(struct format *cfg, char **argv, int argc)
+{
+	return verify_dumpfile_or_restore(cfg,argv,argc,1);
+}
+
 int md_convert_07_to_08(struct format *cfg)
 {
 	int i,j=1;
@@ -2446,15 +2551,16 @@
 struct sigaction sa;
 static void signal_handler(int signo)
 {
-  fprintf(stderr,"%s\nThis feels like a bug.\n",
-		  (signo == SIGBUS)
-		  ? "SIGBUS: out of band access to the mmaped area!"
-		  : "SIGSEGV!");
-  fprintf(stderr,"debug hint: last memset: %s:%u: @%p %llu\n"
-		 "Sorry.\n",
-		 last_memset_func, last_memset_line,
-		 last_memset_target, (unsigned long long)last_memset_n);
-  exit(128 | signo);
+	fflush(stdout);
+	fprintf(stderr,"%s\nThis feels like a bug.\n",
+		(signo == SIGBUS)
+		? "SIGBUS: out of band access to the mmaped area!"
+		: "SIGSEGV!");
+	fprintf(stderr,"debug hint: last memset: %s:%u: @%p %llu\n"
+		"Sorry.\n",
+		last_memset_func, last_memset_line,
+		last_memset_target, (unsigned long long)last_memset_n);
+	exit(128 | signo);
 }
 
 int main(int argc, char **argv)

Modified: trunk/user/drbdmeta_parser.h
===================================================================
--- trunk/user/drbdmeta_parser.h	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/user/drbdmeta_parser.h	2007-07-19 11:09:26 UTC (rev 2975)
@@ -8,6 +8,7 @@
 #define YY_NO_UNPUT 1
 
 extern YYSTYPE yylval;
+extern int yylineno;
 
 enum yytokentype {
 	TK_STRING = 258,
@@ -23,6 +24,8 @@
 	TK_DEVICE_UUID,
 	TK_TIMES,
 	TK_FLAGS,
+	TK_INVALID,
+	TK_INVALID_CHAR,
 };
 
 /* avoid compiler warnings about implicit declaration */

Modified: trunk/user/drbdmeta_scanner.fl
===================================================================
--- trunk/user/drbdmeta_scanner.fl	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/user/drbdmeta_scanner.fl	2007-07-19 11:09:26 UTC (rev 2975)
@@ -4,45 +4,76 @@
 #include "drbdmeta_parser.h"
 
 static void unescape(void);
+static void bad_token(char*);
 
 //#define DP printf("%s ",yytext);
 #define DP
+#define CP yylval.txt=yytext
 #define YY_NO_UNPUT 1
 static void yyunput (int c, register char * yy_bp ) __attribute((unused));
 
 %}
 
 %option noyywrap
+%option yylineno
 
-WS		[ \t\n]
+/* remember to avoid backing up.
+ * tell user about bad/unexpected tokens. */
+
+OP		[{};]
+WS		[ \r\t\n]
 COMMENT		\#[^\n]*
-NUM		[0-9]{1,10}
+
+/* 1<<63 is 19 digits. has to be enough.
+ * 20 digits would risk overflow of 64bit unsigned int */
+NUM		[0-9]{1,19}
+NUM_TOO_LONG	{NUM}[0-9]
+
 U64		0x[0-9A-Fa-f]{16}
 U32		0x[0-9A-Fa-f]{8}
-OP		[{};]
-STRING		\"[^\"]*\"
+INVALID_HEX	0x[0-9A-Fa-f]{0,17}
 
+STRING		\"[^\"\r\n]{1,20}\"
+EMPTY_STRING    \"\"?
+INVALID_STRING  \"[^\"\r\n]{1,20}
+
+INVALID_TOKEN	 [-_a-zA-Z0-9]{1,100}
+INVALID_CHAR    [^-_a-zA-Z0-9 \t\r\n\";{}]
+
 %%
 
-{WS}
-{COMMENT}
+{WS}		/* skip silently */
+{COMMENT}	/* skip silently */
 {OP}		DP; return yytext[0];
-{STRING}	unescape(); yylval.txt=yytext; DP; return TK_STRING;
+{STRING}	unescape(); DP; CP; return TK_STRING;
 {U64}		yylval.u64 = strto_u64(yytext, NULL, 16); DP; return TK_U64;
 {U32}		yylval.u64 = strto_u64(yytext, NULL, 16); DP; return TK_U32;
 {NUM}		yylval.u64 = strto_u64(yytext, NULL, 10); DP; return TK_NUM;
-gc		DP; return TK_GC;
-bm		DP; return TK_BM;
-uuid		DP; return TK_UUID;
-version		DP; return TK_VERSION;
-la-size-sect	DP; return TK_LA_SIZE;
-bm-byte-per-bit DP; return TK_BM_BYTE_PER_BIT;
-device-uuid	DP; return TK_DEVICE_UUID;
-times		DP; return TK_TIMES;
-flags		DP; return TK_FLAGS;
+gc		DP; CP; return TK_GC;
+bm		DP; CP; return TK_BM;
+uuid		DP; CP; return TK_UUID;
+version		DP; CP; return TK_VERSION;
+la-size-sect	DP; CP; return TK_LA_SIZE;
+bm-byte-per-bit DP; CP; return TK_BM_BYTE_PER_BIT;
+device-uuid	DP; CP; return TK_DEVICE_UUID;
+times		DP; CP; return TK_TIMES;
+flags		DP; CP; return TK_FLAGS;
 
+{INVALID_STRING} CP; bad_token("invalid string"); return TK_INVALID;
+{EMPTY_STRING}	 CP; bad_token("invalid string"); return TK_INVALID;
+{INVALID_HEX}	 CP; bad_token("invalid hex number (only 8 or 16 hex digits accepted)"); return TK_INVALID;
+{NUM_TOO_LONG}	 CP; bad_token("number too big"); return TK_INVALID;
+{INVALID_TOKEN}	 CP; bad_token("unknown token"); return TK_INVALID;
+{INVALID_CHAR}	 CP; return TK_INVALID_CHAR;
+
 %%
 
+static void bad_token(char *msg)
+{
+	fflush(stdout);
+	fprintf(stderr,"line %u: %s: %s ...\n", yylineno, msg, yytext);
+}
+
 static void unescape(void)
 {
   /* backslash escapes from string */

Modified: trunk/user/drbdmeta_unfinished_rewrite.c
===================================================================
--- trunk/user/drbdmeta_unfinished_rewrite.c	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/user/drbdmeta_unfinished_rewrite.c	2007-07-19 11:09:26 UTC (rev 2975)
@@ -593,6 +593,7 @@
 int meta_show_gi(struct format *cfg, char **argv, int argc);
 int meta_dump_md(struct format *cfg, char **argv, int argc);
 int meta_restore_md(struct format *cfg, char **argv, int argc);
+int meta_verify_dump_file(struct format *cfg, char **argv, int argc);
 int meta_create_md(struct format *cfg, char **argv, int argc);
 int meta_wipe_md(struct format *cfg, char **argv, int argc);
 int meta_outdate(struct format *cfg, char **argv, int argc);
@@ -606,6 +607,7 @@
 	{"show-gi", 0, meta_show_gi, 1},
 	{"dump-md", 0, meta_dump_md, 1},
 	{"restore-md", "file", meta_restore_md, 1},
+	{"verify-dump", "file", meta_verify_dump_file, 1},
 	{"create-md", 0, meta_create_md, 1},
 	{"wipe-md", 0, meta_wipe_md, 1},
 	{"outdate", 0, meta_outdate, 1},
@@ -1505,15 +1507,90 @@
 	return cfg->ops->close(cfg);
 }
 
-void md_parse_error(const char *etext)
+void md_parse_error(int expected_token, int seen_token,const char *etext)
 {
-	fprintf(stderr,"Parse error '%s' expected.",etext);
+	if (!etext) {
+		switch(expected_token) {
+		/* leading space indicates to strip off "expected" below */
+		default : etext = " invalid/unexpected token!"; break;
+		case 0  : etext = "end of file"; break;
+		case ';': etext = "semicolon (;)"; break;
+		case '{': etext = "opening brace ({)"; break;
+		case '}': etext = "closing brace (})"; break;
+		case TK_BM:
+			etext = "keyword 'bm'"; break;
+		case TK_BM_BYTE_PER_BIT:
+			etext = "keyword 'bm-byte-per-bit'"; break;
+		case TK_DEVICE_UUID:
+			etext = "keyword 'device-uuid'"; break;
+		case TK_FLAGS:
+			etext = "keyword 'flags'"; break;
+		case TK_GC:
+			etext = "keyword 'gc'"; break;
+		case TK_LA_SIZE:
+			etext = "keyword 'la-size-sect'"; break;
+		case TK_TIMES:
+			etext = "keyword 'times'"; break;
+		case TK_UUID:
+			etext = "keyword 'uuid'"; break;
+		case TK_VERSION:
+			etext = "keyword 'version'"; break;
+		case TK_NUM:
+			etext = "number ([0-9], up to 20 digits)"; break;
+		case TK_STRING:
+			etext = "short quoted string "
+			        "(\"..up to 20 characters, no newline..\")";
+				break;
+		case TK_U32:
+			etext = "an 8-digit hex number"; break;
+		case TK_U64:
+			etext = "a 16-digit hex number"; break;
+		}
+	}
+	fflush(stdout);
+	fprintf(stderr,"Parse error in line %u: %s%s",
+		yylineno, etext,
+		(etext[0] == ' ' ? ":" : " expected")
+		);
+
+	switch(seen_token) {
+	case 0:
+		fprintf(stderr, ", but end of file encountered\n"); break;
+
+	case   1 ...  58: /* ord(';') == 58 */
+	case  60 ... 122: /* ord('{') == 123 */
+	case 124:         /* ord('}') == 125 */
+	case 126 ... 257:
+		/* oopsie. these should never be returned! */
+		fprintf(stderr, "; got token value %u (this should never happen!)\n", seen_token); break;
+		break;
+
+	case TK_INVALID_CHAR:
+		fprintf(stderr,"; got invalid input character '\\x%02x' [%c]\n",
+			(unsigned char)yylval.txt[0], yylval.txt[0]);
+		break;
+	case ';': case '{': case '}':
+		fprintf(stderr, ", not '%c'\n", seen_token); break;
+	case TK_NUM:
+	case TK_U32:
+	case TK_U64:
+		fprintf(stderr, ", not some number\n"); break;
+	case TK_INVALID:
+		/* already reported by scanner */
+		fprintf(stderr,"\n"); break;
+	default:
+		fprintf(stderr, ", not '%s'\n", yylval.txt);
+	}
 	exit(10);
 }
 
-#define EXP(TOKEN) if(yylex() != TOKEN) md_parse_error( #TOKEN );
+static void EXP(int expected_token) {
+	int tok = yylex();
+	if (tok != expected_token)
+		md_parse_error(expected_token, tok, NULL);
+}
 
-int meta_restore_md(struct format *cfg, char **argv, int argc)
+int verify_dumpfile_or_restore(struct format *cfg, char **argv, int argc, int parse_only)
 {
 	int i,times;
 	int err;
@@ -1528,7 +1605,7 @@
 		}
 	}
 
-	if (!cfg->ops->open(cfg)) {
+	if (!parse_only && !cfg->ops->open(cfg)) {
 		if (!confirmed("Valid meta-data in place, overwrite?"))
 			return -1;
 	}
@@ -1572,8 +1649,19 @@
 	i = 0;
 	bm_on_disk_off = cfg->bm_offset;
 	while(1) {
-		switch(yylex()) {
+		int tok = yylex();
+		switch(tok) {
 		case TK_U64:
+			EXP(';');
+			/* NOTE:
+			 * even though this EXP(';'); already advanced
+			 * to the next token, yylval will *not* be updated
+			 * for * ';', so it is still valid.
+			 *
+			 * This seemed to be the least ugly way to implement a
+			 * "parse_only" functionality without ugly if-branches
+			 * or the maintenance nightmare of code duplication */
+			if (parse_only) break;
 			bm[i].le = cpu_to_le64(yylval.u64);
 			if (++i == buffer_size/sizeof(*bm)) {
 				pwrite_or_die(cfg->md_fd, on_disk_buffer,
@@ -1582,14 +1670,14 @@
 				bm_on_disk_off += buffer_size;
 				i = 0;
 			}
-			EXP(';');
 			break;
 		case TK_NUM:
+			times = yylval.u64;
 			EXP(TK_TIMES);
-			times = yylval.u64;
 			EXP(TK_U64);
+			EXP(';');
+			if (parse_only) break;
 			value.le = cpu_to_le64(yylval.u64);
-			EXP(';');
 			while(times--) {
 				bm[i] = value;
 				if (++i == buffer_size/sizeof(*bm)) {
@@ -1604,11 +1692,22 @@
 		case '}':
 			goto break_loop;
 		default:
-			md_parse_error("TK_U64, TK_NUM or }");
+			md_parse_error(0 /* ignored, since etext is set */,
+				tok, "repeat count, 16-digit hex number, or closing brace (})");
 			goto break_loop;
 		}
 	}
 	break_loop:
+
+	/* there should be no trailing garbage in the input file */
+	EXP(0);
+
+	if (parse_only) {
+		printf("input file parsed ok\n");
+		return 0;
+	}
+
+	/* not reached if parse_only */
 	if (i) {
 		size_t s = i * sizeof(*bm);
 		memset(bm+i, 0x00, buffer_size - s);
@@ -1631,8 +1730,16 @@
 	return 0;
 }
 
-#undef EXP
+int meta_restore_md(struct format *cfg, char **argv, int argc)
+{
+	return verify_dumpfile_or_restore(cfg,argv,argc,0);
+}
 
+int meta_verify_dump_file(struct format *cfg, char **argv, int argc)
+{
+	return verify_dumpfile_or_restore(cfg,argv,argc,1);
+}
+
 void md_convert_07_to_08(struct format *cfg)
 {
 	int i,j=1;

Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c	2007-07-18 16:22:09 UTC (rev 2974)
+++ trunk/user/drbdsetup.c	2007-07-19 11:09:26 UTC (rev 2975)
@@ -482,6 +482,15 @@
 
 void add_tag(struct drbd_tag_list *tl, int tag, void *data, int data_len)
 {
+	if(data_len > tag_descriptions[tag_number(tag)].max_len) {
+		fprintf(stderr, "The value for %s may only be %d byte long."
+			" You requested %d.\n",
+			tag_descriptions[tag_number(tag)].name,
+			tag_descriptions[tag_number(tag)].max_len,
+			data_len);
+		exit(20);
+	}
+
 	if( (tl->tag_list_cpos - tl->tag_list_start) + data_len
 	    > tl->tag_size ) {
 		fprintf(stderr, "Tag list size exceeded!\n");

From drbd-cvs at lists.linbit.com  Sun Jul 22 09:55:29 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Sun Jul 22 09:55:31 2007
Subject: [DRBD-cvs] svn commit by phil - r2976 - branches/drbd-8.0/user -
	Rasto reported this. When one uses "drbdsetup /dev/drbd
Message-ID: <20070722075529.06A1940095@garcon1.linbit.com>

Author: phil
Date: 2007-07-22 09:55:29 +0200 (Sun, 22 Jul 2007)
New Revision: 2976

Modified:
   branches/drbd-8.0/user/drbdsetup.c
Log:
Rasto reported this.
  When one uses "drbdsetup /dev/drbd0 events --all-devices" we 
  send to the kernel 256 get_state requests. After receiving
  that reply packets we ignored all real state broadcasts
  with sequence numbers small then 256.
  Fixed that.


Modified: branches/drbd-8.0/user/drbdsetup.c
===================================================================
--- branches/drbd-8.0/user/drbdsetup.c	2007-07-19 11:09:26 UTC (rev 2975)
+++ branches/drbd-8.0/user/drbdsetup.c	2007-07-22 07:55:29 UTC (rev 2976)
@@ -1273,7 +1273,7 @@
 	struct drbd_nl_cfg_reply *reply;
 	struct drbd_tag_list *tl;
 	struct option *lo;
-	unsigned int seq=0;
+	unsigned int b_seq=0, r_seq=0;
 	int sk_nl,c,cont=1,rr,i,last;
 	int unfiltered=0, all_devices=0;
 	int wfc_timeout=0, degr_wfc_timeout=0,timeout_ms;
@@ -1368,8 +1368,17 @@
 
 		// dump_tag_list(reply->tag_list);
 
-		if(!unfiltered && cn_reply->seq <= seq) continue;
-		seq = cn_reply->seq;
+		/* There are two value spaces for sequence numbers. The first
+		   is the one created by this drbdsetup instance, the kernel's
+		   reply packets simply echo those sequence numbers.
+		   The second is created by the kernel's broadcast packets. */
+		if(cn_reply->ack==0) { // broadcasts
+			if(!unfiltered && cn_reply->seq <= b_seq) continue;
+			b_seq = cn_reply->seq;
+		} else { // replies to drbdsetup packes
+			if(!unfiltered && cn_reply->seq <= r_seq) continue;
+			r_seq = cn_reply->seq;
+		}
 
 		if( all_devices || minor == reply->minor ) {
 			cont=cm->ep.proc_event(cn_reply->seq, reply);

From drbd-cvs at lists.linbit.com  Mon Jul 23 16:11:48 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Mon Jul 23 16:11:49 2007
Subject: [DRBD-cvs] svn commit by lars - r2977 - branches -
	drbd-8.0-for-linus to track the process of mainline ker
Message-ID: <20070723141148.4436D40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-23 16:11:46 +0200 (Mon, 23 Jul 2007)
New Revision: 2977

Added:
   branches/drbd-8.0-for-linus/
Log:
drbd-8.0-for-linus to track the process of mainline kernel inclusion
also in our svn.


Copied: branches/drbd-8.0-for-linus (from rev 2975, branches/drbd-8.0)

From drbd-cvs at lists.linbit.com  Mon Jul 23 16:16:15 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Mon Jul 23 16:16:19 2007
Subject: [DRBD-cvs] svn commit by lars - r2978 -
	branches/drbd-8.0-for-linus/drbd - renamed
	drbd_compat_wrappers.h to drbd_wrappers.h 
Message-ID: <20070723141615.0DF7E40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-23 16:16:14 +0200 (Mon, 23 Jul 2007)
New Revision: 2978

Added:
   branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
Removed:
   branches/drbd-8.0-for-linus/drbd/drbd_compat_wrappers.h
Modified:
   branches/drbd-8.0-for-linus/drbd/drbd_int.h
Log:
renamed drbd_compat_wrappers.h to drbd_wrappers.h

Deleted: branches/drbd-8.0-for-linus/drbd/drbd_compat_wrappers.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_compat_wrappers.h	2007-07-23 14:11:46 UTC (rev 2977)
+++ branches/drbd-8.0-for-linus/drbd/drbd_compat_wrappers.h	2007-07-23 14:16:14 UTC (rev 2978)
@@ -1,340 +0,0 @@
-/*
- * FIXME this file is bound to die, renamed or included in drbd_int.h
- */
-
-#include <linux/version.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
-# error "use a 2.6 kernel, please"
-#endif
-
-
-/* struct page has a union in 2.6.15 ...
- * an anonymous union and struct since 2.6.16
- * or in fc5 "2.6.15" */
-#include <linux/mm.h>
-#ifndef page_private
-# define page_private(page)		((page)->private)
-# define set_page_private(page, v)	((page)->private = (v))
-#endif
-
-#include <linux/buffer_head.h> // for fsync_bdev
-
-/* 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);
-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);
-extern int drbd_endio_write_sec(struct bio *bio, unsigned int bytes_done, int error);
-extern int drbd_endio_pri      (struct bio *bio, unsigned int bytes_done, int error);
-
-static inline sector_t drbd_get_hardsect(struct block_device *bdev)
-{
-	return bdev->bd_disk->queue->hardsect_size;
-}
-
-/* Returns the number of 512 byte sectors of the device */
-static inline sector_t drbd_get_capacity(struct block_device *bdev)
-{
-	/* return bdev ? get_capacity(bdev->bd_disk) : 0; */
-	return bdev ? bdev->bd_inode->i_size >> 9 : 0;
-}
-
-/* sets the number of 512 byte sectors of our virtual device */
-static inline void drbd_set_my_capacity(drbd_dev *mdev,
-					sector_t size)
-{
-	/* set_capacity(mdev->this_bdev->bd_disk, size); */
-	set_capacity(mdev->vdisk,size);
-	mdev->this_bdev->bd_inode->i_size = (loff_t)size << 9;
-}
-
-static inline int drbd_sync_me(drbd_dev *mdev)
-{
-	return fsync_bdev(mdev->this_bdev);
-}
-
-#define drbd_bio_uptodate(bio) bio_flagged(bio,BIO_UPTODATE)
-
-#ifdef CONFIG_HIGHMEM
-/*
- * I don't know why there is no bvec_kmap, only bvec_kmap_irq ...
- *
- * we do a sock_recvmsg into the target buffer,
- * so we obviously cannot use the bvec_kmap_irq variant.	-lge
- *
- * Most likely it is only due to performance anyways:
-  * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because
-  * no global lock is needed and because the kmap code must perform a global TLB
-  * invalidation when the kmap pool wraps.
-  *
-  * However when holding an atomic kmap is is not legal to sleep, so atomic
-  * kmaps are appropriate for short, tight code paths only.
- */
-static inline char *drbd_bio_kmap(struct bio *bio)
-{
-	struct bio_vec *bvec = bio_iovec(bio);
-	unsigned long addr;
-
-	addr = (unsigned long) kmap(bvec->bv_page);
-
-	if (addr & ~PAGE_MASK)
-		BUG();
-
-	return (char *) addr + bvec->bv_offset;
-}
-
-static inline void drbd_bio_kunmap(struct bio *bio)
-{
-	struct bio_vec *bvec = bio_iovec(bio);
-
-	kunmap(bvec->bv_page);
-}
-
-#else
-static inline char *drbd_bio_kmap(struct bio *bio)
-{
-	struct bio_vec *bvec = bio_iovec(bio);
-	return page_address(bvec->bv_page) + bvec->bv_offset;
-}
-static inline void drbd_bio_kunmap(struct bio *bio)
-{
-	// do nothing.
-}
-#endif
-
-static inline int drbd_bio_has_active_page(struct bio *bio)
-{
-	struct bio_vec *bvec;
-	int i;
-
-	__bio_for_each_segment(bvec, bio, i, 0) {
-		if (page_count(bvec->bv_page) > 1) return 1;
-	}
-
-	return 0;
-}
-
-/*
- * used to submit our private bio
- */
-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.
-
-	if (!bio->bi_bdev) {
-		printk(KERN_ERR DEVICE_NAME "%d: drbd_generic_make_request: bio->bi_bdev == NULL\n",
-		       mdev_to_minor(mdev));
-		dump_stack();
-		bio_endio(bio, bio->bi_size, -ENODEV);
-		return;
-	}
-
-	if (FAULT_ACTIVE(mdev, fault_type))
-		bio_endio(bio,bio->bi_size,-EIO);
-	else
-		generic_make_request(bio);
-}
-
-static inline void drbd_plug_device(drbd_dev *mdev)
-{
-	request_queue_t *q;
-	q = bdev_get_queue(mdev->this_bdev);
-
-	spin_lock_irq(q->queue_lock);
-
-/* XXX the check on !blk_queue_plugged is redundant,
- * implicitly checked in blk_plug_device */
-
-	if(!blk_queue_plugged(q)) {
-		blk_plug_device(q);
-		del_timer(&q->unplug_timer);
-		// unplugging should not happen automatically...
-	}
-	spin_unlock_irq(q->queue_lock);
-}
-
-static inline int _drbd_send_bio(drbd_dev *mdev, struct bio *bio)
-{
-	struct bio_vec *bvec = bio_iovec(bio);
-	struct page *page = bvec->bv_page;
-	size_t size = bvec->bv_len;
-	int offset = bvec->bv_offset;
-	int ret;
-
-	ret = drbd_send(mdev, mdev->data.socket, kmap(page) + offset, size, 0);
-	kunmap(page);
-	return ret;
-}
-
-#ifdef DEFINE_SOCK_CREATE_KERN
-#define sock_create_kern sock_create
-#endif
-
-#ifdef USE_KMEM_CACHE_S
-typedef struct kmem_cache_s drbd_kmem_cache_t;
-#else
-typedef struct kmem_cache drbd_kmem_cache_t;
-#endif
-
-#ifdef NEED_BACKPORT_OF_ATOMIC_ADD
-
-#if defined(__x86_64__)
-
-static __inline__ int atomic_add_return(int i, atomic_t *v)
-{
-        int __i = i;
-        __asm__ __volatile__(
-                LOCK_PREFIX "xaddl %0, %1;"
-                :"=r"(i)
-                :"m"(v->counter), "0"(i));
-        return i + __i;
-}
-
-static __inline__ int atomic_sub_return(int i, atomic_t *v)
-{
-        return atomic_add_return(-i,v);
-}
-
-#define atomic_inc_return(v)  (atomic_add_return(1,v))
-#define atomic_dec_return(v)  (atomic_sub_return(1,v))
-
-#elif defined(__i386__) || defined(__arch_um__)
-
-static __inline__ int atomic_add_return(int i, atomic_t *v)
-{
-        int __i;
-#ifdef CONFIG_M386
-        unsigned long flags;
-        if(unlikely(boot_cpu_data.x86==3))
-                goto no_xadd;
-#endif
-        /* Modern 486+ processor */
-        __i = i;
-        __asm__ __volatile__(
-                LOCK_PREFIX "xaddl %0, %1;"
-                :"=r"(i)
-                :"m"(v->counter), "0"(i));
-        return i + __i;
-
-#ifdef CONFIG_M386
-no_xadd: /* Legacy 386 processor */
-        local_irq_save(flags);
-        __i = atomic_read(v);
-        atomic_set(v, i + __i);
-        local_irq_restore(flags);
-        return i + __i;
-#endif
-}
-
-static __inline__ int atomic_sub_return(int i, atomic_t *v)
-{
-        return atomic_add_return(-i,v);
-}
-
-#define atomic_inc_return(v)  (atomic_add_return(1,v))
-#define atomic_dec_return(v)  (atomic_sub_return(1,v))
-
-#else
-# error "You need to copy/past atomic_inc_return()/atomic_dec_return() here"
-# error "for your architecture. (Hint: Kernels after 2.6.10 have those"
-# error "by default! Using a later kernel might be less effort!)"
-#endif
-
-#endif
-
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
-/* With Linux-2.6.19 the crypto API changed! */
-/* This is not a generic backport of the new api, it just implements
-   the corner case of "hmac(xxx)".  */
-
-#define CRYPTO_ALG_ASYNC 4711
-#define CRYPTO_ALG_TYPE_HASH CRYPTO_ALG_TYPE_DIGEST
-
-struct crypto_hash {
-        struct crypto_tfm *base;
-	const u8 *key;
-	int keylen;
-};
-
-struct hash_desc {
-        struct crypto_hash *tfm;
-        u32 flags;
-};
-
-static inline struct crypto_hash *
-crypto_alloc_hash(char *alg_name, u32 type, u32 mask)
-{
-	struct crypto_hash *ch;
-	char *closing_bracket;
-
-	// "hmac(xxx)" is in alg_name we need that xxx.
-	closing_bracket = strchr(alg_name,')');
-	if(!closing_bracket) return NULL;
-	if(closing_bracket-alg_name < 6) return NULL;
-
-	ch = kmalloc(sizeof(struct crypto_hash),GFP_KERNEL);
-	if(!ch) return NULL;
-
-	*closing_bracket = 0;
-	ch->base = crypto_alloc_tfm(alg_name + 5, 0);
-	*closing_bracket = ')';
-
-	if (ch->base == NULL) {
-		kfree(ch);
-		return NULL;
-	}
-
-	return ch;
-}
-
-static inline int
-crypto_hash_setkey(struct crypto_hash *hash,const u8 *key,unsigned int keylen)
-{
-	hash->key = key;
-	hash->keylen = keylen;
-
-	return 0;
-}
-
-static inline int
-crypto_hash_digest(struct hash_desc *desc, struct scatterlist *sg,
-		   unsigned int nbytes, u8 *out)
-{
-
-	crypto_hmac(desc->tfm->base, (u8*)desc->tfm->key,
-		    &desc->tfm->keylen, sg, 1 /* ! */ , out);
-	/* ! this is not generic. Would need to convert nbytes -> nsg */
-
-	return 0;
-}
-
-static inline void crypto_free_hash(struct crypto_hash *tfm)
-{
-	crypto_free_tfm(tfm->base);
-	kfree(tfm);
-}
-
-static inline unsigned int crypto_hash_digestsize(struct crypto_hash *tfm)
-{
-	return crypto_tfm_alg_digestsize(tfm->base);
-}
-
-static inline struct crypto_tfm *crypto_hash_tfm(struct crypto_hash *tfm)
-{
-        return tfm->base;
-}
-
-#endif
-
-#ifdef NEED_BACKPORT_OF_KZALLOC
-static inline void *kzalloc(size_t size, int flags)
-{
-	void *rv = kmalloc(size,flags);
-	if(rv) memset(rv,0,size);
-
-	return rv;
-}
-#endif

Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-23 14:11:46 UTC (rev 2977)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-23 14:16:14 UTC (rev 2978)
@@ -1165,7 +1165,7 @@
 
 /* needs to be included here,
  * because of kmem_cache_t weirdness */
-#include "drbd_compat_wrappers.h"
+#include "drbd_wrappers.h"
 
 extern int minor_count;
 extern drbd_kmem_cache_t *drbd_request_cache;

Copied: branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h (from rev 2977, branches/drbd-8.0-for-linus/drbd/drbd_compat_wrappers.h)

From drbd-cvs at lists.linbit.com  Mon Jul 23 17:51:46 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Mon Jul 23 17:51:48 2007
Subject: [DRBD-cvs] svn commit by lars - r2979 -
	branches/drbd-8.0-for-linus/drbd - equivalent of: DRBD: added
	DRBD_MAJOR to linux/major.h; 
Message-ID: <20070723155146.CAFD540095@garcon1.linbit.com>

Author: lars
Date: 2007-07-23 17:51:45 +0200 (Mon, 23 Jul 2007)
New Revision: 2979

Modified:
   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_wrappers.h
Log:
equivalent of: DRBD: added DRBD_MAJOR to linux/major.h; cleanup; ca60be259a731f7c43219728c2751131438fee20

Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-23 14:16:14 UTC (rev 2978)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-23 15:51:45 UTC (rev 2979)
@@ -42,8 +42,6 @@
 // module parameter, defined in drbd_main.c
 extern int minor_count;
 extern int allow_oos;
-extern int major_nr;
-extern int use_nbd_major;
 
 #ifdef DRBD_ENABLE_FAULTS
 extern int enable_faults;
@@ -54,13 +52,12 @@
 extern char usermode_helper[];
 
 #include <linux/major.h>
-#ifdef DRBD_MAJOR
-# warning "FIXME. DRBD_MAJOR is now officially defined in major.h"
+#ifndef DRBD_MAJOR
+# define DRBD_MAJOR 147
 #endif
 
 #include <linux/blkdev.h>
 #include <linux/bio.h>
-#define MAJOR_NR major_nr
 
 #undef DEVICE_NAME
 #define DEVICE_NAME "drbd"

Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-23 14:16:14 UTC (rev 2978)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-23 15:51:45 UTC (rev 2979)
@@ -56,10 +56,6 @@
 #include "drbd_int.h"
 #include "drbd_req.h" /* only for _req_mod in tl_release and tl_clear */
 
-/* YES. We got an official device major from lanana
- */
-#define LANANA_DRBD_MAJOR 147
-
 struct after_state_chg_work {
 	struct drbd_work w;
 	drbd_state_t os;
@@ -104,9 +100,7 @@
 #endif
 
 // module parameter, defined
-int major_nr = LANANA_DRBD_MAJOR;
 int minor_count = 32;
-
 int allow_oos = 0;
 
 #ifdef ENABLE_DYNAMIC_TRACE
@@ -2302,7 +2296,7 @@
 
 	kfree(minor_table);
 
-	if (unregister_blkdev(MAJOR_NR, DEVICE_NAME) != 0)
+	if (unregister_blkdev(DRBD_MAJOR, DEVICE_NAME) != 0)
 		printk(KERN_ERR DEVICE_NAME": unregister of device failed\n");
 
 	printk(KERN_INFO DEVICE_NAME": module cleanup done.\n");
@@ -2334,14 +2328,14 @@
 	set_disk_ro( disk, TRUE );
 
 	disk->queue = q;
-	disk->major = MAJOR_NR;
+	disk->major = DRBD_MAJOR;
 	disk->first_minor = minor;
 	disk->fops = &drbd_ops;
 	sprintf(disk->disk_name, DEVICE_NAME "%d", minor);
 	disk->private_data = mdev;
 	add_disk(disk);
 
-	mdev->this_bdev = bdget(MKDEV(MAJOR_NR,minor));
+	mdev->this_bdev = bdget(MKDEV(DRBD_MAJOR,minor));
 	// we have no partitions. we contain only ourselves.
 	mdev->this_bdev->bd_contains = mdev->this_bdev;
 
@@ -2433,11 +2427,11 @@
 		return err;
 	}
 
-	err = register_blkdev(MAJOR_NR, DEVICE_NAME);
+	err = register_blkdev(DRBD_MAJOR, DEVICE_NAME);
 	if (err) {
 		printk(KERN_ERR DEVICE_NAME
 		       ": unable to register block device major %d\n",
-		       MAJOR_NR);
+		       DRBD_MAJOR);
 		return err;
 	}
 
@@ -2478,7 +2472,7 @@
 	       "Version: " REL_VERSION " (api:%d/proto:%d)\n",
 	       API_VERSION,PRO_VERSION);
 	printk(KERN_INFO DEVICE_NAME ": %s\n", drbd_buildtag());
-	printk(KERN_INFO DEVICE_NAME": registered as block device major %d\n", MAJOR_NR);
+	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!

Modified: branches/drbd-8.0-for-linus/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-23 14:16:14 UTC (rev 2978)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-23 15:51:45 UTC (rev 2979)
@@ -29,6 +29,7 @@
 #include <linux/module.h>
 #include <linux/in.h>
 #include <linux/fs.h>
+#include <linux/buffer_head.h> /* for fsync_bdev */
 #include <linux/file.h>
 #include <linux/slab.h>
 #include <linux/connector.h>
@@ -303,7 +304,7 @@
 
 	if(forced) WARN("Forced to conisder local data as UpToDate!\n");
 
-	drbd_sync_me(mdev);
+	fsync_bdev(mdev->this_bdev);
 
 	/* Wait until nothing is on the fly :) */
 	if ( wait_event_interruptible( mdev->misc_wait,
@@ -1032,7 +1033,7 @@
 STATIC int drbd_nl_detach(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
 			  struct drbd_nl_cfg_reply *reply)
 {
-	drbd_sync_me(mdev);
+	fsync_bdev(mdev->this_bdev);
 	reply->ret_code = drbd_request_state(mdev,NS(disk,Diskless));
 
 	return 0;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-23 14:16:14 UTC (rev 2978)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-23 15:51:45 UTC (rev 2979)
@@ -872,10 +872,10 @@
 	int epoch_size=0;
 	Drbd_Barrier_Packet *p = (Drbd_Barrier_Packet*)h;
 
-	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
+	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return false;
 
 	rv = drbd_recv(mdev, h->payload, h->length);
-	ERR_IF(rv != h->length) return FALSE;
+	ERR_IF(rv != h->length) return false;
 
 	inc_unacked(mdev);
 

Modified: branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-23 14:16:14 UTC (rev 2978)
+++ branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-23 15:51:45 UTC (rev 2979)
@@ -1,7 +1,3 @@
-/*
- * FIXME this file is bound to die, renamed or included in drbd_int.h
- */
-
 #include <linux/version.h>
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 # error "use a 2.6 kernel, please"
@@ -17,8 +13,6 @@
 # define set_page_private(page, v)	((page)->private = (v))
 #endif
 
-#include <linux/buffer_head.h> // for fsync_bdev
-
 /* see get_sb_bdev and bd_claim */
 extern char* drbd_sec_holder;
 
@@ -51,11 +45,6 @@
 	mdev->this_bdev->bd_inode->i_size = (loff_t)size << 9;
 }
 
-static inline int drbd_sync_me(drbd_dev *mdev)
-{
-	return fsync_bdev(mdev->this_bdev);
-}
-
 #define drbd_bio_uptodate(bio) bio_flagged(bio,BIO_UPTODATE)
 
 #ifdef CONFIG_HIGHMEM

From drbd-cvs at lists.linbit.com  Mon Jul 23 17:55:17 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Mon Jul 23 17:55:18 2007
Subject: [DRBD-cvs] svn commit by lars - r2980 -
	branches/drbd-8.0-for-linus/drbd - equivalet of
	31bd956bd9dccf93b714fdd3cf8671b78433993a D
Message-ID: <20070723155517.42FFA40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-23 17:55:14 +0200 (Mon, 23 Jul 2007)
New Revision: 2980

Modified:
   branches/drbd-8.0-for-linus/drbd/drbd_int.h
   branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
Log:
equivalet of 31bd956bd9dccf93b714fdd3cf8671b78433993a DRBD: remove non-working distributed TCQ

Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-23 15:51:45 UTC (rev 2979)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-23 15:55:14 UTC (rev 2980)
@@ -1877,18 +1877,9 @@
 
 static inline int drbd_queue_order_type(drbd_dev* mdev)
 {
-	int rv;
-#if !defined(QUEUE_FLAG_ORDERED)
-	ERR_IF(mdev->bc == NULL) return QUEUE_ORDERED_NONE;
-	rv = bdev_get_queue(mdev->bc->backing_bdev)->ordered;
-#else
-# define QUEUE_ORDERED_NONE 0
-# define QUEUE_ORDERED_TAG 1
-# define QUEUE_ORDERED_FLUSH 2
-# warning "TCQ code disabled at compile time."
-	rv = QUEUE_ORDERED_NONE; // Kernels before 2.6.12 had not had TCQ support.
-#endif
-	return rv;
+	/* sorry, we currently have no working implementation
+	 * of distributed TCQ stuff */
+	return QUEUE_ORDERED_NONE;
 }
 
 /*

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-23 15:51:45 UTC (rev 2979)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-23 15:55:14 UTC (rev 2980)
@@ -865,40 +865,6 @@
 	return TRUE;
 }
 
-#if 0
-STATIC int receive_Barrier_tcq(drbd_dev *mdev, Drbd_Header* h)
-{
-	int rv;
-	int epoch_size=0;
-	Drbd_Barrier_Packet *p = (Drbd_Barrier_Packet*)h;
-
-	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return false;
-
-	rv = drbd_recv(mdev, h->payload, h->length);
-	ERR_IF(rv != h->length) return false;
-
-	inc_unacked(mdev);
-
-	spin_lock_irq(&mdev->ee_lock);
-	if(list_empty(&mdev->active_ee)) {
-		epoch_size = mdev->epoch_size;
-		mdev->epoch_size = 0;
-	} else if (mdev->last_write_w_barrier) {
-		mdev->last_write_w_barrier->barrier_nr2 = be32_to_cpu(p->barrier);
-	} else {
-		mdev->next_barrier_nr = be32_to_cpu(p->barrier);
-	}
-	spin_unlock_irq(&mdev->ee_lock);
-
-	if(epoch_size) {
-		rv = drbd_send_b_ack(mdev, p->barrier, epoch_size);
-		dec_unacked(mdev);
-	}
-
-	return rv;
-}
-#endif
-
 STATIC int receive_Barrier_no_tcq(drbd_dev *mdev, Drbd_Header* h)
 {
 	int rv;
@@ -2157,36 +2123,8 @@
 
 STATIC void drbd_setup_order_type(drbd_dev *mdev, int peer)
 {
-#if 0
-	int self = drbd_queue_order_type(mdev);
-	int type;
-
-	static char *order_txt[] = {
-		[QUEUE_ORDERED_NONE]  = "none - oldIDE",
-		[QUEUE_ORDERED_FLUSH] = "flush - IDE",
-		[QUEUE_ORDERED_TAG]   = "tag - TCQ",
-	};
-
-	if(self == QUEUE_ORDERED_NONE ||
-	   peer == QUEUE_ORDERED_NONE) {
-		type = QUEUE_ORDERED_NONE;
-	} else if (self == QUEUE_ORDERED_FLUSH ||
-		   peer == QUEUE_ORDERED_FLUSH) {
-		type = QUEUE_ORDERED_FLUSH;
-	} else if(self == QUEUE_ORDERED_TAG ||
-		  peer == QUEUE_ORDERED_TAG) {
-		type = QUEUE_ORDERED_TAG;
-	} else {
-		D_ASSERT(0);
-		type = QUEUE_ORDERED_NONE;
-	}
-
-	if (type != self ) {
-		INFO("Exposing an order type of '%s' to the kernel\n",
-		     order_txt[type]);
-		blk_queue_ordered(mdev->rq_queue,type);
-	}
-#endif
+	/* sorry, we currently have no working implementation
+	 * of distributed TCQ */
 }
 
 /* warn if the arguments differ by more than 12.5% */
@@ -2592,27 +2530,6 @@
 static drbd_cmd_handler_f *drbd_cmd_handler = drbd_default_handler;
 static drbd_cmd_handler_f *drbd_opt_cmd_handler = NULL;
 
-#if 0
-	/* FIXME lge thinks the implementation of barrier handling via
-	 * tcq is currently broken */
-void drbd_set_recv_tcq(drbd_dev * mdev, int tcq_enabled)
-{
-// warning LGE "FIXME make drbd_cmd_handler a member of mdev"
-	if(tcq_enabled &&
-	   drbd_default_handler[Barrier] != receive_Barrier_tcq) {
-		INFO("Enabling TCQ for barrier processing on backend.\n");
-		drbd_default_handler[Barrier] = receive_Barrier_tcq;
-	}
-
-	if(!tcq_enabled &&
-	   drbd_default_handler[Barrier] != receive_Barrier_usual) {
-		INFO("Using conventional (non TCQ) barrier processing"
-		     " on backend.\n");
-		drbd_default_handler[Barrier] = receive_Barrier_usual;
-	}
-}
-#endif
-
 STATIC void drbdd(drbd_dev *mdev)
 {
 	drbd_cmd_handler_f handler;

From drbd-cvs at lists.linbit.com  Mon Jul 23 18:04:50 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Mon Jul 23 18:04:51 2007
Subject: [DRBD-cvs] svn commit by lars - r2981 -
	branches/drbd-8.0-for-linus/drbd -
	fd43b7e8cefe861ac4c25483396ad3912fd832bf DRBD: cleanup:
Message-ID: <20070723160450.41E6D40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-23 18:04:49 +0200 (Mon, 23 Jul 2007)
New Revision: 2981

Modified:
   branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c
Log:
fd43b7e8cefe861ac4c25483396ad3912fd832bf DRBD: cleanup: removed even more compatibility ifdefs
well, almost nothing of it, actually.
we must stay compatibile out-of-tree for now...


Modified: branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-23 15:55:14 UTC (rev 2980)
+++ branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-23 16:04:49 UTC (rev 2981)
@@ -1027,14 +1027,6 @@
 	ERR_IF(!b) return 1;
 	ERR_IF(!b->bm) return 1;
 
-#if 0
-	/* hm. I assumed that, when inside of lock_irq/unlock_irq,
-	 * in_interrupt() would be true ?
-	 * how else can I assert that this called with irq disabled without using
-	 * spin_lock_irqsave? */
-	D_BUG_ON(!in_interrupt()); /* called within spin_lock_irq(&mdev->req_lock) */
-#endif
-
 	spin_lock(&b->bm_lock);
 	BM_PARANOIA_CHECK();
 	MUST_NOT_BE_LOCKED();

From drbd-cvs at lists.linbit.com  Mon Jul 23 19:54:19 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Mon Jul 23 19:54:21 2007
Subject: [DRBD-cvs] svn commit by lars - r2982 -
	branches/drbd-8.0-for-linus/drbd - oops,
	I broke compile on rhel4 earlier :( 
Message-ID: <20070723175419.A2B8F40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-23 19:54:18 +0200 (Mon, 23 Jul 2007)
New Revision: 2982

Modified:
   branches/drbd-8.0-for-linus/drbd/drbd_int.h
Log:
oops, I broke compile on rhel4 earlier :(


Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-23 16:04:49 UTC (rev 2981)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-23 17:54:18 UTC (rev 2982)
@@ -1879,6 +1879,9 @@
 {
 	/* sorry, we currently have no working implementation
 	 * of distributed TCQ stuff */
+#ifndef QUEUE_ORDERED_NONE
+#define QUEUE_ORDERED_NONE 0
+#endif
 	return QUEUE_ORDERED_NONE;
 }
 

From drbd-cvs at lists.linbit.com  Tue Jul 24 10:47:37 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 10:47:39 2007
Subject: [DRBD-cvs] svn commit by lars - r2983 -
	branches/drbd-8.0-for-linus/drbd -
	a97d57e6fadb7027f8b1ebbb266078c73db58046 if( => if ( 
Message-ID: <20070724084737.8F77340095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 10:47:36 +0200 (Tue, 24 Jul 2007)
New Revision: 2983

Modified:
   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_wrappers.h
Log:
a97d57e6fadb7027f8b1ebbb266078c73db58046 if( => if (



Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-23 17:54:18 UTC (rev 2982)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 08:47:36 UTC (rev 2983)
@@ -1165,8 +1165,8 @@
 #include "drbd_wrappers.h"
 
 extern int minor_count;
-extern drbd_kmem_cache_t *drbd_request_cache;
-extern drbd_kmem_cache_t *drbd_ee_cache;
+extern struct kmem_cache *drbd_request_cache;
+extern struct kmem_cache *drbd_ee_cache;
 extern mempool_t *drbd_request_mempool;
 extern mempool_t *drbd_ee_mempool;
 

Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-23 17:54:18 UTC (rev 2982)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 08:47:36 UTC (rev 2983)
@@ -78,7 +78,7 @@
 MODULE_DESCRIPTION("drbd - Distributed Replicated Block Device v" REL_VERSION);
 MODULE_LICENSE("GPL");
 MODULE_PARM_DESC(minor_count, "Maximum number of drbd devices (1-255)");
-MODULE_ALIAS_BLOCKDEV_MAJOR(LANANA_DRBD_MAJOR);
+MODULE_ALIAS_BLOCKDEV_MAJOR(DRBD_MAJOR);
 
 #include <linux/moduleparam.h>
 /* allow_open_on_secondary */
@@ -129,8 +129,8 @@
  */
 struct Drbd_Conf **minor_table = NULL;
 
-drbd_kmem_cache_t *drbd_request_cache;
-drbd_kmem_cache_t *drbd_ee_cache;
+struct kmem_cache *drbd_request_cache;
+struct kmem_cache *drbd_ee_cache;
 mempool_t *drbd_request_mempool;
 mempool_t *drbd_ee_mempool;
 
@@ -2151,15 +2151,15 @@
 	drbd_pp_pool         = NULL;
 
 	// caches
-	drbd_request_cache = kmem_cache_create(
+	drbd_request_cache = drbd_kmem_cache_create(
 		"drbd_req_cache", sizeof(drbd_request_t),
-		0, 0, NULL, NULL);
+		0, 0, NULL);
 	if (drbd_request_cache == NULL)
 		goto Enomem;
 
-	drbd_ee_cache = kmem_cache_create(
+	drbd_ee_cache = drbd_kmem_cache_create(
 		"drbd_ee_cache", sizeof(struct Tl_epoch_entry),
-		0, 0, NULL, NULL);
+		0, 0, NULL);
 	if (drbd_ee_cache == NULL)
 		goto Enomem;
 

Modified: branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-23 17:54:18 UTC (rev 2982)
+++ branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-24 08:47:36 UTC (rev 2983)
@@ -163,11 +163,23 @@
 #endif
 
 #ifdef USE_KMEM_CACHE_S
-typedef struct kmem_cache_s drbd_kmem_cache_t;
-#else
-typedef struct kmem_cache drbd_kmem_cache_t;
+#define kmem_cache kmem_cache_s
 #endif
 
+/* dtor was removed in 20c2df83d25c6a95affe6157a4c9cac4cf5ffaac
+ * on the way to 2.6.23 */
+static inline struct kmem_cache *
+drbd_kmem_cache_create (const char *name, size_t size, size_t align,
+        unsigned long flags,
+        void (*ctor)(void*, struct kmem_cache *, unsigned long))
+{
+	return kmem_cache_create(name, size, align, flags, ctor
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+		, NULL
+#endif
+		);
+}
+
 #ifdef NEED_BACKPORT_OF_ATOMIC_ADD
 
 #if defined(__x86_64__)

From drbd-cvs at lists.linbit.com  Tue Jul 24 11:44:12 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 11:44:14 2007
Subject: [DRBD-cvs] svn commit by lars - r2984 -
	branches/drbd-8.0-for-linus/drbd -
	a97d57e6fadb7027f8b1ebbb266078c73db58046 if( => if ( dc
Message-ID: <20070724094412.5C27240095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 11:44:10 +0200 (Tue, 24 Jul 2007)
New Revision: 2984

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
   branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
   branches/drbd-8.0-for-linus/drbd/lru_cache.c
Log:
a97d57e6fadb7027f8b1ebbb266078c73db58046 if( => if (
dc3d193957478fb03ad8a2a3ec7e08097c88d114 if ( ... ) => if (...)

(last commit got a wrong log message first,
 I "repaired" that with svnadmin setlog, though...)



Modified: branches/drbd-8.0-for-linus/drbd/drbd_actlog.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 08:47:36 UTC (rev 2983)
+++ branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 09:44:10 UTC (rev 2984)
@@ -46,7 +46,7 @@
 	bio->bi_bdev = bdev->md_bdev;
 	bio->bi_sector = sector;
 	ok = (bio_add_page(bio, page, size, 0) == size);
-	if(!ok) goto out;
+	if (!ok) goto out;
 	init_completion(&event);
 	bio->bi_private = &event;
 	bio->bi_end_io = drbd_md_io_complete;
@@ -87,13 +87,13 @@
 	}
 
 	hardsect = drbd_get_hardsect(bdev->md_bdev);
-	if(hardsect == 0) hardsect = MD_HARDSECT;
+	if (hardsect == 0) hardsect = MD_HARDSECT;
 
 	// in case hardsect != 512 [ s390 only? ]
-	if( hardsect != MD_HARDSECT ) {
-		if(!mdev->md_io_tmpp) {
+	if (hardsect != MD_HARDSECT) {
+		if (!mdev->md_io_tmpp) {
 			struct page *page = alloc_page(GFP_NOIO);
-			if(!page) return 0;
+			if (!page) return 0;
 
 			WARN("Meta data's bdev hardsect = %d != %d\n",
 			     hardsect, MD_HARDSECT);
@@ -145,7 +145,7 @@
 		return 0;
 	}
 
-	if( hardsect != MD_HARDSECT && rw == READ ) {
+	if (hardsect != MD_HARDSECT && rw == READ) {
 		void *p = page_address(mdev->md_io_page);
 		void *hp = page_address(mdev->md_io_tmpp);
 
@@ -194,7 +194,7 @@
 	spin_lock_irq(&mdev->al_lock);
 	bm_ext = (struct bm_extent*) lc_find(mdev->resync,enr/AL_EXT_PER_BM_SECT);
 	if (unlikely(bm_ext!=NULL)) {
-		if(test_bit(BME_NO_WRITES,&bm_ext->flags)) {
+		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;
@@ -241,7 +241,7 @@
 
 		evicted = al_ext->lc_number;
 
-		if(mdev->state.conn < Connected && evicted != LC_FREE ) {
+		if (mdev->state.conn < Connected && evicted != LC_FREE) {
 			drbd_bm_write_sect(mdev, evicted/AL_EXT_PER_BM_SECT );
 		}
 
@@ -286,13 +286,13 @@
 
 	extent = lc_find(mdev->act_log,enr);
 
-	if(!extent) {
+	if (!extent) {
 		spin_unlock_irqrestore(&mdev->al_lock,flags);
 		ERR("al_complete_io() called on inactive extent %u\n",enr);
 		return;
 	}
 
-	if( lc_put(mdev->act_log,extent) == 0 ) {
+	if ( lc_put(mdev->act_log,extent) == 0 ) {
 		wake_up(&mdev->al_wait);
 	}
 
@@ -343,7 +343,7 @@
 		xor_sum ^= LC_FREE;
 	}
 	mdev->al_tr_cycle += AL_EXTENTS_PT;
-	if(mdev->al_tr_cycle >= mdev->act_log->nr_elements) mdev->al_tr_cycle=0;
+	if (mdev->al_tr_cycle >= mdev->act_log->nr_elements) mdev->al_tr_cycle=0;
 
 	buffer->xor_sum = cpu_to_be32(xor_sum);
 
@@ -351,12 +351,12 @@
 // 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)) {
+	if (!drbd_md_sync_page_io(mdev,mdev->bc,sector,WRITE)) {
 		drbd_chk_io_error(mdev, 1, TRUE);
 		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);
@@ -386,7 +386,7 @@
 
 	sector = bdev->md.md_offset + bdev->md.al_offset + index;
 
-	if(!drbd_md_sync_page_io(mdev,bdev,sector,READ)) {
+	if (!drbd_md_sync_page_io(mdev,bdev,sector,READ)) {
 		// Dont process error normally as this is done before
 		// disk is atached!
 		return -1;
@@ -427,27 +427,27 @@
 	// 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;
-		if(rv == -1) {
+		if (rv == 0) continue;
+		if (rv == -1) {
 			up(&mdev->md_io_mutex);
 			return 0;
 		}
 		cnr = be32_to_cpu(buffer->tr_number);
 		// INFO("index %d valid tnr=%d\n",i,cnr);
 
-		if(cnr == -1) overflow=1;
+		if (cnr == -1) overflow=1;
 
-		if(cnr < from_tnr && !overflow) {
+		if (cnr < from_tnr && !overflow) {
 			from = i;
 			from_tnr = cnr;
 		}
-		if(cnr > to_tnr) {
+		if (cnr > to_tnr) {
 			to = i;
 			to_tnr = cnr;
 		}
 	}
 
-	if(from == -1 || to == -1) {
+	if (from == -1 || to == -1) {
 		WARN("No usable activity log found.\n");
 
 		up(&mdev->md_io_mutex);
@@ -467,7 +467,7 @@
 
 		rv = drbd_al_read_tr(mdev,bdev,buffer,i);
 		ERR_IF(rv == 0) goto cancel;
-		if(rv == -1) {
+		if (rv == -1) {
 			up(&mdev->md_io_mutex);
 			return 0;
 		}
@@ -484,9 +484,9 @@
 			pos = be32_to_cpu(buffer->updates[j].pos);
 			extent_nr = be32_to_cpu(buffer->updates[j].extent);
 
-			if(extent_nr == LC_FREE) continue;
+			if (extent_nr == LC_FREE) continue;
 
-		       //if(j<3) INFO("T%03d S%03d=E%06d\n",trn,pos,extent_nr);
+		       //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++;
 		}
@@ -495,14 +495,14 @@
 		transactions++;
 
 	cancel:
-		if( i == to) break;
+		if (i == to) break;
 		i++;
-		if( i > mx ) i=0;
+		if (i > mx) i=0;
 	}
 
 	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;
 	}
 
@@ -539,14 +539,14 @@
 	}
 
 	drbd_chk_io_error(mdev,error,TRUE);
-	if(error && wc->error == 0) wc->error=error;
+	if (error && wc->error == 0) wc->error=error;
 
 	if (atomic_dec_and_test(&wc->count)) {
 		complete(&wc->io_done);
 	}
 
 	page = bio->bi_io_vec[0].bv_page;
-	if(page) put_page(page);
+	if (page) put_page(page);
 	bio_put(bio);
 	mdev->bm_writ_cnt++;
 	dec_local(mdev);
@@ -572,22 +572,22 @@
 
 	// 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;
+		if (bio->bi_sector == on_disk_sector) return 0;
 		i++;
 	}
 
 	bio = bio_alloc(GFP_KERNEL, 1);
-	if(bio==NULL) return -ENOMEM;
+	if (bio==NULL) return -ENOMEM;
 
 	bio->bi_bdev = mdev->bc->md_bdev;
 	bio->bi_sector = on_disk_sector;
 
 	bios[i] = bio;
 
-	if(*page_offset == PAGE_SIZE) {
+	if (*page_offset == PAGE_SIZE) {
 		np = alloc_page(__GFP_HIGHMEM);
 		/* no memory leak, bio gets cleaned up by caller */
-		if(np == NULL) return -ENOMEM;
+		if (np == NULL) return -ENOMEM;
 		*page = np;
 		*page_offset = 0;
 		allocated_page=1;
@@ -599,12 +599,12 @@
 			 kmap(*page) + *page_offset );
 	kunmap(*page);
 
-	if(bio_add_page(bio, *page, MD_HARDSECT, *page_offset)!=MD_HARDSECT) {
+	if (bio_add_page(bio, *page, MD_HARDSECT, *page_offset)!=MD_HARDSECT) {
 		/* no memory leak, page gets cleaned up by caller */
 		return -EINVAL;
 	}
 
-	if(!allocated_page) get_page(*page);
+	if (!allocated_page) get_page(*page);
 
 	*page_offset += MD_HARDSECT;
 
@@ -644,7 +644,7 @@
 	nr_elements = mdev->act_log->nr_elements;
 
 	bios = kzalloc(sizeof(struct bio*) * nr_elements, GFP_KERNEL);
-	if(!bios) goto submit_one_by_one;
+	if (!bios) goto submit_one_by_one;
 
 	atomic_set(&wc.count,0);
 	init_completion(&wc.io_done);
@@ -653,9 +653,9 @@
 
 	for(i=0;i<nr_elements;i++) {
 		enr = lc_entry(mdev->act_log,i)->lc_number;
-		if(enr == LC_FREE) continue;
+		if (enr == LC_FREE) continue;
 		/* next statement also does atomic_inc wc.count */
-		if(atodb_prepare_unless_covered(mdev,bios,&page,
+		if (atodb_prepare_unless_covered(mdev,bios,&page,
 						&page_offset,
 						enr/AL_EXT_PER_BM_SECT,
 						&wc))
@@ -685,19 +685,19 @@
 	//
 	// 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);
+	// Therefore this if () ...
+	if (atomic_read(&wc.count)) wait_for_completion(&wc.io_done);
 
 	dec_local(mdev);
 
-	if(wc.error) drbd_io_error(mdev, TRUE);
+	if (wc.error) drbd_io_error(mdev, TRUE);
 	kfree(bios);
 	return;
 
  free_bios_submit_one_by_one:
 	// free everything by calling the endio callback directly.
 	for(i=0;i<nr_elements;i++) {
-		if(bios[i]==NULL) break;
+		if (bios[i]==NULL) break;
 		bios[i]->bi_size=0;
 		atodb_endio(bios[i], MD_HARDSECT, 0);
 	}
@@ -708,7 +708,7 @@
 
 	for(i=0;i<mdev->act_log->nr_elements;i++) {
 		enr = lc_entry(mdev->act_log,i)->lc_number;
-		if(enr == LC_FREE) continue;
+		if (enr == LC_FREE) continue;
 		/* Really slow: if we have al-extents 16..19 active,
 		 * sector 4 will be written four times! Synchronous! */
 		drbd_bm_write_sect(mdev, enr/AL_EXT_PER_BM_SECT );
@@ -734,7 +734,7 @@
 
 	for(i=0;i<mdev->act_log->nr_elements;i++) {
 		enr = lc_entry(mdev->act_log,i)->lc_number;
-		if(enr == LC_FREE) continue;
+		if (enr == LC_FREE) continue;
 		add += drbd_bm_ALe_set_all(mdev, enr);
 	}
 
@@ -751,10 +751,10 @@
 
 	spin_lock_irq(&mdev->al_lock);
 	rv = (al_ext->refcnt == 0);
-	if(likely(rv)) lc_del(mdev->act_log,al_ext);
+	if (likely(rv)) lc_del(mdev->act_log,al_ext);
 	spin_unlock_irq(&mdev->al_lock);
 
-	if(unlikely(!rv)) INFO("Waiting for extent in drbd_al_shrink()\n");
+	if (unlikely(!rv)) INFO("Waiting for extent in drbd_al_shrink()\n");
 
 	return rv;
 }
@@ -773,7 +773,7 @@
 
 	for(i=0;i<mdev->act_log->nr_elements;i++) {
 		al_ext = lc_entry(mdev->act_log,i);
-		if(al_ext->lc_number == LC_FREE) continue;
+		if (al_ext->lc_number == LC_FREE) continue;
 		wait_event(mdev->al_wait, _try_lc_del(mdev,al_ext));
 	}
 
@@ -784,7 +784,7 @@
 {
 	struct update_odbm_work *udw = (struct update_odbm_work*)w;
 
-	if( !inc_local_if_state(mdev,Attaching) ) {
+	if ( !inc_local_if_state(mdev,Attaching) ) {
 		if (DRBD_ratelimit(5*HZ,5))
 			WARN("Can not update on disk bitmap, local IO disabled.\n");
 		return 1;
@@ -795,7 +795,7 @@
 
 	kfree(udw);
 
-	if(drbd_bm_total_weight(mdev) <= mdev->rs_failed &&
+	if (drbd_bm_total_weight(mdev) <= mdev->rs_failed &&
 	   ( mdev->state.conn == SyncSource || mdev->state.conn == SyncTarget ||
 	     mdev->state.conn == PausedSyncS || mdev->state.conn == PausedSyncT ) ) {
 		drbd_bm_lock(mdev);
@@ -831,7 +831,7 @@
 
 	ext = (struct bm_extent *) lc_get(mdev->resync,enr);
 	if (ext) {
-		if( ext->lce.lc_number == enr) {
+		if (ext->lce.lc_number == enr) {
 			if (success)
 				ext->rs_left -= count;
 			else
@@ -860,7 +860,7 @@
 				     ext->flags, enr, rs_left);
 				ext->flags = 0;
 			}
-			if( ext->rs_failed ) {
+			if (ext->rs_failed) {
 				WARN("Kicking resync_lru element enr=%u "
 				     "out with rs_failed=%d\n",
 				     ext->lce.lc_number, ext->rs_failed);
@@ -877,7 +877,7 @@
 			ext->rs_failed = 0;
 
 			udw=kmalloc(sizeof(*udw),GFP_ATOMIC);
-			if(udw) {
+			if (udw) {
 				udw->enr = ext->lce.lc_number;
 				udw->w.cb = w_update_odbm;
 				drbd_queue_work_front(&mdev->data.work,&udw->w);
@@ -952,16 +952,16 @@
 	}
 	if (count) {
 		// we need the lock for drbd_try_clear_on_disk_bm
-		if(jiffies - mdev->rs_mark_time > HZ*10) {
+		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) &&
+			if ( mdev->rs_mark_left != drbd_bm_total_weight(mdev) &&
 			    mdev->state.conn != PausedSyncT &&
 			    mdev->state.conn != PausedSyncS ) {
 				mdev->rs_mark_time =jiffies;
 				mdev->rs_mark_left =drbd_bm_total_weight(mdev);
 			}
 		}
-		if( inc_local_if_state(mdev,Attaching) ) {
+		if ( inc_local_if_state(mdev,Attaching) ) {
 			drbd_try_clear_on_disk_bm(mdev,sector,count,TRUE);
 			dec_local(mdev);
 		}
@@ -970,7 +970,7 @@
 		wake_up=1;
 	}
 	spin_unlock_irqrestore(&mdev->al_lock,flags);
-	if(wake_up) wake_up(&mdev->al_wait);
+	if (wake_up) wake_up(&mdev->al_wait);
 }
 
 /*
@@ -990,7 +990,7 @@
 	unsigned int enr;
 	struct bm_extent* ext;
 
-	if(inc_local(mdev)) {
+	if (inc_local(mdev)) {
 		enr = BM_SECT_TO_EXT(sector);
 		spin_lock_irqsave(&mdev->al_lock,flags);
 		ext = (struct bm_extent *) lc_find(mdev->resync,enr);
@@ -1078,17 +1078,17 @@
 	int rv=0;
 
 	spin_lock_irq(&mdev->al_lock);
-	if(unlikely(enr == mdev->act_log->new_number)) rv=1;
+	if (unlikely(enr == mdev->act_log->new_number)) rv=1;
 	else {
 		al_ext = lc_find(mdev->act_log,enr);
-		if(al_ext) {
+		if (al_ext) {
 			if (al_ext->refcnt) rv=1;
 		}
 	}
 	spin_unlock_irq(&mdev->al_lock);
 
 	/*
-	if(unlikely(rv)) {
+	if (unlikely(rv)) {
 		INFO("Delaying sync read until app's write is done\n");
 	}
 	*/
@@ -1120,14 +1120,14 @@
 			(bm_ext = _bme_get(mdev,enr)) );
 	if (sig) return 0;
 
-	if(test_bit(BME_LOCKED,&bm_ext->flags)) return 1;
+	if (test_bit(BME_LOCKED,&bm_ext->flags)) return 1;
 
 	for(i=0;i<AL_EXT_PER_BM_SECT;i++) {
 		sig = wait_event_interruptible( mdev->al_wait,
 				!_is_in_al(mdev,enr*AL_EXT_PER_BM_SECT+i) );
 		if (sig) {
 			spin_lock_irq(&mdev->al_lock);
-			if( lc_put(mdev->resync,&bm_ext->lce) == 0 ) {
+			if ( lc_put(mdev->resync,&bm_ext->lce) == 0 ) {
 				clear_bit(BME_NO_WRITES,&bm_ext->flags);
 				mdev->resync_locked--;
 				wake_up(&mdev->al_wait);
@@ -1279,20 +1279,20 @@
 
 	spin_lock_irqsave(&mdev->al_lock,flags);
 	bm_ext = (struct bm_extent*) lc_find(mdev->resync,enr);
-	if(!bm_ext) {
+	if (!bm_ext) {
 		spin_unlock_irqrestore(&mdev->al_lock,flags);
 		ERR("drbd_rs_complete_io() called, but extent not found\n");
 		return;
 	}
 
-	if(bm_ext->lce.refcnt == 0) {
+	if (bm_ext->lce.refcnt == 0) {
 		spin_unlock_irqrestore(&mdev->al_lock,flags);
 		ERR("drbd_rs_complete_io(,%llu [=%u]) called, but refcnt is 0!?\n",
 		    (unsigned long long)sector, enr);
 		return;
 	}
 
-	if( lc_put(mdev->resync,(struct lc_element *)bm_ext) == 0 ) {
+	if ( lc_put(mdev->resync,(struct lc_element *)bm_ext) == 0 ) {
 		clear_bit(BME_LOCKED,&bm_ext->flags);
 		clear_bit(BME_NO_WRITES,&bm_ext->flags);
 		mdev->resync_locked--;
@@ -1317,10 +1317,10 @@
 
 	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)) { // Makes sure ->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;
+			if (bm_ext->lce.lc_number == LC_FREE) continue;
 			bm_ext->lce.refcnt = 0; // Rude but ok.
 			bm_ext->rs_left = 0;
 			clear_bit(BME_LOCKED,&bm_ext->flags);
@@ -1353,10 +1353,10 @@
 
 	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)) { // Makes sure ->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;
+			if (bm_ext->lce.lc_number == LC_FREE) continue;
 			if (bm_ext->lce.lc_number == mdev->resync_wenr) {
 				INFO("dropping %u in drbd_rs_del_all, "
 				     "aparently got 'synced' by application io\n",
@@ -1367,7 +1367,7 @@
 				mdev->resync_wenr = LC_FREE;
 				lc_put(mdev->resync,&bm_ext->lce);
 			}
-			if(bm_ext->lce.refcnt != 0) {
+			if (bm_ext->lce.refcnt != 0) {
 				INFO("Retrying drbd_rs_del_all() later. "
 				     "refcnt=%d\n",bm_ext->lce.refcnt);
 				dec_local(mdev);
@@ -1443,7 +1443,7 @@
 	if (count) {
 		mdev->rs_failed += count;
 
-		if( inc_local_if_state(mdev,Attaching) ) {
+		if ( inc_local_if_state(mdev,Attaching) ) {
 			drbd_try_clear_on_disk_bm(mdev,sector,count,FALSE);
 			dec_local(mdev);
 		}
@@ -1453,5 +1453,5 @@
 		wake_up=1;
 	}
 	spin_unlock_irq(&mdev->al_lock);
-	if(wake_up) wake_up(&mdev->al_wait);
+	if (wake_up) wake_up(&mdev->al_wait);
 }

Modified: branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 08:47:36 UTC (rev 2983)
+++ branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 09:44:10 UTC (rev 2984)
@@ -212,7 +212,7 @@
 	INFO("bm[%d]=0x%lX\n", w, b->bm[w]);
 	w++;
 
-	if ( w < b->bm_words ) {
+	if (w < b->bm_words) {
 		D_ASSERT(w == b->bm_words -1);
 		INFO("bm[%d]=0x%lX\n",w,b->bm[w]);
 	}
@@ -288,12 +288,12 @@
 	size_t w = b->bm_bits >> LN2_BPL;
 	int cleared=0;
 
-	if ( w < b->bm_words ) {
+	if (w < b->bm_words) {
 		cleared = hweight_long(b->bm[w] & ~mask);
 		b->bm[w++] &= mask;
 	}
 
-	if ( w < b->bm_words ) {
+	if (w < b->bm_words) {
 		cleared += hweight_long(b->bm[w]);
 		b->bm[w++]=0;
 	}
@@ -306,11 +306,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);
 	}
 }
@@ -340,7 +340,7 @@
 
 	spin_lock_irqsave(&b->bm_lock,flags);
 	bits = bm_count_bits(b,0);
-	if(bits != b->bm_set) {
+	if (bits != b->bm_set) {
 		ERR("bm_set was %lu, corrected to %lu. %s:%d\n",
 		    b->bm_set,bits,file,line);
 		b->bm_set = bits;
@@ -400,7 +400,7 @@
 
 		D_ASSERT((u64)bits <= (((u64)mdev->bc->md.md_size_sect-MD_BM_OFFSET) << 12));
 
-		if ( words == b->bm_words ) {
+		if (words == b->bm_words) {
 			/* optimize: capacity has changed,
 			 * but only within one long word worth of bits.
 			 * just update the bm_dev_capacity and bm_bits members.
@@ -444,7 +444,7 @@
 		b->bm_words = words;
 		b->bm_dev_capacity = capacity;
 		bm_clear_surplus(b);
-		if( !growing ) b->bm_set = bm_count_bits(b,0);
+		if (!growing) b->bm_set = bm_count_bits(b,0);
 		bm_end_info(mdev, __FUNCTION__ );
 		spin_unlock_irq(&b->bm_lock);
 		INFO("resync bitmap: bits=%lu words=%lu\n",bits,words);
@@ -699,7 +699,7 @@
 	// MUST_BE_LOCKED(); not neccessarily global ...
 
 	down(&mdev->md_io_mutex);
-	if(drbd_md_sync_page_io(mdev,mdev->bc,on_disk_sector,READ)) {
+	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
 		num_words = min(S2W(1), bm_words - offset);
@@ -783,7 +783,7 @@
 	 */
 	mdev->bitmap = NULL;
 
-	if(rw == WRITE)	bm_cpu_to_lel(b);
+	if (rw == WRITE)	bm_cpu_to_lel(b);
 
 	now = jiffies;
 	atomic_set(&b->bm_async_io, num_pages);
@@ -807,7 +807,7 @@
 	}
 
 	now = jiffies;
-	if(rw == WRITE) {
+	if (rw == WRITE) {
 		bm_lel_to_cpu(b);
 	} else /* rw == READ */ {
 		/* just read, if neccessary adjust endianness */

Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 08:47:36 UTC (rev 2983)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 09:44:10 UTC (rev 2984)
@@ -236,7 +236,7 @@
 #define RECALC_SIGPENDING()        recalc_sigpending();
 
 #if defined(DBG_SPINLOCKS) && defined(__SMP__)
-# define MUST_HOLD(lock) if(!spin_is_locked(lock)) { ERR("Not holding lock! in %s\n", __FUNCTION__ ); }
+# define MUST_HOLD(lock) if (!spin_is_locked(lock)) { ERR("Not holding lock! in %s\n", __FUNCTION__ ); }
 #else
 # define MUST_HOLD(lock)
 #endif
@@ -1501,7 +1501,7 @@
 
 static inline int semaphore_is_locked(struct semaphore* s)
 {
-	if(!down_trylock(s)) {
+	if (!down_trylock(s)) {
 		up(s);
 		return 0;
 	}
@@ -1609,7 +1609,7 @@
 }
 
 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);
 	}
 }
@@ -1681,14 +1681,14 @@
 }
 
 #define ERR_IF_CNT_IS_NEGATIVE(which)				\
-	if(atomic_read(&mdev->which)<0)				\
+	if (atomic_read(&mdev->which)<0)				\
 		ERR("in %s:%d: " #which " = %d < 0 !\n",	\
 		    __func__ , __LINE__ ,			\
 		    atomic_read(&mdev->which))
 
 #define dec_ap_pending(mdev)	do {				\
 	typecheck(drbd_dev*,mdev);				\
-	if(atomic_dec_and_test(&mdev->ap_pending_cnt))		\
+	if (atomic_dec_and_test(&mdev->ap_pending_cnt))		\
 		wake_up(&mdev->misc_wait);			\
 	ERR_IF_CNT_IS_NEGATIVE(ap_pending_cnt); } while (0)
 
@@ -1735,7 +1735,7 @@
 
 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);
 	}
 }
@@ -1750,7 +1750,7 @@
 
 	atomic_inc(&mdev->net_cnt);
 	have_net_conf = mdev->state.conn >= Unconnected;
-	if(!have_net_conf) dec_net(mdev);
+	if (!have_net_conf) dec_net(mdev);
 	return have_net_conf;
 }
 
@@ -1762,7 +1762,7 @@
 
 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);
@@ -1777,7 +1777,7 @@
 
 	atomic_inc(&mdev->local_cnt);
 	io_allowed = (mdev->state.disk >= mins );
-	if( !io_allowed ) {
+	if (!io_allowed) {
 		dec_local(mdev);
 	}
 	return io_allowed;
@@ -1793,7 +1793,7 @@
 static inline int drbd_get_max_buffers(drbd_dev* mdev)
 {
 	int mxb = 1000000; /* arbitrary limit on open requests */
-	if(inc_net(mdev)) {
+	if (inc_net(mdev)) {
 		mxb = mdev->net_conf->max_buffers;
 		dec_net(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 08:47:36 UTC (rev 2983)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 09:44:10 UTC (rev 2984)
@@ -159,7 +159,7 @@
 	struct drbd_barrier *b;
 
 	b=kmalloc(sizeof(struct drbd_barrier),GFP_KERNEL);
-	if(!b) return 0;
+	if (!b) return 0;
 	INIT_LIST_HEAD(&b->requests);
 	INIT_LIST_HEAD(&b->w.list);
 	b->next=0;
@@ -179,7 +179,7 @@
 {
 	D_ASSERT(mdev->oldest_barrier == mdev->newest_barrier);
 	kfree(mdev->oldest_barrier);
-	if(mdev->tl_hash) {
+	if (mdev->tl_hash) {
 		kfree(mdev->tl_hash);
 		mdev->tl_hash_s = 0;
 	}
@@ -241,11 +241,11 @@
 	D_ASSERT(b->n_req == set_size);
 
 #if 1
-	if(b->br_number != barrier_nr) {
+	if (b->br_number != barrier_nr) {
 		DUMPI(b->br_number);
 		DUMPI(barrier_nr);
 	}
-	if(b->n_req != set_size) {
+	if (b->n_req != set_size) {
 		DUMPI(b->n_req);
 		DUMPI(set_size);
 	}
@@ -319,22 +319,22 @@
 	int send,ok=1;
 
 	eh = PassOn;
-	if(inc_local_if_state(mdev,Failed)) {
+	if (inc_local_if_state(mdev,Failed)) {
 		eh = mdev->bc->dc.on_io_error;
 		dec_local(mdev);
 	}
 
-	if(!forcedetach && eh == PassOn)
+	if (!forcedetach && eh == PassOn)
 		return 1;
 
 	spin_lock_irqsave(&mdev->req_lock,flags);
-	if( (send = (mdev->state.disk == Failed)) ) {
+	if ( (send = (mdev->state.disk == Failed)) ) {
 		_drbd_set_state(_NS(mdev,disk,Diskless),
 				ChgStateHard|ScheduleAfter);
 	}
 	spin_unlock_irqrestore(&mdev->req_lock,flags);
 
-	if(!send) return ok;
+	if (!send) return ok;
 
 	ok = drbd_send_state(mdev);
 	if (ok) WARN("Notified peer that my disk is broken.\n");
@@ -349,7 +349,7 @@
 
 	/* Releasing the backing device is done in after_state_ch() */
 
-	if(eh == CallIOEHelper) {
+	if (eh == CallIOEHelper) {
 		drbd_khelper(mdev,"local-io-error");
 	}
 
@@ -404,22 +404,22 @@
 	unsigned long flags;
 	int rv;
 
-	if(test_and_clear_bit(CL_ST_CHG_SUCCESS,&mdev->flags))
+	if (test_and_clear_bit(CL_ST_CHG_SUCCESS,&mdev->flags))
 		return SS_CW_Success;
 
-	if(test_and_clear_bit(CL_ST_CHG_FAIL,&mdev->flags))
+	if (test_and_clear_bit(CL_ST_CHG_FAIL,&mdev->flags))
 		return SS_CW_FailedByPeer;
 
 	rv=0;
 	spin_lock_irqsave(&mdev->req_lock,flags);
 	os = mdev->state;
 	ns.i = (os.i & ~mask.i) | val.i;
-	if( !cl_wide_st_chg(mdev,os,ns) ) rv = SS_CW_NoNeed;
-	if( !rv ) {
+	if ( !cl_wide_st_chg(mdev,os,ns) ) rv = SS_CW_NoNeed;
+	if (!rv) {
 		rv = is_valid_state(mdev,ns);
-		if(rv==SS_Success) {
+		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);
@@ -444,30 +444,30 @@
 	os = mdev->state;
 	ns.i = (os.i & ~mask.i) | val.i;
 
-	if(cl_wide_st_chg(mdev,os,ns)) {
+	if (cl_wide_st_chg(mdev,os,ns)) {
 		rv = is_valid_state(mdev,ns);
-		if(rv == SS_Success ) rv = is_valid_state_transition(mdev,ns,os);
+		if (rv == SS_Success) rv = is_valid_state_transition(mdev,ns,os);
 		spin_unlock_irqrestore(&mdev->req_lock,flags);
 
-		if( rv < SS_Success ) {
-			if( f & ChgStateVerbose ) print_st_err(mdev,os,ns,rv);
+		if (rv < SS_Success) {
+			if (f & ChgStateVerbose) print_st_err(mdev,os,ns,rv);
 			return rv;
 		}
 
 		drbd_state_lock(mdev);
-		if( !drbd_send_state_req(mdev,mask,val) ) {
+		if ( !drbd_send_state_req(mdev,mask,val) ) {
 			drbd_state_unlock(mdev);
 			rv = SS_CW_FailedByPeer;
-			if( f & ChgStateVerbose ) print_st_err(mdev,os,ns,rv);
+			if (f & ChgStateVerbose) print_st_err(mdev,os,ns,rv);
 			return rv;
 		}
 
 		wait_event(mdev->state_wait,(rv=_req_st_cond(mdev,mask,val)));
 
-		if( rv < SS_Success ) {
+		if (rv < SS_Success) {
 			// nearly dead code.
 			drbd_state_unlock(mdev);
-			if( f & ChgStateVerbose ) print_st_err(mdev,os,ns,rv);
+			if (f & ChgStateVerbose) print_st_err(mdev,os,ns,rv);
 			return rv;
 		}
 		spin_lock_irqsave(&mdev->req_lock,flags);
@@ -519,7 +519,7 @@
 #define user_isps_to_name(A) ( (A) ? "1" : "0" )
 
 #define PSC(A) \
-	({ if( ns.A != os.A ) { \
+	({ if (ns.A != os.A) { \
 		pbp += sprintf(pbp, #A "( %s -> %s ) ", \
 		              A##s_to_name(os.A), \
 		              A##s_to_name(ns.A)); \
@@ -533,41 +533,41 @@
 	int rv=SS_Success;
 
 	fp = DontCare;
-	if(inc_local(mdev)) {
+	if (inc_local(mdev)) {
 		fp = mdev->bc->dc.fencing;
 		dec_local(mdev);
 	}
 
-	if(inc_net(mdev)) {
-		if( !mdev->net_conf->two_primaries &&
+	if (inc_net(mdev)) {
+		if ( !mdev->net_conf->two_primaries &&
 		    ns.role == Primary && ns.peer == Primary )
 			rv=SS_TwoPrimaries;
 		dec_net(mdev);
 	}
 
-	if( rv <= 0 ) /* already found a reason to abort */;
-	else if( ns.role == Secondary && mdev->open_cnt )
+	if (rv <= 0) /* already found a reason to abort */;
+	else if (ns.role == Secondary && mdev->open_cnt)
 		rv=SS_DeviceInUse;
 
-	else if( ns.role == Primary && ns.conn < Connected &&
+	else if ( ns.role == Primary && ns.conn < Connected &&
 		 ns.disk < UpToDate ) rv=SS_NoUpToDateDisk;
 
-	else if( fp >= Resource &&
+	else if ( fp >= Resource &&
 		 ns.role == Primary && ns.conn < Connected &&
 		 ns.pdsk >= DUnknown ) rv=SS_PrimaryNOP;
 
-	else if( ns.role == Primary && ns.disk <= Inconsistent &&
+	else if ( ns.role == Primary && ns.disk <= Inconsistent &&
 		 ns.pdsk <= Inconsistent ) rv=SS_NoUpToDateDisk;
 
-	else if( ns.conn > Connected &&
+	else if ( ns.conn > Connected &&
 		 ns.disk < UpToDate && ns.pdsk < UpToDate )
 		rv=SS_BothInconsistent;
 
-	else if( ns.conn > Connected &&
+	else if ( ns.conn > Connected &&
 		 (ns.disk == Diskless || ns.pdsk == Diskless ) )
 		rv=SS_SyncingDiskless;
 
-	else if( (ns.conn == Connected ||
+	else if ( (ns.conn == Connected ||
 		  ns.conn == WFBitMapS ||
 		  ns.conn == SyncSource ||
 		  ns.conn == PausedSyncS) &&
@@ -580,13 +580,13 @@
 {
 	int rv=SS_Success;
 
-	if( (ns.conn == StartingSyncT || ns.conn == StartingSyncS ) &&
+	if ( (ns.conn == StartingSyncT || ns.conn == StartingSyncS ) &&
 	    os.conn > Connected) rv=SS_ResyncRunning;
 
-	if( ns.conn == Disconnecting && os.conn == StandAlone)
+	if (ns.conn == Disconnecting && os.conn == StandAlone)
 		rv=SS_AlreadyStandAlone;
 
-	if( ns.disk > Attaching && os.disk == Diskless)
+	if (ns.disk > Attaching && os.disk == Diskless)
 		rv=SS_IsDiskLess;
 
 	return rv;
@@ -603,49 +603,49 @@
 	os = mdev->state;
 
 	fp = DontCare;
-	if(inc_local(mdev)) {
+	if (inc_local(mdev)) {
 		fp = mdev->bc->dc.fencing;
 		dec_local(mdev);
 	}
 
 	/* Early state sanitising. Dissalow the invalidate ioctl to connect  */
-	if( (ns.conn == StartingSyncS || ns.conn == StartingSyncT) &&
+	if ( (ns.conn == StartingSyncS || ns.conn == StartingSyncT) &&
 		os.conn < Connected ) {
 		ns.conn = os.conn;
 		ns.pdsk = os.pdsk;
 	}
 
 	/* Dissalow Network errors to configure a device's network part */
-	if( (ns.conn >= Timeout && ns.conn <= TearDown ) &&
+	if ( (ns.conn >= Timeout && ns.conn <= TearDown ) &&
 	    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)
+	if ( ( (os.conn >= Timeout && os.conn <= TearDown)
 	      || os.conn == Disconnecting ) &&
 	    ns.conn >= Timeout && ns.conn <= TearDown ) {
 		ns.conn = os.conn;
 	}
 
-	if( ns.conn < Connected ) {
+	if (ns.conn < Connected) {
 		ns.peer_isp = 0;
 		ns.peer = Unknown;
 		if ( ns.pdsk > DUnknown ||
 		     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 )) {
+	if ( ns.conn > Connected && (ns.disk <= Failed || ns.pdsk <= Failed )) {
 		warn_sync_abort=1;
 		ns.conn = Connected;
 	}
 
-	if( ns.conn >= Connected &&
+	if ( ns.conn >= Connected &&
 	    ( ns.disk == Consistent || ns.disk == Outdated ) ) {
 		switch(ns.conn) {
 		case WFBitMapT:
@@ -663,12 +663,12 @@
 			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 &&
+	if ( ns.conn >= Connected &&
 	    ( ns.pdsk == Consistent || ns.pdsk == Outdated ) ) {
 		switch(ns.conn) {
 		case Connected:
@@ -686,45 +686,45 @@
 			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" */
-	if (ns.conn < Connected && ns.disk == Negotiating ) {
+	if (ns.conn < Connected && ns.disk == Negotiating) {
 		ns.disk = mdev->new_state_tmp.disk;
 		ns.pdsk = mdev->new_state_tmp.pdsk;
 	}
 
-	if( fp == Stonith ) {
-		if(ns.role == Primary &&
+	if (fp == Stonith) {
+		if (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;
-		if(ns.conn == SyncTarget) ns.conn=PausedSyncT;
+	if (ns.aftr_isp || ns.peer_isp || ns.user_isp) {
+		if (ns.conn == SyncSource) ns.conn=PausedSyncS;
+		if (ns.conn == SyncTarget) ns.conn=PausedSyncT;
 	} else {
-		if(ns.conn == PausedSyncS) ns.conn=SyncSource;
-		if(ns.conn == PausedSyncT) ns.conn=SyncTarget;
+		if (ns.conn == PausedSyncS) ns.conn=SyncSource;
+		if (ns.conn == PausedSyncT) ns.conn=SyncTarget;
 	}
 
-	if( ns.i == os.i ) return SS_NothingToDo;
+	if (ns.i == os.i) return SS_NothingToDo;
 
-	if( !(flags & ChgStateHard) ) {
+	if ( !(flags & ChgStateHard) ) {
 		/*  pre-state-change checks ; only look at ns  */
 		/* See drbd_state_sw_errors in drbd_strings.c */
 
 		rv = is_valid_state(mdev,ns);
-		if(rv < SS_Success) {
+		if (rv < SS_Success) {
 			/* If the old state was illegal as well, then let
 			   this happen...*/
 
-			if( is_valid_state(mdev,os) == rv ) {
+			if ( is_valid_state(mdev,os) == rv ) {
 				ERR("Forcing state change from bad state. "
 				    "Error would be: '%s'\n",
 				    set_st_err_name(rv));
@@ -735,12 +735,12 @@
 		} else rv = is_valid_state_transition(mdev,ns,os);
 	}
 
-	if(rv < SS_Success) {
-		if( flags & ChgStateVerbose ) print_st_err(mdev,os,ns,rv);
+	if (rv < SS_Success) {
+		if (flags & ChgStateVerbose) print_st_err(mdev,os,ns,rv);
 		return rv;
 	}
 
-	if(warn_sync_abort) {
+	if (warn_sync_abort) {
 		WARN("Resync aborted.\n");
 	}
 
@@ -767,27 +767,27 @@
 	wake_up(&mdev->state_wait);
 
 	/**   post-state-change actions   **/
-	if ( os.conn >= SyncSource   && ns.conn <= Connected ) {
+	if (os.conn >= SyncSource   && ns.conn <= Connected) {
 		set_bit(STOP_SYNC_TIMER,&mdev->flags);
 		mod_timer(&mdev->resync_timer,jiffies);
 	}
 
-	if( (os.conn == PausedSyncT || os.conn == PausedSyncS) &&
+	if ( (os.conn == PausedSyncT || os.conn == PausedSyncS) &&
 	    (ns.conn == SyncTarget  || ns.conn == SyncSource) ) {
 		INFO("Syncer continues.\n");
 		mdev->rs_paused += (long)jiffies-(long)mdev->rs_mark_time;
-		if( ns.conn == SyncTarget ) {
+		if (ns.conn == SyncTarget) {
 			D_ASSERT(!test_bit(STOP_SYNC_TIMER,&mdev->flags));
 			clear_bit(STOP_SYNC_TIMER,&mdev->flags);
 			mod_timer(&mdev->resync_timer,jiffies);
 		}
 	}
 
-	if( (os.conn == SyncTarget  || os.conn == SyncSource) &&
+	if ( (os.conn == SyncTarget  || os.conn == SyncSource) &&
 	    (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);
 		}
 	}
@@ -799,11 +799,11 @@
 		D_ASSERT(i);
 	}
 
-	if( flags & ScheduleAfter ) {
+	if (flags & ScheduleAfter) {
 		struct after_state_chg_work* ascw;
 
 		ascw = kmalloc(sizeof(*ascw), GFP_ATOMIC);
-		if(ascw) {
+		if (ascw) {
 			ascw->os = os;
 			ascw->ns = ns;
 			ascw->flags = flags;
@@ -836,13 +836,13 @@
 
 	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;
-	if(inc_local(mdev)) {
+	if (inc_local(mdev)) {
 		fp = mdev->bc->dc.fencing;
 
 		mdf = mdev->bc->md.flags & ~(MDF_Consistent|MDF_PrimaryInd|
@@ -858,7 +858,7 @@
 		if (mdev->state.disk > Outdated)       mdf |= MDF_WasUpToDate;
 		if (mdev->state.pdsk <= Outdated &&
 		    mdev->state.pdsk >= Inconsistent)  mdf |= MDF_PeerOutDated;
-		if( mdf != mdev->bc->md.flags) {
+		if (mdf != mdev->bc->md.flags) {
 			mdev->bc->md.flags = mdf;
 			drbd_md_mark_dirty(mdev);
 		}
@@ -871,7 +871,7 @@
 	/* Here we have the actions that are performed after a
 	   state change. This function might sleep */
 
-	if( fp == Stonith && ns.susp ) {
+	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
@@ -900,16 +900,16 @@
 	/* Lost contact to peer's copy of the data */
 	if ( (os.pdsk>=Inconsistent && os.pdsk!=DUnknown && os.pdsk!=Outdated) &&
 	     (ns.pdsk<Inconsistent || ns.pdsk==DUnknown || ns.pdsk==Outdated) ) {
-		if ( mdev->p_uuid ) {
+		if (mdev->p_uuid) {
 			kfree(mdev->p_uuid);
 			mdev->p_uuid = NULL;
 		}
 		if (inc_local(mdev)) {
-			if (ns.role == Primary && mdev->bc->md.uuid[Bitmap] == 0 ) {
+			if (ns.role == Primary && mdev->bc->md.uuid[Bitmap] == 0) {
 				/* Only do it if we have not yet done it... */
 				drbd_uuid_new_current(mdev);
 			}
-			if (ns.peer == Primary ) {
+			if (ns.peer == Primary) {
 				/* Note: The condition ns.peer == Primary implies
 				   that we are connected. Otherwise it would
 				   be ns.peer == Unknown. */
@@ -925,13 +925,13 @@
 		}
 	}
 
-	if( ns.pdsk < Inconsistent ) {
+	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);
 		}
 	}
@@ -1001,7 +1001,7 @@
 		drbd_bm_unlock(mdev);
 	}
 
-	if ( os.disk > Diskless && ns.disk == Diskless ) {
+	if (os.disk > Diskless && ns.disk == Diskless) {
 		/* since inc_local() only works as long as disk>=Inconsistent,
 		   and it is Diskless here, local_cnt can only go down, it can
 		   not increase... It will reach zero */
@@ -1020,12 +1020,12 @@
 	}
 
 	// 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);
 	}
 
@@ -1035,13 +1035,13 @@
 		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);
 		}
 	}
@@ -1076,7 +1076,7 @@
 
 	while(1) {
 		retval = thi->function(thi);
-		if(get_t_state(thi) != Restarting) break;
+		if (get_t_state(thi) != Restarting) break;
 		thi->t_state = Running;
 	}
 
@@ -1151,7 +1151,7 @@
 
 	if (thi->t_state == None) {
 		spin_unlock(&thi->t_lock);
-		if(restart) drbd_thread_start(thi);
+		if (restart) drbd_thread_start(thi);
 		return;
 	}
 
@@ -1164,7 +1164,7 @@
 		thi->t_state = ns;
 		smp_mb();
 		if (thi->task != current) {
-			if(wait) init_completion(&thi->startstop);
+			if (wait) init_completion(&thi->startstop);
 			force_sig(DRBD_SIGKILL,thi->task);
 		} else D_ASSERT(!wait);
 	}
@@ -1214,7 +1214,7 @@
 	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);
 	}
@@ -1304,7 +1304,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 ? */
@@ -1342,7 +1342,7 @@
 	int q_order_type;
 	int ok;
 
-	if(inc_local_if_state(mdev,Negotiating)) {
+	if (inc_local_if_state(mdev,Negotiating)) {
 		D_ASSERT(mdev->bc->backing_bdev);
 		d_size = drbd_get_max_capacity(mdev->bc);
 		u_size = mdev->bc->dc.disk_size;
@@ -1552,7 +1552,7 @@
 		return TRUE;
 
 	drop_it = !--mdev->ko_count;
-	if ( !drop_it ) {
+	if (!drop_it) {
 		ERR("[%s/%d] sock_sendmsg time expired, ko = %u\n",
 		       current->comm, current->pid, mdev->ko_count);
 		request_ping(mdev);
@@ -1697,13 +1697,13 @@
 	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 &&
+	if (mdev->state.conn >= SyncSource &&
 	   mdev->state.conn <= PausedSyncT) {
 		dp_flags |= DP_MAY_SET_IN_SYNC;
 	}
@@ -1712,8 +1712,8 @@
 	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 (ok) {
+		if (mdev->net_conf->wire_protocol == DRBD_PROT_A) {
 			ok = _drbd_send_bio(mdev,req->master_bio);
 		} else {
 			ok = _drbd_send_zc_bio(mdev,req->master_bio);
@@ -1831,7 +1831,7 @@
 				continue;
 		}
 		D_ASSERT(rv != 0);
-		if (rv == -EINTR ) {
+		if (rv == -EINTR) {
 #if 0
 			/* FIXME this happens all the time.
 			 * we don't care for now!
@@ -1876,7 +1876,7 @@
 	int rv=0;
 
 	mdev = minor_to_mdev(MINOR(inode->i_rdev));
-	if(!mdev) return -ENODEV;
+	if (!mdev) return -ENODEV;
 
 	spin_lock_irqsave(&mdev->req_lock,flags);
 	/* to have a stable mdev->state.role and no race with updating open_cnt */
@@ -1889,7 +1889,7 @@
 		}
 	}
 
-	if(!rv) mdev->open_cnt++;
+	if (!rv) mdev->open_cnt++;
 	spin_unlock_irqrestore(&mdev->req_lock,flags);
 
 	return rv;
@@ -1901,7 +1901,7 @@
 	drbd_dev *mdev;
 
 	mdev = minor_to_mdev(MINOR(inode->i_rdev));
-	if(!mdev) return -ENODEV;
+	if (!mdev) return -ENODEV;
 
 	/*
 	printk(KERN_ERR DEVICE_NAME ": close(inode=%p,file=%p)"
@@ -1943,7 +1943,7 @@
 	}
 	spin_unlock_irq(&mdev->req_lock);
 
-	if(mdev->state.disk >= Inconsistent) drbd_kick_lo(mdev);
+	if (mdev->state.disk >= Inconsistent) drbd_kick_lo(mdev);
 }
 
 void drbd_set_defaults(drbd_dev *mdev)
@@ -2073,7 +2073,7 @@
 	drbd_thread_stop(&mdev->receiver);
 
 	/* no need to lock it, I'm the only thread alive */
-	if ( mdev->epoch_size !=  0)
+	if (mdev->epoch_size !=  0)
 		ERR("epoch_size:%d\n",mdev->epoch_size);
 	mdev->al_writ_cnt  =
 	mdev->bm_writ_cnt  =
@@ -2179,7 +2179,7 @@
 
 	for (i=0;i< number;i++) {
 		page = alloc_page(GFP_HIGHUSER);
-		if(!page) goto Enomem;
+		if (!page) goto Enomem;
 		set_page_private(page,(unsigned long)drbd_pp_pool);
 		drbd_pp_pool = page;
 	}
@@ -2224,7 +2224,7 @@
 			struct gendisk  **disk = &mdev->vdisk;
 			request_queue_t **q    = &mdev->rq_queue;
 
-			if(!mdev) continue;
+			if (!mdev) continue;
 			drbd_free_resources(mdev);
 
 			if (*disk) {
@@ -2243,19 +2243,19 @@
 			if (mdev->resync) lc_free(mdev->resync);
 
 			rr = drbd_release_ee(mdev,&mdev->active_ee);
-			if(rr) ERR("%d EEs in active list found!\n",rr);
+			if (rr) ERR("%d EEs in active list found!\n",rr);
 
 			rr = drbd_release_ee(mdev,&mdev->sync_ee);
-			if(rr) ERR("%d EEs in sync list found!\n",rr);
+			if (rr) ERR("%d EEs in sync list found!\n",rr);
 
 			rr = drbd_release_ee(mdev,&mdev->read_ee);
-			if(rr) ERR("%d EEs in read list found!\n",rr);
+			if (rr) ERR("%d EEs in read list found!\n",rr);
 
 			rr = drbd_release_ee(mdev,&mdev->done_ee);
-			if(rr) ERR("%d EEs in done list found!\n",rr);
+			if (rr) ERR("%d EEs in done list found!\n",rr);
 
 			rr = drbd_release_ee(mdev,&mdev->net_ee);
-			if(rr) ERR("%d EEs in net list found!\n",rr);
+			if (rr) ERR("%d EEs in net list found!\n",rr);
 
 			ERR_IF (!list_empty(&mdev->data.work.q)) {
 				struct list_head *lp;
@@ -2272,21 +2272,21 @@
 
 			if (mdev->act_log) lc_free(mdev->act_log);
 
-			if(mdev->ee_hash) {
+			if (mdev->ee_hash) {
 				kfree(mdev->ee_hash);
 				mdev->ee_hash_s = 0;
 				mdev->ee_hash = NULL;
 			}
-			if(mdev->tl_hash) {
+			if (mdev->tl_hash) {
 				kfree(mdev->tl_hash);
 				mdev->tl_hash_s = 0;
 				mdev->tl_hash = NULL;
 			}
-			if(mdev->app_reads_hash) {
+			if (mdev->app_reads_hash) {
 				kfree(mdev->app_reads_hash);
 				mdev->app_reads_hash = NULL;
 			}
-			if ( mdev->p_uuid ) {
+			if (mdev->p_uuid) {
 				kfree(mdev->p_uuid);
 				mdev->p_uuid = NULL;
 			}
@@ -2309,7 +2309,7 @@
 	request_queue_t *q;
 
 	mdev = kzalloc(sizeof(drbd_dev),GFP_KERNEL);
-	if(!mdev) goto Enomem;
+	if (!mdev) goto Enomem;
 
 	mdev->minor = minor;
 
@@ -2346,7 +2346,7 @@
 	q->unplug_fn = drbd_unplug_fn;
 
 	mdev->md_io_page = alloc_page(GFP_KERNEL);
-	if(!mdev->md_io_page) goto Enomem;
+	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.
@@ -2358,9 +2358,9 @@
 	return mdev;
 
  Enomem:
-	if(mdev) {
-		if(mdev->app_reads_hash) kfree(mdev->app_reads_hash);
-		if(mdev->md_io_page) __free_page(mdev->md_io_page);
+	if (mdev) {
+		if (mdev->app_reads_hash) kfree(mdev->app_reads_hash);
+		if (mdev->md_io_page) __free_page(mdev->md_io_page);
 		kfree(mdev);
 	}
 	return NULL;
@@ -2423,7 +2423,7 @@
 #endif
 	}
 
-	if( (err = drbd_nl_init()) ) {
+	if ( (err = drbd_nl_init()) ) {
 		return err;
 	}
 
@@ -2446,7 +2446,7 @@
 
 	drbd_proc = NULL; // play safe for drbd_cleanup
 	minor_table = kzalloc(sizeof(drbd_dev *)*minor_count,GFP_KERNEL);
-	if(!minor_table) goto Enomem;
+	if (!minor_table) goto Enomem;
 
 	if ((err = drbd_create_mempools()))
 		goto Enomem;
@@ -2488,7 +2488,7 @@
 
 void drbd_free_bc(struct drbd_backing_dev* bc)
 {
-	if(bc == NULL) return;
+	if (bc == NULL) return;
 
 	BD_RELEASE(bc->backing_bdev);
 	BD_RELEASE(bc->md_bdev);
@@ -2514,7 +2514,7 @@
 
 void drbd_free_resources(drbd_dev *mdev)
 {
-	if ( mdev->cram_hmac_tfm ) {
+	if (mdev->cram_hmac_tfm) {
 		crypto_free_hash(mdev->cram_hmac_tfm);
 		mdev->cram_hmac_tfm = NULL;
 	}
@@ -2558,7 +2558,7 @@
 
 	// 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;
+	if (!inc_local_if_state(mdev,Failed)) return;
 
 	INFO("Writing meta data super block now.\n");
 
@@ -2621,7 +2621,7 @@
 	struct meta_data_on_disk * buffer;
 	int i,rv = NoError;
 
-	if(!inc_local_if_state(mdev,Attaching)) return MDIOError;
+	if (!inc_local_if_state(mdev,Attaching)) return MDIOError;
 
 	down(&mdev->md_io_mutex);
 	buffer = (struct meta_data_on_disk *)page_address(mdev->md_io_page);
@@ -2634,7 +2634,7 @@
 		goto err;
 	}
 
-	if(be32_to_cpu(buffer->magic) != DRBD_MD_MAGIC) {
+	if (be32_to_cpu(buffer->magic) != DRBD_MD_MAGIC) {
 		ERR("Error while reading metadata, magic not found.\n");
 		rv = MDInvalid;
 		goto err;
@@ -2713,7 +2713,7 @@
 
 void _drbd_uuid_set(drbd_dev *mdev, int idx, u64 val)
 {
-	if(idx == Current) {
+	if (idx == Current) {
 		if (mdev->state.role == Primary) {
 			val |= 1;
 		} else {
@@ -2733,7 +2733,7 @@
 
 void drbd_uuid_set(drbd_dev *mdev, int idx, u64 val)
 {
-	if(mdev->bc->md.uuid[idx]) {
+	if (mdev->bc->md.uuid[idx]) {
 		drbd_uuid_move_history(mdev);
 		mdev->bc->md.uuid[History_start]=mdev->bc->md.uuid[idx];
 		MTRACE(TraceTypeUuid,TraceLvlMetrics,
@@ -2768,9 +2768,9 @@
 
 void drbd_uuid_set_bm(drbd_dev *mdev, u64 val)
 {
-	if( mdev->bc->md.uuid[Bitmap]==0 && val==0 ) return;
+	if (mdev->bc->md.uuid[Bitmap]==0 && val==0) return;
 
-	if(val==0) {
+	if (val==0) {
 		drbd_uuid_move_history(mdev);
 		mdev->bc->md.uuid[History_start]=mdev->bc->md.uuid[Bitmap];
 		mdev->bc->md.uuid[Bitmap]=0;
@@ -2780,7 +2780,7 @@
 		       drbd_print_uuid(mdev,Bitmap);
 			);
 	} else {
-		if( mdev->bc->md.uuid[Bitmap] ) WARN("bm UUID already set");
+		if (mdev->bc->md.uuid[Bitmap]) WARN("bm UUID already set");
 
 		mdev->bc->md.uuid[Bitmap] = val;
 		mdev->bc->md.uuid[Bitmap] &= ~((u64)1);
@@ -3057,7 +3057,7 @@
 
 #define PSM(A) \
 do { \
-	if( mask.A ) { \
+	if (mask.A) { \
 		int i = snprintf(p, len, " " #A "( %s )", \
 				A##s_to_name(val.A)); \
 		if (i >= len) return op; \

Modified: branches/drbd-8.0-for-linus/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 08:47:36 UTC (rev 2983)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 09:44:10 UTC (rev 2984)
@@ -57,7 +57,7 @@
 		switch( tag_number(tag) ) { \
 		fields \
 		default: \
-			if( tag & T_MANDATORY ) { \
+			if (tag & T_MANDATORY) { \
 				ERR("Unknown tag: %d\n",tag_number(tag)); \
 				return 0; \
 			} \
@@ -188,14 +188,14 @@
 	D_ASSERT(mdev->state.pdsk == DUnknown);
 
 	fp = DontCare;
-	if(inc_local(mdev)) {
+	if (inc_local(mdev)) {
 		fp = mdev->bc->dc.fencing;
 		dec_local(mdev);
 	}
 
 	D_ASSERT( fp > DontCare );
 
-	if( fp == Stonith ) drbd_request_state(mdev,NS(susp,1));
+	if (fp == Stonith) drbd_request_state(mdev,NS(susp,1));
 
 	r=drbd_khelper(mdev,"outdate-peer");
 
@@ -216,7 +216,7 @@
 		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;
@@ -240,7 +240,7 @@
 	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
 	}
 
@@ -249,7 +249,7 @@
 
 	while (try++ < 3) {
 		r = _drbd_request_state(mdev,mask,val,0);
-		if( r == SS_NoUpToDateDisk && force &&
+		if ( r == SS_NoUpToDateDisk && force &&
 		    ( mdev->state.disk == Inconsistent ||
 		      mdev->state.disk == Outdated ) ) {
 			mask.disk = disk_mask;
@@ -258,12 +258,12 @@
 			continue;
 		}
 
-		if( r == SS_NoUpToDateDisk &&
+		if ( r == SS_NoUpToDateDisk &&
 		    mdev->state.disk == Consistent ) {
 			D_ASSERT(mdev->state.pdsk == DUnknown);
 			nps = drbd_try_outdate_peer(mdev);
 
-			if(nps == Outdated) {
+			if (nps == Outdated) {
 				val.disk = UpToDate;
 				mask.disk = disk_mask;
 			}
@@ -274,11 +274,11 @@
 			continue;
 		}
 
-		if ( r == SS_NothingToDo ) goto fail;
-		if ( r == SS_PrimaryNOP ) {
+		if (r == SS_NothingToDo) goto fail;
+		if (r == SS_PrimaryNOP) {
 			nps = drbd_try_outdate_peer(mdev);
 
-			if ( force && nps > Outdated ) {
+			if (force && nps > Outdated) {
 				WARN("Forced into split brain situation!\n");
 				nps = Outdated;
 			}
@@ -288,21 +288,21 @@
 
 			continue;
 		}
-		if( r == SS_TwoPrimaries ) {
+		if (r == SS_TwoPrimaries) {
 			// 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 ) {
+		if (r < SS_Success) {
 			r = drbd_request_state(mdev,mask,val); // Be verbose.
-			if( r < SS_Success ) goto fail;
+			if (r < SS_Success) goto fail;
 		}
 		break;
 	}
 
-	if(forced) WARN("Forced to conisder local data as UpToDate!\n");
+	if (forced) WARN("Forced to conisder local data as UpToDate!\n");
 
 	fsync_bdev(mdev->this_bdev);
 
@@ -326,7 +326,7 @@
 			dec_local(mdev);
 		}
 	} else {
-		if(inc_net(mdev)) {
+		if (inc_net(mdev)) {
 			mdev->net_conf->want_lose = 0;
 			dec_net(mdev);
 		}
@@ -346,14 +346,14 @@
 		}
 	}
 
-	if((new_role == Secondary) && inc_local(mdev) ) {
+	if ((new_role == Secondary) && inc_local(mdev) ) {
 		drbd_al_to_on_disk_bm(mdev);
 		dec_local(mdev);
 	}
 
 	if (mdev->state.conn >= WFReportParams) {
 		/* if this was forced, we should consider sync */
-		if(forced) drbd_send_uuids(mdev);
+		if (forced) drbd_send_uuids(mdev);
 		drbd_send_state(mdev);
 	}
 
@@ -372,7 +372,7 @@
 	struct primary primary_args;
 
 	memset(&primary_args, 0, sizeof(struct primary));
-	if(!primary_from_tags(mdev,nlp->tag_list,&primary_args)) {
+	if (!primary_from_tags(mdev,nlp->tag_list,&primary_args)) {
 		reply->ret_code=UnknownMandatoryTag;
 		return 0;
 	}
@@ -471,7 +471,7 @@
 
 	size = drbd_new_dev_size(mdev,mdev->bc);
 
-	if( drbd_get_capacity(mdev->this_bdev) != size ||
+	if ( drbd_get_capacity(mdev->this_bdev) != size ||
 	    drbd_bm_capacity(mdev) != size ) {
 		int err;
 		err = drbd_bm_resize(mdev,size);
@@ -503,13 +503,13 @@
 	md_moved = prev_first_sect != drbd_md_first_sector(mdev->bc)
 		|| prev_size       != mdev->bc->md.md_size_sect;
 
-	if ( md_moved ) {
+	if (md_moved) {
 		WARN("Moving meta-data.\n");
 		/* assert: (flexible) internal meta data */
 	}
 
-	if ( la_size_changed || md_moved ) {
-		if( inc_local_if_state(mdev,Attaching) ) {
+	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.
@@ -534,25 +534,25 @@
 
 	m_size = drbd_get_max_capacity(bdev);
 
-	if(p_size && m_size) {
+	if (p_size && m_size) {
 		size=min_t(sector_t,p_size,m_size);
 	} else {
-		if(la_size) {
+		if (la_size) {
 			size=la_size;
-			if(m_size && m_size < size) size=m_size;
-			if(p_size && p_size < size) size=p_size;
+			if (m_size && m_size < size) size=m_size;
+			if (p_size && p_size < size) size=p_size;
 		} else {
-			if(m_size) size=m_size;
-			if(p_size) size=p_size;
+			if (m_size) size=m_size;
+			if (p_size) size=p_size;
 		}
 	}
 
-	if(size == 0) {
+	if (size == 0) {
 		ERR("Both nodes diskless!\n");
 	}
 
-	if(u_size) {
-		if(u_size<<1 > size) {
+	if (u_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 {
@@ -652,7 +652,7 @@
 	// t->max_segment_size = min_not_zero(...,...)
 
 	// workaround here:
-	if(q->max_segment_size == 0) q->max_segment_size = max_seg_s;
+	if (q->max_segment_size == 0) q->max_segment_size = max_seg_s;
 
 	MTRACE(TraceTypeRq,TraceLvlSummary,
 	       DUMPI(q->max_sectors);
@@ -663,13 +663,13 @@
 	       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) {
+	if (q->backing_dev_info.ra_pages != b->backing_dev_info.ra_pages) {
 		INFO("Adjusting my ra_pages to backing device's (%lu -> %lu)\n",
 		     q->backing_dev_info.ra_pages,
 		     b->backing_dev_info.ra_pages);
@@ -700,7 +700,7 @@
         * then fail.
         */
 	while(mdev->bc != NULL) {
-		if(ntries++ >= 5) {
+		if (ntries++ >= 5) {
 			WARN("drbd_nl_disk_conf: mdev->bc not NULL.\n");
 			retcode=HaveDiskConfig;
 			goto fail;
@@ -710,12 +710,12 @@
 	}
 
 	nbc = kmalloc(sizeof(struct drbd_backing_dev),GFP_KERNEL);
-	if(!nbc) {
+	if (!nbc) {
 		retcode=KMallocFailed;
 		goto fail;
 	}
 
-	if( !(nlp->flags & DRBD_NL_SET_DEFAULTS) && inc_local(mdev) ) {
+	if ( !(nlp->flags & DRBD_NL_SET_DEFAULTS) && inc_local(mdev) ) {
 		memcpy(&nbc->dc,&mdev->bc->dc,sizeof(struct disk_conf));
 		dec_local(mdev);
 	} else {
@@ -725,7 +725,7 @@
 		nbc->dc.fencing     = DRBD_FENCING_DEF;
 	}
 
-	if(!disk_conf_from_tags(mdev,nlp->tag_list,&nbc->dc)) {
+	if (!disk_conf_from_tags(mdev,nlp->tag_list,&nbc->dc)) {
 		retcode=UnknownMandatoryTag;
 		goto fail;
 	}
@@ -733,7 +733,7 @@
 	nbc->lo_file = NULL;
 	nbc->md_file = NULL;
 
-	if ( nbc->dc.meta_dev_idx < DRBD_MD_INDEX_FLEX_INT) {
+	if (nbc->dc.meta_dev_idx < DRBD_MD_INDEX_FLEX_INT) {
 		retcode=LDMDInvalid;
 		goto fail;
 	}
@@ -782,7 +782,7 @@
 	}
 
 	resync_lru = lc_alloc("resync",31, sizeof(struct bm_extent),mdev);
-	if(!resync_lru) {
+	if (!resync_lru) {
 		retcode=KMallocFailed;
 		goto fail;
 	}
@@ -816,7 +816,7 @@
 		goto release_bdev2_fail;
 	}
 
-	if ( nbc->dc.meta_dev_idx == -1 ) i = 1;
+	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
@@ -828,7 +828,7 @@
 	 * 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
+	if ( drbd_get_capacity(nbc->md_bdev) < 2*MD_RESERVED_SIZE*i
 				+ (nbc->dc.meta_dev_idx == -1) ? (1<<16) : 0 )
 	{
 		retcode = MDDeviceTooSmall;
@@ -844,14 +844,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;
 	}
 
@@ -862,13 +862,13 @@
 	}
 
 	// Prevent shrinking of consistent devices !
-	if(drbd_md_test_flag(nbc,MDF_Consistent) &&
+	if (drbd_md_test_flag(nbc,MDF_Consistent) &&
 	   drbd_new_dev_size(mdev,nbc) < nbc->md.la_size_sect) {
 		retcode = LDDeviceTooSmall;
 		goto force_diskless;
 	}
 
-	if(!drbd_al_read_log(mdev,nbc)) {
+	if (!drbd_al_read_log(mdev,nbc)) {
 		retcode = MDIOError;
 		goto force_diskless;
 	}
@@ -883,7 +883,7 @@
 	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 {
 		clear_bit(CRASHED_PRIMARY, &mdev->flags);
@@ -939,7 +939,7 @@
 		}
 	}
 
-	if(test_bit(CRASHED_PRIMARY, &mdev->flags)) {
+	if (test_bit(CRASHED_PRIMARY, &mdev->flags)) {
 		drbd_al_apply_to_bm(mdev);
 		drbd_al_to_on_disk_bm(mdev);
 	}
@@ -955,8 +955,8 @@
 	   If MDF_WasUpToDate is not set go into Outdated disk state,
 	   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_Consistent)) {
+		if (drbd_md_test_flag(mdev->bc,MDF_WasUpToDate)) {
 			ns.disk = Consistent;
 		} else {
 			ns.disk = Outdated;
@@ -965,11 +965,11 @@
 		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 &&
+	if ( ns.disk == Consistent &&
 	    ( ns.pdsk == Outdated || mdev->bc->dc.fencing == DontCare ) ) {
 		ns.disk = UpToDate;
 	}
@@ -981,7 +981,7 @@
 
 	/* In case we are Connected postpone any desicion on the new disk
 	   state after the negotiation phase. */
-	if(mdev->state.conn == Connected) {
+	if (mdev->state.conn == Connected) {
 		mdev->new_state_tmp.i = ns.i;
 		ns.i = os.i;
 		ns.disk = Negotiating;
@@ -998,8 +998,8 @@
 
 	drbd_bm_unlock(mdev);
 
-	if(inc_local_if_state(mdev,Attaching)) {
-		if(mdev->state.role == Primary) mdev->bc->md.uuid[Current] |=  (u64)1;
+	if (inc_local_if_state(mdev,Attaching)) {
+		if (mdev->state.role == Primary) mdev->bc->md.uuid[Current] |=  (u64)1;
 		else                            mdev->bc->md.uuid[Current] &= ~(u64)1;
 		dec_local(mdev);
 	}
@@ -1059,12 +1059,12 @@
 	}
 
 	new_conf = kmalloc(sizeof(struct net_conf),GFP_KERNEL);
-	if(!new_conf) {
+	if (!new_conf) {
 		retcode=KMallocFailed;
 		goto fail;
 	}
 
-	if( !(nlp->flags & DRBD_NL_SET_DEFAULTS) && inc_net(mdev)) {
+	if ( !(nlp->flags & DRBD_NL_SET_DEFAULTS) && inc_net(mdev)) {
 		memcpy(new_conf,mdev->net_conf,sizeof(struct net_conf));
 		dec_local(mdev);
 	} else {
@@ -1097,7 +1097,7 @@
 		goto fail;
 	};
 
-	if( mdev->state.role == Primary && new_conf->want_lose ) {
+	if (mdev->state.role == Primary && new_conf->want_lose) {
 		retcode=DiscardNotAllowed;
 		goto fail;
 	}
@@ -1109,18 +1109,18 @@
 	retcode = NoError;
 	for(i=0;i<minor_count;i++) {
 		odev = minor_to_mdev(i);
-		if(!odev || odev == mdev) continue;
-		if( inc_net(odev)) {
-			if( M_ADDR(new_conf) == M_ADDR(odev->net_conf) &&
+		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) ) {
 				retcode=LAAlreadyInUse;
 			}
-			if(O_ADDR(new_conf) == O_ADDR(odev->net_conf) &&
+			if (O_ADDR(new_conf) == O_ADDR(odev->net_conf) &&
 			   O_PORT(new_conf) == O_PORT(odev->net_conf) ) {
 				retcode=OAAlreadyInUse;
 			}
 			dec_net(odev);
-			if(retcode != NoError) goto fail;
+			if (retcode != NoError) goto fail;
 		}
 	}
 #undef M_ADDR
@@ -1128,7 +1128,7 @@
 #undef O_ADDR
 #undef O_PORT
 
-	if( new_conf->cram_hmac_alg[0] != 0) {
+	if (new_conf->cram_hmac_alg[0] != 0) {
 		snprintf(hmac_name,HMAC_NAME_L,"hmac(%s)",new_conf->cram_hmac_alg);
 		tfm = crypto_alloc_hash(hmac_name, 0, CRYPTO_ALG_ASYNC);
 		if (IS_ERR(tfm)) {
@@ -1147,7 +1147,7 @@
 	ns = new_conf->max_epoch_size/8;
 	if (mdev->tl_hash_s != ns) {
 		new_tl_hash=kzalloc(ns*sizeof(void*), GFP_KERNEL);
-		if(!new_tl_hash) {
+		if (!new_tl_hash) {
 			retcode=KMallocFailed;
 			goto fail;
 		}
@@ -1156,7 +1156,7 @@
 	ns = new_conf->max_buffers/8;
 	if (new_conf->two_primaries && ( mdev->ee_hash_s != ns ) ) {
 		new_ee_hash=kzalloc(ns*sizeof(void*), GFP_KERNEL);
-		if(!new_ee_hash) {
+		if (!new_ee_hash) {
 			retcode=KMallocFailed;
 			goto fail;
 		}
@@ -1195,19 +1195,19 @@
 	mdev->send_cnt = 0;
 	mdev->recv_cnt = 0;
 
-	if(new_tl_hash) {
+	if (new_tl_hash) {
 		if (mdev->tl_hash) kfree(mdev->tl_hash);
 		mdev->tl_hash_s = mdev->net_conf->max_epoch_size/8;
 		mdev->tl_hash = new_tl_hash;
 	}
 
-	if(new_ee_hash) {
+	if (new_ee_hash) {
 		if (mdev->ee_hash) kfree(mdev->ee_hash);
 		mdev->ee_hash_s = mdev->net_conf->max_buffers/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;
@@ -1234,9 +1234,9 @@
 
 	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 ) {
+	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.
 		retcode = drbd_request_state(mdev,NS2(conn,Disconnecting,
 						      pdsk,Outdated));
@@ -1244,7 +1244,7 @@
 		// The peer probabely wants to see us outdated.
 		retcode = _drbd_request_state(mdev,NS2(conn,Disconnecting,
 						       disk,Outdated),0);
-		if( retcode == SS_IsDiskLess ) {
+		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.
@@ -1252,9 +1252,9 @@
 		}
 	}
 
-	if( retcode < SS_Success ) goto fail;
+	if (retcode < SS_Success) goto fail;
 
-	if( wait_event_interruptible( mdev->misc_wait,
+	if ( wait_event_interruptible( mdev->misc_wait,
 				      mdev->state.conn==StandAlone) ) {
 		retcode = GotSignal;
 		goto fail;
@@ -1291,7 +1291,7 @@
 		goto fail;
 	}
 
-	if(!inc_local(mdev)) {
+	if (!inc_local(mdev)) {
 		retcode = HaveNoDiskConfig;
 		goto fail;
 	}
@@ -1322,7 +1322,7 @@
 
 	memcpy(&sc,&mdev->sync_conf,sizeof(struct syncer_conf));
 
-	if(nlp->flags & DRBD_NL_SET_DEFAULTS) {
+	if (nlp->flags & DRBD_NL_SET_DEFAULTS) {
 		sc.rate       = DRBD_RATE_DEF;
 		sc.after      = DRBD_AFTER_DEF;
 		sc.al_extents = DRBD_AL_EXTENTS_DEF;
@@ -1333,18 +1333,18 @@
 		goto fail;
 	}
 
-	if( sc.after != -1) {
-		if( sc.after < -1 || minor_to_mdev(sc.after) == NULL ) {
+	if (sc.after != -1) {
+		if ( sc.after < -1 || minor_to_mdev(sc.after) == NULL ) {
 			retcode=SyncAfterInvalid;
 			goto fail;
 		}
 		odev = minor_to_mdev(sc.after); // check against loops in
 		while(1) {
-			if( odev == mdev ) {
+			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);
 		}
 	}
@@ -1352,7 +1352,7 @@
 	ERR_IF (sc.rate < 1) sc.rate = 1;
 	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) {
+	if (sc.al_extents > AL_MAX) {
 		ERR("sc.al_extents > %d\n",AL_MAX);
 		sc.al_extents = AL_MAX;
 	}
@@ -1360,7 +1360,7 @@
 
 	mdev->sync_conf = sc;
 
-	if(inc_local(mdev)) {
+	if (inc_local(mdev)) {
 		err = drbd_check_al_size(mdev);
 		dec_local(mdev);
 		drbd_md_sync(mdev);
@@ -1404,7 +1404,7 @@
 {
 	int retcode=NoError;
 
-	if(drbd_request_state(mdev,NS(user_isp,1)) == SS_NothingToDo)
+	if (drbd_request_state(mdev,NS(user_isp,1)) == SS_NothingToDo)
 		retcode = PauseFlagAlreadySet;
 
 	reply->ret_code = retcode;
@@ -1416,7 +1416,7 @@
 {
 	int retcode=NoError;
 
-	if(drbd_request_state(mdev,NS(user_isp,0)) == SS_NothingToDo)
+	if (drbd_request_state(mdev,NS(user_isp,0)) == SS_NothingToDo)
 		retcode = PauseFlagAlreadyClear;
 
 	reply->ret_code = retcode;
@@ -1446,7 +1446,7 @@
 
 	spin_lock_irq(&mdev->req_lock);
 	os = mdev->state;
-	if( mdev->state.disk < Outdated ) {
+	if (mdev->state.disk < Outdated) {
 		retcode = -999;
 	} else {
 		retcode = _drbd_set_state(_NS(mdev,disk,Outdated),ChgStateVerbose);
@@ -1455,7 +1455,7 @@
 	spin_unlock_irq(&mdev->req_lock);
 	if (retcode==SS_Success) after_state_ch(mdev,os,ns, ChgStateVerbose);
 
-	if( retcode == -999 ) {
+	if (retcode == -999) {
 		retcode = DiskLowerThanOutdated;
 		goto fail;
 	}
@@ -1474,12 +1474,12 @@
 
 	tl = reply->tag_list;
 
-	if(inc_local(mdev)) {
+	if (inc_local(mdev)) {
 		tl = disk_conf_to_tags(mdev,&mdev->bc->dc,tl);
 		dec_local(mdev);
 	}
 
-	if(inc_net(mdev)) {
+	if (inc_net(mdev)) {
 		tl = net_conf_to_tags(mdev,mdev->net_conf,tl);
 		dec_net(mdev);
 	}
@@ -1510,7 +1510,7 @@
 
 	tl = reply->tag_list;
 
-	if(inc_local(mdev)) {
+	if (inc_local(mdev)) {
 		// This is a hand crafted add tag ;)
 		*tl++ = T_uuids;
 		*tl++ = UUID_SIZE*sizeof(u64);
@@ -1551,19 +1551,19 @@
 
 	mdev = minor_to_mdev(nlp->drbd_minor);
 
-	if(!mdev && (nlp->flags & DRBD_NL_CREATE_DEVICE)) {
+	if (!mdev && (nlp->flags & DRBD_NL_CREATE_DEVICE)) {
 		mdev = drbd_new_device(nlp->drbd_minor);
 
 		spin_lock_irq(&drbd_pp_lock);
-		if( minor_table[nlp->drbd_minor] == NULL) {
+		if (minor_table[nlp->drbd_minor] == NULL) {
 			minor_table[nlp->drbd_minor] = mdev;
 			mdev = NULL;
 		}
 		spin_unlock_irq(&drbd_pp_lock);
 
-		if(mdev) {
-			if(mdev->app_reads_hash) kfree(mdev->app_reads_hash);
-			if(mdev->md_io_page) __free_page(mdev->md_io_page);
+		if (mdev) {
+			if (mdev->app_reads_hash) kfree(mdev->app_reads_hash);
+			if (mdev->md_io_page) __free_page(mdev->md_io_page);
 			kfree(mdev);
 			mdev = NULL;
 		}
@@ -1623,19 +1623,19 @@
 		+ sizeof(struct drbd_nl_cfg_reply)
 		+ sizeof(short int);
 
-	if(!try_module_get(THIS_MODULE)) {
+	if (!try_module_get(THIS_MODULE)) {
 		printk(KERN_ERR DEVICE_NAME "try_module_get() failed!\n");
 		return;
 	}
 
-	if( !(mdev = ensure_mdev(nlp)) ) {
+	if ( !(mdev = ensure_mdev(nlp)) ) {
 		retcode=MinorNotKnown;
 		goto fail;
 	}
 
 	TRACE(TraceTypeNl, TraceLvlSummary, nl_trace_packet(data););
 
-	if( nlp->packet_type >= P_nl_after_last_packet ) {
+	if (nlp->packet_type >= P_nl_after_last_packet) {
 		retcode=UnknownNetLinkPacket;
 		goto fail;
 	}
@@ -1643,7 +1643,7 @@
 	cm = cnd_table + nlp->packet_type;
 	reply_size += cm->reply_body_size;
 
-	if( !(cn_reply = kmalloc(reply_size,GFP_KERNEL)) ) {
+	if ( !(cn_reply = kmalloc(reply_size,GFP_KERNEL)) ) {
 		retcode=KMallocFailed;
 		goto fail;
 	}
@@ -1665,7 +1665,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);
 	}
 	kfree(cn_reply);
@@ -1815,7 +1815,7 @@
 	if(err) return err;
 #endif
 	err = cn_add_callback(&cn_id_drbd,"cn_drbd",&drbd_connector_callback);
-	if(err) {
+	if (err) {
 		printk(KERN_ERR DEVICE_NAME "cn_drbd failed to register\n");
 		return err;
 	}
@@ -1856,7 +1856,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 08:47:36 UTC (rev 2983)
+++ branches/drbd-8.0-for-linus/drbd/drbd_proc.c	2007-07-24 09:44:10 UTC (rev 2984)
@@ -194,11 +194,11 @@
 
 	for (i = 0; i < minor_count; i++) {
 		mdev = minor_to_mdev(i);
-		if(!mdev) {
+		if (!mdev) {
 			hole=1;
 			continue;
 		}
-		if( hole ) {
+		if (hole) {
 			hole=0;
 			seq_printf( seq, "\n");
 		}
@@ -241,14 +241,14 @@
 		     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) {
+		if (mdev->resync) {
 			lc_dump(mdev->resync,seq,"rs_left",
 				resync_dump_detail);
 		}

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 08:47:36 UTC (rev 2983)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 09:44:10 UTC (rev 2984)
@@ -76,13 +76,13 @@
 	do {
 		la=le;
 		le=le->next;
-		if( le->prev != la ) {
+		if (le->prev != la) {
 			printk(KERN_ERR DEVICE_NAME
 			       "%d: %s list fucked.\n",
 			       mdev_to_minor(mdev),t);
 			break;
 		}
-		if( forward++ > CHECK_LIST_LIMIT ) {
+		if (forward++ > CHECK_LIST_LIMIT) {
 			printk(KERN_ERR DEVICE_NAME
 			       "%d: %s forward > 1000\n",
 			       mdev_to_minor(mdev),t);
@@ -94,13 +94,13 @@
 	do {
 		la=le;
 		le=le->prev;
-		if( le->next != la ) {
+		if (le->next != la) {
 			printk(KERN_ERR DEVICE_NAME
 			       "%d: %s list fucked.\n",
 			       mdev_to_minor(mdev),t);
 			break;
 		}
-		if( backward++ > CHECK_LIST_LIMIT ) {
+		if (backward++ > CHECK_LIST_LIMIT) {
 			printk(KERN_ERR DEVICE_NAME
 			       "%d: %s backward > 1000\n",
 			       mdev_to_minor(mdev),t);
@@ -108,7 +108,7 @@
 		}
 	} while(le != list);
 
-	if(forward != backward) {
+	if (forward != backward) {
 		printk(KERN_ERR DEVICE_NAME "%d: forward=%d, backward=%d\n",
 		       mdev_to_minor(mdev),forward,backward);
 	}
@@ -163,7 +163,7 @@
 		 * don't wait, if none is available, though.
 		 */
 		if ( atomic_read(&mdev->pp_in_use) < mdev->net_conf->max_buffers ) {
-			if( (page = alloc_page(GFP_TRY)) )
+			if ( (page = alloc_page(GFP_TRY)) )
 				break;
 		}
 
@@ -206,7 +206,7 @@
 
 	atomic_dec(&mdev->pp_in_use);
 
-	if(free_it) __free_page(page);
+	if (free_it) __free_page(page);
 
 	/*
 	 * FIXME
@@ -380,7 +380,7 @@
 
 	list_for_each_safe(le, tle, &mdev->net_ee) {
 		e = list_entry(le, struct Tl_epoch_entry, w.list);
-		if( drbd_bio_has_active_page(e->private_bio) ) break;
+		if ( drbd_bio_has_active_page(e->private_bio) ) break;
 		list_del(le);
 		drbd_free_ee(mdev,e);
 	}
@@ -445,11 +445,11 @@
 		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 ||
+		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);
+		if (!hlist_unhashed(&e->colision)) hlist_del_init(&e->colision);
 		drbd_free_ee(mdev,e);
 	}
 
@@ -503,7 +503,7 @@
       out_release:
 	sock_release(newsock);
       out:
-	if(err != -EAGAIN && err != -EINTR)
+	if (err != -EAGAIN && err != -EINTR)
 		ERR("accept failed! %d\n", err);
 	return 0;
 }
@@ -585,7 +585,7 @@
 
 	set_fs(oldfs);
 
-	if(rv != size) drbd_force_state(mdev,NS(conn,BrokenPipe));
+	if (rv != size) drbd_force_state(mdev,NS(conn,BrokenPipe));
 
 	return rv;
 }
@@ -602,7 +602,7 @@
 		return NULL;
 	}
 
-	if(!inc_net(mdev)) return NULL;
+	if (!inc_net(mdev)) return NULL;
 
 	sock->sk->sk_rcvtimeo =
 	sock->sk->sk_sndtimeo =  mdev->net_conf->try_connect_int*HZ;
@@ -652,7 +652,7 @@
 		return NULL;
 	}
 
-	if(!inc_net(mdev)) return NULL;
+	if (!inc_net(mdev)) return NULL;
 
 	sock2->sk->sk_reuse    = 1; /* SO_REUSEADDR */
 	sock2->sk->sk_rcvtimeo =
@@ -693,7 +693,7 @@
 
 	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);
 	}
 
@@ -715,7 +715,7 @@
 	D_ASSERT(mdev->state.conn >= Unconnected);
 	D_ASSERT(!mdev->data.socket);
 
-	if(drbd_request_state(mdev,NS(conn,WFConnection)) < SS_Success ) return 0;
+	if (drbd_request_state(mdev,NS(conn,WFConnection)) < SS_Success ) return 0;
 	clear_bit(DISCARD_CONCURRENT, &mdev->flags);
 
 	sock  = NULL;
@@ -724,20 +724,20 @@
 	do {
 		for(try=0;;) { // 3 tries, this should take less than a second!
 			s=drbd_try_connect(mdev);
-			if(s || ++try >= 3 ) break;
+			if (s || ++try >= 3) break;
 			// give the other side time to call bind() & listen()
 			set_current_state(TASK_INTERRUPTIBLE);
 			schedule_timeout(HZ / 10);
 		}
 
-		if(s) {
-			if( !sock ) {
-				if( drbd_send_fp(mdev, s, HandShakeS) ) {
+		if (s) {
+			if (!sock) {
+				if ( drbd_send_fp(mdev, s, HandShakeS) ) {
 					sock = s;
 					s = NULL;
 				}
-			} else if( !msock ) {
-				if( drbd_send_fp(mdev, s, HandShakeM) ) {
+			} else if (!msock) {
+				if ( drbd_send_fp(mdev, s, HandShakeM) ) {
 					msock = s;
 					s = NULL;
 				}
@@ -745,23 +745,23 @@
 				ERR("Logic error in drbd_connect()\n");
 				return -1;
 			}
-			if(s) {
+			if (s) {
 				ERR("Error during sending initial packet.\n");
 				sock_release(s);
 			}
 		}
 
-		if(sock && msock) break;
+		if (sock && msock) break;
 
 		s=drbd_wait_for_connect(mdev);
-		if(s) {
+		if (s) {
 			switch(drbd_recv_fp(mdev,s)) {
 			case HandShakeS:
-				if(sock) sock_release(sock);
+				if (sock) sock_release(sock);
 				sock = s;
 				break;
 			case HandShakeM:
-				if(msock) sock_release(msock);
+				if (msock) sock_release(msock);
 				msock = s;
 				set_bit(DISCARD_CONCURRENT, &mdev->flags);
 				break;
@@ -771,13 +771,13 @@
 			}
 		}
 
-		if(mdev->state.conn <= Disconnecting) return -1;
-		if(signal_pending(current)) {
+		if (mdev->state.conn <= Disconnecting) return -1;
+		if (signal_pending(current)) {
 			flush_signals(current);
 			smp_rmb();
 			if (get_t_state(&mdev->receiver) == Exiting) {
-				if(sock) sock_release(sock);
-				if(msock) sock_release(msock);
+				if (sock) sock_release(sock);
+				if (msock) sock_release(msock);
 				return -1;
 			}
 		}
@@ -811,13 +811,13 @@
 	mdev->meta.socket = msock;
 	mdev->last_received = jiffies;
 
-	if(drbd_request_state(mdev,NS(conn,WFReportParams)) < SS_Success) return 0;
+	if (drbd_request_state(mdev,NS(conn,WFReportParams)) < SS_Success) return 0;
 	D_ASSERT(mdev->asender.task == NULL);
 
 	h = drbd_do_handshake(mdev);
 	if (h <= 0) return h;
 
-	if ( mdev->cram_hmac_tfm ) {
+	if (mdev->cram_hmac_tfm) {
 		if (!drbd_do_auth(mdev)) {
 			ERR("Authentication of peer failed\n");
 			return 0;
@@ -917,14 +917,14 @@
 	int ds,i,rr;
 
 	e = drbd_alloc_ee(mdev,id,sector,data_size,GFP_KERNEL);
-	if(!e) return 0;
+	if (!e) return 0;
 	bio = e->private_bio;
 	ds = data_size;
 	bio_for_each_segment(bvec, bio, i) {
 		page = bvec->bv_page;
 		rr = drbd_recv(mdev,kmap(page),min_t(int,ds,PAGE_SIZE));
 		kunmap(page);
-		if( rr != min_t(int,ds,PAGE_SIZE) ) {
+		if ( rr != min_t(int,ds,PAGE_SIZE) ) {
 			drbd_free_ee(mdev,e);
 			WARN("short read receiving data: read %d expected %d\n",
 			     rr, min_t(int,ds,PAGE_SIZE));
@@ -952,7 +952,7 @@
 	data=kmap(page);
 	while(data_size) {
 		rr = drbd_recv(mdev,data,min_t(int,data_size,PAGE_SIZE));
-		if( rr != min_t(int,data_size,PAGE_SIZE) ) {
+		if ( rr != min_t(int,data_size,PAGE_SIZE) ) {
 			rv = 0;
 			WARN("short read receiving data: read %d expected %d\n",
 			     rr, min_t(int,data_size,PAGE_SIZE));
@@ -1037,7 +1037,7 @@
 	struct Tl_epoch_entry *e;
 
 	e = read_in_block(mdev,ID_SYNCER,sector,data_size);
-	if(!e) return FALSE;
+	if (!e) return FALSE;
 
 	dec_rs_pending(mdev);
 
@@ -1130,7 +1130,7 @@
 	sector = be64_to_cpu(p->sector);
 	D_ASSERT(p->block_id == ID_SYNCER);
 
-	if(inc_local(mdev)) {
+	if (inc_local(mdev)) {
 		/* data is submitted to disk within recv_resync_read.
 		 * corresponding dec_local done below on error,
 		 * or in drbd_endio_write_sec. */
@@ -1166,14 +1166,14 @@
 	// unsigned int epoch_size;
 	int ok=1,pcmd;
 
-	if(mdev->net_conf->wire_protocol == DRBD_PROT_C) {
-		if(likely(drbd_bio_uptodate(e->private_bio))) {
+	if (mdev->net_conf->wire_protocol == DRBD_PROT_C) {
+		if (likely(drbd_bio_uptodate(e->private_bio))) {
 			pcmd = (mdev->state.conn >= SyncSource &&
 				mdev->state.conn <= PausedSyncT &&
 				e->flags & EE_MAY_SET_IN_SYNC) ?
 				RSWriteAck : WriteAck;
 			ok &= drbd_send_ack(mdev,pcmd,e);
-			if(pcmd==RSWriteAck)
+			if (pcmd==RSWriteAck)
 				drbd_set_in_sync(mdev,sector,e->size);
 		} else {
 			/* FIXME I think we should send a NegAck regardless of
@@ -1188,7 +1188,7 @@
 			 * maybe assert this?  */
 		}
 		dec_unacked(mdev);
-	} else if(unlikely(!drbd_bio_uptodate(e->private_bio))) {
+	} else if (unlikely(!drbd_bio_uptodate(e->private_bio))) {
 		ok = drbd_io_error(mdev, FALSE);
 	}
 
@@ -1293,7 +1293,7 @@
 	if (drbd_recv(mdev, h->payload, header_size) != header_size)
 		return FALSE;
 
-	if(!inc_local(mdev)) {
+	if (!inc_local(mdev)) {
 		/* data is submitted to disk at the end of this function.
 		 * corresponding dec_local done either below (on error),
 		 * or in drbd_endio_write_sec. */
@@ -1320,13 +1320,13 @@
 	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;
 	}
 
@@ -1542,7 +1542,7 @@
 		break;
 	}
 
-	if(mdev->state.pdsk == Diskless) {
+	if (mdev->state.pdsk == Diskless) {
 		// 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;
@@ -1597,7 +1597,7 @@
 		return FALSE;
 	}
 
-	if(!inc_local_if_state(mdev, UpToDate)) {
+	if (!inc_local_if_state(mdev, UpToDate)) {
 		if (DRBD_ratelimit(5*HZ,5))
 			ERR("Can not satisfy peer's read request, no local data.\n");
 		drbd_send_ack_rp(mdev,h->command == DataRequest ? NegDReply :
@@ -1686,17 +1686,17 @@
 		WARN("Discard younger/older primary did not found a decision\n"
 		     "Using discard-least-changes instead\n");
 	case DiscardZeroChg:
-		if( ch_peer == 0 && ch_self == 0) {
+		if (ch_peer == 0 && ch_self == 0) {
 			rv=test_bit(DISCARD_CONCURRENT,&mdev->flags) ? -1 : 1;
 			break;
 		} else {
-			if ( ch_peer == 0 ) { rv =  1; break; }
-			if ( ch_self == 0 ) { rv = -1; break; }
+			if (ch_peer == 0) { rv =  1; break; }
+			if (ch_self == 0) { rv = -1; break; }
 		}
-		if( mdev->net_conf->after_sb_0p == DiscardZeroChg ) break;
+		if (mdev->net_conf->after_sb_0p == DiscardZeroChg) break;
 	case DiscardLeastChg:
 		if      ( ch_self < ch_peer ) rv = -1;
-		else 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.
 			rv=test_bit(DISCARD_CONCURRENT,&mdev->flags) ? -1 : 1;
@@ -1731,8 +1731,8 @@
 		break;
 	case Consensus:
 		hg = drbd_asb_recover_0p(mdev);
-		if( hg == -1 && mdev->state.role==Secondary) rv=hg;
-		if( hg == 1  && mdev->state.role==Primary)   rv=hg;
+		if (hg == -1 && mdev->state.role==Secondary) rv=hg;
+		if (hg == 1  && mdev->state.role==Primary)   rv=hg;
 		break;
 	case Violently:
 		rv = drbd_asb_recover_0p(mdev);
@@ -1741,7 +1741,7 @@
 		return mdev->state.role==Primary ? 1 : -1;
 	case CallHelper:
 		hg = drbd_asb_recover_0p(mdev);
-		if( hg == -1 && mdev->state.role==Primary) {
+		if (hg == -1 && mdev->state.role==Primary) {
 			self = drbd_set_role(mdev,Secondary,0);
 			if (self != SS_Success) {
 				drbd_khelper(mdev,"pri-lost-after-sb");
@@ -1779,7 +1779,7 @@
 		break;
 	case CallHelper:
 		hg = drbd_asb_recover_0p(mdev);
-		if( hg == -1 ) {
+		if (hg == -1) {
 			self = drbd_set_role(mdev,Secondary,0);
 			if (self != SS_Success) {
 				drbd_khelper(mdev,"pri-lost-after-sb");
@@ -1904,7 +1904,7 @@
 	drbd_disks_t mydisk;
 
 	mydisk = mdev->state.disk;
-	if( mydisk == Negotiating ) mydisk = mdev->new_state_tmp.disk;
+	if (mydisk == Negotiating) mydisk = mdev->new_state_tmp.disk;
 
 	hg = drbd_uuid_compare(mdev,&rule_nr);
 
@@ -1921,11 +1921,11 @@
 		return conn_mask;
 	}
 
-	if( (mydisk==Inconsistent && peer_disk>Inconsistent) ||
+	if ( (mydisk==Inconsistent && peer_disk>Inconsistent) ||
 	    (peer_disk==Inconsistent && mydisk>Inconsistent) )  {
 		int f = (hg == -100) || abs(hg) == 2;
 		hg = mydisk > Inconsistent ? 1 : -1;
-		if(f) hg=hg*2;
+		if (f) hg=hg*2;
 		INFO("Becoming sync %s due to disk states.\n",
 		     hg > 0 ? "source" : "target");
 	}
@@ -1948,7 +1948,7 @@
 		if ( abs(hg) < 100 ) {
 			WARN("Split-Brain detected, %d primaries, automatically solved. Sync from %s node\n",
 			     pcount, (hg < 0) ? "peer":"this");
-			if(forced) {
+			if (forced) {
 				WARN("Doing a full sync, since"
 				     " UUIDs where ambiguous.\n");
 				drbd_uuid_dump(mdev,"self",mdev->bc->md.uuid);
@@ -1958,11 +1958,11 @@
 		}
 	}
 
-	if ( hg == -100 ) {
-		if(mdev->net_conf->want_lose && !(mdev->p_uuid[UUID_FLAGS]&1)){
+	if (hg == -100) {
+		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;
 		}
 
@@ -1980,7 +1980,7 @@
 		return conn_mask;
 	}
 
-	if (hg > 0 && mydisk <= Inconsistent ) {
+	if (hg > 0 && mydisk <= Inconsistent) {
 		ERR("I shall become SyncSource, but I am inconsistent!\n");
 		drbd_force_state(mdev,NS(conn,Disconnecting));
 		return conn_mask;
@@ -2022,7 +2022,7 @@
 		rv = WFBitMapT;
 	} else {
 		rv = Connected;
-		if(drbd_bm_total_weight(mdev)) {
+		if (drbd_bm_total_weight(mdev)) {
 			INFO("No resync, but %lu bits in bitmap!\n",
 			     drbd_bm_total_weight(mdev));
 		}
@@ -2037,15 +2037,15 @@
 STATIC int cmp_after_sb(enum after_sb_handler peer, enum after_sb_handler self)
 {
 	// DiscardRemote - DiscardLocal is valid
-	if( (peer == DiscardRemote && self == DiscardLocal) ||
+	if ( (peer == DiscardRemote && self == DiscardLocal) ||
 	    (self == DiscardRemote && peer == DiscardLocal) ) return 0;
 
 	// any other things with DiscardRemote or DiscardLocal are invalid
-	if( peer == DiscardRemote || peer == DiscardLocal ||
+	if ( peer == DiscardRemote || peer == DiscardLocal ||
 	    self == DiscardRemote || self == DiscardLocal ) return 1;
 
 	// everything else is valid if they are equal on both sides.
-	if( peer == self ) return 0;
+	if (peer == self) return 0;
 
 	// everything es is invalid.
 	return 1;
@@ -2069,32 +2069,32 @@
 	p_want_lose     = be32_to_cpu(p->want_lose);
 	p_two_primaries = be32_to_cpu(p->two_primaries);
 
-	if( p_proto != mdev->net_conf->wire_protocol) {
+	if (p_proto != mdev->net_conf->wire_protocol) {
 		ERR("incompatible communication protocols\n");
 		goto disconnect;
 	}
 
-	if( cmp_after_sb(p_after_sb_0p, mdev->net_conf->after_sb_0p) ) {
+	if ( cmp_after_sb(p_after_sb_0p, mdev->net_conf->after_sb_0p) ) {
 		ERR("incompatible after-sb-0pri settings\n");
 		goto disconnect;
 	}
 
-	if( cmp_after_sb(p_after_sb_1p, mdev->net_conf->after_sb_1p) ) {
+	if ( cmp_after_sb(p_after_sb_1p, mdev->net_conf->after_sb_1p) ) {
 		ERR("incompatible after-sb-1pri settings\n");
 		goto disconnect;
 	}
 
-	if( cmp_after_sb(p_after_sb_2p, mdev->net_conf->after_sb_2p) ) {
+	if ( cmp_after_sb(p_after_sb_2p, mdev->net_conf->after_sb_2p) ) {
 		ERR("incompatible after-sb-2pri settings\n");
 		goto disconnect;
 	}
 
-	if( p_want_lose && mdev->net_conf->want_lose ) {
+	if (p_want_lose && mdev->net_conf->want_lose) {
 		ERR("both sides have the 'want_lose' flag set\n");
 		goto disconnect;
 	}
 
-	if( p_two_primaries != mdev->net_conf->two_primaries ) {
+	if (p_two_primaries != mdev->net_conf->two_primaries) {
 		ERR("incompatible setting of the two-primaries options\n");
 		goto disconnect;
 	}
@@ -2153,14 +2153,14 @@
 	p_size=be64_to_cpu(p->d_size);
 	p_usize=be64_to_cpu(p->u_size);
 
-	if(p_size == 0 && mdev->state.disk == Diskless ) {
+	if (p_size == 0 && mdev->state.disk == Diskless) {
 		ERR("some backing storage is needed\n");
 		drbd_force_state(mdev,NS(conn,Disconnecting));
 		return FALSE;
 	}
 
 #define min_not_zero(l, r) (l == 0) ? r : ((r == 0) ? l : min(l, r))
-	if(inc_local(mdev)) {
+	if (inc_local(mdev)) {
 		warn_if_differ_considerably(mdev, "lower level device sizes",
 			   p_size, drbd_get_capacity(mdev->bc->backing_bdev));
 		warn_if_differ_considerably(mdev, "user requested size",
@@ -2175,14 +2175,14 @@
 
 		my_usize = mdev->bc->dc.disk_size;
 
-		if( mdev->bc->dc.disk_size != p_usize ) {
+		if (mdev->bc->dc.disk_size != p_usize) {
 			mdev->bc->dc.disk_size = p_usize;
 			INFO("Peer sets u_size to %lu KB\n",
 			     (unsigned long)mdev->bc->dc.disk_size);
 		}
 
 		// Never shrink a device with usable data.
-		if(drbd_new_dev_size(mdev,mdev->bc) <
+		if (drbd_new_dev_size(mdev,mdev->bc) <
 		   drbd_get_capacity(mdev->this_bdev) &&
 		   mdev->state.disk >= Outdated ) {
 			dec_local(mdev);
@@ -2196,7 +2196,7 @@
 #undef min_not_zero
 
 	mdev->p_size=p_size;
-	if(inc_local(mdev)) {
+	if (inc_local(mdev)) {
 		drbd_bm_lock(mdev); // {
 		/*
 		 * you may get a flip-flop connection established/connection loss,
@@ -2216,17 +2216,17 @@
 		nconn=drbd_sync_handshake(mdev,mdev->state.peer,mdev->state.pdsk);
 		dec_local(mdev);
 
-		if(nconn == conn_mask) return FALSE;
+		if (nconn == conn_mask) return FALSE;
 
-		if(drbd_request_state(mdev,NS(conn,nconn)) < SS_Success) {
+		if (drbd_request_state(mdev,NS(conn,nconn)) < SS_Success) {
 			drbd_force_state(mdev,NS(conn,Disconnecting));
 			return FALSE;
 		}
 	}
 
-	if(inc_local(mdev)) {
+	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);
 		}
 
@@ -2234,8 +2234,8 @@
 		dec_local(mdev);
 	}
 
-	if (mdev->state.conn > WFReportParams ) {
-		if( be64_to_cpu(p->c_size) !=
+	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...
@@ -2262,7 +2262,7 @@
 		p_uuid[i] = be64_to_cpu(p->uuid[i]);
 	}
 
-	if ( mdev->p_uuid ) kfree(mdev->p_uuid);
+	if (mdev->p_uuid) kfree(mdev->p_uuid);
 	mdev->p_uuid = p_uuid;
 
 	return TRUE;
@@ -2344,7 +2344,7 @@
 	oconn = nconn = mdev->state.conn;
 	spin_unlock_irq(&mdev->req_lock);
 
-	if (nconn == WFReportParams ) nconn = Connected;
+	if (nconn == WFReportParams) nconn = Connected;
 
 	if (mdev->p_uuid && oconn <= Connected &&
 	    peer_state.disk >= Negotiating &&
@@ -2352,31 +2352,31 @@
 		nconn=drbd_sync_handshake(mdev,peer_state.role,peer_state.disk);
 		dec_local(mdev);
 
-		if(nconn == conn_mask) return FALSE;
+		if (nconn == conn_mask) return FALSE;
 	}
 
 	spin_lock_irq(&mdev->req_lock);
-	if( mdev->state.conn != oconn ) goto retry;
+	if (mdev->state.conn != oconn) goto retry;
 	os = mdev->state;
 	ns.i = mdev->state.i;
 	ns.conn = nconn;
 	ns.peer = peer_state.role;
 	ns.pdsk = peer_state.disk;
 	ns.peer_isp = ( peer_state.aftr_isp | peer_state.user_isp );
-	if((nconn == Connected || nconn == WFBitMapS) &&
+	if ((nconn == Connected || nconn == WFBitMapS) &&
 	   ns.disk == Negotiating ) ns.disk = UpToDate;
-	if((nconn == Connected || nconn == WFBitMapT) &&
+	if ((nconn == Connected || nconn == WFBitMapT) &&
 	   ns.pdsk == Negotiating ) ns.pdsk = UpToDate;
 	rv = _drbd_set_state(mdev,ns,ChgStateVerbose | ChgStateHard);
 	spin_unlock_irq(&mdev->req_lock);
 
-	if(rv < SS_Success) {
+	if (rv < SS_Success) {
 		drbd_force_state(mdev,NS(conn,Disconnecting));
 		return FALSE;
 	}
 
-	if (oconn > WFReportParams ) {
-		if( nconn > Connected && peer_state.conn <= Connected) {
+	if (oconn > WFReportParams) {
+		if (nconn > Connected && peer_state.conn <= Connected) {
 			// we want resync, peer has not yet decided to sync...
 			drbd_send_uuids(mdev);
 			drbd_send_state(mdev);
@@ -2614,7 +2614,7 @@
 	drbd_thread_stop(&mdev->asender);
 
 	fp = DontCare;
-	if(inc_local(mdev)) {
+	if (inc_local(mdev)) {
 		fp = mdev->bc->dc.fencing;
 		dec_local(mdev);
 	}
@@ -2665,7 +2665,7 @@
 	drbd_queue_work(&mdev->data.work,&prev_work_done);
 	wait_event(mdev->misc_wait, !test_bit(WORK_PENDING,&mdev->flags));
 
-	if ( mdev->p_uuid ) {
+	if (mdev->p_uuid) {
 		kfree(mdev->p_uuid);
 		mdev->p_uuid = NULL;
 	}
@@ -2679,8 +2679,8 @@
 
 	drbd_md_sync(mdev);
 
-	if ( mdev->state.role == Primary ) {
-		if( fp >= Resource &&
+	if (mdev->state.role == Primary) {
+		if ( fp >= Resource &&
 		    mdev->state.pdsk >= DUnknown ) {
 			drbd_disks_t nps = drbd_try_outdate_peer(mdev);
 			drbd_request_state(mdev,NS(pdsk,nps));
@@ -2689,7 +2689,7 @@
 
 	spin_lock_irq(&mdev->req_lock);
 	os = mdev->state;
-	if ( os.conn >= Unconnected ) {
+	if (os.conn >= Unconnected) {
 		// Do not restart in case we are Disconnecting
 		ns = os;
 		ns.conn = Unconnected;
@@ -2700,20 +2700,20 @@
 		after_state_ch(mdev,os,ns,ChgStateVerbose);
 	}
 
-	if(os.conn == Disconnecting) {
+	if (os.conn == Disconnecting) {
 		wait_event( mdev->misc_wait,atomic_read(&mdev->net_cnt) == 0 );
-		if(mdev->ee_hash) {
+		if (mdev->ee_hash) {
 			kfree(mdev->ee_hash);
 			mdev->ee_hash = NULL;
 			mdev->ee_hash_s = 0;
 		}
 
-		if(mdev->tl_hash) {
+		if (mdev->tl_hash) {
 			kfree(mdev->tl_hash);
 			mdev->tl_hash = NULL;
 			mdev->tl_hash_s = 0;
 		}
-		if(mdev->cram_hmac_tfm) {
+		if (mdev->cram_hmac_tfm) {
 			crypto_free_hash(mdev->cram_hmac_tfm);
 			mdev->cram_hmac_tfm = NULL;
 		}
@@ -2881,7 +2881,7 @@
 
 	rv = crypto_hash_setkey(mdev->cram_hmac_tfm,
 				(u8*)mdev->net_conf->shared_secret, key_len);
-	if(rv) {
+	if (rv) {
 		ERR("crypto_hash_setkey() failed with %d\n",rv);
 		rv = 0;
 		goto fail;
@@ -2902,14 +2902,14 @@
 		goto fail;
 	}
 
-	if (p.length > CHALLENGE_LEN*2 ) {
+	if (p.length > CHALLENGE_LEN*2) {
 		ERR( "expected AuthChallenge payload too big.\n");
 		rv = 0;
 		goto fail;
 	}
 
 	peers_ch = kmalloc(p.length,GFP_KERNEL);
-	if(peers_ch == NULL) {
+	if (peers_ch == NULL) {
 		ERR("kmalloc of peers_ch failed\n");
 		rv = 0;
 		goto fail;
@@ -2925,7 +2925,7 @@
 
 	resp_size = crypto_hash_digestsize(mdev->cram_hmac_tfm);
 	response = kmalloc(resp_size,GFP_KERNEL);
-	if(response == NULL) {
+	if (response == NULL) {
 		ERR("kmalloc of response failed\n");
 		rv = 0;
 		goto fail;
@@ -2936,7 +2936,7 @@
 	sg.length = p.length;
 
 	rv = crypto_hash_digest(&desc, &sg, sg.length, response);
-	if(rv) {
+	if (rv) {
 		ERR( "crypto_hash_digest() failed with %d\n",rv);
 		rv = 0;
 		goto fail;
@@ -2955,7 +2955,7 @@
 		goto fail;
 	}
 
-	if (p.length != resp_size ) {
+	if (p.length != resp_size) {
 		ERR( "expected AuthResponse payload of wrong size\n" );
 		rv = 0;
 		goto fail;
@@ -2970,7 +2970,7 @@
 	}
 
 	right_response = kmalloc(resp_size,GFP_KERNEL);
-	if(response == NULL) {
+	if (response == NULL) {
 		ERR("kmalloc of right_response failed\n");
 		rv = 0;
 		goto fail;
@@ -2981,7 +2981,7 @@
 	sg.length = CHALLENGE_LEN;
 
 	rv = crypto_hash_digest(&desc, &sg, sg.length, right_response);
-	if(rv) {
+	if (rv) {
 		ERR( "crypto_hash_digest() failed with %d\n",rv);
 		rv = 0;
 		goto fail;
@@ -2989,15 +2989,15 @@
 
 	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);
-	if(response) kfree(response);
-	if(right_response) kfree(right_response);
+	if (peers_ch) kfree(peers_ch);
+	if (response) kfree(response);
+	if (right_response) kfree(right_response);
 
 	return rv;
 }
@@ -3019,14 +3019,14 @@
 			drbd_disconnect(mdev);
 			schedule_timeout(HZ);
 		}
-		if( h < 0 ) {
+		if (h < 0) {
 			WARN("Discarding network configuration.\n");
 			drbd_force_state(mdev,NS(conn,Disconnecting));
 		}
 	} while ( h == 0 );
 
-	if( h > 0 ) {
-		if(inc_net(mdev)) {
+	if (h > 0) {
+		if (inc_net(mdev)) {
 			drbdd(mdev);
 			dec_net(mdev);
 		}
@@ -3035,10 +3035,10 @@
 	drbd_disconnect(mdev);
 
 	// Ensure that the thread state fits to our connection state.
-	if( mdev->state.conn == Unconnected ) {
+	if (mdev->state.conn == Unconnected) {
 		ERR_IF( mdev->receiver.t_state != Restarting )
 			drbd_thread_restart_nowait(&mdev->receiver);
-	} else if( mdev->state.conn == StandAlone ) {
+	} else if (mdev->state.conn == StandAlone) {
 		ERR_IF( mdev->receiver.t_state != Exiting )
 			drbd_thread_stop_nowait(&mdev->receiver);
 	}
@@ -3055,7 +3055,7 @@
 
 	int retcode = be32_to_cpu(p->retcode);
 
-	if(retcode >= SS_Success) {
+	if (retcode >= SS_Success) {
 		set_bit(CL_ST_CHG_SUCCESS,&mdev->flags);
 	} else {
 		set_bit(CL_ST_CHG_FAIL,&mdev->flags);
@@ -3090,7 +3090,7 @@
 
 	update_peer_seq(mdev,be32_to_cpu(p->seq_num));
 
-	if( is_syncer_block_id(p->block_id)) {
+	if ( is_syncer_block_id(p->block_id)) {
 		drbd_set_in_sync(mdev,sector,blksize);
 		dec_rs_pending(mdev);
 	} else {
@@ -3144,7 +3144,7 @@
 
 	update_peer_seq(mdev,be32_to_cpu(p->seq_num));
 
-	if(is_syncer_block_id(p->block_id)) {
+	if (is_syncer_block_id(p->block_id)) {
 		sector_t sector = be64_to_cpu(p->sector);
 		int size = be32_to_cpu(p->blksize);
 
@@ -3206,7 +3206,7 @@
 
 	dec_rs_pending(mdev);
 
-	if(inc_local_if_state(mdev,Failed)) {
+	if (inc_local_if_state(mdev,Failed)) {
 		drbd_rs_complete_io(mdev,sector);
 		drbd_rs_failed_io(mdev, sector, size);
 		dec_local(mdev);
@@ -3277,7 +3277,7 @@
 			spin_lock_irq(&mdev->req_lock);
 			empty = list_empty(&mdev->done_ee);
 			spin_unlock_irq(&mdev->req_lock);
-			if(empty) break;
+			if (empty) break;
 			clear_bit(SIGNAL_ASENDER, &mdev->flags);
 			flush_signals(current);
 		}
@@ -3308,7 +3308,7 @@
 			ERR("meta connection shut down by peer.\n");
 			goto err;
 		} else if (rv == -EAGAIN) {
-			if( mdev->meta.socket->sk->sk_rcvtimeo ==
+			if ( mdev->meta.socket->sk->sk_rcvtimeo ==
 			    mdev->net_conf->ping_timeo*HZ/10 ) {
 				ERR("PingAck did not arrive in time.\n");
 				goto err;
@@ -3322,7 +3322,7 @@
 			goto err;
 		}
 
-		if (received == expect && cmd == -1 ) {
+		if (received == expect && cmd == -1) {
 			cmd = be16_to_cpu(h->command);
 			len = be16_to_cpu(h->length);
 			if (unlikely( h->magic != BE_DRBD_MAGIC )) {
@@ -3337,10 +3337,10 @@
 				DUMPI(expect);
 			}
 		}
-		if(received == expect) {
+		if (received == expect) {
 			D_ASSERT(cmd != -1);
 			dump_packet(mdev,mdev->meta.socket,1,(void*)h, __FILE__, __LINE__);
-			if(!asender_tbl[cmd].process(mdev,h)) goto err;
+			if (!asender_tbl[cmd].process(mdev,h)) goto err;
 
 			buf      = h;
 			received = 0;
@@ -3349,7 +3349,7 @@
 		}
 	} //while
 
-	if(0) {
+	if (0) {
 	err:
 		clear_bit(SIGNAL_ASENDER, &mdev->flags);
 		if (mdev->state.conn >= Connected)

Modified: branches/drbd-8.0-for-linus/drbd/drbd_req.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 08:47:36 UTC (rev 2983)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 09:44:10 UTC (rev 2984)
@@ -127,7 +127,7 @@
 			drbd_set_out_of_sync(mdev,req->sector,req->size);
 		}
 
-		if( (s & RQ_NET_OK) && (s & RQ_LOCAL_OK) &&
+		if ( (s & RQ_NET_OK) && (s & RQ_LOCAL_OK) &&
 		    (s & RQ_NET_SIS) ) {
 			drbd_set_in_sync(mdev,req->sector,req->size);
 		}
@@ -388,7 +388,7 @@
 		}
 	}
 
-	if(mdev->ee_hash_s) {
+	if (mdev->ee_hash_s) {
 		/* now, check for overlapping requests with remote origin */
 		BUG_ON(mdev->ee_hash == NULL);
 #undef OVERLAPS
@@ -589,7 +589,7 @@
 
 		/* mark the current epoch as closed,
 		 * in case it outgrew the limit */
-		if( ++mdev->newest_barrier->n_req >= mdev->net_conf->max_epoch_size )
+		if (++mdev->newest_barrier->n_req >= mdev->net_conf->max_epoch_size)
 			set_bit(ISSUE_BARRIER,&mdev->flags);
 
 		D_ASSERT(req->rq_state & RQ_NET_PENDING);
@@ -871,7 +871,7 @@
 	{
   allocate_barrier:
 		b = kmalloc(sizeof(struct drbd_barrier),GFP_NOIO);
-		if(!b) {
+		if (!b) {
 			ERR("Failed to alloc barrier.");
 			err = -ENOMEM;
 			goto fail_and_free_req;
@@ -1076,7 +1076,7 @@
 	}
 
 	/* Currently our BARRIER code is disabled. */
-	if(unlikely(bio_barrier(bio))) {
+	if (unlikely(bio_barrier(bio))) {
 		bio_endio(bio, bio->bi_size, -EOPNOTSUPP);
 		return 0;
 	}
@@ -1094,7 +1094,7 @@
 	s_enr = bio->bi_sector >> HT_SHIFT;
 	e_enr = (bio->bi_sector+(bio->bi_size>>9)-1) >> HT_SHIFT;
 
-	if(unlikely(s_enr != e_enr)) {
+	if (unlikely(s_enr != e_enr)) {
 	if (bio->bi_vcnt != 1 || bio->bi_idx != 0) {
 		/* rather error out here than BUG in bio_split */
 		ERR("bio would need to, but cannot, be split: "
@@ -1159,7 +1159,7 @@
 		if (limit <= bvec->bv_len) limit = bvec->bv_len;
 	} else if (limit && inc_local(mdev)) {
 		request_queue_t * const b = mdev->bc->backing_bdev->bd_disk->queue;
-		if(b->merge_bvec_fn && mdev->bc->dc.use_bmbv) {
+		if (b->merge_bvec_fn && mdev->bc->dc.use_bmbv) {
 			backing_limit = b->merge_bvec_fn(b,bio,bvec);
 			limit = min(limit,backing_limit);
 		}

Modified: branches/drbd-8.0-for-linus/drbd/drbd_worker.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 08:47:36 UTC (rev 2983)
+++ branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 09:44:10 UTC (rev 2984)
@@ -102,7 +102,7 @@
 	spin_lock_irqsave(&mdev->req_lock,flags);
 	mdev->read_cnt += e->size >> 9;
 	list_del(&e->w.list);
-	if(list_empty(&mdev->read_ee)) wake_up(&mdev->ee_wait);
+	if (list_empty(&mdev->read_ee)) wake_up(&mdev->ee_wait);
 	spin_unlock_irqrestore(&mdev->req_lock,flags);
 
 	drbd_chk_io_error(mdev,error,FALSE);
@@ -169,7 +169,7 @@
 	 * done from "drbd_process_done_ee" within the appropriate w.cb
 	 * (e_end_block/e_end_resync_block) or from _drbd_clear_done_ee */
 
-	if(!is_syncer_req) mdev->epoch_size++;
+	if (!is_syncer_req) mdev->epoch_size++;
 
 	do_wake = is_syncer_req
 		? list_empty(&mdev->sync_ee)
@@ -240,10 +240,10 @@
 	 * when it is done and had a local write error, see comments there */
 	drbd_req_free(req);
 
-	if(unlikely(cancel)) return 1;
+	if (unlikely(cancel)) return 1;
 
 	ok = drbd_io_error(mdev, FALSE);
-	if(unlikely(!ok)) ERR("Sending in w_io_error() failed\n");
+	if (unlikely(!ok)) ERR("Sending in w_io_error() failed\n");
 	return ok;
 }
 
@@ -285,7 +285,7 @@
 
 	spin_lock_irqsave(&mdev->req_lock,flags);
 
-	if(likely(!test_and_clear_bit(STOP_SYNC_TIMER,&mdev->flags))) {
+	if (likely(!test_and_clear_bit(STOP_SYNC_TIMER,&mdev->flags))) {
 		queue=1;
 		mdev->resync_work.cb = w_make_resync_request;
 	} else {
@@ -296,7 +296,7 @@
 	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);
 	}
 }
@@ -314,9 +314,9 @@
 
 	PARANOIA_BUG_ON(w != &mdev->resync_work);
 
-	if(unlikely(cancel)) return 1;
+	if (unlikely(cancel)) return 1;
 
-	if(unlikely(mdev->state.conn < Connected)) {
+	if (unlikely(mdev->state.conn < Connected)) {
 		ERR("Confused in w_make_resync_request()! cstate < Connected");
 		return 0;
 	}
@@ -332,7 +332,7 @@
 	}
 	number -= atomic_read(&mdev->rs_pending_cnt);
 
-	if(!inc_local(mdev)) {
+	if (!inc_local(mdev)) {
 		/* Since we only need to access mdev->rsync a
 		   inc_local_if_state(mdev,Failed) would be sufficient, but
 		   to continue resync with a broken disk makes no sense at
@@ -405,7 +405,7 @@
 				break;
 			bit++;
 			size += BM_BLOCK_SIZE;
-			if( (BM_BLOCK_SIZE<<align) <= size) align++;
+			if ( (BM_BLOCK_SIZE<<align) <= size) align++;
 			i++;
 		}
 		/* if we merged some,
@@ -417,7 +417,7 @@
 		/* adjust very last sectors, in case we are oddly sized */
 		if (sector + (size>>9) > capacity) size = (capacity-sector)<<9;
 		inc_rs_pending(mdev);
-		if(!drbd_send_drequest(mdev,RSDataRequest,
+		if (!drbd_send_drequest(mdev,RSDataRequest,
 				       sector,size,ID_SYNCER)) {
 			ERR("drbd_send_drequest() failed, aborting...\n");
 			dec_rs_pending(mdev);
@@ -426,7 +426,7 @@
 		}
 	}
 
-	if(drbd_bm_rs_done(mdev)) {
+	if (drbd_bm_rs_done(mdev)) {
 		/* last syncer _request_ was sent,
 		 * but the RSDataReply not yet received.  sync will end (and
 		 * next sync group will resume), as soon as we receive the last
@@ -464,7 +464,7 @@
 	// 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)) {
+	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
@@ -474,7 +474,7 @@
 		set_current_state(TASK_INTERRUPTIBLE);
 		schedule_timeout(HZ / 10);
 		w = kmalloc(sizeof(struct drbd_work), GFP_ATOMIC);
-		if(w) {
+		if (w) {
 			w->cb = w_resync_finished;
 			drbd_queue_work(&mdev->data.work,w);
 			return 1;
@@ -508,7 +508,7 @@
 
 		if (mdev->state.conn == SyncTarget ||
 		    mdev->state.conn == PausedSyncT) {
-			if( mdev->p_uuid ) {
+			if (mdev->p_uuid) {
 				int i;
 				for ( i=Bitmap ; i<=History_end ; i++ ) {
 					_drbd_uuid_set(mdev,i,mdev->p_uuid[i]);
@@ -522,7 +522,7 @@
 
 		drbd_uuid_set_bm(mdev,0UL);
 
-		if ( mdev->p_uuid ) {
+		if (mdev->p_uuid) {
 			// Now the two UUID sets are equal, update what we
 			// know of the peer.
 			int i;
@@ -560,13 +560,13 @@
 	struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
 	int ok;
 
-	if(unlikely(cancel)) {
+	if (unlikely(cancel)) {
 		drbd_free_ee(mdev,e);
 		dec_unacked(mdev);
 		return 1;
 	}
 
-	if(likely(drbd_bio_uptodate(e->private_bio))) {
+	if (likely(drbd_bio_uptodate(e->private_bio))) {
 		ok=drbd_send_block(mdev, DataReply, e);
 	} else {
 		if (DRBD_ratelimit(5*HZ,5))
@@ -584,7 +584,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 {
@@ -592,7 +592,7 @@
 	}
 	spin_unlock_irq(&mdev->req_lock);
 
-	if(unlikely(!ok)) ERR("drbd_send_block() failed\n");
+	if (unlikely(!ok)) ERR("drbd_send_block() failed\n");
 	return ok;
 }
 
@@ -604,18 +604,18 @@
 	struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
 	int ok;
 
-	if(unlikely(cancel)) {
+	if (unlikely(cancel)) {
 		drbd_free_ee(mdev,e);
 		dec_unacked(mdev);
 		return 1;
 	}
 
-	if(inc_local_if_state(mdev,Failed)) {
+	if (inc_local_if_state(mdev,Failed)) {
 		drbd_rs_complete_io(mdev,e->sector);
 		dec_local(mdev);
 	}
 
-	if(likely(drbd_bio_uptodate(e->private_bio))) {
+	if (likely(drbd_bio_uptodate(e->private_bio))) {
 		if (likely( mdev->state.pdsk >= Inconsistent )) {
 			inc_rs_pending(mdev);
 			ok=drbd_send_block(mdev, RSDataReply, e);
@@ -640,7 +640,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 {
@@ -648,7 +648,7 @@
 	}
 	spin_unlock_irq(&mdev->req_lock);
 
-	if(unlikely(!ok)) ERR("drbd_send_block() failed\n");
+	if (unlikely(!ok)) ERR("drbd_send_block() failed\n");
 	return ok;
 }
 
@@ -730,7 +730,7 @@
 	ok = drbd_send_drequest(mdev, DataRequest, req->sector, req->size,
 				(unsigned long)req);
 
-	if(ok) {
+	if (ok) {
 		req_mod(req, handed_over_to_network, 0);
 	} else {
 		/* ?? we set Timeout or BrokenPipe in drbd_send() */
@@ -752,7 +752,7 @@
 
 	local_irq_disable();
 	for (i=0; i < minor_count; i++) {
-		if(!(mdev = minor_to_mdev(i))) continue;
+		if (!(mdev = minor_to_mdev(i))) continue;
 		spin_lock(&mdev->req_lock);
 	}
 }
@@ -763,7 +763,7 @@
 	int i;
 
 	for (i=0; i < minor_count; i++) {
-		if(!(mdev = minor_to_mdev(i))) continue;
+		if (!(mdev = minor_to_mdev(i))) continue;
 		spin_unlock(&mdev->req_lock);
 	}
 	local_irq_enable();
@@ -774,10 +774,10 @@
 	drbd_dev *odev = mdev;
 
 	while(1) {
-		if( odev->sync_conf.after == -1 ) return 1;
+		if (odev->sync_conf.after == -1) return 1;
 		odev = minor_to_mdev(odev->sync_conf.after);
 		ERR_IF(!odev) return 1;
-		if( (odev->state.conn >= SyncSource &&
+		if ( (odev->state.conn >= SyncSource &&
 		     odev->state.conn <= PausedSyncT) ||
 		    odev->state.aftr_isp || odev->state.peer_isp ||
 		    odev->state.user_isp ) return 0;
@@ -796,7 +796,7 @@
 	int i, rv = 0;
 
 	for (i=0; i < minor_count; i++) {
-		if( !(odev = minor_to_mdev(i)) ) continue;
+		if ( !(odev = minor_to_mdev(i)) ) continue;
 		if (! _drbd_may_sync_now(odev)) {
 			rv |= ( _drbd_set_state(_NS(odev,aftr_isp,1),
 						ChgStateHard|ScheduleAfter)
@@ -819,8 +819,8 @@
 	int i, rv = 0;
 
 	for (i=0; i < minor_count; i++) {
-		if( !(odev = minor_to_mdev(i)) ) continue;
-		if ( odev->state.aftr_isp ) {
+		if ( !(odev = minor_to_mdev(i)) ) continue;
+		if (odev->state.aftr_isp) {
 			if (_drbd_may_sync_now(odev)) {
 				rv |= ( _drbd_set_state(_NS(odev,aftr_isp,0),
 							ChgStateHard|ScheduleAfter)
@@ -883,7 +883,7 @@
 	/* In case a previous resync run was aborted by an IO error... */
 	drbd_rs_cancel_all(mdev);
 
-	if(side == SyncTarget) {
+	if (side == SyncTarget) {
 		drbd_bm_reset_find(mdev);
 	} else /* side == SyncSource */ {
 		u64 uuid;
@@ -902,7 +902,7 @@
 
 	ns.conn = side;
 
-	if(side == SyncTarget) {
+	if (side == SyncTarget) {
 		ns.disk = Inconsistent;
 	} else /* side == SyncSource */ {
 		ns.pdsk = Inconsistent;
@@ -911,7 +911,7 @@
 	r = _drbd_set_state(mdev,ns,ChgStateVerbose);
 	ns = mdev->state;
 
-	if ( r == SS_Success ) {
+	if (r == SS_Success) {
 		mdev->rs_total     =
 		mdev->rs_mark_left = drbd_bm_total_weight(mdev);
 		mdev->rs_failed    = 0;
@@ -922,7 +922,7 @@
 	}
 	drbd_global_unlock();
 
-	if ( r == SS_Success ) {
+	if (r == SS_Success) {
 		after_state_ch(mdev,os,ns,ChgStateVerbose);
 
 		INFO("Began resync as %s (will sync %lu KB [%lu bits set]).\n",
@@ -930,12 +930,12 @@
 		     (unsigned long) mdev->rs_total << (BM_BLOCK_SIZE_B-10),
 		     (unsigned long) mdev->rs_total);
 
-		if ( mdev->rs_total == 0 ) {
+		if (mdev->rs_total == 0) {
 			drbd_resync_finished(mdev);
 			return;
 		}
 
-		if( ns.conn == SyncTarget ) {
+		if (ns.conn == SyncTarget) {
 			D_ASSERT(!test_bit(STOP_SYNC_TIMER,&mdev->flags));
 			mod_timer(&mdev->resync_timer,jiffies);
 		}
@@ -955,15 +955,15 @@
 
 	while (get_t_state(thi) == Running) {
 
-		if(down_trylock(&mdev->data.work.s)) {
+		if (down_trylock(&mdev->data.work.s)) {
 			down(&mdev->data.mutex);
-			if(mdev->data.socket)drbd_tcp_flush(mdev->data.socket);
+			if (mdev->data.socket)drbd_tcp_flush(mdev->data.socket);
 			up(&mdev->data.mutex);
 
 			intr = down_interruptible(&mdev->data.work.s);
 
 			down(&mdev->data.mutex);
-			if(mdev->data.socket) drbd_tcp_cork(mdev->data.socket);
+			if (mdev->data.socket) drbd_tcp_cork(mdev->data.socket);
 			up(&mdev->data.mutex);
 		}
 
@@ -1001,7 +1001,7 @@
 		list_del_init(&w->list);
 		spin_unlock_irq(&mdev->data.work.q_lock);
 
-		if(!w->cb(mdev,w, mdev->state.conn < Connected )) {
+		if (!w->cb(mdev,w, mdev->state.conn < Connected )) {
 			//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 08:47:36 UTC (rev 2983)
+++ branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-24 09:44:10 UTC (rev 2984)
@@ -137,7 +137,7 @@
 /* XXX the check on !blk_queue_plugged is redundant,
  * implicitly checked in blk_plug_device */
 
-	if(!blk_queue_plugged(q)) {
+	if (!blk_queue_plugged(q)) {
 		blk_plug_device(q);
 		del_timer(&q->unplug_timer);
 		// unplugging should not happen automatically...

Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 08:47:36 UTC (rev 2983)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 09:44:10 UTC (rev 2984)
@@ -215,7 +215,7 @@
 	BUG_ON(!lc->nr_elements);
 
 	PARANOIA_ENTRY();
-	if ( lc->flags & LC_STARVING ) {
+	if (lc->flags & LC_STARVING) {
 		++lc->starving;
 		RETURN(NULL);
 	}
@@ -223,7 +223,7 @@
 	e = lc_find(lc, enr);
 	if (e) {
 		++lc->hits;
-		if( e->refcnt++ == 0) lc->used++;
+		if (e->refcnt++ == 0) lc->used++;
 		list_move(&e->list,&lc->in_use); // Not evictable...
 		RETURN(e);
 	}
@@ -233,7 +233,7 @@
 	/* In case there is nothing available and we can not kick out
 	 * the LRU element, we have to wait ...
 	 */
-	if(!lc_unused_element_available(lc)) {
+	if (!lc_unused_element_available(lc)) {
 		__set_bit(__LC_STARVING,&lc->flags);
 		RETURN(NULL);
 	}
@@ -272,7 +272,7 @@
 	BUG_ON(!lc->nr_elements);
 
 	PARANOIA_ENTRY();
-	if ( lc->flags & LC_STARVING ) {
+	if (lc->flags & LC_STARVING) {
 		++lc->starving;
 		RETURN(NULL);
 	}
@@ -280,7 +280,7 @@
 	e = lc_find(lc, enr);
 	if (e) {
 		++lc->hits;
-		if( e->refcnt++ == 0) lc->used++;
+		if (e->refcnt++ == 0) lc->used++;
 		list_move(&e->list,&lc->in_use); // Not evictable...
 	}
 	RETURN(e);
@@ -311,7 +311,7 @@
 	PARANOIA_ENTRY();
 	BUG_ON(e->refcnt == 0);
 	BUG_ON(e == lc->changing_element);
-	if ( --e->refcnt == 0) {
+	if (--e->refcnt == 0) {
 		list_move(&e->list,&lc->lru); // move it to the front of LRU.
 		lc->used--;
 		clear_bit(__LC_STARVING,&lc->flags);
@@ -332,7 +332,7 @@
 {
 	struct lc_element *e;
 
-	if ( index < 0 || index >= lc->nr_elements ) return;
+	if (index < 0 || index >= lc->nr_elements) return;
 
 	e = lc_entry(lc,index);
 	e->lc_number = enr;
@@ -356,7 +356,7 @@
 	seq_printf(seq,"\tnn: lc_number refcnt %s\n ",utext);
 	for(i=0;i<nr_elements;i++) {
 		e = lc_entry(lc,i);
-		if( e->lc_number == LC_FREE ) {
+		if (e->lc_number == LC_FREE) {
 			seq_printf(seq,"\t%2d: FREE\n",i );
 		} else {
 			seq_printf(seq,"\t%2d: %4u %4u    ", i,

From drbd-cvs at lists.linbit.com  Tue Jul 24 13:38:08 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 13:38:14 2007
Subject: [DRBD-cvs] svn commit by lars - r2985 - in
	branches/drbd-8.0-for-linus/drbd: . linux -
	293bfdba51982d69e720fe2bd371084f731b390f ..., ... => ...
Message-ID: <20070724113808.4029740095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 13:38:05 +0200 (Tue, 24 Jul 2007)
New Revision: 2985

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_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_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:
293bfdba51982d69e720fe2bd371084f731b390f ...,... => ..., ...
(comma spacing)


Modified: branches/drbd-8.0-for-linus/drbd/drbd_actlog.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 11:38:05 UTC (rev 2985)
@@ -53,7 +53,7 @@
 
 	if (FAULT_ACTIVE(mdev, (rw & WRITE)? DRBD_FAULT_MD_WR:DRBD_FAULT_MD_RD)) {
 		bio->bi_rw |= rw;
-		bio_endio(bio,bio->bi_size,-EIO);
+		bio_endio(bio, bio->bi_size, -EIO);
 	}
 	else {
 #ifdef BIO_RW_SYNC
@@ -73,13 +73,13 @@
 int drbd_md_sync_page_io(drbd_dev *mdev, struct drbd_backing_dev *bdev,
 			 sector_t sector, int rw)
 {
-	int hardsect,mask,ok,offset=0;
+	int hardsect, mask, ok, offset=0;
 	struct page *iop = mdev->md_io_page;
 
 	D_ASSERT(semaphore_is_locked(&mdev->md_io_mutex));
 
 	if (!bdev->md_bdev) {
-		if (DRBD_ratelimit(5*HZ,5)) {
+		if (DRBD_ratelimit(5*HZ, 5)) {
 			ERR("bdev->md_bdev==NULL\n");
 			dump_stack();
 		}
@@ -113,8 +113,8 @@
 			void *p = page_address(mdev->md_io_page);
 			void *hp = page_address(mdev->md_io_tmpp);
 
-			ok = _drbd_md_sync_page_io(mdev, bdev,iop,
-						   sector,READ,hardsect);
+			ok = _drbd_md_sync_page_io(mdev, bdev, iop,
+						   sector, READ, hardsect);
 
 			if (unlikely(!ok)) {
 				ERR("drbd_md_sync_page_io(,%llus,READ [hardsect!=512]) failed!\n",
@@ -138,10 +138,10 @@
 		     (unsigned long long)sector, rw ? "WRITE" : "READ");
 	}
 
-	ok = _drbd_md_sync_page_io(mdev, bdev,iop,sector,rw,hardsect);
+	ok = _drbd_md_sync_page_io(mdev, bdev, iop, sector, rw, hardsect);
 	if (unlikely(!ok)) {
 		ERR("drbd_md_sync_page_io(,%llus,%s) failed!\n",
-		    (unsigned long long)sector,rw ? "WRITE" : "READ");
+		    (unsigned long long)sector, rw ? "WRITE" : "READ");
 		return 0;
 	}
 
@@ -192,15 +192,15 @@
 	unsigned long     al_flags=0;
 
 	spin_lock_irq(&mdev->al_lock);
-	bm_ext = (struct bm_extent*) lc_find(mdev->resync,enr/AL_EXT_PER_BM_SECT);
+	bm_ext = (struct bm_extent*) lc_find(mdev->resync, enr/AL_EXT_PER_BM_SECT);
 	if (unlikely(bm_ext!=NULL)) {
-		if (test_bit(BME_NO_WRITES,&bm_ext->flags)) {
+		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;
 		}
 	}
-	al_ext   = lc_get(mdev->act_log,enr);
+	al_ext   = lc_get(mdev->act_log, enr);
 	al_flags = mdev->act_log->flags;
 	spin_unlock_irq(&mdev->al_lock);
 
@@ -227,13 +227,13 @@
 
 	D_ASSERT(atomic_read(&mdev->local_cnt)>0);
 
-	MTRACE(TraceTypeALExts,TraceLvlMetrics,
+	MTRACE(TraceTypeALExts, TraceLvlMetrics,
 	       INFO("al_begin_io( sec=%llus (al_enr=%u) (rs_enr=%d) )\n",
 		    (unsigned long long) sector, enr, 
 		    (int)BM_SECT_TO_EXT(sector));
 	       );
 
-	wait_event(mdev->al_wait, (al_ext = _al_get(mdev,enr)) );
+	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.
@@ -254,7 +254,7 @@
 		al_work.al_ext = al_ext;
 		al_work.enr = enr;
 		al_work.w.cb = w_al_write_transaction;
-		drbd_queue_work_front(&mdev->data.work,&al_work.w);
+		drbd_queue_work_front(&mdev->data.work, &al_work.w);
 		wait_for_completion(&al_work.event);
 
 		mdev->al_writ_cnt++;
@@ -264,7 +264,7 @@
 		DUMPI(mdev->act_log->new_number);
 		*/
 		spin_lock_irq(&mdev->al_lock);
-		lc_changed(mdev->act_log,al_ext);
+		lc_changed(mdev->act_log, al_ext);
 		spin_unlock_irq(&mdev->al_lock);
 		wake_up(&mdev->al_wait);
 	}
@@ -276,33 +276,33 @@
 	struct lc_element *extent;
 	unsigned long flags;
 
-	MTRACE(TraceTypeALExts,TraceLvlMetrics,
+	MTRACE(TraceTypeALExts, TraceLvlMetrics,
 	       INFO("al_complete_io( sec=%llus (al_enr=%u) (rs_enr=%d) )\n",
 		    (unsigned long long) sector, enr, 
 		    (int)BM_SECT_TO_EXT(sector));
 	       );
 
-	spin_lock_irqsave(&mdev->al_lock,flags);
+	spin_lock_irqsave(&mdev->al_lock, flags);
 
-	extent = lc_find(mdev->act_log,enr);
+	extent = lc_find(mdev->act_log, enr);
 
 	if (!extent) {
-		spin_unlock_irqrestore(&mdev->al_lock,flags);
-		ERR("al_complete_io() called on inactive extent %u\n",enr);
+		spin_unlock_irqrestore(&mdev->al_lock, flags);
+		ERR("al_complete_io() called on inactive extent %u\n", enr);
 		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);
+	spin_unlock_irqrestore(&mdev->al_lock, flags);
 }
 
 STATIC int
 w_al_write_transaction(struct Drbd_Conf *mdev, struct drbd_work *w, int unused)
 {
-	int i,n,mx;
+	int i, n, mx;
 	unsigned int extent_nr;
 	struct al_transaction* buffer;
 	sector_t sector;
@@ -323,12 +323,12 @@
 	buffer->updates[0].extent = cpu_to_be32(new_enr);
 
 #if 0	/* Use this printf with the test_al.pl program */
-	ERR("T%03d S%03d=E%06d\n", mdev->al_tr_number,n,new_enr);
+	ERR("T%03d S%03d=E%06d\n", mdev->al_tr_number, n, new_enr);
 #endif
 
 	xor_sum ^= new_enr;
 
-	mx = min_t(int,AL_EXTENTS_PT,
+	mx = min_t(int, AL_EXTENTS_PT,
 		   mdev->act_log->nr_elements - mdev->al_tr_cycle);
 	for(i=0;i<mx;i++) {
 		extent_nr = lc_entry(mdev->act_log,
@@ -351,12 +351,12 @@
 // 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)) {
+	if (!drbd_md_sync_page_io(mdev, mdev->bc, sector, WRITE)) {
 		drbd_chk_io_error(mdev, 1, TRUE);
 		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);
@@ -381,12 +381,12 @@
 			   int index)
 {
 	sector_t sector;
-	int rv,i;
+	int rv, i;
 	u32 xor_sum=0;
 
 	sector = bdev->md.md_offset + bdev->md.al_offset + index;
 
-	if (!drbd_md_sync_page_io(mdev,bdev,sector,READ)) {
+	if (!drbd_md_sync_page_io(mdev, bdev, sector, READ)) {
 		// Dont process error normally as this is done before
 		// disk is atached!
 		return -1;
@@ -407,16 +407,16 @@
  * representation. Returns 1 on success, returns 0 when
  * reading the log failed due to IO errors.
  */
-int drbd_al_read_log(struct Drbd_Conf *mdev,struct drbd_backing_dev *bdev)
+int drbd_al_read_log(struct Drbd_Conf *mdev, struct drbd_backing_dev *bdev)
 {
 	struct al_transaction* buffer;
-	int from=-1,to=-1,i,cnr, overflow=0,rv;
+	int from=-1, to=-1, i, cnr, overflow=0, rv;
 	u32 from_tnr=-1, to_tnr=0;
 	int active_extents=0;
 	int transactions=0;
 	int mx;
 
-	mx = div_ceil(mdev->act_log->nr_elements,AL_EXTENTS_PT);
+	mx = div_ceil(mdev->act_log->nr_elements, AL_EXTENTS_PT);
 
 	/* lock out all other meta data io for now,
 	 * and make sure the page is mapped.
@@ -426,7 +426,7 @@
 
 	// Find the valid transaction in the log
 	for(i=0;i<=mx;i++) {
-		rv = drbd_al_read_tr(mdev,bdev,buffer,i);
+		rv = drbd_al_read_tr(mdev, bdev, buffer, i);
 		if (rv == 0) continue;
 		if (rv == -1) {
 			up(&mdev->md_io_mutex);
@@ -461,11 +461,11 @@
 	 */
 	i=from;
 	while(1) {
-		int j,pos;
+		int j, pos;
 		unsigned int extent_nr;
 		unsigned int trn;
 
-		rv = drbd_al_read_tr(mdev,bdev,buffer,i);
+		rv = drbd_al_read_tr(mdev, bdev, buffer, i);
 		ERR_IF(rv == 0) goto cancel;
 		if (rv == -1) {
 			up(&mdev->md_io_mutex);
@@ -487,7 +487,7 @@
 			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);
+			lc_set(mdev->act_log, extent_nr, pos);
 			active_extents++;
 		}
 		spin_unlock_irq(&mdev->al_lock);
@@ -502,7 +502,7 @@
 
 	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;
 	}
 
@@ -510,7 +510,7 @@
 	up(&mdev->md_io_mutex);
 
 	INFO("Found %d transactions (%d active extents) in activity log.\n",
-	     transactions,active_extents);
+	     transactions, active_extents);
 
 	return 1;
 }
@@ -527,7 +527,7 @@
 	struct drbd_atodb_wait *wc = bio->bi_private;
 	struct Drbd_Conf *mdev=wc->mdev;
 	struct page *page;
-	int uptodate = bio_flagged(bio,BIO_UPTODATE);
+	int uptodate = bio_flagged(bio, BIO_UPTODATE);
 
 	if (bio->bi_size) return 1;
 	if (!error && !uptodate) {
@@ -538,7 +538,7 @@
 		error = -EIO;
 	}
 
-	drbd_chk_io_error(mdev,error,TRUE);
+	drbd_chk_io_error(mdev, error, TRUE);
 	if (error && wc->error == 0) wc->error=error;
 
 	if (atomic_dec_and_test(&wc->count)) {
@@ -564,7 +564,7 @@
 			     unsigned int enr,
 			     struct drbd_atodb_wait *wc)
 {
-	int i=0,allocated_page=0;
+	int i=0, allocated_page=0;
 	struct bio *bio;
 	struct page *np;
 	sector_t on_disk_sector = enr + mdev->bc->md.md_offset + mdev->bc->md.bm_offset;
@@ -595,7 +595,7 @@
 
 	offset = S2W(enr);
 	drbd_bm_get_lel( mdev, offset, 
-			 min_t(size_t,S2W(1), drbd_bm_words(mdev) - offset),
+			 min_t(size_t, S2W(1), drbd_bm_words(mdev) - offset),
 			 kmap(*page) + *page_offset );
 	kunmap(*page);
 
@@ -636,7 +636,7 @@
 	unsigned int page_offset=PAGE_SIZE;
 	struct drbd_atodb_wait wc;
 
-	ERR_IF (!inc_local_if_state(mdev,Attaching))
+	ERR_IF (!inc_local_if_state(mdev, Attaching))
 		return; /* sorry, I don't have any act_log etc... */
 
 	wait_event(mdev->al_wait, lc_try_lock(mdev->act_log));
@@ -646,16 +646,16 @@
 	bios = kzalloc(sizeof(struct bio*) * nr_elements, GFP_KERNEL);
 	if (!bios) goto submit_one_by_one;
 
-	atomic_set(&wc.count,0);
+	atomic_set(&wc.count, 0);
 	init_completion(&wc.io_done);
 	wc.mdev = mdev;
 	wc.error = 0;
 
 	for(i=0;i<nr_elements;i++) {
-		enr = lc_entry(mdev->act_log,i)->lc_number;
+		enr = lc_entry(mdev->act_log, i)->lc_number;
 		if (enr == LC_FREE) continue;
 		/* next statement also does atomic_inc wc.count */
-		if (atodb_prepare_unless_covered(mdev,bios,&page,
+		if (atodb_prepare_unless_covered(mdev, bios, &page,
 						&page_offset,
 						enr/AL_EXT_PER_BM_SECT,
 						&wc))
@@ -671,7 +671,7 @@
 		if (bios[i]==NULL) break;
 		if (FAULT_ACTIVE( mdev, DRBD_FAULT_MD_WR )) {
 			bios[i]->bi_rw = WRITE;
-			bio_endio(bios[i],bios[i]->bi_size,-EIO);
+			bio_endio(bios[i], bios[i]->bi_size, -EIO);
 		} else {
 			submit_bio(WRITE, bios[i]);
 		}
@@ -707,7 +707,7 @@
 	WARN("Using the slow drbd_al_to_on_disk_bm()\n");
 
 	for(i=0;i<mdev->act_log->nr_elements;i++) {
-		enr = lc_entry(mdev->act_log,i)->lc_number;
+		enr = lc_entry(mdev->act_log, i)->lc_number;
 		if (enr == LC_FREE) continue;
 		/* Really slow: if we have al-extents 16..19 active,
 		 * sector 4 will be written four times! Synchronous! */
@@ -733,7 +733,7 @@
 	wait_event(mdev->al_wait, lc_try_lock(mdev->act_log));
 
 	for(i=0;i<mdev->act_log->nr_elements;i++) {
-		enr = lc_entry(mdev->act_log,i)->lc_number;
+		enr = lc_entry(mdev->act_log, i)->lc_number;
 		if (enr == LC_FREE) continue;
 		add += drbd_bm_ALe_set_all(mdev, enr);
 	}
@@ -742,16 +742,16 @@
 	wake_up(&mdev->al_wait);
 
 	INFO("Marked additional %s as out-of-sync based on AL.\n",
-	     ppsize(ppb,Bit2KB(add)));
+	     ppsize(ppb, Bit2KB(add)));
 }
 
-static inline int _try_lc_del(struct Drbd_Conf *mdev,struct lc_element *al_ext)
+static inline int _try_lc_del(struct Drbd_Conf *mdev, struct lc_element *al_ext)
 {
 	int rv;
 
 	spin_lock_irq(&mdev->al_lock);
 	rv = (al_ext->refcnt == 0);
-	if (likely(rv)) lc_del(mdev->act_log,al_ext);
+	if (likely(rv)) lc_del(mdev->act_log, al_ext);
 	spin_unlock_irq(&mdev->al_lock);
 
 	if (unlikely(!rv)) INFO("Waiting for extent in drbd_al_shrink()\n");
@@ -769,12 +769,12 @@
 	struct lc_element *al_ext;
 	int i;
 
-	D_ASSERT( test_bit(__LC_DIRTY,&mdev->act_log->flags) );
+	D_ASSERT( test_bit(__LC_DIRTY, &mdev->act_log->flags) );
 
 	for(i=0;i<mdev->act_log->nr_elements;i++) {
-		al_ext = lc_entry(mdev->act_log,i);
+		al_ext = lc_entry(mdev->act_log, i);
 		if (al_ext->lc_number == LC_FREE) continue;
-		wait_event(mdev->al_wait, _try_lc_del(mdev,al_ext));
+		wait_event(mdev->al_wait, _try_lc_del(mdev, al_ext));
 	}
 
 	wake_up(&mdev->al_wait);
@@ -784,8 +784,8 @@
 {
 	struct update_odbm_work *udw = (struct update_odbm_work*)w;
 
-	if ( !inc_local_if_state(mdev,Attaching) ) {
-		if (DRBD_ratelimit(5*HZ,5))
+	if ( !inc_local_if_state(mdev, Attaching) ) {
+		if (DRBD_ratelimit(5*HZ, 5))
 			WARN("Can not update on disk bitmap, local IO disabled.\n");
 		return 1;
 	}
@@ -814,7 +814,7 @@
  *
  * TODO will be obsoleted once we have a caching lru of the on disk bitmap
  */
-STATIC void drbd_try_clear_on_disk_bm(struct Drbd_Conf *mdev,sector_t sector,
+STATIC void drbd_try_clear_on_disk_bm(struct Drbd_Conf *mdev, sector_t sector,
 				      int count, int success)
 {
 	struct bm_extent* ext;
@@ -829,7 +829,7 @@
 	// a 16 MB extent border. (Currently this is true...)
 	enr = BM_SECT_TO_EXT(sector);
 
-	ext = (struct bm_extent *) lc_get(mdev->resync,enr);
+	ext = (struct bm_extent *) lc_get(mdev->resync, enr);
 	if (ext) {
 		if (ext->lce.lc_number == enr) {
 			if (success)
@@ -842,7 +842,7 @@
 				     ext->lce.lc_number, ext->rs_left, ext->rs_failed, count);
 				dump_stack();
 				// FIXME brrrgs. should never happen!
-				drbd_force_state(mdev,NS(conn,Disconnecting));
+				drbd_force_state(mdev, NS(conn, Disconnecting));
 				return;
 			}
 		} else {
@@ -852,7 +852,7 @@
 
 			// OR an application write finished, and therefore
 			// we set something in this area in sync.
-			int rs_left = drbd_bm_e_weight(mdev,enr);
+			int rs_left = drbd_bm_e_weight(mdev, enr);
 			if (ext->flags != 0) {
 				WARN("changing resync lce: %d[%u;%02lx]"
 				     " -> %d[%u;00]\n",
@@ -864,26 +864,26 @@
 				WARN("Kicking resync_lru element enr=%u "
 				     "out with rs_failed=%d\n",
 				     ext->lce.lc_number, ext->rs_failed);
-				set_bit(WRITE_BM_AFTER_RESYNC,&mdev->flags);
+				set_bit(WRITE_BM_AFTER_RESYNC, &mdev->flags);
 			}
 			ext->rs_left = rs_left;
 			ext->rs_failed = success ? 0 : count;
-			lc_changed(mdev->resync,&ext->lce);
+			lc_changed(mdev->resync, &ext->lce);
 		}
-		lc_put(mdev->resync,&ext->lce);
+		lc_put(mdev->resync, &ext->lce);
 		// no race, we are within the al_lock!
 
 		if (ext->rs_left == ext->rs_failed) {
 			ext->rs_failed = 0;
 
-			udw=kmalloc(sizeof(*udw),GFP_ATOMIC);
+			udw=kmalloc(sizeof(*udw), GFP_ATOMIC);
 			if (udw) {
 				udw->enr = ext->lce.lc_number;
 				udw->w.cb = w_update_odbm;
-				drbd_queue_work_front(&mdev->data.work,&udw->w);
+				drbd_queue_work_front(&mdev->data.work, &udw->w);
 			} else {
 				WARN("Could not kmalloc an udw\n");
-				set_bit(WRITE_BM_AFTER_RESYNC,&mdev->flags);
+				set_bit(WRITE_BM_AFTER_RESYNC, &mdev->flags);
 			}
 		}
 	} else {
@@ -904,7 +904,7 @@
 void __drbd_set_in_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line)
 {
 	/* Is called from worker and receiver context _only_ */
-	unsigned long sbnr,ebnr,lbnr,bnr;
+	unsigned long sbnr, ebnr, lbnr, bnr;
 	unsigned long count = 0;
 	sector_t esector, nr_sectors;
 	int wake_up=0;
@@ -912,7 +912,7 @@
 
 	if (size <= 0 || (size & 0x1ff) != 0 || size > DRBD_MAX_SEGMENT_SIZE) {
 		ERR("drbd_set_in_sync: sector=%llus size=%d nonsense!\n",
-				(unsigned long long)sector,size);
+				(unsigned long long)sector, size);
 		return;
 	}
 	nr_sectors = drbd_get_capacity(mdev->this_bdev);
@@ -946,9 +946,9 @@
 	 * ok, (capacity & 7) != 0 sometimes, but who cares...
 	 * we count rs_{total,left} in bits, not sectors.
 	 */
-	spin_lock_irqsave(&mdev->al_lock,flags);
+	spin_lock_irqsave(&mdev->al_lock, flags);
 	for(bnr=sbnr; bnr <= ebnr; bnr++) {
-		if (drbd_bm_clear_bit(mdev,bnr)) count++;
+		if (drbd_bm_clear_bit(mdev, bnr)) count++;
 	}
 	if (count) {
 		// we need the lock for drbd_try_clear_on_disk_bm
@@ -961,15 +961,15 @@
 				mdev->rs_mark_left =drbd_bm_total_weight(mdev);
 			}
 		}
-		if ( inc_local_if_state(mdev,Attaching) ) {
-			drbd_try_clear_on_disk_bm(mdev,sector,count,TRUE);
+		if ( inc_local_if_state(mdev, Attaching) ) {
+			drbd_try_clear_on_disk_bm(mdev, sector, count, TRUE);
 			dec_local(mdev);
 		}
 		/* just wake_up unconditional now,
 		 * various lc_chaged(), lc_put() in drbd_try_clear_on_disk_bm(). */
 		wake_up=1;
 	}
-	spin_unlock_irqrestore(&mdev->al_lock,flags);
+	spin_unlock_irqrestore(&mdev->al_lock, flags);
 	if (wake_up) wake_up(&mdev->al_wait);
 }
 
@@ -982,7 +982,7 @@
  */
 void __drbd_set_out_of_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line)
 {
-	unsigned long sbnr,ebnr,lbnr;
+	unsigned long sbnr, ebnr, lbnr;
 	sector_t esector, nr_sectors;
 
 	/*  Find codepoints that call set_out_of_sync()
@@ -1004,7 +1004,7 @@
 	*/
 
 	if (size <= 0 || (size & 0x1ff) != 0 || size > DRBD_MAX_SEGMENT_SIZE) {
-		ERR("sector: %llus, size: %d\n",(unsigned long long)sector,size);
+		ERR("sector: %llus, size: %d\n", (unsigned long long)sector, size);
 		return;
 	}
 
@@ -1028,7 +1028,7 @@
 
 	/* ok, (capacity & 7) != 0 sometimes, but who cares...
 	 * we count rs_{total,left} in bits, not sectors.  */
-	drbd_bm_set_bits_in_irq(mdev,sbnr,ebnr);
+	drbd_bm_set_bits_in_irq(mdev, sbnr, ebnr);
 }
 
 static inline
@@ -1044,16 +1044,16 @@
 		spin_unlock_irq(&mdev->al_lock);
 		return NULL;
 	}
-	bm_ext = (struct bm_extent*) lc_get(mdev->resync,enr);
+	bm_ext = (struct bm_extent*) lc_get(mdev->resync, enr);
 	if (bm_ext) {
 		if (bm_ext->lce.lc_number != enr) {
-			bm_ext->rs_left = drbd_bm_e_weight(mdev,enr);
+			bm_ext->rs_left = drbd_bm_e_weight(mdev, enr);
 			bm_ext->rs_failed = 0;
-			lc_changed(mdev->resync,(struct lc_element*)bm_ext);
+			lc_changed(mdev->resync, (struct lc_element*)bm_ext);
 			wakeup = 1;
 		}
 		if (bm_ext->lce.refcnt == 1) mdev->resync_locked++;
-		set_bit(BME_NO_WRITES,&bm_ext->flags);
+		set_bit(BME_NO_WRITES, &bm_ext->flags);
 	}
 	rs_flags=mdev->resync->flags;
 	spin_unlock_irq(&mdev->al_lock);
@@ -1080,7 +1080,7 @@
 	spin_lock_irq(&mdev->al_lock);
 	if (unlikely(enr == mdev->act_log->new_number)) rv=1;
 	else {
-		al_ext = lc_find(mdev->act_log,enr);
+		al_ext = lc_find(mdev->act_log, enr);
 		if (al_ext) {
 			if (al_ext->refcnt) rv=1;
 		}
@@ -1113,22 +1113,22 @@
 
 	MTRACE(TraceTypeResync, TraceLvlAll,
 	       INFO("drbd_rs_begin_io: sector=%llus (rs_end=%d)\n",
-		    (unsigned long long)sector,enr);
+		    (unsigned long long)sector, enr);
 	    );
 
 	sig = wait_event_interruptible( mdev->al_wait,
-			(bm_ext = _bme_get(mdev,enr)) );
+			(bm_ext = _bme_get(mdev, enr)) );
 	if (sig) return 0;
 
-	if (test_bit(BME_LOCKED,&bm_ext->flags)) return 1;
+	if (test_bit(BME_LOCKED, &bm_ext->flags)) return 1;
 
 	for(i=0;i<AL_EXT_PER_BM_SECT;i++) {
 		sig = wait_event_interruptible( mdev->al_wait,
-				!_is_in_al(mdev,enr*AL_EXT_PER_BM_SECT+i) );
+				!_is_in_al(mdev, enr*AL_EXT_PER_BM_SECT+i) );
 		if (sig) {
 			spin_lock_irq(&mdev->al_lock);
-			if ( lc_put(mdev->resync,&bm_ext->lce) == 0 ) {
-				clear_bit(BME_NO_WRITES,&bm_ext->flags);
+			if ( lc_put(mdev->resync, &bm_ext->lce) == 0 ) {
+				clear_bit(BME_NO_WRITES, &bm_ext->flags);
 				mdev->resync_locked--;
 				wake_up(&mdev->al_wait);
 			}
@@ -1137,7 +1137,7 @@
 		}
 	}
 
-	set_bit(BME_LOCKED,&bm_ext->flags);
+	set_bit(BME_LOCKED, &bm_ext->flags);
 
 	return 1;
 }
@@ -1183,24 +1183,24 @@
 			INFO("dropping %u, aparently got 'synced' "
 			     "by application io\n", mdev->resync_wenr);
 		);
-		bm_ext = (struct bm_extent*)lc_find(mdev->resync,mdev->resync_wenr);
+		bm_ext = (struct bm_extent*)lc_find(mdev->resync, mdev->resync_wenr);
 		if (bm_ext) {
-			D_ASSERT(!test_bit(BME_LOCKED,&bm_ext->flags));
-			D_ASSERT(test_bit(BME_NO_WRITES,&bm_ext->flags));
-			clear_bit(BME_NO_WRITES,&bm_ext->flags);
+			D_ASSERT(!test_bit(BME_LOCKED, &bm_ext->flags));
+			D_ASSERT(test_bit(BME_NO_WRITES, &bm_ext->flags));
+			clear_bit(BME_NO_WRITES, &bm_ext->flags);
 			mdev->resync_wenr = LC_FREE;
-			lc_put(mdev->resync,&bm_ext->lce);
+			lc_put(mdev->resync, &bm_ext->lce);
 			wake_up(&mdev->al_wait);
 		} else {
 			ALERT("LOGIC BUG\n");
 		}
 	}
-	bm_ext = (struct bm_extent*)lc_try_get(mdev->resync,enr);
+	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)) {
+		if (!test_and_set_bit(BME_NO_WRITES, &bm_ext->flags)) {
 			mdev->resync_locked++;
 		} else {
 			/* we did set the BME_NO_WRITES,
@@ -1208,7 +1208,7 @@
 			 * so we tried again.
 			 * drop the extra reference. */
 			MTRACE(TraceTypeResync, TraceLvlAll,
-				INFO("dropping extra reference on %u\n",enr);
+				INFO("dropping extra reference on %u\n", enr);
 			);
 			bm_ext->lce.refcnt--;
 			D_ASSERT(bm_ext->lce.refcnt > 0);
@@ -1217,7 +1217,7 @@
 	} else {
 		if (mdev->resync_locked > mdev->resync->nr_elements-3)
 			goto try_again;
-		bm_ext = (struct bm_extent*)lc_get(mdev->resync,enr);
+		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) {
@@ -1230,28 +1230,28 @@
 			goto try_again;
 		}
 		if (bm_ext->lce.lc_number != enr) {
-			bm_ext->rs_left = drbd_bm_e_weight(mdev,enr);
+			bm_ext->rs_left = drbd_bm_e_weight(mdev, enr);
 			bm_ext->rs_failed = 0;
-			lc_changed(mdev->resync,(struct lc_element*)bm_ext);
+			lc_changed(mdev->resync, (struct lc_element*)bm_ext);
 			wake_up(&mdev->al_wait);
-			D_ASSERT(test_bit(BME_LOCKED,&bm_ext->flags) == 0);
+			D_ASSERT(test_bit(BME_LOCKED, &bm_ext->flags) == 0);
 		}
-		set_bit(BME_NO_WRITES,&bm_ext->flags);
+		set_bit(BME_NO_WRITES, &bm_ext->flags);
 		D_ASSERT(bm_ext->lce.refcnt == 1);
 		mdev->resync_locked++;
 		goto check_al;
 	}
   check_al:
 	MTRACE(TraceTypeResync, TraceLvlAll,
-		INFO("checking al for %u\n",enr);
+		INFO("checking al for %u\n", enr);
 	);
 	for (i=0;i<AL_EXT_PER_BM_SECT;i++) {
 		if (unlikely(al_enr+i == mdev->act_log->new_number))
 			goto try_again;
-		if (lc_is_used(mdev->act_log,al_enr+i))
+		if (lc_is_used(mdev->act_log, al_enr+i))
 			goto try_again;
 	}
-	set_bit(BME_LOCKED,&bm_ext->flags);
+	set_bit(BME_LOCKED, &bm_ext->flags);
   proceed:
 	mdev->resync_wenr = LC_FREE;
 	spin_unlock_irq(&mdev->al_lock);
@@ -1259,7 +1259,7 @@
 
   try_again:
 	MTRACE(TraceTypeResync, TraceLvlAll,
-		INFO("need to try again for %u\n",enr);
+		INFO("need to try again for %u\n", enr);
 	);
 	if (bm_ext) mdev->resync_wenr = enr;
 	spin_unlock_irq(&mdev->al_lock);
@@ -1277,29 +1277,29 @@
 		    (long long)sector, enr);
 	    );
 
-	spin_lock_irqsave(&mdev->al_lock,flags);
-	bm_ext = (struct bm_extent*) lc_find(mdev->resync,enr);
+	spin_lock_irqsave(&mdev->al_lock, flags);
+	bm_ext = (struct bm_extent*) lc_find(mdev->resync, enr);
 	if (!bm_ext) {
-		spin_unlock_irqrestore(&mdev->al_lock,flags);
+		spin_unlock_irqrestore(&mdev->al_lock, flags);
 		ERR("drbd_rs_complete_io() called, but extent not found\n");
 		return;
 	}
 
 	if (bm_ext->lce.refcnt == 0) {
-		spin_unlock_irqrestore(&mdev->al_lock,flags);
+		spin_unlock_irqrestore(&mdev->al_lock, flags);
 		ERR("drbd_rs_complete_io(,%llu [=%u]) called, but refcnt is 0!?\n",
 		    (unsigned long long)sector, enr);
 		return;
 	}
 
-	if ( lc_put(mdev->resync,(struct lc_element *)bm_ext) == 0 ) {
-		clear_bit(BME_LOCKED,&bm_ext->flags);
-		clear_bit(BME_NO_WRITES,&bm_ext->flags);
+	if ( lc_put(mdev->resync, (struct lc_element *)bm_ext) == 0 ) {
+		clear_bit(BME_LOCKED, &bm_ext->flags);
+		clear_bit(BME_NO_WRITES, &bm_ext->flags);
 		mdev->resync_locked--;
 		wake_up(&mdev->al_wait);
 	}
 
-	spin_unlock_irqrestore(&mdev->al_lock,flags);
+	spin_unlock_irqrestore(&mdev->al_lock, flags);
 }
 
 /**
@@ -1317,15 +1317,15 @@
 
 	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)) { // Makes sure ->resync is there.
 		for(i=0;i<mdev->resync->nr_elements;i++) {
-			bm_ext = (struct bm_extent*) lc_entry(mdev->resync,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->rs_left = 0;
-			clear_bit(BME_LOCKED,&bm_ext->flags);
-			clear_bit(BME_NO_WRITES,&bm_ext->flags);
-			lc_del(mdev->resync,&bm_ext->lce);
+			clear_bit(BME_LOCKED, &bm_ext->flags);
+			clear_bit(BME_NO_WRITES, &bm_ext->flags);
+			lc_del(mdev->resync, &bm_ext->lce);
 		}
 		mdev->resync->used=0;
 		dec_local(mdev);
@@ -1353,31 +1353,31 @@
 
 	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)) { // Makes sure ->resync is there.
 		for(i=0;i<mdev->resync->nr_elements;i++) {
-			bm_ext = (struct bm_extent*) lc_entry(mdev->resync,i);
+			bm_ext = (struct bm_extent*) lc_entry(mdev->resync, i);
 			if (bm_ext->lce.lc_number == LC_FREE) continue;
 			if (bm_ext->lce.lc_number == mdev->resync_wenr) {
 				INFO("dropping %u in drbd_rs_del_all, "
 				     "aparently got 'synced' by application io\n",
 				     mdev->resync_wenr);
-				D_ASSERT(!test_bit(BME_LOCKED,&bm_ext->flags));
-				D_ASSERT(test_bit(BME_NO_WRITES,&bm_ext->flags));
-				clear_bit(BME_NO_WRITES,&bm_ext->flags);
+				D_ASSERT(!test_bit(BME_LOCKED, &bm_ext->flags));
+				D_ASSERT(test_bit(BME_NO_WRITES, &bm_ext->flags));
+				clear_bit(BME_NO_WRITES, &bm_ext->flags);
 				mdev->resync_wenr = LC_FREE;
-				lc_put(mdev->resync,&bm_ext->lce);
+				lc_put(mdev->resync, &bm_ext->lce);
 			}
 			if (bm_ext->lce.refcnt != 0) {
 				INFO("Retrying drbd_rs_del_all() later. "
-				     "refcnt=%d\n",bm_ext->lce.refcnt);
+				     "refcnt=%d\n", bm_ext->lce.refcnt);
 				dec_local(mdev);
 				spin_unlock_irq(&mdev->al_lock);
 				return -EAGAIN;
 			}
 			D_ASSERT(bm_ext->rs_left == 0);
-			D_ASSERT(!test_bit(BME_LOCKED,&bm_ext->flags));
-			D_ASSERT(!test_bit(BME_NO_WRITES,&bm_ext->flags));
-			lc_del(mdev->resync,&bm_ext->lce);
+			D_ASSERT(!test_bit(BME_LOCKED, &bm_ext->flags));
+			D_ASSERT(!test_bit(BME_NO_WRITES, &bm_ext->flags));
+			lc_del(mdev->resync, &bm_ext->lce);
 		}
 		D_ASSERT(mdev->resync->used==0);
 		dec_local(mdev);
@@ -1395,19 +1395,19 @@
 void drbd_rs_failed_io(drbd_dev* mdev, sector_t sector, int size)
 {
 	/* Is called from worker and receiver context _only_ */
-	unsigned long sbnr,ebnr,lbnr,bnr;
+	unsigned long sbnr, ebnr, lbnr, bnr;
 	unsigned long count = 0;
 	sector_t esector, nr_sectors;
 	int wake_up=0;
 
 	MTRACE(TraceTypeResync, TraceLvlSummary,
 	       INFO("drbd_rs_failed_io: sector=%llus, size=%u\n",
-		    (unsigned long long)sector,size);
+		    (unsigned long long)sector, size);
 	    );
 
 	if (size <= 0 || (size & 0x1ff) != 0 || size > DRBD_MAX_SEGMENT_SIZE) {
 		ERR("drbd_rs_failed_io: sector=%llus size=%d nonsense!\n",
-				(unsigned long long)sector,size);
+				(unsigned long long)sector, size);
 		return;
 	}
 	nr_sectors = drbd_get_capacity(mdev->this_bdev);
@@ -1438,13 +1438,13 @@
 	 */
 	spin_lock_irq(&mdev->al_lock);
 	for(bnr=sbnr; bnr <= ebnr; bnr++) {
-		if (drbd_bm_test_bit(mdev,bnr)>0) count++;
+		if (drbd_bm_test_bit(mdev, bnr)>0) count++;
 	}
 	if (count) {
 		mdev->rs_failed += count;
 
-		if ( inc_local_if_state(mdev,Attaching) ) {
-			drbd_try_clear_on_disk_bm(mdev,sector,count,FALSE);
+		if ( inc_local_if_state(mdev, Attaching) ) {
+			drbd_try_clear_on_disk_bm(mdev, sector, count, FALSE);
 			dec_local(mdev);
 		}
 

Modified: branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 11:38:05 UTC (rev 2985)
@@ -118,17 +118,17 @@
 
 #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)) {				\
+	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);	\
+			    __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)) {				\
+	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();					\
@@ -143,12 +143,12 @@
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	spin_lock_irq(&b->bm_lock);
-	if (!__test_and_set_bit(BM_LOCKED,&b->bm_flags)) {
+	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)) {
+	} 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);
+		    file, line, b->bm_file, b->bm_line);
 		/*
 		dump_stack();
 		ERR("This is no oops, but debug stack trace only.\n");
@@ -162,7 +162,7 @@
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	spin_lock_irq(&b->bm_lock);
-	if (!__test_and_clear_bit(BM_LOCKED,&mdev->bitmap->bm_flags)) {
+	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,
@@ -181,8 +181,8 @@
 	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",\
+		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 );	\
 		}								\
@@ -214,7 +214,7 @@
 
 	if (w < b->bm_words) {
 		D_ASSERT(w == b->bm_words -1);
-		INFO("bm[%d]=0x%lX\n",w,b->bm[w]);
+		INFO("bm[%d]=0x%lX\n", w, b->bm[w]);
 	}
 }
 #else
@@ -244,7 +244,7 @@
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	D_BUG_ON(b);
-	b = kzalloc(sizeof(struct drbd_bitmap),GFP_KERNEL);
+	b = kzalloc(sizeof(struct drbd_bitmap), GFP_KERNEL);
 	if (!b)
 		return -ENOMEM;
 	spin_lock_init(&b->bm_lock);
@@ -338,14 +338,14 @@
 
 	ERR_IF(!b) return;
 
-	spin_lock_irqsave(&b->bm_lock,flags);
-	bits = bm_count_bits(b,0);
+	spin_lock_irqsave(&b->bm_lock, flags);
+	bits = bm_count_bits(b, 0);
 	if (bits != b->bm_set) {
 		ERR("bm_set was %lu, corrected to %lu. %s:%d\n",
-		    b->bm_set,bits,file,line);
+		    b->bm_set, bits, file, line);
 		b->bm_set = bits;
 	}
-	spin_unlock_irqrestore(&b->bm_lock,flags);
+	spin_unlock_irqrestore(&b->bm_lock, flags);
 }
 
 #define BM_SECTORS_PER_BIT (BM_BLOCK_SIZE/512)
@@ -389,14 +389,14 @@
 		spin_unlock_irq(&b->bm_lock);
 		goto free_obm;
 	} else {
-		bits = BM_SECT_TO_BIT(ALIGN(capacity,BM_SECTORS_PER_BIT));
+		bits = BM_SECT_TO_BIT(ALIGN(capacity, BM_SECTORS_PER_BIT));
 
 		/* if we would use
 		   words = ALIGN(bits,BITS_PER_LONG) >> LN2_BPL;
 		   a 32bit host could present the wrong number of words
 		   to a 64bit host.
 		*/
-		words = ALIGN(bits,64) >> LN2_BPL;
+		words = ALIGN(bits, 64) >> LN2_BPL;
 
 		D_ASSERT((u64)bits <= (((u64)mdev->bc->md.md_size_sect-MD_BM_OFFSET) << 12));
 
@@ -417,7 +417,7 @@
 			bytes = (words+1)*sizeof(long);
 			nbm = vmalloc(bytes);
 			if (!nbm) {
-				ERR("bitmap: failed to vmalloc %lu bytes\n",bytes);
+				ERR("bitmap: failed to vmalloc %lu bytes\n", bytes);
 				err = -ENOMEM;
 				goto out;
 			}
@@ -429,7 +429,7 @@
 		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));
+			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
@@ -444,10 +444,10 @@
 		b->bm_words = words;
 		b->bm_dev_capacity = capacity;
 		bm_clear_surplus(b);
-		if (!growing) b->bm_set = bm_count_bits(b,0);
+		if (!growing) b->bm_set = bm_count_bits(b, 0);
 		bm_end_info(mdev, __FUNCTION__ );
 		spin_unlock_irq(&b->bm_lock);
-		INFO("resync bitmap: bits=%lu words=%lu\n",bits,words);
+		INFO("resync bitmap: bits=%lu words=%lu\n", bits, words);
 	}
  free_obm:
 	vfree(obm); // vfree(NULL) is noop
@@ -473,9 +473,9 @@
 	ERR_IF(!b) return 0;
 	// MUST_BE_LOCKED(); well. yes. but ...
 
-	spin_lock_irqsave(&b->bm_lock,flags);
+	spin_lock_irqsave(&b->bm_lock, flags);
 	s = b->bm_set;
-	spin_unlock_irqrestore(&b->bm_lock,flags);
+	spin_unlock_irqrestore(&b->bm_lock, flags);
 
 	return s;
 }
@@ -620,7 +620,7 @@
 
 	spin_lock_irq(&b->bm_lock);
 	BM_PARANOIA_CHECK();
-	memset(b->bm,0xff,b->bm_words*sizeof(long));
+	memset(b->bm, 0xff, b->bm_words*sizeof(long));
 	bm_clear_surplus(b);
 	b->bm_set = b->bm_bits;
 	spin_unlock_irq(&b->bm_lock);
@@ -629,7 +629,7 @@
 int drbd_bm_async_io_complete(struct bio *bio, unsigned int bytes_done, int error)
 {
 	struct drbd_bitmap *b = bio->bi_private;
-	int uptodate = bio_flagged(bio,BIO_UPTODATE);
+	int uptodate = bio_flagged(bio, BIO_UPTODATE);
 
 	if (bio->bi_size)
 		return 1;
@@ -646,7 +646,7 @@
 		 * for now, set all bits, and flag MD_IO_ERROR
 		 */
 		/* FIXME kmap_atomic memset etc. pp. */
-		__set_bit(BM_MD_IO_ERROR,&b->bm_flags);
+		__set_bit(BM_MD_IO_ERROR, &b->bm_flags);
 	}
 	if (atomic_dec_and_test(&b->bm_async_io))
 		wake_up(&b->bm_io_wait);
@@ -681,7 +681,7 @@
 
 	if (FAULT_ACTIVE(mdev, (rw&WRITE)?DRBD_FAULT_MD_WR:DRBD_FAULT_MD_RD)) {
 		bio->bi_rw |= rw;
-		bio_endio(bio,bio->bi_size,-EIO);
+		bio_endio(bio, bio->bi_size, -EIO);
 	}
 	else
 		submit_bio(rw, bio);
@@ -691,7 +691,7 @@
  * @enr is _sector_ offset from start of on disk bitmap (aka bm-extent nr).
  * returns 0 on success, -EIO on failure
  */
-int drbd_bm_read_sect(drbd_dev *mdev,unsigned long enr)
+int drbd_bm_read_sect(drbd_dev *mdev, unsigned long enr)
 {
 	sector_t on_disk_sector = mdev->bc->md.md_offset + mdev->bc->md.bm_offset + enr;
 	int bm_words, num_words, offset, err  = 0;
@@ -699,7 +699,7 @@
 	// MUST_BE_LOCKED(); not neccessarily global ...
 
 	down(&mdev->md_io_mutex);
-	if (drbd_md_sync_page_io(mdev,mdev->bc,on_disk_sector,READ)) {
+	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
 		num_words = min(S2W(1), bm_words - offset);
@@ -718,7 +718,7 @@
 		drbd_chk_io_error(mdev, 1, TRUE);
 		drbd_io_error(mdev, TRUE);
 		for (i = 0; i < AL_EXT_PER_BM_SECT; i++)
-			drbd_bm_ALe_set_all(mdev,enr*AL_EXT_PER_BM_SECT+i);
+			drbd_bm_ALe_set_all(mdev, enr*AL_EXT_PER_BM_SECT+i);
 	}
 	up(&mdev->md_io_mutex);
 	return err;
@@ -787,11 +787,11 @@
 
 	now = jiffies;
 	atomic_set(&b->bm_async_io, num_pages);
-	__clear_bit(BM_MD_IO_ERROR,&b->bm_flags);
+	__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... */
-		drbd_bm_page_io_async(mdev,b,i,rw);
+		drbd_bm_page_io_async(mdev, b, i, rw);
 	}
 
 	drbd_blk_run_queue(bdev_get_queue(mdev->bc->md_bdev));
@@ -799,7 +799,7 @@
 	INFO("%s of bitmap took %lu jiffies\n",
 	     rw == READ ? "reading" : "writing", jiffies - now);
 
-	if (test_bit(BM_MD_IO_ERROR,&b->bm_flags)) {
+	if (test_bit(BM_MD_IO_ERROR, &b->bm_flags)) {
 		ALERT("we had at least one MD IO ERROR during bitmap IO\n");
 		drbd_chk_io_error(mdev, 1, TRUE);
 		drbd_io_error(mdev, TRUE);
@@ -823,7 +823,7 @@
 	mdev->bitmap = b;
 
 	INFO("%s marked out-of-sync by on disk bit-map.\n",
-	     ppsize(ppb,drbd_bm_total_weight(mdev) << (BM_BLOCK_SIZE_B-10)) );
+	     ppsize(ppb, drbd_bm_total_weight(mdev) << (BM_BLOCK_SIZE_B-10)) );
 
 	return err;
 }
@@ -851,7 +851,7 @@
  * @enr: The _sector_ offset from the start of the bitmap.
  *
  */
-int drbd_bm_write_sect(struct Drbd_Conf *mdev,unsigned long enr)
+int drbd_bm_write_sect(struct Drbd_Conf *mdev, unsigned long enr)
 {
 	sector_t on_disk_sector = enr + mdev->bc->md.md_offset + mdev->bc->md.bm_offset;
 	int bm_words, num_words, offset, err  = 0;
@@ -867,11 +867,11 @@
 			enr, offset, num_words);
 #endif
 	if (num_words < S2W(1)) {
-		memset(page_address(mdev->md_io_page),0,MD_HARDSECT);
+		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)) {
+	if (!drbd_md_sync_page_io(mdev, mdev->bc, on_disk_sector, WRITE)) {
 		int i;
 		err = -EIO;
 		ERR( "IO ERROR writing bitmap sector %lu "
@@ -880,7 +880,7 @@
 		drbd_chk_io_error(mdev, 1, TRUE);
 		drbd_io_error(mdev, TRUE);
 		for (i = 0; i < AL_EXT_PER_BM_SECT; i++)
-			drbd_bm_ALe_set_all(mdev,enr*AL_EXT_PER_BM_SECT+i);
+			drbd_bm_ALe_set_all(mdev, enr*AL_EXT_PER_BM_SECT+i);
 	}
 	mdev->bm_writ_cnt++;
 	up(&mdev->md_io_mutex);
@@ -912,7 +912,7 @@
 
 	spin_lock_irq(&b->bm_lock);
 	BM_PARANOIA_CHECK();
-	memset(b->bm,0,b->bm_words*sizeof(long));
+	memset(b->bm, 0, b->bm_words*sizeof(long));
 	b->bm_set = 0;
 	spin_unlock_irq(&b->bm_lock);
 }
@@ -948,9 +948,9 @@
 	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);
+		i = find_next_bit(b->bm, b->bm_bits, b->bm_fo);
 	} else if (b->bm_fo > b->bm_bits) {
-		ERR("bm_fo=%lu bm_bits=%lu\n",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;
@@ -1007,7 +1007,7 @@
 	BM_PARANOIA_CHECK();
 	MUST_NOT_BE_LOCKED();
 	ERR_IF (bitnr >= b->bm_bits) {
-		ERR("bitnr=%lu bm_bits=%lu\n",bitnr, b->bm_bits);
+		ERR("bitnr=%lu bm_bits=%lu\n", bitnr, b->bm_bits);
 		i = 0;
 	} else {
 		i = (0 != __test_and_set_bit(bitnr, b->bm));
@@ -1032,7 +1032,7 @@
 	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);
+			ERR("bitnr=%lu bm_bits=%lu\n", bitnr, b->bm_bits);
 		} else {
 			c += (0 == __test_and_set_bit(bitnr, b->bm));
 		}
@@ -1053,17 +1053,17 @@
 	ERR_IF(!b) return 0;
 	ERR_IF(!b->bm) return 0;
 
-	spin_lock_irqsave(&b->bm_lock,flags);
+	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);
+		ERR("bitnr=%lu bm_bits=%lu\n", bitnr, b->bm_bits);
 		i = 0;
 	} else {
 		i = (0 != __test_and_clear_bit(bitnr, b->bm));
 		b->bm_set -= i;
 	}
-	spin_unlock_irqrestore(&b->bm_lock,flags);
+	spin_unlock_irqrestore(&b->bm_lock, flags);
 
 	/* clearing bits should only take place when sync is in progress!
 	 * this is only called from drbd_set_in_sync.
@@ -1097,7 +1097,7 @@
 	} else if (bitnr == b->bm_bits) {
 		i = -1;
 	} else /* (bitnr > b->bm_bits) */ {
-		ERR("bitnr=%lu > bm_bits=%lu\n",bitnr, b->bm_bits);
+		ERR("bitnr=%lu > bm_bits=%lu\n", bitnr, b->bm_bits);
 		i = 0;
 	}
 
@@ -1127,11 +1127,11 @@
 
 	ERR_IF(!b) return 0;
 	ERR_IF(!b->bm) return 0;
-	spin_lock_irqsave(&b->bm_lock,flags);
+	spin_lock_irqsave(&b->bm_lock, flags);
 	BM_PARANOIA_CHECK();
 
 	s = S2W(enr);
-	e = min((size_t)S2W(enr+1),b->bm_words);
+	e = min((size_t)S2W(enr+1), b->bm_words);
 	count = 0;
 	if (s < b->bm_words) {
 		const unsigned long* w = b->bm+s;
@@ -1140,7 +1140,7 @@
 	} else {
 		ERR("start offset (%d) too large in drbd_bm_e_weight\n", s);
 	}
-	spin_unlock_irqrestore(&b->bm_lock,flags);
+	spin_unlock_irqrestore(&b->bm_lock, flags);
 #if DUMP_MD >= 3
 	INFO("enr=%lu weight=%d e=%d s=%d\n", enr, count, e, s);
 #endif
@@ -1170,7 +1170,7 @@
 		int n = e-s;
 		while (n--) count += hweight_long(*w++);
 		n = e-s;
-		memset(b->bm+s,-1,n*sizeof(long));
+		memset(b->bm+s, -1, n*sizeof(long));
 		b->bm_set += n*BITS_PER_LONG - count;
 		if (e == b->bm_words) {
 			b->bm_set -= bm_clear_surplus(b);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 11:38:05 UTC (rev 2985)
@@ -15,7 +15,7 @@
 
   drbd is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
@@ -87,8 +87,8 @@
 #define DRBD_SIGKILL SIGHUP
 
 #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)
+#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 :(
@@ -114,11 +114,11 @@
  *************************/
 
 // 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__);
-#define DUMPLX(A)  ERR( #A " = %lx in %s:%d\n", (A),__FILE__,__LINE__);
-#define DUMPI(A)   ERR( #A " = %d in %s:%d\n",  (int)(A),__FILE__,__LINE__);
+#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__);
+#define DUMPLX(A)  ERR( #A " = %lx in %s:%d\n", (A), __FILE__, __LINE__);
+#define DUMPI(A)   ERR( #A " = %d in %s:%d\n", (int)(A), __FILE__, __LINE__);
 
 #define DUMPST(A) DUMPLLU((unsigned long long)(A))
 
@@ -137,23 +137,23 @@
 #endif
 
 // 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...) \
+//	 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)
 
-#define ALERT(fmt,args...) PRINTK(KERN_ALERT, fmt , ##args)
-#define ERR(fmt,args...)  PRINTK(KERN_ERR, fmt , ##args)
-#define WARN(fmt,args...) PRINTK(KERN_WARNING, fmt , ##args)
-#define INFO(fmt,args...) PRINTK(KERN_INFO, fmt , ##args)
-#define DBG(fmt,args...)  PRINTK(KERN_DEBUG, fmt , ##args)
+#define ALERT(fmt, args...) PRINTK(KERN_ALERT, fmt , ##args)
+#define ERR(fmt, args...)   PRINTK(KERN_ERR, fmt , ##args)
+#define WARN(fmt, args...)  PRINTK(KERN_WARNING, fmt , ##args)
+#define INFO(fmt, args...)  PRINTK(KERN_INFO, fmt , ##args)
+#define DBG(fmt, args...)   PRINTK(KERN_DEBUG, fmt , ##args)
 
 /* see kernel/printk.c:printk_ratelimit
  * macro, so it is easy do have independend rate limits at different locations
  * "initializer element not constant ..." with kernel 2.4 :(
  * so I initialize toks to something large
  */
-#define DRBD_ratelimit(ratelimit_jiffies,ratelimit_burst)	\
+#define DRBD_ratelimit(ratelimit_jiffies, ratelimit_burst)	\
 ({								\
 	int __ret;						\
 	static unsigned long toks = 0x80000000UL;		\
@@ -169,7 +169,7 @@
 		missed = 0;					\
 		toks -= ratelimit_jiffies;			\
 		if (lost)					\
-			WARN("%d messages suppressed in %s:%d.\n",\
+			WARN("%d messages suppressed in %s:%d.\n", \
 				lost , __FILE__ , __LINE__ );	\
 		__ret=1;					\
 	} else {						\
@@ -182,15 +182,15 @@
 
 #ifdef DBG_ASSERTS
 extern void drbd_assert_breakpoint(drbd_dev*, char *, char *, int );
-# define D_ASSERT(exp)  if (!(exp)) \
-	 drbd_assert_breakpoint(mdev,#exp,__FILE__,__LINE__)
+# define D_ASSERT(exp)	if (!(exp)) \
+	 drbd_assert_breakpoint(mdev, #exp, __FILE__, __LINE__)
 #else
-# define D_ASSERT(exp)  if (!(exp)) \
-	 ERR("ASSERT( " #exp " ) in %s:%d\n", __FILE__,__LINE__)
+# define D_ASSERT(exp)	if (!(exp)) \
+	 ERR("ASSERT( " #exp " ) in %s:%d\n", __FILE__, __LINE__)
 #endif
 #define ERR_IF(exp) if (({ \
 	int _b = (exp)!=0; \
-	if (_b) ERR("%s: (" #exp ") in %s:%d\n", __func__, __FILE__,__LINE__); \
+	if (_b) ERR("%s: (" #exp ") in %s:%d\n", __func__, __FILE__, __LINE__); \
 	 _b; \
 	}))
 
@@ -211,11 +211,11 @@
 extern unsigned int _drbd_insert_fault(drbd_dev *mdev, unsigned int type);
 static inline int
 drbd_insert_fault(drbd_dev *mdev, unsigned int type) {
-    return (fault_rate && 
-	    (enable_faults & (1<<type)) && 
-	    _drbd_insert_fault(mdev,type));
+    return (fault_rate &&
+	    (enable_faults & (1<<type)) &&
+	    _drbd_insert_fault(mdev, type));
 }
-#define FAULT_ACTIVE(_m, _t) (drbd_insert_fault((_m),(_t)))
+#define FAULT_ACTIVE(_m, _t) (drbd_insert_fault((_m), (_t)))
 
 #else
 #define FAULT_ACTIVE(_m, _t) (0)
@@ -223,17 +223,17 @@
 
 #include <linux/stringify.h>
 // integer division, round _UP_ to the next integer
-#define div_ceil(A,B) ( (A)/(B) + ((A)%(B) ? 1 : 0) )
+#define div_ceil(A, B) ( (A)/(B) + ((A)%(B) ? 1 : 0) )
 // usual integer division
-#define div_floor(A,B) ( (A)/(B) )
+#define div_floor(A, B) ( (A)/(B) )
 
 /*
  * Compatibility Section
  *************************/
 
-#define LOCK_SIGMASK(task,flags)   spin_lock_irqsave(&task->sighand->siglock, flags)
-#define UNLOCK_SIGMASK(task,flags) spin_unlock_irqrestore(&task->sighand->siglock, flags)
-#define RECALC_SIGPENDING()        recalc_sigpending();
+#define LOCK_SIGMASK(task, flags)   spin_lock_irqsave(&task->sighand->siglock, flags)
+#define UNLOCK_SIGMASK(task, flags) spin_unlock_irqrestore(&task->sighand->siglock, flags)
+#define RECALC_SIGPENDING()	    recalc_sigpending();
 
 #if defined(DBG_SPINLOCKS) && defined(__SMP__)
 # define MUST_HOLD(lock) if (!spin_is_locked(lock)) { ERR("Not holding lock! in %s\n", __FUNCTION__ ); }
@@ -253,10 +253,10 @@
  *************************/
 
 #define SET_MDEV_MAGIC(x) \
-	({ typecheck(struct Drbd_Conf*,x); \
+	({ typecheck(struct Drbd_Conf*, x); \
 	  (x)->magic = (long)(x) ^ DRBD_MAGIC; })
 #define IS_VALID_MDEV(x)  \
-	( typecheck(struct Drbd_Conf*,x) && \
+	( typecheck(struct Drbd_Conf*, x) && \
 	  ((x) ? (((x)->magic ^ DRBD_MAGIC) == (long)(x)):0))
 
 /* drbd_meta-data.c (still in drbd_main.c) */
@@ -289,7 +289,7 @@
 	AuthResponse,
 	StateChgRequest,
 
-	Ping,         // These are sent on the meta socket...
+	Ping,	      // These are sent on the meta socket...
 	PingAck,
 	RecvAck,      // Used in protocol B
 	WriteAck,     // Used in protocol C
@@ -320,34 +320,34 @@
 	 * when we want to support more than
 	 * one PRO_VERSION */
 	static const char *cmdnames[] = {
-		[Data]             = "Data",
-		[DataReply]        = "DataReply",
-		[RSDataReply]      = "RSDataReply",
-		[Barrier]          = "Barrier",
-		[ReportBitMap]     = "ReportBitMap",
+		[Data]		   = "Data",
+		[DataReply]	   = "DataReply",
+		[RSDataReply]	   = "RSDataReply",
+		[Barrier]	   = "Barrier",
+		[ReportBitMap]	   = "ReportBitMap",
 		[BecomeSyncTarget] = "BecomeSyncTarget",
 		[BecomeSyncSource] = "BecomeSyncSource",
-		[UnplugRemote]     = "UnplugRemote",
-		[DataRequest]      = "DataRequest",
+		[UnplugRemote]	   = "UnplugRemote",
+		[DataRequest]	   = "DataRequest",
 		[RSDataRequest]    = "RSDataRequest",
-		[SyncParam]        = "SyncParam",
+		[SyncParam]	   = "SyncParam",
 		[ReportProtocol]   = "ReportProtocol",
-		[ReportUUIDs]      = "ReportUUIDs",
-		[ReportSizes]      = "ReportSizes",
-		[ReportState]      = "ReportState",
+		[ReportUUIDs]	   = "ReportUUIDs",
+		[ReportSizes]	   = "ReportSizes",
+		[ReportState]	   = "ReportState",
 		[ReportSyncUUID]   = "ReportSyncUUID",
 		[AuthChallenge]    = "AuthChallenge",
-		[AuthResponse]     = "AuthResponse",
-		[Ping]             = "Ping",
-		[PingAck]          = "PingAck",
-		[RecvAck]          = "RecvAck",
-		[WriteAck]         = "WriteAck",
-		[RSWriteAck]       = "RSWriteAck",
-		[DiscardAck]       = "DiscardAck",
-		[NegAck]           = "NegAck",
-		[NegDReply]        = "NegDReply",
-		[NegRSDReply]      = "NegRSDReply",
-		[BarrierAck]       = "BarrierAck",
+		[AuthResponse]	   = "AuthResponse",
+		[Ping]		   = "Ping",
+		[PingAck]	   = "PingAck",
+		[RecvAck]	   = "RecvAck",
+		[WriteAck]	   = "WriteAck",
+		[RSWriteAck]	   = "RSWriteAck",
+		[DiscardAck]	   = "DiscardAck",
+		[NegAck]	   = "NegAck",
+		[NegDReply]	   = "NegDReply",
+		[NegRSDReply]	   = "NegRSDReply",
+		[BarrierAck]	   = "BarrierAck",
 		[StateChgRequest]  = "StateChgRequest",
 		[StateChgReply]    = "StateChgReply"
 	};
@@ -375,18 +375,18 @@
 /* This is the layout for a packet on the wire.
  * The byteorder is the network byte order.
  *     (except block_id and barrier fields.
- *      these are pointers to local structs
- *      and have no relevance for the partner,
- *      which just echoes them as received.)
+ *	these are pointers to local structs
+ *	and have no relevance for the partner,
+ *	which just echoes them as received.)
  *
  * NOTE that the payload starts at a long aligned offset,
  * regardless of 32 or 64 bit arch!
  */
 typedef struct {
-	u32       magic;
-	u16       command;
-	u16       length;	// bytes of data after this header
-	char      payload[0];
+	u32	  magic;
+	u16	  command;
+	u16	  length;	// bytes of data after this header
+	char	  payload[0];
 } __attribute((packed)) Drbd_Header;
 // 8 bytes. packet FIXED for the next century!
 
@@ -405,16 +405,16 @@
  *   Data, DataReply (see Drbd_Data_Packet)
  */
 
-#define DP_HARDBARRIER        1
-#define DP_RW_SYNC            2
+#define DP_HARDBARRIER	      1
+#define DP_RW_SYNC	      2
 #define DP_MAY_SET_IN_SYNC    4
 
 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.
-	u32         seq_num;
-	u32         dp_flags;
+	u64	    sector;    // 64 bits sector number
+	u64	    block_id;  // Used in protocol B&C for the address of the req.
+	u32	    seq_num;
+	u32	    dp_flags;
 } __attribute((packed)) Drbd_Data_Packet;
 
 /*
@@ -427,19 +427,19 @@
  */
 typedef struct {
 	Drbd_Header head;
-	u64         sector;
-	u64         block_id;
-	u32         blksize;
-	u32         seq_num;
+	u64	    sector;
+	u64	    block_id;
+	u32	    blksize;
+	u32	    seq_num;
 } __attribute((packed)) Drbd_BlockAck_Packet;
 
 
 typedef struct {
 	Drbd_Header head;
-	u64         sector;
-	u64         block_id;
-	u32         blksize;
-	u32         pad;	//make sure packet is a multiple of 8 Byte
+	u64	    sector;
+	u64	    block_id;
+	u32	    blksize;
+	u32	    pad;	//make sure packet is a multiple of 8 Byte
 } __attribute((packed)) Drbd_BlockRequest_Packet;
 
 /*
@@ -453,108 +453,108 @@
 
 typedef struct {
 	Drbd_Header head;		// 8 bytes
-	u32         protocol_version;
-	u32         feature_flags;
+	u32	    protocol_version;
+	u32	    feature_flags;
 
 	/* should be more than enough for future enhancements
 	 * for now, feature_flags and the reserverd array shall be zero.
 	 */
 
-	u64         reserverd[8];
+	u64	    reserverd[8];
 } __attribute((packed)) Drbd_HandShake_Packet;
 // 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;	// make sure packet is a multiple of 8 Byte
 } __attribute((packed)) Drbd_Barrier_Packet;
 
 typedef struct {
 	Drbd_Header head;
-	u32         barrier;
-	u32         set_size;
+	u32	    barrier;
+	u32	    set_size;
 } __attribute((packed)) Drbd_BarrierAck_Packet;
 
 typedef struct {
 	Drbd_Header head;
-	u32         rate;
+	u32	    rate;
 } __attribute((packed)) Drbd_SyncParam_Packet;
 
 typedef struct {
 	Drbd_Header head;
-	u32         protocol;
-	u32         after_sb_0p;
-	u32         after_sb_1p;
-	u32         after_sb_2p;
-	u32         want_lose;
-	u32         two_primaries;
+	u32	    protocol;
+	u32	    after_sb_0p;
+	u32	    after_sb_1p;
+	u32	    after_sb_2p;
+	u32	    want_lose;
+	u32	    two_primaries;
 } __attribute((packed)) Drbd_Protocol_Packet;
 
 typedef struct {
 	Drbd_Header head;
-	u64         uuid[EXT_UUID_SIZE];
+	u64	    uuid[EXT_UUID_SIZE];
 } __attribute((packed)) Drbd_GenCnt_Packet;
 
 typedef struct {
 	Drbd_Header head;
-	u64         uuid;
+	u64	    uuid;
 } __attribute((packed)) Drbd_SyncUUID_Packet;
 
 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
-	u32         queue_order_type;
+	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;
 
 typedef struct {
 	Drbd_Header head;
-	u32         state;
+	u32	    state;
 } __attribute((packed)) Drbd_State_Packet;
 
 typedef struct {
 	Drbd_Header head;
-	u32         mask;
-	u32         val;
+	u32	    mask;
+	u32	    val;
 } __attribute((packed)) Drbd_Req_State_Packet;
 
 typedef struct {
 	Drbd_Header head;
-	u32         retcode;
+	u32	    retcode;
 } __attribute((packed)) Drbd_RqS_Reply_Packet;
 
 typedef struct {
-	u64       size;
-	u32       state;
-	u32       blksize;
-	u32       protocol;
-	u32       version;
-	u32       gen_cnt[5];
-	u32       bit_map_gen[5];
+	u64	  size;
+	u32	  state;
+	u32	  blksize;
+	u32	  protocol;
+	u32	  version;
+	u32	  gen_cnt[5];
+	u32	  bit_map_gen[5];
 } __attribute((packed)) Drbd06_Parameter_P;
 
 typedef struct {
 	Drbd_Header head;
-	u64         block_id;
-	u32         seq_num;
-	u32         pad;
+	u64	    block_id;
+	u32	    seq_num;
+	u32	    pad;
 } __attribute((packed)) Drbd_Discard_Packet;
 
 typedef union {
-	Drbd_Header              head;
-	Drbd_HandShake_Packet    HandShake;
-	Drbd_Data_Packet         Data;
-	Drbd_BlockAck_Packet     BlockAck;
-	Drbd_Barrier_Packet      Barrier;
-	Drbd_BarrierAck_Packet   BarrierAck;
-	Drbd_SyncParam_Packet    SyncParam;
-	Drbd_Protocol_Packet     Protocol;
-	Drbd_Sizes_Packet        Sizes;
-	Drbd_GenCnt_Packet       GenCnt;
-	Drbd_State_Packet        State;
+	Drbd_Header		 head;
+	Drbd_HandShake_Packet	 HandShake;
+	Drbd_Data_Packet	 Data;
+	Drbd_BlockAck_Packet	 BlockAck;
+	Drbd_Barrier_Packet	 Barrier;
+	Drbd_BarrierAck_Packet	 BarrierAck;
+	Drbd_SyncParam_Packet	 SyncParam;
+	Drbd_Protocol_Packet	 Protocol;
+	Drbd_Sizes_Packet	 Sizes;
+	Drbd_GenCnt_Packet	 GenCnt;
+	Drbd_State_Packet	 State;
 	Drbd_Req_State_Packet	 ReqState;
 	Drbd_RqS_Reply_Packet	 RqSReply;
 	Drbd_BlockRequest_Packet BlockRequest;
@@ -582,7 +582,7 @@
 {
 	/* THINK testing the t_state seems to be uncritical in all cases
 	 * (but thread_{start,stop}), so we can read it *without* the lock.
-	 * 	--lge */
+	 *	--lge */
 
 	smp_rmb();
 	return (volatile int)thi->t_state;
@@ -631,7 +631,7 @@
 	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
+	int n_req;	// number of requests attached before this barrier
 };
 
 typedef struct drbd_request drbd_request_t;
@@ -687,14 +687,14 @@
 	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!
+	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...
+	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.
+				// cleared when the state.conn	goes into
+				// Connected state.
 	WRITE_BM_AFTER_RESYNC	// A kmalloc() during resync failed
 };
 
@@ -724,7 +724,7 @@
 struct drbd_socket {
 	struct drbd_work_queue work;
 	struct semaphore  mutex;
-	struct socket    *socket;
+	struct socket	 *socket;
 	Drbd_Polymorph_Packet sbuf;  // this way we get our
 	Drbd_Polymorph_Packet rbuf;  // send/receive buffers off the stack
 };
@@ -749,10 +749,10 @@
 
 // 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;
-#define BIT(pn,pr,member)   unsigned member : 1;
-#define STRING(pn,pr,member,len) unsigned char member[len]; int member ## _len;
+#define INTEGER(pn, pr, member) int member;
+#define INT64(pn, pr, member) __u64 member;
+#define BIT(pn, pr, member) unsigned member : 1;
+#define STRING(pn, pr, member, len) unsigned char member[len]; int member ## _len;
 #include "linux/drbd_nl.h"
 
 struct drbd_backing_dev {
@@ -779,7 +779,7 @@
 	sector_t p_size;     /* partner's disk size */
 	request_queue_t     *rq_queue;
 	struct block_device *this_bdev;
-	struct gendisk      *vdisk;
+	struct gendisk	    *vdisk;
 
 	struct drbd_socket data; // for data/barrier/cstate/parameter packets
 	struct drbd_socket meta; // for ping/ack (metadata) packets
@@ -787,7 +787,7 @@
 	volatile unsigned int ko_count;
 	struct drbd_work  resync_work,
 			  unplug_work,
-	                  md_sync_work;
+			  md_sync_work;
 	struct timer_list resync_timer;
 	struct timer_list md_sync_timer;
 
@@ -801,12 +801,12 @@
 	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_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 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;
@@ -854,7 +854,7 @@
 	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;
@@ -911,9 +911,9 @@
 // drbd_main.c
 
 enum chg_state_flags {
-	ChgStateHard    = 1,
+	ChgStateHard	= 1,
 	ChgStateVerbose = 2,
-	ScheduleAfter   = 4,
+	ScheduleAfter	= 4,
 };
 
 extern int drbd_change_state(drbd_dev* mdev, enum chg_state_flags f,
@@ -929,10 +929,10 @@
 extern void _drbd_thread_stop(struct Drbd_thread *thi, int restart, int wait);
 extern void drbd_thread_signal(struct Drbd_thread *thi);
 extern void drbd_free_resources(drbd_dev *mdev);
-extern void tl_release(drbd_dev *mdev,unsigned int barrier_nr,
+extern void tl_release(drbd_dev *mdev, unsigned int barrier_nr,
 		       unsigned int set_size);
 extern void tl_clear(drbd_dev *mdev);
-extern struct drbd_barrier *_tl_add_barrier(drbd_dev *,struct drbd_barrier *);
+extern struct drbd_barrier *_tl_add_barrier(drbd_dev *, struct drbd_barrier *);
 extern void drbd_free_sock(drbd_dev *mdev);
 extern int drbd_send(drbd_dev *mdev, struct socket *sock,
 		     void* buf, size_t size, unsigned msg_flags);
@@ -966,7 +966,7 @@
 extern int drbd_send_dblock(drbd_dev *mdev, drbd_request_t *req);
 extern int _drbd_send_barrier(drbd_dev *mdev, struct drbd_barrier *barrier);
 extern int drbd_send_drequest(drbd_dev *mdev, int cmd,
-			      sector_t sector,int size, u64 block_id);
+			      sector_t sector, int size, u64 block_id);
 extern int drbd_send_bitmap(drbd_dev *mdev);
 extern int _drbd_send_bitmap(drbd_dev *mdev);
 extern int drbd_send_sr_reply(drbd_dev *mdev, int retcode);
@@ -978,7 +978,7 @@
 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?
-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_set(drbd_dev *mdev, int idx, u64 val);
 extern void drbd_uuid_new_current(drbd_dev *mdev);
 extern void drbd_uuid_set_bm(drbd_dev *mdev, u64 val);
@@ -994,16 +994,16 @@
 
 #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_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      (1<<MD_HARDSECT_B)
+#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
+#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
@@ -1039,11 +1039,11 @@
  */
 
 #define BM_BLOCK_SIZE_B  12			 //  4k per bit
-#define BM_BLOCK_SIZE    (1<<BM_BLOCK_SIZE_B)
+#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      (1<<BM_EXT_SIZE_B)
+#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)
 #error "HAVE YOU FIXED drbdmeta AS WELL??"
@@ -1081,21 +1081,21 @@
 
 /* the extent in "PER_EXTENT" below is an activity log extent
  * we need that many (long words/bytes) to store the bitmap
- *                   of one AL_EXTENT_SIZE chunk of storage.
+ *		     of one AL_EXTENT_SIZE chunk of storage.
  * we can store the bitmap for that many AL_EXTENTS within
  * one sector of the _on_disk_ bitmap:
- * bit   0        bit 37   bit 38            bit (512*8)-1
- *           ...|........|........|.. // ..|........|
- * sect. 0       `296     `304                     ^(512*8*8)-1
+ * bit	 0	  bit 37   bit 38	     bit (512*8)-1
+ *	     ...|........|........|.. // ..|........|
+ * sect. 0	 `296	  `304			   ^(512*8*8)-1
  *
 #define BM_WORDS_PER_EXT    ( (AL_EXT_SIZE/BM_BLOCK_SIZE) / BITS_PER_LONG )
 #define BM_BYTES_PER_EXT    ( (AL_EXT_SIZE/BM_BLOCK_SIZE) / 8 )  // 128
-#define BM_EXT_PER_SECT	    ( 512 / BM_BYTES_PER_EXTENT )        //   4
+#define BM_EXT_PER_SECT	    ( 512 / BM_BYTES_PER_EXTENT )	 //   4
  */
 
 #define DRBD_MAX_SECTORS_32 (0xffffffffLU)
 #define DRBD_MAX_SECTORS_BM \
-          ( (MD_RESERVED_SECT - MD_BM_OFFSET) * (1LL<<(BM_EXT_SIZE_B-9)) )
+	  ( (MD_RESERVED_SECT - MD_BM_OFFSET) * (1LL<<(BM_EXT_SIZE_B-9)) )
 #if DRBD_MAX_SECTORS_BM < DRBD_MAX_SECTORS_32
 #define DRBD_MAX_SECTORS      DRBD_MAX_SECTORS_BM
 #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_BM
@@ -1134,9 +1134,9 @@
 extern int  drbd_bm_read      (drbd_dev *mdev);
 extern int  drbd_bm_write     (drbd_dev *mdev);
 extern unsigned long drbd_bm_ALe_set_all (drbd_dev *mdev, unsigned long al_enr);
-extern size_t        drbd_bm_words       (drbd_dev *mdev);
-extern sector_t      drbd_bm_capacity    (drbd_dev *mdev);
-extern unsigned long drbd_bm_find_next   (drbd_dev *mdev);
+extern size_t	     drbd_bm_words	 (drbd_dev *mdev);
+extern sector_t      drbd_bm_capacity	 (drbd_dev *mdev);
+extern unsigned long drbd_bm_find_next	 (drbd_dev *mdev);
 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);
@@ -1157,7 +1157,7 @@
 #define drbd_bm_lock(mdev)    __drbd_bm_lock(mdev, __FILE__, __LINE__ )
 
 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__ )
+#define drbd_bm_recount_bits(mdev) _drbd_bm_recount_bits(mdev,	__FILE__, __LINE__ )
 // drbd_main.c
 
 /* needs to be included here,
@@ -1172,7 +1172,7 @@
 
 extern struct page* drbd_pp_pool; // drbd's page pool
 extern spinlock_t   drbd_pp_lock;
-extern int          drbd_pp_vacant;
+extern int	    drbd_pp_vacant;
 extern wait_queue_head_t drbd_pp_wait;
 
 extern drbd_dev *drbd_new_device(int minor);
@@ -1194,12 +1194,12 @@
 
 enum {
 	TraceTypePacket = 0x00000001,
-	TraceTypeRq     = 0x00000002,
+	TraceTypeRq	= 0x00000002,
 	TraceTypeUuid	= 0x00000004,
 	TraceTypeResync = 0x00000008,
-	TraceTypeEE     = 0x00000010,
+	TraceTypeEE	= 0x00000010,
 	TraceTypeUnplug = 0x00000020,
-	TraceTypeNl     = 0x00000040,
+	TraceTypeNl	= 0x00000040,
 	TraceTypeALExts = 0x00000080,
 };
 
@@ -1213,16 +1213,16 @@
 		( ( 1 << mdev_to_minor(mdev)) & trace_devs));
 }
 
-#define MTRACE(type,lvl,code...) \
+#define MTRACE(type, lvl, code...) \
 do { \
-	if (unlikely(is_mdev_trace(mdev,type,lvl))) { \
+	if (unlikely(is_mdev_trace(mdev, type, lvl))) { \
 		code \
 	} \
 } while (0)
 
-#define TRACE(type,lvl,code...) \
+#define TRACE(type, lvl, code...) \
 do { \
-	if (unlikely(is_trace(type,lvl))) { \
+	if (unlikely(is_trace(type, lvl))) { \
 		code \
 	} \
 } while (0)
@@ -1230,24 +1230,24 @@
 // 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.
+//	 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;
 
 extern void drbd_print_uuid(drbd_dev *mdev, unsigned int idx);
 
-extern void drbd_print_buffer(const char *prefix,unsigned int flags,int size,
-			      const void *buffer,const void *buffer_va,
+extern void drbd_print_buffer(const char *prefix, unsigned int flags, int size,
+			      const void *buffer, const void *buffer_va,
 			      unsigned int length);
 
 // 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) {
-	MTRACE(TraceTypeRq,TraceLvlSummary,
+	MTRACE(TraceTypeRq, TraceLvlSummary,
 	       _dump_bio(mdev, bio, complete);
 		);
 }
@@ -1261,7 +1261,7 @@
 	    int recv, Drbd_Polymorph_Packet *p, char* file, int line)
 {
 	MTRACE(TraceTypePacket, TraceLvlSummary,
-	       _dump_packet(mdev,sock,recv,p,file,line);
+	       _dump_packet(mdev, sock, recv, p, file, line);
 		);
 }
 
@@ -1305,18 +1305,18 @@
 				sector_t sector, int rw);
 // 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);
-extern int w_e_end_rsdata_req    (drbd_dev *, struct drbd_work *, int);
-extern int w_resync_inactive     (drbd_dev *, struct drbd_work *, int);
-extern int w_resume_next_sg      (drbd_dev *, struct drbd_work *, int);
-extern int w_io_error            (drbd_dev *, struct drbd_work *, int);
-extern int w_send_write_hint     (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);
+extern int w_e_end_rsdata_req	 (drbd_dev *, struct drbd_work *, int);
+extern int w_resync_inactive	 (drbd_dev *, struct drbd_work *, int);
+extern int w_resume_next_sg	 (drbd_dev *, struct drbd_work *, int);
+extern int w_io_error		 (drbd_dev *, struct drbd_work *, int);
+extern int w_send_write_hint	 (drbd_dev *, struct drbd_work *, int);
 extern int w_make_resync_request (drbd_dev *, struct drbd_work *, int);
-extern int w_send_dblock         (drbd_dev *, struct drbd_work *, int);
-extern int w_send_barrier        (drbd_dev *, struct drbd_work *, int);
-extern int w_send_read_req       (drbd_dev *, struct drbd_work *, int);
-extern int w_prev_work_done      (drbd_dev *, struct drbd_work *, int);
+extern int w_send_dblock	 (drbd_dev *, struct drbd_work *, int);
+extern int w_send_barrier	 (drbd_dev *, struct drbd_work *, int);
+extern int w_send_read_req	 (drbd_dev *, struct drbd_work *, int);
+extern int w_prev_work_done	 (drbd_dev *, struct drbd_work *, int);
 
 extern void resync_timer_fn(unsigned long data);
 
@@ -1340,7 +1340,7 @@
 #endif
 
 // drbd_receiver.c
-extern int drbd_release_ee(drbd_dev* mdev,struct list_head* list);
+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,
 					    sector_t sector,
@@ -1396,13 +1396,13 @@
 extern void drbd_rs_cancel_all(drbd_dev* mdev);
 extern int drbd_rs_del_all(drbd_dev* mdev);
 extern void drbd_rs_failed_io(drbd_dev* mdev, sector_t sector, int size);
-extern int drbd_al_read_log(struct Drbd_Conf *mdev,struct drbd_backing_dev *);
+extern int drbd_al_read_log(struct Drbd_Conf *mdev, struct drbd_backing_dev *);
 extern void __drbd_set_in_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line);
-#define drbd_set_in_sync(mdev,sector,size) \
-	__drbd_set_in_sync(mdev,sector,size, __FILE__, __LINE__ )
+#define drbd_set_in_sync(mdev, sector, size) \
+	__drbd_set_in_sync(mdev, sector, size, __FILE__, __LINE__ )
 extern void __drbd_set_out_of_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line);
-#define drbd_set_out_of_sync(mdev,sector,size) \
-	__drbd_set_out_of_sync(mdev,sector,size, __FILE__, __LINE__ )
+#define drbd_set_out_of_sync(mdev, sector, size) \
+	__drbd_set_out_of_sync(mdev, sector, size, __FILE__, __LINE__ )
 extern void drbd_al_apply_to_bm(struct Drbd_Conf *mdev);
 extern void drbd_al_to_on_disk_bm(struct Drbd_Conf *mdev);
 extern void drbd_al_shrink(struct Drbd_Conf *mdev);
@@ -1425,36 +1425,36 @@
 #define user_isp_mask 1
 #define aftr_isp_mask 1
 
-#define NS(T,S) ({drbd_state_t mask; mask.i=0; mask.T = T##_mask; mask;}), \
-                ({drbd_state_t val; val.i=0; val.T = (S); val;})
-#define NS2(T1,S1,T2,S2) \
-                ({drbd_state_t mask; mask.i=0; mask.T1 = T1##_mask; \
+#define NS(T, S) ({drbd_state_t mask; mask.i=0; mask.T = T##_mask; mask;}), \
+		({drbd_state_t val; val.i=0; val.T = (S); val;})
+#define NS2(T1, S1, T2, S2) \
+		({drbd_state_t mask; mask.i=0; mask.T1 = T1##_mask; \
 		  mask.T2 = T2##_mask; mask;}), \
-                ({drbd_state_t val; val.i=0; val.T1 = (S1); \
-                  val.T2 = (S2); val;})
-#define NS3(T1,S1,T2,S2,T3,S3) \
-                ({drbd_state_t mask; mask.i=0; mask.T1 = T1##_mask; \
+		({drbd_state_t val; val.i=0; val.T1 = (S1); \
+		  val.T2 = (S2); val;})
+#define NS3(T1, S1, T2, S2, T3, S3) \
+		({drbd_state_t mask; mask.i=0; mask.T1 = T1##_mask; \
 		  mask.T2 = T2##_mask; mask.T3 = T3##_mask; mask;}), \
-                ({drbd_state_t val; val.i=0; val.T1 = (S1); \
-                  val.T2 = (S2); val.T3 = (S3); val;})
+		({drbd_state_t val; val.i=0; val.T1 = (S1); \
+		  val.T2 = (S2); val.T3 = (S3); val;})
 
-#define _NS(D,T,S) D,({drbd_state_t ns; ns.i = D->state.i; ns.T = (S); ns;})
-#define _NS2(D,T1,S1,T2,S2) \
-                D,({drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
-                ns.T2 = (S2); ns;})
-#define _NS3(D,T1,S1,T2,S2,T3,S3) \
-                D,({drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
-                ns.T2 = (S2); ns.T3 = (S3); ns;})
+#define _NS(D, T, S) D, ({drbd_state_t ns; ns.i = D->state.i; ns.T = (S); ns;})
+#define _NS2(D, T1, S1, T2, S2) \
+		D, ({drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
+		ns.T2 = (S2); ns;})
+#define _NS3(D, T1, S1, T2, S2, T3, S3) \
+		D, ({drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
+		ns.T2 = (S2); ns.T3 = (S3); ns;})
 
 static inline void drbd_state_lock(drbd_dev *mdev)
 {
 	wait_event(mdev->misc_wait,
-		   !test_and_set_bit(CLUSTER_ST_CHANGE,&mdev->flags));
+		   !test_and_set_bit(CLUSTER_ST_CHANGE, &mdev->flags));
 }
 
 static inline void drbd_state_unlock(drbd_dev *mdev)
 {
-	clear_bit(CLUSTER_ST_CHANGE,&mdev->flags);
+	clear_bit(CLUSTER_ST_CHANGE, &mdev->flags);
 	wake_up(&mdev->misc_wait);
 }
 
@@ -1481,7 +1481,7 @@
 	case Detach:
 	case CallIOEHelper:
 		if (mdev->state.disk > Failed) {
-			_drbd_set_state(_NS(mdev,disk,Failed),
+			_drbd_set_state(_NS(mdev, disk, Failed),
 					ChgStateHard|ScheduleAfter);
 			ERR("Local IO failed. Detaching...\n");
 		}
@@ -1493,9 +1493,9 @@
 {
 	if (error) {
 		unsigned long flags;
-		spin_lock_irqsave(&mdev->req_lock,flags);
-		__drbd_chk_io_error(mdev,forcedetach);
-		spin_unlock_irqrestore(&mdev->req_lock,flags);
+		spin_lock_irqsave(&mdev->req_lock, flags);
+		__drbd_chk_io_error(mdev, forcedetach);
+		spin_unlock_irqrestore(&mdev->req_lock, flags);
 	}
 }
 
@@ -1566,7 +1566,7 @@
 		/* sizeof(struct md_on_disk_07) == 4k
 		 * position: last 4k aligned block of 4k size */
 		if (!bdev->backing_bdev) {
-			if (DRBD_ratelimit(5*HZ,5)) {
+			if (DRBD_ratelimit(5*HZ, 5)) {
 				ERR("bdev->backing_bdev==NULL\n");
 				dump_stack();
 			}
@@ -1582,7 +1582,7 @@
 static inline void
 _drbd_queue_work(struct drbd_work_queue *q, struct drbd_work *w)
 {
-	list_add_tail(&w->list,&q->q);
+	list_add_tail(&w->list, &q->q);
 	up(&q->s);
 }
 
@@ -1590,22 +1590,22 @@
 drbd_queue_work_front(struct drbd_work_queue *q, struct drbd_work *w)
 {
 	unsigned long flags;
-	spin_lock_irqsave(&q->q_lock,flags);
-	list_add(&w->list,&q->q);
+	spin_lock_irqsave(&q->q_lock, flags);
+	list_add(&w->list, &q->q);
 	up(&q->s); /* within the spinlock,
 		      see comment near end of drbd_worker() */
-	spin_unlock_irqrestore(&q->q_lock,flags);
+	spin_unlock_irqrestore(&q->q_lock, flags);
 }
 
 static inline void
 drbd_queue_work(struct drbd_work_queue *q, struct drbd_work *w)
 {
 	unsigned long flags;
-	spin_lock_irqsave(&q->q_lock,flags);
-	list_add_tail(&w->list,&q->q);
+	spin_lock_irqsave(&q->q_lock, flags);
+	list_add_tail(&w->list, &q->q);
 	up(&q->s); /* within the spinlock,
 		      see comment near end of drbd_worker() */
-	spin_unlock_irqrestore(&q->q_lock,flags);
+	spin_unlock_irqrestore(&q->q_lock, flags);
 }
 
 static inline void wake_asender(drbd_dev *mdev) {
@@ -1615,41 +1615,41 @@
 }
 
 static inline void request_ping(drbd_dev *mdev) {
-	set_bit(SEND_PING,&mdev->flags);
+	set_bit(SEND_PING, &mdev->flags);
 	wake_asender(mdev);
 }
 
 static inline int drbd_send_short_cmd(drbd_dev *mdev, Drbd_Packet_Cmd cmd)
 {
 	Drbd_Header h;
-	return drbd_send_cmd(mdev,USE_DATA_SOCKET,cmd,&h,sizeof(h));
+	return drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, &h, sizeof(h));
 }
 
 static inline int drbd_send_ping(drbd_dev *mdev)
 {
 	Drbd_Header h;
-	return drbd_send_cmd(mdev,USE_META_SOCKET,Ping,&h,sizeof(h));
+	return drbd_send_cmd(mdev, USE_META_SOCKET, Ping, &h, sizeof(h));
 }
 
 static inline int drbd_send_ping_ack(drbd_dev *mdev)
 {
 	Drbd_Header h;
-	return drbd_send_cmd(mdev,USE_META_SOCKET,PingAck,&h,sizeof(h));
+	return drbd_send_cmd(mdev, USE_META_SOCKET, PingAck, &h, sizeof(h));
 }
 
 static inline void drbd_thread_stop(struct Drbd_thread *thi)
 {
-	_drbd_thread_stop(thi,FALSE,TRUE);
+	_drbd_thread_stop(thi, FALSE, TRUE);
 }
 
 static inline void drbd_thread_stop_nowait(struct Drbd_thread *thi)
 {
-	_drbd_thread_stop(thi,FALSE,FALSE);
+	_drbd_thread_stop(thi, FALSE, FALSE);
 }
 
 static inline void drbd_thread_restart_nowait(struct Drbd_thread *thi)
 {
-	_drbd_thread_stop(thi,TRUE,FALSE);
+	_drbd_thread_stop(thi, TRUE, FALSE);
 }
 
 /* counts how many answer packets packets we expect from our peer,
@@ -1687,16 +1687,16 @@
 		    atomic_read(&mdev->which))
 
 #define dec_ap_pending(mdev)	do {				\
-	typecheck(drbd_dev*,mdev);				\
+	typecheck(drbd_dev*, mdev);				\
 	if (atomic_dec_and_test(&mdev->ap_pending_cnt))		\
 		wake_up(&mdev->misc_wait);			\
 	ERR_IF_CNT_IS_NEGATIVE(ap_pending_cnt); } while (0)
 
 /* counts how many resync-related answers we still expect from the peer
- *                   increase                   decrease
+ *		     increase			decrease
  * SyncTarget sends RSDataRequest (and expects RSDataReply)
  * SyncSource sends RSDataReply   (and expects WriteAck whith ID_SYNCER)
- *                                         (or NegAck with ID_SYNCER)
+ *					   (or NegAck with ID_SYNCER)
  */
 static inline void inc_rs_pending(drbd_dev* mdev)
 {
@@ -1704,18 +1704,18 @@
 }
 
 #define dec_rs_pending(mdev)	do {				\
-	typecheck(drbd_dev*,mdev);				\
+	typecheck(drbd_dev*, mdev);				\
 	atomic_dec(&mdev->rs_pending_cnt);			\
 	ERR_IF_CNT_IS_NEGATIVE(rs_pending_cnt); } while (0)
 
 /* counts how many answers we still need to send to the peer.
  * increased on
- *  receive_Data        unless protocol A;
- *                      we need to send a RecvAck (proto B)
- *                      or WriteAck (proto C)
+ *  receive_Data	unless protocol A;
+ *			we need to send a RecvAck (proto B)
+ *			or WriteAck (proto C)
  *  receive_RSDataReply (recv_resync_read) we need to send a WriteAck
  *  receive_DataRequest (receive_RSDataRequest) we need to send back Data
- *  receive_Barrier_*   we need to send a BarrierAck
+ *  receive_Barrier_*	we need to send a BarrierAck
  */
 static inline void inc_unacked(drbd_dev* mdev)
 {
@@ -1723,12 +1723,12 @@
 }
 
 #define dec_unacked(mdev)	do {				\
-	typecheck(drbd_dev*,mdev);				\
+	typecheck(drbd_dev*, mdev);				\
 	atomic_dec(&mdev->unacked_cnt);				\
 	ERR_IF_CNT_IS_NEGATIVE(unacked_cnt); } while (0)
 
 #define sub_unacked(mdev, n)	do {				\
-	typecheck(drbd_dev*,mdev);				\
+	typecheck(drbd_dev*, mdev);				\
 	atomic_sub(n, &mdev->unacked_cnt);			\
 	ERR_IF_CNT_IS_NEGATIVE(unacked_cnt); } while (0)
 
@@ -1831,7 +1831,7 @@
 
 	spin_lock_irq(&mdev->req_lock);
 	while (!__inc_ap_bio_cond(mdev)) {
-		prepare_to_wait(&mdev->misc_wait,&wait,TASK_UNINTERRUPTIBLE);
+		prepare_to_wait(&mdev->misc_wait, &wait, TASK_UNINTERRUPTIBLE);
 		spin_unlock_irq(&mdev->req_lock);
 		schedule();
 		finish_wait(&mdev->misc_wait, &wait);
@@ -1858,12 +1858,12 @@
 	 */
 	return ((s32)(a) - (s32)(b));
 }
-#define seq_lt(a,b) (seq_cmp((a),(b)) < 0)
-#define seq_gt(a,b) (seq_cmp((a),(b)) > 0)
-#define seq_ge(a,b) (seq_cmp((a),(b)) >= 0)
-#define seq_le(a,b) (seq_cmp((a),(b)) <= 0)
+#define seq_lt(a, b) (seq_cmp((a), (b)) < 0)
+#define seq_gt(a, b) (seq_cmp((a), (b)) > 0)
+#define seq_ge(a, b) (seq_cmp((a), (b)) >= 0)
+#define seq_le(a, b) (seq_cmp((a), (b)) <= 0)
 /* CAUTION: please no side effects in arguments! */
-#define seq_max(a,b) ((u32)(seq_gt((a),(b)) ? (a) : (b)))
+#define seq_max(a, b) ((u32)(seq_gt((a), (b)) ? (a) : (b)))
 
 static inline void update_peer_seq(drbd_dev* mdev, unsigned int new_seq)
 {
@@ -1908,7 +1908,7 @@
 static inline void drbd_kick_lo(drbd_dev *mdev)
 {
 	if (!mdev->bc->backing_bdev) {
-		if (DRBD_ratelimit(5*HZ,5)) {
+		if (DRBD_ratelimit(5*HZ, 5)) {
 			ERR("backing_bdev==NULL in drbd_kick_lo! The following call trace is for debuggin purposes only. Don't worry.\n");
 			dump_stack();
 		}

Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 11:38:05 UTC (rev 2985)
@@ -85,18 +85,18 @@
 MODULE_PARM_DESC(allow_oos, "DONT USE!");
 /* thanks to these macros, if compiled into the kernel (not-module),
  * this becomes the boot parameter drbd.minor_count */
-module_param(minor_count, int,0);
-module_param(allow_oos, bool,0);
+module_param(minor_count, int, 0);
+module_param(allow_oos, int, 0);
 
 #ifdef DRBD_ENABLE_FAULTS
 int enable_faults = 0;
 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
@@ -108,9 +108,9 @@
 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);
+module_param(trace_level, int, 0644);
+module_param(trace_type, int, 0644);
+module_param(trace_devs, int, 0644);
 #endif
 
 
@@ -158,7 +158,7 @@
 {
 	struct drbd_barrier *b;
 
-	b=kmalloc(sizeof(struct drbd_barrier),GFP_KERNEL);
+	b=kmalloc(sizeof(struct drbd_barrier), GFP_KERNEL);
 	if (!b) return 0;
 	INIT_LIST_HEAD(&b->requests);
 	INIT_LIST_HEAD(&b->w.list);
@@ -190,7 +190,7 @@
  * It returns the previously newest barrier
  * (not the just created barrier) to the caller.
  */
-struct drbd_barrier *_tl_add_barrier(drbd_dev *mdev,struct drbd_barrier *new)
+struct drbd_barrier *_tl_add_barrier(drbd_dev *mdev, struct drbd_barrier *new)
 {
 	struct drbd_barrier *newest_before;
 
@@ -210,7 +210,7 @@
 }
 
 /* when we receive a barrier ack */
-void tl_release(drbd_dev *mdev,unsigned int barrier_nr,
+void tl_release(drbd_dev *mdev, unsigned int barrier_nr,
 		       unsigned int set_size)
 {
 	struct drbd_barrier *b;
@@ -227,7 +227,7 @@
 	 * in protocol A and B, this should not be empty, even though the
 	 * master_bio's could already been completed.  */
 	list_for_each_safe(le, tle, &b->requests) {
-		r = list_entry(le, struct drbd_request,tl_requests);
+		r = list_entry(le, struct drbd_request, tl_requests);
 		_req_mod(r, barrier_acked, 0);
 	}
 	list_del(&b->requests);
@@ -270,7 +270,7 @@
 		struct drbd_request *r;
 
 		list_for_each_safe(le, tle, &b->requests) {
-			r = list_entry(le, struct drbd_request,tl_requests);
+			r = list_entry(le, struct drbd_request, tl_requests);
 			_req_mod(r, connection_lost_while_pending, 0);
 		}
 		tmp = b->next;
@@ -316,10 +316,10 @@
 {
 	enum io_error_handler eh;
 	unsigned long flags;
-	int send,ok=1;
+	int send, ok=1;
 
 	eh = PassOn;
-	if (inc_local_if_state(mdev,Failed)) {
+	if (inc_local_if_state(mdev, Failed)) {
 		eh = mdev->bc->dc.on_io_error;
 		dec_local(mdev);
 	}
@@ -327,12 +327,12 @@
 	if (!forcedetach && eh == PassOn)
 		return 1;
 
-	spin_lock_irqsave(&mdev->req_lock,flags);
+	spin_lock_irqsave(&mdev->req_lock, flags);
 	if ( (send = (mdev->state.disk == Failed)) ) {
-		_drbd_set_state(_NS(mdev,disk,Diskless),
+		_drbd_set_state(_NS(mdev, disk, Diskless),
 				ChgStateHard|ScheduleAfter);
 	}
-	spin_unlock_irqrestore(&mdev->req_lock,flags);
+	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
 	if (!send) return ok;
 
@@ -350,7 +350,7 @@
 	/* Releasing the backing device is done in after_state_ch() */
 
 	if (eh == CallIOEHelper) {
-		drbd_khelper(mdev,"local-io-error");
+		drbd_khelper(mdev, "local-io-error");
 	}
 
 	return ok;
@@ -375,54 +375,54 @@
 		      drbd_state_t mask, drbd_state_t val)
 {
 	unsigned long flags;
-	drbd_state_t os,ns;
+	drbd_state_t os, ns;
 	int rv;
 
-	spin_lock_irqsave(&mdev->req_lock,flags);
+	spin_lock_irqsave(&mdev->req_lock, flags);
 	os = mdev->state;
 	ns.i = (os.i & ~mask.i) | val.i;
 	rv = _drbd_set_state(mdev, ns, f);
 	ns = mdev->state;
-	spin_unlock_irqrestore(&mdev->req_lock,flags);
-	if (rv==SS_Success && !(f&ScheduleAfter)) after_state_ch(mdev,os,ns,f);
+	spin_unlock_irqrestore(&mdev->req_lock, flags);
+	if (rv==SS_Success && !(f&ScheduleAfter)) after_state_ch(mdev, os, ns, f);
 
 	return rv;
 }
 
 void drbd_force_state(drbd_dev* mdev, drbd_state_t mask, drbd_state_t val)
 {
-	drbd_change_state(mdev,ChgStateHard,mask,val);
+	drbd_change_state(mdev, ChgStateHard, mask, val);
 }
 
 STATIC int is_valid_state(drbd_dev* mdev, drbd_state_t ns);
 STATIC int is_valid_state_transition(drbd_dev*, drbd_state_t, drbd_state_t);
 STATIC int drbd_send_state_req(drbd_dev *, drbd_state_t, drbd_state_t);
 
-set_st_err_t _req_st_cond(drbd_dev* mdev,drbd_state_t mask, drbd_state_t val)
+set_st_err_t _req_st_cond(drbd_dev* mdev, drbd_state_t mask, drbd_state_t val)
 {
-	drbd_state_t os,ns;
+	drbd_state_t os, ns;
 	unsigned long flags;
 	int rv;
 
-	if (test_and_clear_bit(CL_ST_CHG_SUCCESS,&mdev->flags))
+	if (test_and_clear_bit(CL_ST_CHG_SUCCESS, &mdev->flags))
 		return SS_CW_Success;
 
-	if (test_and_clear_bit(CL_ST_CHG_FAIL,&mdev->flags))
+	if (test_and_clear_bit(CL_ST_CHG_FAIL, &mdev->flags))
 		return SS_CW_FailedByPeer;
 
 	rv=0;
-	spin_lock_irqsave(&mdev->req_lock,flags);
+	spin_lock_irqsave(&mdev->req_lock, flags);
 	os = mdev->state;
 	ns.i = (os.i & ~mask.i) | val.i;
-	if ( !cl_wide_st_chg(mdev,os,ns) ) rv = SS_CW_NoNeed;
+	if ( !cl_wide_st_chg(mdev, os, ns) ) rv = SS_CW_NoNeed;
 	if (!rv) {
-		rv = is_valid_state(mdev,ns);
+		rv = is_valid_state(mdev, ns);
 		if (rv==SS_Success) {
-			rv = is_valid_state_transition(mdev,ns,os);
+			rv = is_valid_state_transition(mdev, ns, os);
 			if (rv==SS_Success) rv = 0; // cont waiting, otherwise fail.
 		}
 	}
-	spin_unlock_irqrestore(&mdev->req_lock,flags);
+	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
 	return rv;
 }
@@ -437,40 +437,40 @@
 		       enum chg_state_flags f)
 {
 	unsigned long flags;
-	drbd_state_t os,ns;
+	drbd_state_t os, ns;
 	int rv;
 
-	spin_lock_irqsave(&mdev->req_lock,flags);
+	spin_lock_irqsave(&mdev->req_lock, flags);
 	os = mdev->state;
 	ns.i = (os.i & ~mask.i) | val.i;
 
-	if (cl_wide_st_chg(mdev,os,ns)) {
-		rv = is_valid_state(mdev,ns);
-		if (rv == SS_Success) rv = is_valid_state_transition(mdev,ns,os);
-		spin_unlock_irqrestore(&mdev->req_lock,flags);
+	if (cl_wide_st_chg(mdev, os, ns)) {
+		rv = is_valid_state(mdev, ns);
+		if (rv == SS_Success) rv = is_valid_state_transition(mdev, ns, os);
+		spin_unlock_irqrestore(&mdev->req_lock, flags);
 
 		if (rv < SS_Success) {
-			if (f & ChgStateVerbose) print_st_err(mdev,os,ns,rv);
+			if (f & ChgStateVerbose) print_st_err(mdev, os, ns, rv);
 			return rv;
 		}
 
 		drbd_state_lock(mdev);
-		if ( !drbd_send_state_req(mdev,mask,val) ) {
+		if ( !drbd_send_state_req(mdev, mask, val) ) {
 			drbd_state_unlock(mdev);
 			rv = SS_CW_FailedByPeer;
-			if (f & ChgStateVerbose) print_st_err(mdev,os,ns,rv);
+			if (f & ChgStateVerbose) print_st_err(mdev, os, ns, rv);
 			return rv;
 		}
 
-		wait_event(mdev->state_wait,(rv=_req_st_cond(mdev,mask,val)));
+		wait_event(mdev->state_wait, (rv=_req_st_cond(mdev, mask, val)));
 
 		if (rv < SS_Success) {
 			// nearly dead code.
 			drbd_state_unlock(mdev);
-			if (f & ChgStateVerbose) print_st_err(mdev,os,ns,rv);
+			if (f & ChgStateVerbose) print_st_err(mdev, os, ns, rv);
 			return rv;
 		}
-		spin_lock_irqsave(&mdev->req_lock,flags);
+		spin_lock_irqsave(&mdev->req_lock, flags);
 		os = mdev->state;
 		ns.i = (os.i & ~mask.i) | val.i;
 		drbd_state_unlock(mdev);
@@ -478,9 +478,9 @@
 
 	rv = _drbd_set_state(mdev, ns, f);
 	ns = mdev->state;
-	spin_unlock_irqrestore(&mdev->req_lock,flags);
+	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
-	if (rv==SS_Success && !(f&ScheduleAfter)) after_state_ch(mdev,os,ns,f);
+	if (rv==SS_Success && !(f&ScheduleAfter)) after_state_ch(mdev, os, ns, f);
 
 	return rv;
 }
@@ -504,9 +504,9 @@
 
 void print_st_err(drbd_dev* mdev, drbd_state_t os, drbd_state_t ns, int err)
 {
-	ERR("State change failed: %s\n",set_st_err_name(err));
-	print_st(mdev," state",os);
-	print_st(mdev,"wanted",ns);
+	ERR("State change failed: %s\n", set_st_err_name(err));
+	print_st(mdev, " state", os);
+	print_st(mdev, "wanted", ns);
 }
 
 
@@ -576,7 +576,7 @@
 	return rv;
 }
 
-STATIC int is_valid_state_transition(drbd_dev* mdev,drbd_state_t ns,drbd_state_t os)
+STATIC int is_valid_state_transition(drbd_dev* mdev, drbd_state_t ns, drbd_state_t os)
 {
 	int rv=SS_Success;
 
@@ -592,7 +592,7 @@
 	return rv;
 }
 
-int _drbd_set_state(drbd_dev* mdev, drbd_state_t ns,enum chg_state_flags flags)
+int _drbd_set_state(drbd_dev* mdev, drbd_state_t ns, enum chg_state_flags flags)
 {
 	drbd_state_t os;
 	int rv=SS_Success, warn_sync_abort=0;
@@ -719,24 +719,24 @@
 		/*  pre-state-change checks ; only look at ns  */
 		/* See drbd_state_sw_errors in drbd_strings.c */
 
-		rv = is_valid_state(mdev,ns);
+		rv = is_valid_state(mdev, ns);
 		if (rv < SS_Success) {
 			/* If the old state was illegal as well, then let
 			   this happen...*/
 
-			if ( is_valid_state(mdev,os) == rv ) {
+			if ( is_valid_state(mdev, os) == rv ) {
 				ERR("Forcing state change from bad state. "
 				    "Error would be: '%s'\n",
 				    set_st_err_name(rv));
-				print_st(mdev,"old",os);
-				print_st(mdev,"new",ns);
+				print_st(mdev, "old", os);
+				print_st(mdev, "new", ns);
 				rv = SS_Success;
 			}
-		} else rv = is_valid_state_transition(mdev,ns,os);
+		} else rv = is_valid_state_transition(mdev, ns, os);
 	}
 
 	if (rv < SS_Success) {
-		if (flags & ChgStateVerbose) print_st_err(mdev,os,ns,rv);
+		if (flags & ChgStateVerbose) print_st_err(mdev, os, ns, rv);
 		return rv;
 	}
 
@@ -746,7 +746,7 @@
 
 #if DUMP_MD >= 2
 	{
-	char *pbp,pb[300];
+	char *pbp, pb[300];
 	pbp = pb;
 	*pbp=0;
 	PSC(role);
@@ -768,8 +768,8 @@
 
 	/**   post-state-change actions   **/
 	if (os.conn >= SyncSource   && ns.conn <= Connected) {
-		set_bit(STOP_SYNC_TIMER,&mdev->flags);
-		mod_timer(&mdev->resync_timer,jiffies);
+		set_bit(STOP_SYNC_TIMER, &mdev->flags);
+		mod_timer(&mdev->resync_timer, jiffies);
 	}
 
 	if ( (os.conn == PausedSyncT || os.conn == PausedSyncS) &&
@@ -777,9 +777,9 @@
 		INFO("Syncer continues.\n");
 		mdev->rs_paused += (long)jiffies-(long)mdev->rs_mark_time;
 		if (ns.conn == SyncTarget) {
-			D_ASSERT(!test_bit(STOP_SYNC_TIMER,&mdev->flags));
-			clear_bit(STOP_SYNC_TIMER,&mdev->flags);
-			mod_timer(&mdev->resync_timer,jiffies);
+			D_ASSERT(!test_bit(STOP_SYNC_TIMER, &mdev->flags));
+			clear_bit(STOP_SYNC_TIMER, &mdev->flags);
+			mod_timer(&mdev->resync_timer, jiffies);
 		}
 	}
 
@@ -788,7 +788,7 @@
 		INFO("Resync suspended\n");
 		mdev->rs_mark_time = jiffies;
 		if (ns.conn == PausedSyncT) {
-			set_bit(STOP_SYNC_TIMER,&mdev->flags);
+			set_bit(STOP_SYNC_TIMER, &mdev->flags);
 		}
 	}
 
@@ -808,7 +808,7 @@
 			ascw->ns = ns;
 			ascw->flags = flags;
 			ascw->w.cb = w_after_state_ch;
-			drbd_queue_work(&mdev->data.work,&ascw->w);
+			drbd_queue_work(&mdev->data.work, &ascw->w);
 		} else {
 			WARN("Could not kmalloc an ascw\n");
 		}
@@ -849,7 +849,7 @@
 					     MDF_ConnectedInd|MDF_WasUpToDate|
 					     MDF_PeerOutDated );
 
-		if (test_bit(CRASHED_PRIMARY,&mdev->flags) ||
+		if (test_bit(CRASHED_PRIMARY, &mdev->flags) ||
 		    mdev->state.role == Primary ||
 		    ( mdev->state.pdsk < Inconsistent &&
 		      mdev->state.peer == Primary ) )  mdf |= MDF_PrimaryInd;
@@ -878,7 +878,7 @@
 		     (os.conn < Connected && ns.conn >= Connected) ) {
 			tl_clear(mdev);
 			spin_lock_irq(&mdev->req_lock);
-			_drbd_set_state(_NS(mdev,susp,0),
+			_drbd_set_state(_NS(mdev, susp, 0),
 					ChgStateVerbose | ScheduleAfter );
 			spin_unlock_irq(&mdev->req_lock);
 		}
@@ -963,24 +963,24 @@
 
 		drbd_bm_lock(mdev); // racy...
 
-		drbd_md_set_flag(mdev,MDF_FullSync);
+		drbd_md_set_flag(mdev, MDF_FullSync);
 		drbd_md_sync(mdev);
 
 		drbd_bm_set_all(mdev);
 		drbd_bm_write(mdev);
 
-		drbd_md_clear_flag(mdev,MDF_FullSync);
+		drbd_md_clear_flag(mdev, MDF_FullSync);
 		drbd_md_sync(mdev);
 
 		drbd_bm_unlock(mdev);
 
 		if (ns.conn == StartingSyncT) {
 			spin_lock_irq(&mdev->req_lock);
-			_drbd_set_state(_NS(mdev,conn,WFSyncUUID),
+			_drbd_set_state(_NS(mdev, conn, WFSyncUUID),
 					ChgStateVerbose | ScheduleAfter );
 			spin_unlock_irq(&mdev->req_lock);
 		} else /* StartingSyncS */ {
-			drbd_start_resync(mdev,SyncSource);
+			drbd_start_resync(mdev, SyncSource);
 		}
 	}
 
@@ -989,13 +989,13 @@
 	       os.disk > Inconsistent && ns.disk == Inconsistent ) {
 		drbd_bm_lock(mdev); // racy...
 
-		drbd_md_set_flag(mdev,MDF_FullSync);
+		drbd_md_set_flag(mdev, MDF_FullSync);
 		drbd_md_sync(mdev);
 
 		drbd_bm_set_all(mdev);
 		drbd_bm_write(mdev);
 
-		drbd_md_clear_flag(mdev,MDF_FullSync);
+		drbd_md_clear_flag(mdev, MDF_FullSync);
 		drbd_md_sync(mdev);
 
 		drbd_bm_unlock(mdev);
@@ -1138,7 +1138,7 @@
 }
 
 
-void _drbd_thread_stop(struct Drbd_thread *thi, int restart,int wait)
+void _drbd_thread_stop(struct Drbd_thread *thi, int restart, int wait)
 {
 	drbd_dev *mdev = thi->mdev;
 	Drbd_thread_state ns = restart ? Restarting : Exiting;
@@ -1165,7 +1165,7 @@
 		smp_mb();
 		if (thi->task != current) {
 			if (wait) init_completion(&thi->startstop);
-			force_sig(DRBD_SIGKILL,thi->task);
+			force_sig(DRBD_SIGKILL, thi->task);
 		} else D_ASSERT(!wait);
 	}
 	spin_unlock(&thi->t_lock);
@@ -1190,7 +1190,7 @@
 	}
 
 	if (thi->task != current) {
-		force_sig(DRBD_SIGKILL,thi->task);
+		force_sig(DRBD_SIGKILL, thi->task);
 	}
 
 	spin_unlock(&thi->t_lock);
@@ -1201,7 +1201,7 @@
 			  Drbd_Packet_Cmd cmd, Drbd_Header *h,
 			  size_t size, unsigned msg_flags)
 {
-	int sent,ok;
+	int sent, ok;
 
 	ERR_IF(!h) return FALSE;
 	ERR_IF(!size) return FALSE;
@@ -1210,8 +1210,8 @@
 	h->command = cpu_to_be16(cmd);
 	h->length  = cpu_to_be16(size-sizeof(Drbd_Header));
 
-	dump_packet(mdev,sock,0,(void*)h, __FILE__, __LINE__);
-	sent = drbd_send(mdev,sock,h,size,msg_flags);
+	dump_packet(mdev, sock, 0, (void*)h, __FILE__, __LINE__);
+	sent = drbd_send(mdev, sock, h, size, msg_flags);
 
 	ok = ( sent == size );
 	if (!ok) {
@@ -1264,10 +1264,10 @@
 	if (!drbd_get_data_sock(mdev))
 		return 0;
 
-	dump_packet(mdev,mdev->data.socket,0,(void*)&h, __FILE__, __LINE__);
+	dump_packet(mdev, mdev->data.socket, 0, (void*)&h, __FILE__, __LINE__);
 
-	ok = ( sizeof(h) == drbd_send(mdev,mdev->data.socket,&h,sizeof(h),0) );
-	ok = ok && ( size == drbd_send(mdev,mdev->data.socket,data,size,0) );
+	ok = ( sizeof(h) == drbd_send(mdev, mdev->data.socket, &h, sizeof(h), 0) );
+	ok = ok && ( size == drbd_send(mdev, mdev->data.socket, data, size, 0) );
 
 	drbd_put_data_sock(mdev);
 
@@ -1280,7 +1280,7 @@
 
 	p.rate      = cpu_to_be32(sc->rate);
 
-	return drbd_send_cmd(mdev,USE_DATA_SOCKET,SyncParam,(Drbd_Header*)&p,sizeof(p));
+	return drbd_send_cmd(mdev, USE_DATA_SOCKET, SyncParam, (Drbd_Header*)&p, sizeof(p));
 }
 
 int drbd_send_protocol(drbd_dev *mdev)
@@ -1294,8 +1294,8 @@
 	p.want_lose     = cpu_to_be32(mdev->net_conf->want_lose);
 	p.two_primaries = cpu_to_be32(mdev->net_conf->two_primaries);
 
-	return drbd_send_cmd(mdev,USE_DATA_SOCKET,ReportProtocol,
-			     (Drbd_Header*)&p,sizeof(p));
+	return drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportProtocol,
+			     (Drbd_Header*)&p, sizeof(p));
 }
 
 int drbd_send_uuids(drbd_dev *mdev)
@@ -1304,7 +1304,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 ? */
@@ -1321,8 +1321,8 @@
 
 	dec_local(mdev);
 
-	return drbd_send_cmd(mdev,USE_DATA_SOCKET,ReportUUIDs,
-			     (Drbd_Header*)&p,sizeof(p));
+	return drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportUUIDs,
+			     (Drbd_Header*)&p, sizeof(p));
 }
 
 int drbd_send_sync_uuid(drbd_dev *mdev, u64 val)
@@ -1331,8 +1331,8 @@
 
 	p.uuid = cpu_to_be64(val);
 
-	return drbd_send_cmd(mdev,USE_DATA_SOCKET,ReportSyncUUID,
-			     (Drbd_Header*)&p,sizeof(p));
+	return drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportSyncUUID,
+			     (Drbd_Header*)&p, sizeof(p));
 }
 
 int drbd_send_sizes(drbd_dev *mdev)
@@ -1342,7 +1342,7 @@
 	int q_order_type;
 	int ok;
 
-	if (inc_local_if_state(mdev,Negotiating)) {
+	if (inc_local_if_state(mdev, Negotiating)) {
 		D_ASSERT(mdev->bc->backing_bdev);
 		d_size = drbd_get_max_capacity(mdev->bc);
 		u_size = mdev->bc->dc.disk_size;
@@ -1361,8 +1361,8 @@
 	p.max_segment_size = cpu_to_be32(mdev->rq_queue->max_segment_size);
 	p.queue_order_type = cpu_to_be32(q_order_type);
 
-	ok = drbd_send_cmd(mdev,USE_DATA_SOCKET,ReportSizes,
-			   (Drbd_Header*)&p,sizeof(p));
+	ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportSizes,
+			   (Drbd_Header*)&p, sizeof(p));
 	return ok;
 }
 
@@ -1372,8 +1372,8 @@
 
 	p.state    = cpu_to_be32(mdev->state.i);
 
-	return drbd_send_cmd(mdev,USE_DATA_SOCKET,ReportState,
-			     (Drbd_Header*)&p,sizeof(p));
+	return drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportState,
+			     (Drbd_Header*)&p, sizeof(p));
 }
 
 STATIC int drbd_send_state_req(drbd_dev *mdev, drbd_state_t mask, drbd_state_t val)
@@ -1383,8 +1383,8 @@
 	p.mask    = cpu_to_be32(mask.i);
 	p.val     = cpu_to_be32(val.i);
 
-	return drbd_send_cmd(mdev,USE_DATA_SOCKET,StateChgRequest,
-			     (Drbd_Header*)&p,sizeof(p));
+	return drbd_send_cmd(mdev, USE_DATA_SOCKET, StateChgRequest,
+			     (Drbd_Header*)&p, sizeof(p));
 }
 
 int drbd_send_sr_reply(drbd_dev *mdev, int retcode)
@@ -1393,8 +1393,8 @@
 
 	p.retcode    = cpu_to_be32(retcode);
 
-	return drbd_send_cmd(mdev,USE_META_SOCKET,StateChgReply,
-			     (Drbd_Header*)&p,sizeof(p));
+	return drbd_send_cmd(mdev, USE_META_SOCKET, StateChgReply,
+			     (Drbd_Header*)&p, sizeof(p));
 }
 
 
@@ -1413,7 +1413,7 @@
 	p  = vmalloc(PAGE_SIZE); // sleeps. cannot fail.
 	buffer = (unsigned long*)p->payload;
 
-	if (drbd_md_test_flag(mdev->bc,MDF_FullSync)) {
+	if (drbd_md_test_flag(mdev->bc, MDF_FullSync)) {
 		drbd_bm_set_all(mdev);
 		drbd_bm_write(mdev);
 		if (unlikely(mdev->state.disk <= Failed )) {
@@ -1423,7 +1423,7 @@
 			ERR("Failed to write bitmap to disk!\n");
 		}
 		else {
-			drbd_md_clear_flag(mdev,MDF_FullSync);
+			drbd_md_clear_flag(mdev, MDF_FullSync);
 			drbd_md_sync(mdev);
 		}
 	}
@@ -1438,7 +1438,7 @@
 		if (want) {
 			drbd_bm_get_lel(mdev, bm_i, num_words, buffer);
 		}
-		ok = _drbd_send_cmd(mdev,mdev->data.socket,ReportBitMap,
+		ok = _drbd_send_cmd(mdev, mdev->data.socket, ReportBitMap,
 				   p, sizeof(*p) + want, 0);
 		bm_i += num_words;
 	} while (ok && want);
@@ -1458,7 +1458,7 @@
 	return ok;
 }
 
-int drbd_send_b_ack(drbd_dev *mdev, u32 barrier_nr,u32 set_size)
+int drbd_send_b_ack(drbd_dev *mdev, u32 barrier_nr, u32 set_size)
 {
 	int ok;
 	Drbd_BarrierAck_Packet p;
@@ -1466,7 +1466,7 @@
 	p.barrier  = barrier_nr;
 	p.set_size = cpu_to_be32(set_size);
 
-	ok = drbd_send_cmd(mdev,USE_META_SOCKET,BarrierAck,(Drbd_Header*)&p,sizeof(p));
+	ok = drbd_send_cmd(mdev, USE_META_SOCKET, BarrierAck, (Drbd_Header*)&p, sizeof(p));
 	return ok;
 }
 
@@ -1486,10 +1486,10 @@
 	p.sector   = sector;
 	p.block_id = block_id;
 	p.blksize  = blksize;
-	p.seq_num  = cpu_to_be32(atomic_add_return(1,&mdev->packet_seq));
+	p.seq_num  = cpu_to_be32(atomic_add_return(1, &mdev->packet_seq));
 
 	if (!mdev->meta.socket || mdev->state.conn < Connected) return FALSE;
-	ok=drbd_send_cmd(mdev,USE_META_SOCKET,cmd,(Drbd_Header*)&p,sizeof(p));
+	ok=drbd_send_cmd(mdev, USE_META_SOCKET, cmd, (Drbd_Header*)&p, sizeof(p));
 	return ok;
 }
 
@@ -1499,26 +1499,26 @@
 	const int header_size = sizeof(Drbd_Data_Packet) - sizeof(Drbd_Header);
 	int data_size  = ((Drbd_Header*)dp)->length - header_size;
 
-	return _drbd_send_ack(mdev,cmd,dp->sector,cpu_to_be32(data_size),
+	return _drbd_send_ack(mdev, cmd, dp->sector, cpu_to_be32(data_size),
 			      dp->block_id);
 }
 
 int drbd_send_ack_rp(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
 		     Drbd_BlockRequest_Packet *rp)
 {
-	return _drbd_send_ack(mdev,cmd,rp->sector,rp->blksize,rp->block_id);
+	return _drbd_send_ack(mdev, cmd, rp->sector, rp->blksize, rp->block_id);
 }
 
 int drbd_send_ack(drbd_dev *mdev, Drbd_Packet_Cmd cmd, struct Tl_epoch_entry *e)
 {
-	return _drbd_send_ack(mdev,cmd,
+	return _drbd_send_ack(mdev, cmd,
 			      cpu_to_be64(e->sector),
 			      cpu_to_be32(e->size),
 			      e->block_id);
 }
 
 int drbd_send_drequest(drbd_dev *mdev, int cmd,
-		       sector_t sector,int size, u64 block_id)
+		       sector_t sector, int size, u64 block_id)
 {
 	int ok;
 	Drbd_BlockRequest_Packet p;
@@ -1529,7 +1529,7 @@
 
 	/* FIXME BIO_RW_SYNC ? */
 
-	ok = drbd_send_cmd(mdev,USE_DATA_SOCKET,cmd,(Drbd_Header*)&p,sizeof(p));
+	ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, (Drbd_Header*)&p, sizeof(p));
 	return ok;
 }
 
@@ -1594,7 +1594,7 @@
 		    int offset, size_t size)
 {
 	mm_segment_t oldfs = get_fs();
-	int sent,ok;
+	int sent, ok;
 	int len   = size;
 
 #ifdef SHOW_SENDPAGE_USAGE
@@ -1634,8 +1634,8 @@
 
 	set_fs(KERNEL_DS);
 	do {
-		sent = mdev->data.socket->ops->sendpage(mdev->data.socket,page,
-							offset,len,
+		sent = mdev->data.socket->ops->sendpage(mdev->data.socket, page,
+							offset, len,
 							MSG_NOSIGNAL);
 		if (sent == -EAGAIN) {
 			if (we_should_drop_the_connection(mdev,
@@ -1646,7 +1646,7 @@
 		}
 		if (sent <= 0) {
 			WARN("%s: size=%d len=%d sent=%d\n",
-			     __func__,(int)size,len,sent);
+			     __func__, (int)size, len, sent);
 			break;
 		}
 		len    -= sent;
@@ -1695,7 +1695,7 @@
 	p.sector   = cpu_to_be64(req->sector);
 	p.block_id = (unsigned long)req;
 	p.seq_num  = cpu_to_be32( req->seq_num =
-				  atomic_add_return(1,&mdev->packet_seq) );
+				  atomic_add_return(1, &mdev->packet_seq) );
 	dp_flags = 0;
 	if (req->master_bio->bi_rw & BIO_RW_BARRIER) {
 		dp_flags |= DP_HARDBARRIER;
@@ -1709,14 +1709,14 @@
 	}
 
 	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);
+	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) {
-			ok = _drbd_send_bio(mdev,req->master_bio);
+			ok = _drbd_send_bio(mdev, req->master_bio);
 		} else {
-			ok = _drbd_send_zc_bio(mdev,req->master_bio);
+			ok = _drbd_send_zc_bio(mdev, req->master_bio);
 		}
 	}
 
@@ -1749,9 +1749,9 @@
 	if (!drbd_get_data_sock(mdev))
 		return 0;
 
-	dump_packet(mdev,mdev->data.socket,0,(void*)&p, __FILE__, __LINE__);
-	ok = sizeof(p) == drbd_send(mdev,mdev->data.socket,&p,sizeof(p),MSG_MORE);
-	if (ok) ok = _drbd_send_zc_bio(mdev,e->private_bio);
+	dump_packet(mdev, mdev->data.socket, 0, (void*)&p, __FILE__, __LINE__);
+	ok = sizeof(p) == drbd_send(mdev, mdev->data.socket, &p, sizeof(p), MSG_MORE);
+	if (ok) ok = _drbd_send_zc_bio(mdev, e->private_bio);
 
 	drbd_put_data_sock(mdev);
 	return ok;
@@ -1783,7 +1783,7 @@
 	struct kvec iov;
 #endif
 	struct msghdr msg;
-	int rv,sent=0;
+	int rv, sent=0;
 
 	if (!sock) return -1000;
 
@@ -1825,7 +1825,7 @@
 		rv = kernel_sendmsg(sock, &msg, &iov, 1, size);
 #endif
 		if (rv == -EAGAIN) {
-			if (we_should_drop_the_connection(mdev,sock))
+			if (we_should_drop_the_connection(mdev, sock))
 				break;
 			else
 				continue;
@@ -1837,7 +1837,7 @@
 			 * we don't care for now!
 			 * eventually this should be sorted out be the proper
 			 * use of the SIGNAL_ASENDER bit... */
-			if (DRBD_ratelimit(5*HZ,5)) {
+			if (DRBD_ratelimit(5*HZ, 5)) {
 				DBG("Got a signal in drbd_send(,%c,)!\n",
 				    sock == mdev->meta.socket ? 'm' : 's');
 				// dump_stack();
@@ -1861,9 +1861,9 @@
 			ERR("%s_sendmsg returned %d\n",
 			    sock == mdev->meta.socket ? "msock" : "sock",
 			    rv);
-			drbd_force_state(mdev, NS(conn,BrokenPipe));
+			drbd_force_state(mdev, NS(conn, BrokenPipe));
 		} else
-			drbd_force_state(mdev, NS(conn,Timeout));
+			drbd_force_state(mdev, NS(conn, Timeout));
 	}
 
 	return sent;
@@ -1878,7 +1878,7 @@
 	mdev = minor_to_mdev(MINOR(inode->i_rdev));
 	if (!mdev) return -ENODEV;
 
-	spin_lock_irqsave(&mdev->req_lock,flags);
+	spin_lock_irqsave(&mdev->req_lock, flags);
 	/* to have a stable mdev->state.role and no race with updating open_cnt */
 
 	if (mdev->state.role != Primary) {
@@ -1890,7 +1890,7 @@
 	}
 
 	if (!rv) mdev->open_cnt++;
-	spin_unlock_irqrestore(&mdev->req_lock,flags);
+	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
 	return rv;
 }
@@ -1918,7 +1918,7 @@
 {
 	drbd_dev *mdev = q->queuedata;
 
-	MTRACE(TraceTypeUnplug,TraceLvlSummary,
+	MTRACE(TraceTypeUnplug, TraceLvlSummary,
 	       INFO("got unplugged ap_bio_count=%d\n",
 		    atomic_read(&mdev->ap_bio_cnt));
 	       );
@@ -1932,13 +1932,13 @@
 	spin_lock_irq(&mdev->req_lock);
 	if (mdev->state.pdsk >= Inconsistent && mdev->state.conn >= Connected) {
 		D_ASSERT(mdev->state.role == Primary);
-		if (test_and_clear_bit(UNPLUG_REMOTE,&mdev->flags)) {
+		if (test_and_clear_bit(UNPLUG_REMOTE, &mdev->flags)) {
 			/* add to the data.work queue,
 			 * unless already queued.
 			 * XXX this might be a good addition to drbd_queue_work
 			 * anyways, to detect "double queuing" ... */
 			if (list_empty(&mdev->unplug_work.list))
-				drbd_queue_work(&mdev->data.work,&mdev->unplug_work);
+				drbd_queue_work(&mdev->data.work, &mdev->unplug_work);
 		}
 	}
 	spin_unlock_irq(&mdev->req_lock);
@@ -1970,20 +1970,20 @@
 
 	drbd_set_defaults(mdev);
 
-	atomic_set(&mdev->ap_bio_cnt,0);
-	atomic_set(&mdev->ap_pending_cnt,0);
-	atomic_set(&mdev->rs_pending_cnt,0);
-	atomic_set(&mdev->unacked_cnt,0);
-	atomic_set(&mdev->local_cnt,0);
-	atomic_set(&mdev->net_cnt,0);
-	atomic_set(&mdev->packet_seq,0);
+	atomic_set(&mdev->ap_bio_cnt, 0);
+	atomic_set(&mdev->ap_pending_cnt, 0);
+	atomic_set(&mdev->rs_pending_cnt, 0);
+	atomic_set(&mdev->unacked_cnt, 0);
+	atomic_set(&mdev->local_cnt, 0);
+	atomic_set(&mdev->net_cnt, 0);
+	atomic_set(&mdev->packet_seq, 0);
 	atomic_set(&mdev->pp_in_use, 0);
 
 	init_MUTEX(&mdev->md_io_mutex);
 	init_MUTEX(&mdev->data.mutex);
 	init_MUTEX(&mdev->meta.mutex);
-	sema_init(&mdev->data.work.s,0);
-	sema_init(&mdev->meta.work.s,0);
+	sema_init(&mdev->data.work.s, 0);
+	sema_init(&mdev->meta.work.s, 0);
 
 	spin_lock_init(&mdev->data.work.q_lock);
 	spin_lock_init(&mdev->meta.work.q_lock);
@@ -2024,7 +2024,7 @@
 	drbd_thread_init(mdev, &mdev->asender, drbd_asender);
 
 #ifdef __arch_um__
-	INFO("mdev = 0x%p\n",mdev);
+	INFO("mdev = 0x%p\n", mdev);
 #endif
 }
 
@@ -2074,7 +2074,7 @@
 
 	/* no need to lock it, I'm the only thread alive */
 	if (mdev->epoch_size !=  0)
-		ERR("epoch_size:%d\n",mdev->epoch_size);
+		ERR("epoch_size:%d\n", mdev->epoch_size);
 	mdev->al_writ_cnt  =
 	mdev->bm_writ_cnt  =
 	mdev->read_cnt     =
@@ -2088,8 +2088,8 @@
 	mdev->rs_mark_left =
 	mdev->rs_mark_time = 0;
 	D_ASSERT(mdev->net_conf == NULL);
-	drbd_set_my_capacity(mdev,0);
-	drbd_bm_resize(mdev,0);
+	drbd_set_my_capacity(mdev, 0);
+	drbd_bm_resize(mdev, 0);
 
 	// just in case
 	drbd_free_resources(mdev);
@@ -2180,7 +2180,7 @@
 	for (i=0;i< number;i++) {
 		page = alloc_page(GFP_HIGHUSER);
 		if (!page) goto Enomem;
-		set_page_private(page,(unsigned long)drbd_pp_pool);
+		set_page_private(page, (unsigned long)drbd_pp_pool);
 		drbd_pp_pool = page;
 	}
 	drbd_pp_vacant = number;
@@ -2217,7 +2217,7 @@
 
 	if (minor_table) {
 		if (drbd_proc)
-			remove_proc_entry("drbd",&proc_root);
+			remove_proc_entry("drbd", &proc_root);
 		i=minor_count;
 		while (i--) {
 			drbd_dev        *mdev  = minor_to_mdev(i);
@@ -2242,24 +2242,24 @@
 			if (mdev->bitmap) drbd_bm_cleanup(mdev);
 			if (mdev->resync) lc_free(mdev->resync);
 
-			rr = drbd_release_ee(mdev,&mdev->active_ee);
-			if (rr) ERR("%d EEs in active list found!\n",rr);
+			rr = drbd_release_ee(mdev, &mdev->active_ee);
+			if (rr) ERR("%d EEs in active list found!\n", rr);
 
-			rr = drbd_release_ee(mdev,&mdev->sync_ee);
-			if (rr) ERR("%d EEs in sync list found!\n",rr);
+			rr = drbd_release_ee(mdev, &mdev->sync_ee);
+			if (rr) ERR("%d EEs in sync list found!\n", rr);
 
-			rr = drbd_release_ee(mdev,&mdev->read_ee);
-			if (rr) ERR("%d EEs in read list found!\n",rr);
+			rr = drbd_release_ee(mdev, &mdev->read_ee);
+			if (rr) ERR("%d EEs in read list found!\n", rr);
 
-			rr = drbd_release_ee(mdev,&mdev->done_ee);
-			if (rr) ERR("%d EEs in done list found!\n",rr);
+			rr = drbd_release_ee(mdev, &mdev->done_ee);
+			if (rr) ERR("%d EEs in done list found!\n", rr);
 
-			rr = drbd_release_ee(mdev,&mdev->net_ee);
-			if (rr) ERR("%d EEs in net list found!\n",rr);
+			rr = drbd_release_ee(mdev, &mdev->net_ee);
+			if (rr) ERR("%d EEs in net list found!\n", rr);
 
 			ERR_IF (!list_empty(&mdev->data.work.q)) {
 				struct list_head *lp;
-				list_for_each(lp,&mdev->data.work.q) {
+				list_for_each(lp, &mdev->data.work.q) {
 					DUMPP(lp);
 				}
 			};
@@ -2308,7 +2308,7 @@
 	struct gendisk *disk;
 	request_queue_t *q;
 
-	mdev = kzalloc(sizeof(drbd_dev),GFP_KERNEL);
+	mdev = kzalloc(sizeof(drbd_dev), GFP_KERNEL);
 	if (!mdev) goto Enomem;
 
 	mdev->minor = minor;
@@ -2335,7 +2335,7 @@
 	disk->private_data = mdev;
 	add_disk(disk);
 
-	mdev->this_bdev = bdget(MKDEV(DRBD_MAJOR,minor));
+	mdev->this_bdev = bdget(MKDEV(DRBD_MAJOR, minor));
 	// we have no partitions. we contain only ourselves.
 	mdev->this_bdev->bd_contains = mdev->this_bdev;
 
@@ -2352,7 +2352,7 @@
 	// 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);
+	mdev->app_reads_hash=kzalloc(APP_R_HSIZE*sizeof(void*), GFP_KERNEL);
 	if (!mdev->app_reads_hash) goto Enomem;
 
 	return mdev;
@@ -2370,41 +2370,9 @@
 {
 	int err;
 
-#if 0
-// warning LGE "DEBUGGING"
-/* I am too lazy to calculate this by hand	-lge
- */
-#define SZO(x) printk(KERN_ERR "sizeof(" #x ") = %d\n", sizeof(x))
-	SZO(struct Drbd_Conf);
-	SZO(struct buffer_head);
-	SZO(Drbd_Polymorph_Packet);
-	SZO(struct drbd_socket);
-	SZO(struct bm_extent);
-	SZO(struct lc_element);
-	SZO(struct semaphore);
-	SZO(struct drbd_request);
-	SZO(struct bio);
-	SZO(wait_queue_head_t);
-	SZO(spinlock_t);
-	SZO(Drbd_Header);
-	SZO(Drbd_HandShake_Packet);
-	SZO(Drbd_Barrier_Packet);
-	SZO(Drbd_BarrierAck_Packet);
-	SZO(Drbd_SyncParam_Packet);
-	SZO(Drbd06_Parameter_P);
-	SZO(Drbd_Data_Packet);
-	SZO(Drbd_BlockAck_Packet);
-	printk(KERN_ERR "AL_EXTENTS_PT = %d\n",AL_EXTENTS_PT);
-	printk(KERN_ERR "DRBD_MAX_SECTORS = %llu\n",DRBD_MAX_SECTORS);
-	printk(KERN_ERR "DRBD_MAX_SECTORS_FLEX = %llu\n",DRBD_MAX_SECTORS_FLEX);
-#define OOF(t,m) printk(KERN_ERR "offsetof("#t","#m") = %d\n", offsetof(t,m))
-	OOF(struct Drbd_Conf,bitmap);
-	//OOF(struct drbd_bitmap,bm_set);
-	return -EBUSY;
-#endif
 #ifdef __arch_um__
 	printk(KERN_INFO "drbd_module = 0x%p core = 0x%p\n",
-	       THIS_MODULE,THIS_MODULE->module_core);
+	       THIS_MODULE, THIS_MODULE->module_core);
 #endif
 
 	if (sizeof(Drbd_HandShake_Packet) != 80) {
@@ -2415,7 +2383,7 @@
 
 	if (1 > minor_count||minor_count > 255) {
 		printk(KERN_ERR DEVICE_NAME
-			": invalid minor_count (%d)\n",minor_count);
+			": invalid minor_count (%d)\n", minor_count);
 #ifdef MODULE
 		return -EINVAL;
 #else
@@ -2445,7 +2413,7 @@
 	init_waitqueue_head(&drbd_pp_wait);
 
 	drbd_proc = NULL; // play safe for drbd_cleanup
-	minor_table = kzalloc(sizeof(drbd_dev *)*minor_count,GFP_KERNEL);
+	minor_table = kzalloc(sizeof(drbd_dev *)*minor_count, GFP_KERNEL);
 	if (!minor_table) goto Enomem;
 
 	if ((err = drbd_create_mempools()))
@@ -2470,7 +2438,7 @@
 
 	printk(KERN_INFO DEVICE_NAME ": initialised. "
 	       "Version: " REL_VERSION " (api:%d/proto:%d)\n",
-	       API_VERSION,PRO_VERSION);
+	       API_VERSION, PRO_VERSION);
 	printk(KERN_INFO DEVICE_NAME ": %s\n", drbd_buildtag());
 	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);
@@ -2553,18 +2521,18 @@
 	sector_t sector;
 	int i;
 
-	if (!test_and_clear_bit(MD_DIRTY,&mdev->flags)) return;
+	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!
-	if (!inc_local_if_state(mdev,Failed)) return;
+	if (!inc_local_if_state(mdev, Failed)) return;
 
 	INFO("Writing meta data super block now.\n");
 
 	down(&mdev->md_io_mutex);
 	buffer = (struct meta_data_on_disk *)page_address(mdev->md_io_page);
-	memset(buffer,0,512);
+	memset(buffer, 0, 512);
 
 	buffer->la_size=cpu_to_be64(drbd_get_capacity(mdev->this_bdev));
 	for (i = Current; i < UUID_SIZE; i++)
@@ -2580,20 +2548,20 @@
 
 	buffer->bm_offset = cpu_to_be32(mdev->bc->md.bm_offset);
 
-	D_ASSERT(drbd_md_ss__(mdev,mdev->bc) == mdev->bc->md.md_offset);
+	D_ASSERT(drbd_md_ss__(mdev, mdev->bc) == mdev->bc->md.md_offset);
 	sector = mdev->bc->md.md_offset;
 
 #if 0
 	/* FIXME sooner or later I'd like to use the MD_DIRTY flag everywhere,
 	 * so we can avoid unneccessary md writes.
 	 */
-	ERR_IF (!test_bit(MD_DIRTY,&mdev->flags)) {
+	ERR_IF (!test_bit(MD_DIRTY, &mdev->flags)) {
 		dump_stack();
 	}
 #endif
 
-	if (drbd_md_sync_page_io(mdev,mdev->bc,sector,WRITE)) {
-		clear_bit(MD_DIRTY,&mdev->flags);
+	if (drbd_md_sync_page_io(mdev, mdev->bc, sector, WRITE)) {
+		clear_bit(MD_DIRTY, &mdev->flags);
 	} else {
 		/* this was a try anyways ... */
 		ERR("meta data update failed!\n");
@@ -2619,14 +2587,14 @@
 int drbd_md_read(drbd_dev *mdev, struct drbd_backing_dev *bdev)
 {
 	struct meta_data_on_disk * buffer;
-	int i,rv = NoError;
+	int i, rv = NoError;
 
-	if (!inc_local_if_state(mdev,Attaching)) return MDIOError;
+	if (!inc_local_if_state(mdev, Attaching)) return MDIOError;
 
 	down(&mdev->md_io_mutex);
 	buffer = (struct meta_data_on_disk *)page_address(mdev->md_io_page);
 
-	if ( ! drbd_md_sync_page_io(mdev,bdev,bdev->md.md_offset,READ) ) {
+	if ( ! drbd_md_sync_page_io(mdev, bdev, bdev->md.md_offset, READ) ) {
 		/* NOTE: cant do normal error processing here as this is
 		   called BEFORE disk is attached */
 		ERR("Error while reading metadata.\n");
@@ -2693,8 +2661,8 @@
  */
 void drbd_md_mark_dirty(drbd_dev *mdev)
 {
-	set_bit(MD_DIRTY,&mdev->flags);
-	mod_timer(&mdev->md_sync_timer,jiffies + 5*HZ );
+	set_bit(MD_DIRTY, &mdev->flags);
+	mod_timer(&mdev->md_sync_timer, jiffies + 5*HZ );
 }
 
 
@@ -2705,8 +2673,8 @@
 	for ( i=History_start ; i<History_end ; i++ ) {
 		mdev->bc->md.uuid[i+1] = mdev->bc->md.uuid[i];
 
-		MTRACE(TraceTypeUuid,TraceLvlAll,
-		       drbd_print_uuid(mdev,i+1);
+		MTRACE(TraceTypeUuid, TraceLvlAll,
+		       drbd_print_uuid(mdev, i+1);
 			);
 	}
 }
@@ -2723,8 +2691,8 @@
 
 	mdev->bc->md.uuid[idx] = val;
 
-	MTRACE(TraceTypeUuid,TraceLvlSummary,
-	       drbd_print_uuid(mdev,idx);
+	MTRACE(TraceTypeUuid, TraceLvlSummary,
+	       drbd_print_uuid(mdev, idx);
 		);
 
 	drbd_md_mark_dirty(mdev);
@@ -2736,11 +2704,11 @@
 	if (mdev->bc->md.uuid[idx]) {
 		drbd_uuid_move_history(mdev);
 		mdev->bc->md.uuid[History_start]=mdev->bc->md.uuid[idx];
-		MTRACE(TraceTypeUuid,TraceLvlMetrics,
-		       drbd_print_uuid(mdev,History_start);
+		MTRACE(TraceTypeUuid, TraceLvlMetrics,
+		       drbd_print_uuid(mdev, History_start);
 			);
 	}
-	_drbd_uuid_set(mdev,idx,val);
+	_drbd_uuid_set(mdev, idx, val);
 }
 
 void drbd_uuid_new_current(drbd_dev *mdev)
@@ -2748,8 +2716,8 @@
 	INFO("Creating new current UUID\n");
 	D_ASSERT(mdev->bc->md.uuid[Bitmap] == 0);
 	mdev->bc->md.uuid[Bitmap] = mdev->bc->md.uuid[Current];
-	MTRACE(TraceTypeUuid,TraceLvlMetrics,
-	       drbd_print_uuid(mdev,Bitmap);
+	MTRACE(TraceTypeUuid, TraceLvlMetrics,
+	       drbd_print_uuid(mdev, Bitmap);
 		);
 
 	get_random_bytes(&mdev->bc->md.uuid[Current], sizeof(u64));
@@ -2759,8 +2727,8 @@
 		mdev->bc->md.uuid[Current] &= ~((u64)1);
 	}
 
-	MTRACE(TraceTypeUuid,TraceLvlSummary,
-	       drbd_print_uuid(mdev,Current);
+	MTRACE(TraceTypeUuid, TraceLvlSummary,
+	       drbd_print_uuid(mdev, Current);
 		);
 
 	drbd_md_mark_dirty(mdev);
@@ -2775,9 +2743,9 @@
 		mdev->bc->md.uuid[History_start]=mdev->bc->md.uuid[Bitmap];
 		mdev->bc->md.uuid[Bitmap]=0;
 
-		MTRACE(TraceTypeUuid,TraceLvlMetrics,
-		       drbd_print_uuid(mdev,History_start);
-		       drbd_print_uuid(mdev,Bitmap);
+		MTRACE(TraceTypeUuid, TraceLvlMetrics,
+		       drbd_print_uuid(mdev, History_start);
+		       drbd_print_uuid(mdev, Bitmap);
 			);
 	} else {
 		if (mdev->bc->md.uuid[Bitmap]) WARN("bm UUID already set");
@@ -2785,8 +2753,8 @@
 		mdev->bc->md.uuid[Bitmap] = val;
 		mdev->bc->md.uuid[Bitmap] &= ~((u64)1);
 
-		MTRACE(TraceTypeUuid,TraceLvlMetrics,
-		       drbd_print_uuid(mdev,Bitmap);
+		MTRACE(TraceTypeUuid, TraceLvlMetrics,
+		       drbd_print_uuid(mdev, Bitmap);
 			);
 	}
 	drbd_md_mark_dirty(mdev);
@@ -2818,7 +2786,7 @@
 {
 	drbd_dev* mdev = (drbd_dev*) data;
 
-	drbd_queue_work_front(&mdev->data.work,&mdev->md_sync_work);
+	drbd_queue_work_front(&mdev->data.work, &mdev->md_sync_work);
 }
 
 STATIC int w_md_sync(drbd_dev *mdev, struct drbd_work *w, int unused)
@@ -2877,7 +2845,7 @@
 unsigned int
 _drbd_insert_fault(drbd_dev *mdev, unsigned int type)
 {
-	static struct fault_random_state rrs = {0,0};
+	static struct fault_random_state rrs = {0, 0};
 
 	unsigned int ret = (
 		(fault_devs == 0 || ((1 << mdev_to_minor(mdev)) & fault_devs) != 0) &&
@@ -2912,7 +2880,7 @@
 /* Pretty print a UUID value */
 void
 drbd_print_uuid(drbd_dev *mdev, unsigned int idx) {
-	INFO(" uuid[%s] now %016llX\n",_drbd_uuid_str(idx),mdev->bc->md.uuid[idx]);
+	INFO(" uuid[%s] now %016llX\n", _drbd_uuid_str(idx), mdev->bc->md.uuid[idx]);
 }
 
 
@@ -2942,8 +2910,8 @@
 
 */
 void
-drbd_print_buffer(const char *prefix,unsigned int flags,int size,
-		  const void *buffer,const void *buffer_va,
+drbd_print_buffer(const char *prefix, unsigned int flags, int size,
+		  const void *buffer, const void *buffer_va,
 		  unsigned int length)
 
 #define LINE_SIZE       16
@@ -2952,8 +2920,8 @@
 	const unsigned char *pstart;
 	const unsigned char *pstart_va;
 	const unsigned char *pend;
-	char bytes_str[LINE_SIZE*3+8],ascii_str[LINE_SIZE+8];
-	char *pbytes=bytes_str,*pascii=ascii_str;
+	char bytes_str[LINE_SIZE*3+8], ascii_str[LINE_SIZE+8];
+	char *pbytes=bytes_str, *pascii=ascii_str;
 	int  offset=0;
 	long sizemask;
 	int  field_width;
@@ -3001,8 +2969,8 @@
 	while (p < pend_str) {
 		if (p < (const unsigned char *)buffer || p >= pend) {
 			// Before start of buffer or after end- print spaces
-			pbytes += sprintf(pbytes,"%*c ",field_width,' ');
-			pascii += sprintf(pascii,"%*c",size,' ');
+			pbytes += sprintf(pbytes, "%*c ", field_width, ' ');
+			pascii += sprintf(pascii, "%*c", size, ' ');
 			p += size;
 		}
 		else {
@@ -3021,7 +2989,7 @@
 				break;
 			}
 
-			pbytes += sprintf(pbytes,"%0*x ",field_width,val);
+			pbytes += sprintf(pbytes, "%0*x ", field_width, val);
 
 			for (index = size; index; index--) {
 				*pascii++ = isprint(*p) ? *p : '.';
@@ -3038,8 +3006,8 @@
 			       prefix,
 			       (flags & DBGPRINT_BUFFADDR)
 			       ? (long)pstart_va : (long)offset,
-			       LINE_ENTRIES*(field_width+1),bytes_str,
-			       LINE_SIZE,ascii_str);
+			       LINE_ENTRIES*(field_width+1), bytes_str,
+			       LINE_SIZE, ascii_str);
 
 			// Move onto next line
 			pstart_va += (p-pstart);
@@ -3096,9 +3064,9 @@
 
 char *_dump_block_id(u64 block_id, char *buff) {
     if (is_syncer_block_id(block_id))
-	strcpy(buff,"SyncerId");
+	strcpy(buff, "SyncerId");
     else
-	sprintf(buff,"%llx",block_id);
+	sprintf(buff, "%llx", block_id);
 
     return buff;
 }
@@ -3110,7 +3078,7 @@
 	char *sockname = sock == mdev->meta.socket ? "meta" : "data";
 	int cmd = (recv == 2) ? p->head.command : be16_to_cpu(p->head.command);
 	char tmp[300];
-	drbd_state_t m,v;
+	drbd_state_t m, v;
 
 	switch (cmd) {
 	case HandShake:
@@ -3123,7 +3091,7 @@
 	case Data:
 		INFOP("%s (sector %llus, id %s, seq %u, f %x)\n", cmdname(cmd),
 		      (unsigned long long)be64_to_cpu(p->Data.sector),
-		      _dump_block_id(p->Data.block_id,tmp),
+		      _dump_block_id(p->Data.block_id, tmp),
 		      be32_to_cpu(p->Data.seq_num),
 		      be32_to_cpu(p->Data.dp_flags)
 			);
@@ -3133,7 +3101,7 @@
 	case RSDataReply:
 		INFOP("%s (sector %llus, id %s)\n", cmdname(cmd),
 		      (unsigned long long)be64_to_cpu(p->Data.sector),
-		      _dump_block_id(p->Data.block_id,tmp)
+		      _dump_block_id(p->Data.block_id, tmp)
 			);
 		break;
 
@@ -3146,7 +3114,7 @@
 		INFOP("%s (sector %llus, size %u, id %s, seq %u)\n", cmdname(cmd),
 		      (long long)be64_to_cpu(p->BlockAck.sector),
 		      be32_to_cpu(p->BlockAck.blksize),
-		      _dump_block_id(p->BlockAck.block_id,tmp),
+		      _dump_block_id(p->BlockAck.block_id, tmp),
 		      be32_to_cpu(p->BlockAck.seq_num)
 			);
 		break;
@@ -3156,7 +3124,7 @@
 		INFOP("%s (sector %llus, size %u, id %s)\n", cmdname(cmd),
 		      (long long)be64_to_cpu(p->BlockRequest.sector),
 		      be32_to_cpu(p->BlockRequest.blksize),
-		      _dump_block_id(p->BlockRequest.block_id,tmp)
+		      _dump_block_id(p->BlockRequest.block_id, tmp)
 			);
 		break;
 
@@ -3185,14 +3153,14 @@
 	case ReportState:
 		v.i = be32_to_cpu(p->State.state);
 		m.i = 0xffffffff;
-		dump_st(tmp,sizeof(tmp),m,v);
+		dump_st(tmp, sizeof(tmp), m, v);
 		INFOP("%s (s %x {%s})\n", cmdname(cmd), v.i, tmp);
 		break;
 
 	case StateChgRequest:
 		m.i = be32_to_cpu(p->ReqState.mask);
 		v.i = be32_to_cpu(p->ReqState.val);
-		dump_st(tmp,sizeof(tmp),m,v);
+		dump_st(tmp, sizeof(tmp), m, v);
 		INFOP("%s (m %x v %x {%s})\n", cmdname(cmd), m.i, v.i, tmp);
 		break;
 
@@ -3210,7 +3178,7 @@
 			break;
 		/* fall through... */
 	default:
-		INFOP("%s (%u)\n",cmdname(cmd), cmd);
+		INFOP("%s (%u)\n", cmdname(cmd), cmd);
 		break;
 	}
 }
@@ -3233,7 +3201,7 @@
 
 	INFO("%s %s Bio:%p - %soffset " SECTOR_FORMAT ", size %x\n",
 	     complete? "<<<":">>>",
-	     bio_rw(bio)==WRITE?"Write":"Read",bio,
+	     bio_rw(bio)==WRITE?"Write":"Read", bio,
 	     complete? (drbd_bio_uptodate(bio)? "Success, ":"Failed, ") : "",
 	     bio->bi_sector << SECTOR_SHIFT,
 	     bio->bi_size);
@@ -3242,7 +3210,7 @@
 	    ((bio_rw(bio) == WRITE) ^ complete) ) {
 		printk(KERN_DEBUG "  ind     page   offset   length\n");
 		__bio_for_each_segment(bvec, bio, segno, 0) {
-			printk(KERN_DEBUG "  [%d] %p %8.8x %8.8x\n",segno,
+			printk(KERN_DEBUG "  [%d] %p %8.8x %8.8x\n", segno,
 			       bvec->bv_page, bvec->bv_offset, bvec->bv_len);
 
 			if (trace_level >= TraceLvlAll) {
@@ -3251,7 +3219,7 @@
 
 				bvec_buf = bvec_kmap_irq(bvec, &flags);
 
-				drbd_print_buffer("    ",DBGPRINT_BUFFADDR,1,
+				drbd_print_buffer("    ", DBGPRINT_BUFFADDR, 1,
 						  bvec_buf,
 						  faddr,
 						  (bvec->bv_len <= 0x80)? bvec->bv_len : 0x80);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 11:38:05 UTC (rev 2985)
@@ -58,7 +58,7 @@
 		fields \
 		default: \
 			if (tag & T_MANDATORY) { \
-				ERR("Unknown tag: %d\n",tag_number(tag)); \
+				ERR("Unknown tag: %d\n", tag_number(tag)); \
 				return 0; \
 			} \
 		} \
@@ -66,22 +66,22 @@
 	} \
 	return 1; \
 }
-#define INTEGER(pn,pr,member) \
+#define INTEGER(pn, pr, member) \
 	case pn: /* D_ASSERT( tag_type(tag) == TT_INTEGER ); */ \
 		 arg->member = *(int*)(tags); \
 		 break;
-#define INT64(pn,pr,member) \
+#define INT64(pn, pr, member) \
 	case pn: /* D_ASSERT( tag_type(tag) == TT_INT64 ); */ \
 		 arg->member = *(u64*)(tags); \
 		 break;
-#define BIT(pn,pr,member) \
+#define BIT(pn, pr, member) \
 	case pn: /* D_ASSERT( tag_type(tag) == TT_BIT ); */ \
 		 arg->member = *(char*)(tags) ? 1 : 0; \
 		 break;
-#define STRING(pn,pr,member,len) \
+#define STRING(pn, pr, member, len) \
 	case pn: /* D_ASSERT( tag_type(tag) == TT_STRING ); */ \
 		 arg->member ## _len = dlen; \
-		 memcpy(arg->member,tags,min_t(size_t,dlen,len)); \
+		 memcpy(arg->member, tags, min_t(size_t, dlen, len)); \
 		 break;
 #include "linux/drbd_nl.h"
 
@@ -94,25 +94,25 @@
 	return tags; \
 }
 
-#define INTEGER(pn,pr,member) \
+#define INTEGER(pn, pr, member) \
 	*tags++ = pn | pr | TT_INTEGER; \
 	*tags++ = sizeof(int); \
 	*(int*)tags = arg->member; \
 	tags = (unsigned short*)((char*)tags+sizeof(int));
-#define INT64(pn,pr,member) \
+#define INT64(pn, pr, member) \
 	*tags++ = pn | pr | TT_INT64; \
 	*tags++ = sizeof(u64); \
 	*(u64*)tags = arg->member; \
 	tags = (unsigned short*)((char*)tags+sizeof(u64));
-#define BIT(pn,pr,member) \
+#define BIT(pn, pr, member) \
 	*tags++ = pn | pr | TT_BIT; \
 	*tags++ = sizeof(char); \
 	*(char*)tags = arg->member; \
 	tags = (unsigned short*)((char*)tags+sizeof(char));
-#define STRING(pn,pr,member,len) \
+#define STRING(pn, pr, member, len) \
 	*tags++ = pn | pr | TT_STRING; \
 	*tags++ = arg->member ## _len; \
-	memcpy(tags,arg->member, arg->member ## _len); \
+	memcpy(tags, arg->member, arg->member ## _len); \
 	tags = (unsigned short*)((char*)tags + arg->member ## _len);
 #include "linux/drbd_nl.h"
 
@@ -171,12 +171,12 @@
 				"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
 				NULL };
 
-	snprintf(mb,12,"minor-%d",mdev_to_minor(mdev));
+	snprintf(mb, 12, "minor-%d", mdev_to_minor(mdev));
 
-	INFO("helper command: %s %s\n",usermode_helper,cmd);
+	INFO("helper command: %s %s\n", usermode_helper, cmd);
 
-	drbd_bcast_ev_helper(mdev,cmd);
-	return call_usermodehelper(usermode_helper,argv,envp,1);
+	drbd_bcast_ev_helper(mdev, cmd);
+	return call_usermodehelper(usermode_helper, argv, envp, 1);
 }
 
 drbd_disks_t drbd_try_outdate_peer(drbd_dev *mdev)
@@ -195,9 +195,9 @@
 
 	D_ASSERT( fp > DontCare );
 
-	if (fp == Stonith) drbd_request_state(mdev,NS(susp,1));
+	if (fp == Stonith) drbd_request_state(mdev, NS(susp, 1));
 
-	r=drbd_khelper(mdev,"outdate-peer");
+	r=drbd_khelper(mdev, "outdate-peer");
 
 	switch( (r>>8) & 0xff ) {
 	case 3: /* peer is inconsistent */
@@ -213,7 +213,7 @@
 	case 6: /* Peer is primary, voluntarily outdate myself */
 		WARN("Peer is primary, outdating myself.\n");
 		nps = DUnknown;
-		drbd_request_state(mdev,NS(disk,Outdated));
+		drbd_request_state(mdev, NS(disk, Outdated));
 		break;
 	case 7:
 		if (fp != Stonith) {
@@ -224,19 +224,19 @@
 	default:
 		/* The script is broken ... */
 		nps = DUnknown;
-		drbd_request_state(mdev,NS(disk,Outdated));
-		ERR("outdate-peer helper broken, returned %d \n",(r>>8)&0xff);
+		drbd_request_state(mdev, NS(disk, Outdated));
+		ERR("outdate-peer helper broken, returned %d \n", (r>>8)&0xff);
 		return nps;
 	}
 
-	INFO("outdate-peer helper returned %d \n",(r>>8)&0xff);
+	INFO("outdate-peer helper returned %d \n", (r>>8)&0xff);
 	return nps;
 }
 
 
 int drbd_set_role(drbd_dev *mdev, drbd_role_t new_role, int force)
 {
-	int r=0,forced = 0, try=0;
+	int r=0, forced = 0, try=0;
 	drbd_state_t mask, val;
 	drbd_disks_t nps;
 
@@ -248,7 +248,7 @@
 	val.i  = 0; val.role  = new_role;
 
 	while (try++ < 3) {
-		r = _drbd_request_state(mdev,mask,val,0);
+		r = _drbd_request_state(mdev, mask, val, 0);
 		if ( r == SS_NoUpToDateDisk && force &&
 		    ( mdev->state.disk == Inconsistent ||
 		      mdev->state.disk == Outdated ) ) {
@@ -296,7 +296,7 @@
 			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;
@@ -372,7 +372,7 @@
 	struct primary primary_args;
 
 	memset(&primary_args, 0, sizeof(struct primary));
-	if (!primary_from_tags(mdev,nlp->tag_list,&primary_args)) {
+	if (!primary_from_tags(mdev, nlp->tag_list, &primary_args)) {
 		reply->ret_code=UnknownMandatoryTag;
 		return 0;
 	}
@@ -400,7 +400,7 @@
 	default:
 		/* v07 style fixed size indexed meta data */
 		bdev->md.md_size_sect = MD_RESERVED_SECT;
-		bdev->md.md_offset = drbd_md_ss__(mdev,bdev);
+		bdev->md.md_offset = drbd_md_ss__(mdev, bdev);
 		bdev->md.al_offset = MD_AL_OFFSET;
 		bdev->md.bm_offset = MD_BM_OFFSET;
 		break;
@@ -413,15 +413,15 @@
 		break;
 	case DRBD_MD_INDEX_INTERNAL:
 	case DRBD_MD_INDEX_FLEX_INT:
-		bdev->md.md_offset = drbd_md_ss__(mdev,bdev);
+		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.
 		/* 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);
+		md_size_sect = ALIGN(md_size_sect, BM_SECT_PER_EXT);
 		md_size_sect = BM_SECT_TO_EXT(md_size_sect);
-		md_size_sect = ALIGN(md_size_sect,8);
+		md_size_sect = ALIGN(md_size_sect, 8);
 
 		/* plus the "drbd meta data super block",
 		 * and the activity log; */
@@ -437,13 +437,13 @@
 char* ppsize(char* buf, unsigned long long size)
 {
 	// Needs 9 bytes at max.
-	static char units[] = { 'K','M','G','T','P','E' };
+	static char units[] = { 'K', 'M', 'G', 'T', 'P', 'E' };
 	int base = 0;
 	while (size >= 10000 ) {
 		size = size >> 10;
 		base++;
 	}
-	sprintf(buf,"%lu %cB",(long)size,units[base]);
+	sprintf(buf, "%lu %cB", (long)size, units[base]);
 
 	return buf;
 }
@@ -467,14 +467,14 @@
 	la_size = mdev->bc->md.la_size_sect;
 
 	// TODO: should only be some assert here, not (re)init...
-	drbd_md_set_sector_offsets(mdev,mdev->bc);
+	drbd_md_set_sector_offsets(mdev, mdev->bc);
 
-	size = drbd_new_dev_size(mdev,mdev->bc);
+	size = drbd_new_dev_size(mdev, mdev->bc);
 
 	if ( drbd_get_capacity(mdev->this_bdev) != size ||
 	    drbd_bm_capacity(mdev) != size ) {
 		int err;
-		err = drbd_bm_resize(mdev,size);
+		err = drbd_bm_resize(mdev, size);
 		if (unlikely(err)) {
 			/* currently there is only one error: ENOMEM! */
 			size = drbd_bm_capacity(mdev)>>1;
@@ -490,9 +490,9 @@
 			rv = err;
 		}
 		// racy, see comments above.
-		drbd_set_my_capacity(mdev,size);
+		drbd_set_my_capacity(mdev, size);
 		mdev->bc->md.la_size_sect = size;
-		INFO("size = %s (%llu KB)\n",ppsize(ppb,size>>1),
+		INFO("size = %s (%llu KB)\n", ppsize(ppb, size>>1),
 		     (unsigned long long)size>>1);
 	}
 	if (rv < 0) goto out;
@@ -509,7 +509,7 @@
 	}
 
 	if (la_size_changed || md_moved) {
-		if ( inc_local_if_state(mdev,Attaching) ) {
+		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.
@@ -535,7 +535,7 @@
 	m_size = drbd_get_max_capacity(bdev);
 
 	if (p_size && m_size) {
-		size=min_t(sector_t,p_size,m_size);
+		size=min_t(sector_t, p_size, m_size);
 	} else {
 		if (la_size) {
 			size=la_size;
@@ -572,7 +572,7 @@
  */
 STATIC int drbd_check_al_size(drbd_dev *mdev)
 {
-	struct lru_cache *n,*t;
+	struct lru_cache *n, *t;
 	struct lc_element *e;
 	unsigned int in_use;
 	int i;
@@ -596,7 +596,7 @@
 	spin_lock_irq(&mdev->al_lock);
 	if (t) {
 		for (i=0; i < t->nr_elements; i++) {
-			e = lc_entry(t,i);
+			e = lc_entry(t, i);
 			if (e->refcnt)
 				ERR("refcnt(%d)==%d\n",
 				    e->lc_number, e->refcnt);
@@ -629,7 +629,7 @@
 
 	max_seg_s = min(b->max_sectors * b->hardsect_size, max_seg_s);
 
-	MTRACE(TraceTypeRq,TraceLvlSummary,
+	MTRACE(TraceTypeRq, TraceLvlSummary,
 	       DUMPI(b->max_sectors);
 	       DUMPI(b->max_phys_segments);
 	       DUMPI(b->max_hw_segments);
@@ -654,7 +654,7 @@
 	// workaround here:
 	if (q->max_segment_size == 0) q->max_segment_size = max_seg_s;
 
-	MTRACE(TraceTypeRq,TraceLvlSummary,
+	MTRACE(TraceTypeRq, TraceLvlSummary,
 	       DUMPI(q->max_sectors);
 	       DUMPI(q->max_phys_segments);
 	       DUMPI(q->max_hw_segments);
@@ -686,8 +686,8 @@
 	struct drbd_backing_dev* nbc=NULL; // new_backing_conf
 	struct inode *inode, *inode2;
 	struct lru_cache* resync_lru = NULL;
-	drbd_state_t ns,os;
-	int rv,ntries=0;
+	drbd_state_t ns, os;
+	int rv, ntries=0;
 
 	/* if you want to reconfigure, please tear down first */
 	if (mdev->state.disk > Diskless) {
@@ -709,23 +709,23 @@
 		schedule_timeout(HZ/10);
 	}
 
-	nbc = kmalloc(sizeof(struct drbd_backing_dev),GFP_KERNEL);
+	nbc = kmalloc(sizeof(struct drbd_backing_dev), GFP_KERNEL);
 	if (!nbc) {
 		retcode=KMallocFailed;
 		goto fail;
 	}
 
 	if ( !(nlp->flags & DRBD_NL_SET_DEFAULTS) && inc_local(mdev) ) {
-		memcpy(&nbc->dc,&mdev->bc->dc,sizeof(struct disk_conf));
+		memcpy(&nbc->dc, &mdev->bc->dc, sizeof(struct disk_conf));
 		dec_local(mdev);
 	} else {
-		memset(&nbc->dc,0,sizeof(struct disk_conf));
+		memset(&nbc->dc, 0, sizeof(struct disk_conf));
 		nbc->dc.disk_size   = DRBD_DISK_SIZE_SECT_DEF;
 		nbc->dc.on_io_error = DRBD_ON_IO_ERROR_DEF;
 		nbc->dc.fencing     = DRBD_FENCING_DEF;
 	}
 
-	if (!disk_conf_from_tags(mdev,nlp->tag_list,&nbc->dc)) {
+	if (!disk_conf_from_tags(mdev, nlp->tag_list, &nbc->dc)) {
 		retcode=UnknownMandatoryTag;
 		goto fail;
 	}
@@ -738,7 +738,7 @@
 		goto fail;
 	}
 
-	nbc->lo_file = filp_open(nbc->dc.backing_dev,O_RDWR,0);
+	nbc->lo_file = filp_open(nbc->dc.backing_dev, O_RDWR, 0);
 	if (IS_ERR(nbc->lo_file)) {
 		ERR("open(\"%s\") failed with %ld\n", nbc->dc.backing_dev,
 		    PTR_ERR(nbc->lo_file));
@@ -754,7 +754,7 @@
 		goto fail;
 	}
 
-	nbc->md_file = filp_open(nbc->dc.meta_dev,O_RDWR,0);
+	nbc->md_file = filp_open(nbc->dc.meta_dev, O_RDWR, 0);
 	if (IS_ERR(nbc->md_file)) {
 		ERR("open(\"%s\") failed with %ld\n", nbc->dc.meta_dev,
 		    PTR_ERR(nbc->md_file));
@@ -781,7 +781,7 @@
 		goto fail;
 	}
 
-	resync_lru = lc_alloc("resync",31, sizeof(struct bm_extent),mdev);
+	resync_lru = lc_alloc("resync", 31, sizeof(struct bm_extent), mdev);
 	if (!resync_lru) {
 		retcode=KMallocFailed;
 		goto fail;
@@ -844,13 +844,13 @@
 		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);
+	drbd_md_set_sector_offsets(mdev, nbc);
 
-	retcode = drbd_md_read(mdev,nbc);
+	retcode = drbd_md_read(mdev, nbc);
 	if (retcode != NoError) {
 		goto force_diskless;
 	}
@@ -862,13 +862,13 @@
 	}
 
 	// Prevent shrinking of consistent devices !
-	if (drbd_md_test_flag(nbc,MDF_Consistent) &&
-	   drbd_new_dev_size(mdev,nbc) < nbc->md.la_size_sect) {
+	if (drbd_md_test_flag(nbc, MDF_Consistent) &&
+	   drbd_new_dev_size(mdev, nbc) < nbc->md.la_size_sect) {
 		retcode = LDDeviceTooSmall;
 		goto force_diskless;
 	}
 
-	if (!drbd_al_read_log(mdev,nbc)) {
+	if (!drbd_al_read_log(mdev, nbc)) {
 		retcode = MDIOError;
 		goto force_diskless;
 	}
@@ -883,7 +883,7 @@
 	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 {
 		clear_bit(CRASHED_PRIMARY, &mdev->flags);
@@ -914,24 +914,24 @@
 	 * so we can automatically recover from a crash of a
 	 * degraded but active "cluster" after a certain timeout.
 	 */
-	clear_bit(USE_DEGR_WFC_T,&mdev->flags);
+	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) ) {
-		set_bit(USE_DEGR_WFC_T,&mdev->flags);
+	     drbd_md_test_flag(mdev->bc, MDF_PrimaryInd) &&
+	    !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);
 
-	if (drbd_md_test_flag(mdev->bc,MDF_FullSync)) {
+	if (drbd_md_test_flag(mdev->bc, MDF_FullSync)) {
 		INFO("Assuming that all blocks are out of sync (aka FullSync)\n");
 		drbd_bm_set_all(mdev);
 		if (unlikely(drbd_bm_write(mdev) < 0)) {
 			retcode = MDIOError;
 			goto unlock_bm;
 		}
-		drbd_md_clear_flag(mdev,MDF_FullSync);
+		drbd_md_clear_flag(mdev, MDF_FullSync);
 	} else {
 		if (unlikely(drbd_bm_read(mdev) < 0)) {
 			retcode = MDIOError;
@@ -955,8 +955,8 @@
 	   If MDF_WasUpToDate is not set go into Outdated disk state,
 	   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_Consistent)) {
+		if (drbd_md_test_flag(mdev->bc, MDF_WasUpToDate)) {
 			ns.disk = Consistent;
 		} else {
 			ns.disk = Outdated;
@@ -965,7 +965,7 @@
 		ns.disk = Inconsistent;
 	}
 
-	if (drbd_md_test_flag(mdev->bc,MDF_PeerOutDated)) {
+	if (drbd_md_test_flag(mdev->bc, MDF_PeerOutDated)) {
 		ns.pdsk = Outdated;
 	}
 
@@ -990,7 +990,7 @@
 	rv = _drbd_set_state(mdev, ns, ChgStateVerbose);
 	ns = mdev->state;
 	spin_unlock_irq(&mdev->req_lock);
-	if (rv==SS_Success) after_state_ch(mdev,os,ns,ChgStateVerbose);
+	if (rv==SS_Success) after_state_ch(mdev, os, ns, ChgStateVerbose);
 
 	if (rv < SS_Success) {
 		goto unlock_bm;
@@ -998,7 +998,7 @@
 
 	drbd_bm_unlock(mdev);
 
-	if (inc_local_if_state(mdev,Attaching)) {
+	if (inc_local_if_state(mdev, Attaching)) {
 		if (mdev->state.role == Primary) mdev->bc->md.uuid[Current] |=  (u64)1;
 		else                            mdev->bc->md.uuid[Current] &= ~(u64)1;
 		dec_local(mdev);
@@ -1012,7 +1012,7 @@
  unlock_bm:
 	drbd_bm_unlock(mdev);
  force_diskless:
-	drbd_force_state(mdev,NS(disk,Diskless));
+	drbd_force_state(mdev, NS(disk, Diskless));
 	drbd_md_sync(mdev);
  release_bdev2_fail:
 	if (nbc) BD_RELEASE(nbc->md_bdev);
@@ -1034,7 +1034,7 @@
 			  struct drbd_nl_cfg_reply *reply)
 {
 	fsync_bdev(mdev->this_bdev);
-	reply->ret_code = drbd_request_state(mdev,NS(disk,Diskless));
+	reply->ret_code = drbd_request_state(mdev, NS(disk, Diskless));
 
 	return 0;
 }
@@ -1044,7 +1044,7 @@
 STATIC int drbd_nl_net_conf(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
 			    struct drbd_nl_cfg_reply *reply)
 {
-	int i,ns;
+	int i, ns;
 	enum ret_codes retcode;
 	struct net_conf *new_conf = NULL;
 	struct crypto_hash *tfm = NULL;
@@ -1058,17 +1058,17 @@
 		goto fail;
 	}
 
-	new_conf = kmalloc(sizeof(struct net_conf),GFP_KERNEL);
+	new_conf = kmalloc(sizeof(struct net_conf), GFP_KERNEL);
 	if (!new_conf) {
 		retcode=KMallocFailed;
 		goto fail;
 	}
 
 	if ( !(nlp->flags & DRBD_NL_SET_DEFAULTS) && inc_net(mdev)) {
-		memcpy(new_conf,mdev->net_conf,sizeof(struct net_conf));
+		memcpy(new_conf, mdev->net_conf, sizeof(struct net_conf));
 		dec_local(mdev);
 	} else {
-		memset(new_conf,0,sizeof(struct net_conf));
+		memset(new_conf, 0, sizeof(struct net_conf));
 		new_conf->timeout         = DRBD_TIMEOUT_DEF;
 		new_conf->try_connect_int = DRBD_CONNECT_INT_DEF;
 		new_conf->ping_int        = DRBD_PING_INT_DEF;
@@ -1087,7 +1087,7 @@
 		new_conf->rr_conflict     = DRBD_RR_CONFLICT_DEF;
 	}
 
-	if (!net_conf_from_tags(mdev,nlp->tag_list,new_conf)) {
+	if (!net_conf_from_tags(mdev, nlp->tag_list, new_conf)) {
 		retcode=UnknownMandatoryTag;
 		goto fail;
 	}
@@ -1129,7 +1129,7 @@
 #undef O_PORT
 
 	if (new_conf->cram_hmac_alg[0] != 0) {
-		snprintf(hmac_name,HMAC_NAME_L,"hmac(%s)",new_conf->cram_hmac_alg);
+		snprintf(hmac_name, HMAC_NAME_L, "hmac(%s)", new_conf->cram_hmac_alg);
 		tfm = crypto_alloc_hash(hmac_name, 0, CRYPTO_ALG_ASYNC);
 		if (IS_ERR(tfm)) {
 			tfm = NULL;
@@ -1212,7 +1212,7 @@
 	}
 	mdev->cram_hmac_tfm = tfm;
 
-	retcode = drbd_request_state(mdev,NS(conn,Unconnected));
+	retcode = drbd_request_state(mdev, NS(conn, Unconnected));
 
 	reply->ret_code = retcode;
 	return 0;
@@ -1232,23 +1232,23 @@
 {
 	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.
-		retcode = drbd_request_state(mdev,NS2(conn,Disconnecting,
-						      pdsk,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.
-		retcode = _drbd_request_state(mdev,NS2(conn,Disconnecting,
-						       disk,Outdated),0);
+		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.
-			retcode = drbd_request_state(mdev,NS(conn,StandAlone));
+			retcode = drbd_request_state(mdev, NS(conn, StandAlone));
 		}
 	}
 
@@ -1275,7 +1275,7 @@
 	int retcode=NoError;
 
 	memset(&rs, 0, sizeof(struct resize));
-	if (!resize_from_tags(mdev,nlp->tag_list,&rs)) {
+	if (!resize_from_tags(mdev, nlp->tag_list, &rs)) {
 		retcode=UnknownMandatoryTag;
 		goto fail;
 	}
@@ -1320,7 +1320,7 @@
 	drbd_dev *odev;
 	int err;
 
-	memcpy(&sc,&mdev->sync_conf,sizeof(struct syncer_conf));
+	memcpy(&sc, &mdev->sync_conf, sizeof(struct syncer_conf));
 
 	if (nlp->flags & DRBD_NL_SET_DEFAULTS) {
 		sc.rate       = DRBD_RATE_DEF;
@@ -1328,7 +1328,7 @@
 		sc.al_extents = DRBD_AL_EXTENTS_DEF;
 	}
 
-	if (!syncer_conf_from_tags(mdev,nlp->tag_list,&sc)) {
+	if (!syncer_conf_from_tags(mdev, nlp->tag_list, &sc)) {
 		retcode=UnknownMandatoryTag;
 		goto fail;
 	}
@@ -1353,7 +1353,7 @@
 	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);
+		ERR("sc.al_extents > %d\n", AL_MAX);
 		sc.al_extents = AL_MAX;
 	}
 #undef AL_MAX
@@ -1372,7 +1372,7 @@
 	}
 
 	if (mdev->state.conn >= Connected)
-		drbd_send_sync_param(mdev,&sc);
+		drbd_send_sync_param(mdev, &sc);
 
 	drbd_alter_sa(mdev, sc.after);
 
@@ -1384,8 +1384,8 @@
 STATIC int drbd_nl_invalidate(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
 			      struct drbd_nl_cfg_reply *reply)
 {
-	reply->ret_code = drbd_request_state(mdev,NS2(conn,StartingSyncT,
-						      disk,Inconsistent));
+	reply->ret_code = drbd_request_state(mdev, NS2(conn, StartingSyncT,
+						      disk, Inconsistent));
 	return 0;
 }
 
@@ -1393,8 +1393,8 @@
 				   struct drbd_nl_cfg_reply *reply)
 {
 
-	reply->ret_code = drbd_request_state(mdev,NS2(conn,StartingSyncS,
-						      pdsk,Inconsistent));
+	reply->ret_code = drbd_request_state(mdev, NS2(conn, StartingSyncS,
+						      pdsk, Inconsistent));
 
 	return 0;
 }
@@ -1404,7 +1404,7 @@
 {
 	int retcode=NoError;
 
-	if (drbd_request_state(mdev,NS(user_isp,1)) == SS_NothingToDo)
+	if (drbd_request_state(mdev, NS(user_isp, 1)) == SS_NothingToDo)
 		retcode = PauseFlagAlreadySet;
 
 	reply->ret_code = retcode;
@@ -1416,7 +1416,7 @@
 {
 	int retcode=NoError;
 
-	if (drbd_request_state(mdev,NS(user_isp,0)) == SS_NothingToDo)
+	if (drbd_request_state(mdev, NS(user_isp, 0)) == SS_NothingToDo)
 		retcode = PauseFlagAlreadyClear;
 
 	reply->ret_code = retcode;
@@ -1426,7 +1426,7 @@
 STATIC int drbd_nl_suspend_io(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
 			      struct drbd_nl_cfg_reply *reply)
 {
-	reply->ret_code = drbd_request_state(mdev,NS(susp,1));
+	reply->ret_code = drbd_request_state(mdev, NS(susp, 1));
 
 	return 0;
 }
@@ -1434,7 +1434,7 @@
 STATIC int drbd_nl_resume_io(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
 			     struct drbd_nl_cfg_reply *reply)
 {
-	reply->ret_code = drbd_request_state(mdev,NS(susp,0));
+	reply->ret_code = drbd_request_state(mdev, NS(susp, 0));
 	return 0;
 }
 
@@ -1442,18 +1442,18 @@
 			   struct drbd_nl_cfg_reply *reply)
 {
 	int retcode;
-	drbd_state_t os,ns;
+	drbd_state_t os, ns;
 
 	spin_lock_irq(&mdev->req_lock);
 	os = mdev->state;
 	if (mdev->state.disk < Outdated) {
 		retcode = -999;
 	} else {
-		retcode = _drbd_set_state(_NS(mdev,disk,Outdated),ChgStateVerbose);
+		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);
+	if (retcode==SS_Success) after_state_ch(mdev, os, ns, ChgStateVerbose);
 
 	if (retcode == -999) {
 		retcode = DiskLowerThanOutdated;
@@ -1475,15 +1475,15 @@
 	tl = reply->tag_list;
 
 	if (inc_local(mdev)) {
-		tl = disk_conf_to_tags(mdev,&mdev->bc->dc,tl);
+		tl = disk_conf_to_tags(mdev, &mdev->bc->dc, tl);
 		dec_local(mdev);
 	}
 
 	if (inc_net(mdev)) {
-		tl = net_conf_to_tags(mdev,mdev->net_conf,tl);
+		tl = net_conf_to_tags(mdev, mdev->net_conf, tl);
 		dec_net(mdev);
 	}
-	tl = syncer_conf_to_tags(mdev,&mdev->sync_conf,tl);
+	tl = syncer_conf_to_tags(mdev, &mdev->sync_conf, tl);
 
 	*tl++ = TT_END; /* Close the tag list */
 
@@ -1497,7 +1497,7 @@
 
 	tl = reply->tag_list;
 
-	tl = get_state_to_tags(mdev,(struct get_state*)&mdev->state,tl);
+	tl = get_state_to_tags(mdev, (struct get_state*)&mdev->state, tl);
 	*tl++ = TT_END; /* Close the tag list */
 
 	return (int)((char*)tl - (char*)reply->tag_list);
@@ -1514,12 +1514,12 @@
 		// 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));
+		memcpy(tl, mdev->bc->md.uuid, UUID_SIZE*sizeof(u64));
 		tl=(unsigned short*)((char*)tl + UUID_SIZE*sizeof(u64));
 		dec_local(mdev);
 		*tl++ = T_uuids_flags;
 		*tl++ = sizeof(int);
-		memcpy(tl,&mdev->bc->md.flags,sizeof(int));
+		memcpy(tl, &mdev->bc->md.flags, sizeof(int));
 		tl=(unsigned short*)((char*)tl + sizeof(int));
 	}
 	*tl++ = TT_END; /* Close the tag list */
@@ -1538,7 +1538,7 @@
 	// 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 ;
+	*((char*)tl) = test_bit(USE_DEGR_WFC_T, &mdev->flags) ? 1 : 0 ;
 	tl=(unsigned short*)((char*)tl + sizeof(char));
 	*tl++ = TT_END;
 
@@ -1618,7 +1618,7 @@
 	struct cn_msg *cn_reply;
 	struct drbd_nl_cfg_reply* reply;
 	drbd_dev *mdev;
-	int retcode,rr;
+	int retcode, rr;
 	int reply_size = sizeof(struct cn_msg)
 		+ sizeof(struct drbd_nl_cfg_reply)
 		+ sizeof(short int);
@@ -1643,7 +1643,7 @@
 	cm = cnd_table + nlp->packet_type;
 	reply_size += cm->reply_body_size;
 
-	if ( !(cn_reply = kmalloc(reply_size,GFP_KERNEL)) ) {
+	if ( !(cn_reply = kmalloc(reply_size, GFP_KERNEL)) ) {
 		retcode=KMallocFailed;
 		goto fail;
 	}
@@ -1654,7 +1654,7 @@
 	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);
+	rr = cm->function(mdev, nlp, reply);
 
 	cn_reply->id = req->id;
 	cn_reply->seq = req->seq;
@@ -1666,7 +1666,7 @@
 
 	rr = cn_netlink_send(cn_reply, CN_IDX_DRBD, GFP_KERNEL);
 	if (rr && rr != -ESRCH) {
-		printk(KERN_INFO DEVICE_NAME " cn_netlink_send()=%d\n",rr);
+		printk(KERN_INFO DEVICE_NAME " cn_netlink_send()=%d\n", rr);
 	}
 	kfree(cn_reply);
 	module_put(THIS_MODULE);
@@ -1690,13 +1690,13 @@
 
 	// WARN("drbd_bcast_state() got called\n");
 
-	tl = get_state_to_tags(mdev,(struct get_state*)&mdev->state,tl);
+	tl = get_state_to_tags(mdev, (struct get_state*)&mdev->state, tl);
 	*tl++ = TT_END; /* Close the tag list */
 
 	cn_reply->id.idx = CN_IDX_DRBD;
 	cn_reply->id.val = CN_VAL_DRBD;
 
-	cn_reply->seq = atomic_add_return(1,&drbd_nl_seq);
+	cn_reply->seq = atomic_add_return(1, &drbd_nl_seq);
 	cn_reply->ack = 0; // not used here.
 	cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
 		(int)((char*)tl - (char*)reply->tag_list);
@@ -1727,14 +1727,14 @@
 	str_len = strlen(helper_name)+1;
 	*tl++ = T_helper;
 	*tl++ = str_len;
-	memcpy(tl,helper_name,str_len);
+	memcpy(tl, helper_name, str_len);
 	tl=(unsigned short*)((char*)tl + str_len);
 	*tl++ = TT_END; /* Close the tag list */
 
 	cn_reply->id.idx = CN_IDX_DRBD;
 	cn_reply->id.val = CN_VAL_DRBD;
 
-	cn_reply->seq = atomic_add_return(1,&drbd_nl_seq);
+	cn_reply->seq = atomic_add_return(1, &drbd_nl_seq);
 	cn_reply->ack = 0; // not used here.
 	cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
 		(int)((char*)tl - (char*)reply->tag_list);
@@ -1784,7 +1784,7 @@
 	cn_reply->id.idx = CN_IDX_DRBD;
 	cn_reply->id.val = CN_VAL_DRBD;
 
-	cn_reply->seq = atomic_add_return(1,&drbd_nl_seq);
+	cn_reply->seq = atomic_add_return(1, &drbd_nl_seq);
 	cn_reply->ack = 0; // not used here.
 	cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
 		(int)((char*)tl - (char*)reply->tag_list);
@@ -1814,7 +1814,7 @@
 	err = cn_init();
 	if(err) return err;
 #endif
-	err = cn_add_callback(&cn_id_drbd,"cn_drbd",&drbd_connector_callback);
+	err = cn_add_callback(&cn_id_drbd, "cn_drbd", &drbd_connector_callback);
 	if (err) {
 		printk(KERN_ERR DEVICE_NAME "cn_drbd failed to register\n");
 		return err;
@@ -1857,7 +1857,7 @@
 
 	rr = cn_netlink_send(cn_reply, CN_IDX_DRBD, GFP_KERNEL);
 	if (rr && rr != -ESRCH) {
-		printk(KERN_INFO DEVICE_NAME " cn_netlink_send()=%d\n",rr);
+		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 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/drbd_proc.c	2007-07-24 11:38:05 UTC (rev 2985)
@@ -98,14 +98,14 @@
 		seq_printf(seq, "] ");
 	}
 	res = 1000L - res;
-	seq_printf(seq,"sync'ed:%3lu.%lu%% ", res / 10, res % 10);
+	seq_printf(seq, "sync'ed:%3lu.%lu%% ", res / 10, res % 10);
 	/* if more than 1 GB display in MB */
 	if (mdev->rs_total > 0x100000L) {
-		seq_printf(seq,"(%lu/%lu)M\n\t",
+		seq_printf(seq, "(%lu/%lu)M\n\t",
 			    (unsigned long) Bit2KB(rs_left) >> 10,
 			    (unsigned long) Bit2KB(mdev->rs_total) >> 10 );
 	} else {
-		seq_printf(seq,"(%lu/%lu)K\n\t",
+		seq_printf(seq, "(%lu/%lu)K\n\t",
 			    (unsigned long) Bit2KB(rs_left),
 			    (unsigned long) Bit2KB(mdev->rs_total) );
 	}
@@ -139,7 +139,7 @@
 	dbdt = Bit2KB(db/dt);
 	if (dbdt > 1000)
 		seq_printf(seq, " speed: %ld,%03ld",
-			dbdt/1000,dbdt % 1000);
+			dbdt/1000, dbdt % 1000);
 	else
 		seq_printf(seq, " speed: %ld", dbdt);
 
@@ -151,11 +151,11 @@
 	dbdt = Bit2KB(db/dt);
 	if (dbdt > 1000)
 		seq_printf(seq, " (%ld,%03ld)",
-			dbdt/1000,dbdt % 1000);
+			dbdt/1000, dbdt % 1000);
 	else
 		seq_printf(seq, " (%ld)", dbdt);
 
-	seq_printf(seq," K/sec\n");
+	seq_printf(seq, " K/sec\n");
 }
 
 #if 0
@@ -163,7 +163,7 @@
 {
 	struct bm_extent *bme = (struct bm_extent *)e;
 
-	seq_printf(seq,"%5d %s %s\n",bme->rs_left,
+	seq_printf(seq, "%5d %s %s\n", bme->rs_left,
 		   bme->flags & BME_NO_WRITES ? "NO_WRITES" : "---------",
 		   bme->flags & BME_LOCKED ? "LOCKED" : "------"
 		   );
@@ -172,12 +172,12 @@
 
 STATIC int drbd_seq_show(struct seq_file *seq, void *v)
 {
-	int i,hole=0;
+	int i, hole=0;
 	const char *sn;
 	drbd_dev *mdev;
 
 	seq_printf(seq, "version: " REL_VERSION " (api:%d/proto:%d)\n%s\n",
-		    API_VERSION,PRO_VERSION, drbd_buildtag());
+		    API_VERSION, PRO_VERSION, drbd_buildtag());
 
 	/*
 	  cs .. connection state
@@ -239,17 +239,17 @@
 		}
 		if ( mdev->state.conn == SyncSource ||
 		     mdev->state.conn == SyncTarget ) {
-			drbd_syncer_progress(mdev,seq);
+			drbd_syncer_progress(mdev, seq);
 		}
 		if (mdev->resync) {
-			lc_printf_stats(seq,mdev->resync);
+			lc_printf_stats(seq, mdev->resync);
 		}
 		if (mdev->act_log) {
-			lc_printf_stats(seq,mdev->act_log);
+			lc_printf_stats(seq, mdev->act_log);
 		}
 #if 0
 		if (mdev->resync) {
-			lc_dump(mdev->resync,seq,"rs_left",
+			lc_dump(mdev->resync, seq, "rs_left",
 				resync_dump_detail);
 		}
 #endif

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 11:38:05 UTC (rev 2985)
@@ -67,10 +67,10 @@
 
 #if 0
 #define CHECK_LIST_LIMIT 1000
-void check_list(drbd_dev *mdev,struct list_head *list,char *t)
+void check_list(drbd_dev *mdev, struct list_head *list, char *t)
 {
-	struct list_head *le,*la;
-	int forward=0,backward=0;
+	struct list_head *le, *la;
+	int forward=0, backward=0;
 
 	le=list;
 	do {
@@ -79,13 +79,13 @@
 		if (le->prev != la) {
 			printk(KERN_ERR DEVICE_NAME
 			       "%d: %s list fucked.\n",
-			       mdev_to_minor(mdev),t);
+			       mdev_to_minor(mdev), t);
 			break;
 		}
 		if (forward++ > CHECK_LIST_LIMIT) {
 			printk(KERN_ERR DEVICE_NAME
 			       "%d: %s forward > 1000\n",
-			       mdev_to_minor(mdev),t);
+			       mdev_to_minor(mdev), t);
 			break;
 		}
 	} while(le != list);
@@ -97,20 +97,20 @@
 		if (le->next != la) {
 			printk(KERN_ERR DEVICE_NAME
 			       "%d: %s list fucked.\n",
-			       mdev_to_minor(mdev),t);
+			       mdev_to_minor(mdev), t);
 			break;
 		}
 		if (backward++ > CHECK_LIST_LIMIT) {
 			printk(KERN_ERR DEVICE_NAME
 			       "%d: %s backward > 1000\n",
-			       mdev_to_minor(mdev),t);
+			       mdev_to_minor(mdev), t);
 			break;
 		}
 	} while(le != list);
 
 	if (forward != backward) {
 		printk(KERN_ERR DEVICE_NAME "%d: forward=%d, backward=%d\n",
-		       mdev_to_minor(mdev),forward,backward);
+		       mdev_to_minor(mdev), forward, backward);
 	}
 }
 #endif
@@ -131,7 +131,7 @@
 	 * not make sense.
 	 */
 
-	spin_lock_irqsave(&drbd_pp_lock,flags);
+	spin_lock_irqsave(&drbd_pp_lock, flags);
 	/* This lock needs to lock out irq because we might call drdb_pp_free()
 	   from IRQ context.
 	   FIXME but why irq _save_ ?
@@ -141,7 +141,7 @@
 		drbd_pp_pool = (struct page*)page_private(page);
 		drbd_pp_vacant--;
 	}
-	spin_unlock_irqrestore(&drbd_pp_lock,flags);
+	spin_unlock_irqrestore(&drbd_pp_lock, flags);
 	if (page) goto got_page;
 
 	drbd_kick_lo(mdev);
@@ -150,12 +150,12 @@
 		prepare_to_wait(&drbd_pp_wait, &wait, TASK_INTERRUPTIBLE);
 
 		/* try the pool again, maybe the drbd_kick_lo set some free */
-		spin_lock_irqsave(&drbd_pp_lock,flags);
+		spin_lock_irqsave(&drbd_pp_lock, flags);
 		if ( (page = drbd_pp_pool) ) {
 			drbd_pp_pool = (struct page*)page_private(page);
 			drbd_pp_vacant--;
 		}
-		spin_unlock_irqrestore(&drbd_pp_lock,flags);
+		spin_unlock_irqrestore(&drbd_pp_lock, flags);
 
 		if (page) break;
 
@@ -188,12 +188,12 @@
 	return page;
 }
 
-STATIC void drbd_pp_free(drbd_dev *mdev,struct page *page)
+STATIC void drbd_pp_free(drbd_dev *mdev, struct page *page)
 {
 	unsigned long flags=0;
 	int free_it;
 
-	spin_lock_irqsave(&drbd_pp_lock,flags);
+	spin_lock_irqsave(&drbd_pp_lock, flags);
 	if (drbd_pp_vacant > (DRBD_MAX_SEGMENT_SIZE/PAGE_SIZE)*minor_count) {
 		free_it = 1;
 	} else {
@@ -202,7 +202,7 @@
 		drbd_pp_vacant++;
 		free_it = 0;
 	}
-	spin_unlock_irqrestore(&drbd_pp_lock,flags);
+	spin_unlock_irqrestore(&drbd_pp_lock, flags);
 
 	atomic_dec(&mdev->pp_in_use);
 
@@ -251,7 +251,7 @@
 		return NULL;
 	}
 
-	bio = bio_alloc(GFP_KERNEL, div_ceil(data_size,PAGE_SIZE));
+	bio = bio_alloc(GFP_KERNEL, div_ceil(data_size, PAGE_SIZE));
 	if (!bio) {
 		ERR("alloc_ee: Allocation of a bio failed\n");
 		goto fail1;
@@ -268,7 +268,7 @@
 			goto fail2;
 		}
 		if (!bio_add_page(bio, page, min_t(int, ds, PAGE_SIZE), 0)) {
-			drbd_pp_free(mdev,page);
+			drbd_pp_free(mdev, page);
 			ERR("alloc_ee: bio_add_page(s=%llu,"
 			    "data_size=%u,ds=%u) failed\n",
 			    (unsigned long long)sector, data_size, ds);
@@ -307,16 +307,16 @@
 	e->barrier_nr2 = 0;
 	e->flags = 0;
 
-	MTRACE(TraceTypeEE,TraceLvlAll,
+	MTRACE(TraceTypeEE, TraceLvlAll,
 	       INFO("allocated EE sec=%llus size=%u ee=%p\n",
-		    (unsigned long long)sector,data_size,e);
+		    (unsigned long long)sector, data_size, e);
 	       );
 
 	return e;
 
  fail2:
 	__bio_for_each_segment(bvec, bio, i, 0) {
-		drbd_pp_free(mdev,bvec->bv_page);
+		drbd_pp_free(mdev, bvec->bv_page);
 	}
 	bio_put(bio);
  fail1:
@@ -331,13 +331,13 @@
 	struct bio_vec *bvec;
 	int i;
 
-	MTRACE(TraceTypeEE,TraceLvlAll,
+	MTRACE(TraceTypeEE, TraceLvlAll,
 	       INFO("Free EE sec=%llus size=%u ee=%p\n",
-		    (unsigned long long)e->sector,e->size,e);
+		    (unsigned long long)e->sector, e->size, e);
 	       );
 
 	__bio_for_each_segment(bvec, bio, i, 0) {
-		drbd_pp_free(mdev,bvec->bv_page);
+		drbd_pp_free(mdev, bvec->bv_page);
 	}
 
 	bio_put(bio);
@@ -348,7 +348,7 @@
 }
 
 /* currently on module unload only */
-int drbd_release_ee(drbd_dev *mdev,struct list_head* list)
+int drbd_release_ee(drbd_dev *mdev, struct list_head* list)
 {
 	int count=0;
 	struct Tl_epoch_entry* e;
@@ -359,7 +359,7 @@
 		le = list->next;
 		list_del(le);
 		e = list_entry(le, struct Tl_epoch_entry, w.list);
-		drbd_free_ee(mdev,e);
+		drbd_free_ee(mdev, e);
 		count++;
 	}
 	spin_unlock_irq(&mdev->req_lock);
@@ -371,7 +371,7 @@
 STATIC void reclaim_net_ee(drbd_dev *mdev)
 {
 	struct Tl_epoch_entry *e;
-	struct list_head *le,*tle;
+	struct list_head *le, *tle;
 
 	/* The EEs are always appended to the end of the list. Since
 	   they are sent in order over the wire, they have to finish
@@ -382,7 +382,7 @@
 		e = list_entry(le, struct Tl_epoch_entry, w.list);
 		if ( drbd_bio_has_active_page(e->private_bio) ) break;
 		list_del(le);
-		drbd_free_ee(mdev,e);
+		drbd_free_ee(mdev, e);
 	}
 }
 
@@ -401,11 +401,11 @@
 	LIST_HEAD(work_list);
 	struct Tl_epoch_entry *e, *t;
 	int ok=1;
-	int do_clear_bit = test_bit(WRITE_ACK_PENDING,&mdev->flags);
+	int do_clear_bit = test_bit(WRITE_ACK_PENDING, &mdev->flags);
 
 	spin_lock_irq(&mdev->req_lock);
 	reclaim_net_ee(mdev);
-	list_splice_init(&mdev->done_ee,&work_list);
+	list_splice_init(&mdev->done_ee, &work_list);
 	spin_unlock_irq(&mdev->req_lock);
 
 	/* possible callbacks here:
@@ -413,16 +413,16 @@
 	 * all ignore the last argument.
 	 */
 	list_for_each_entry_safe(e, t, &work_list, w.list) {
-		MTRACE(TraceTypeEE,TraceLvlAll,
+		MTRACE(TraceTypeEE, TraceLvlAll,
 		       INFO("Process EE on done_ee sec=%llus size=%u ee=%p\n",
-			    (unsigned long long)e->sector,e->size,e);
+			    (unsigned long long)e->sector, e->size, e);
 			);
 		// 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);
+		if (e->w.cb(mdev, &e->w, 0) == 0) ok = 0;
+		drbd_free_ee(mdev, e);
 	}
 	if (do_clear_bit)
-		clear_bit(WRITE_ACK_PENDING,&mdev->flags);
+		clear_bit(WRITE_ACK_PENDING, &mdev->flags);
 	wake_up(&mdev->ee_wait);
 
 	return ok;
@@ -450,20 +450,20 @@
 			++n;
 		}
 		if (!hlist_unhashed(&e->colision)) hlist_del_init(&e->colision);
-		drbd_free_ee(mdev,e);
+		drbd_free_ee(mdev, e);
 	}
 
 	sub_unacked(mdev, n);
 }
 
-void _drbd_wait_ee_list_empty(drbd_dev *mdev,struct list_head *head)
+void _drbd_wait_ee_list_empty(drbd_dev *mdev, struct list_head *head)
 {
 	DEFINE_WAIT(wait);
 	MUST_HOLD(&mdev->req_lock);
 
 	/* avoids spin_lock/unlock and calling prepare_to_wait in the fast path */
 	while (!list_empty(head)) {
-		prepare_to_wait(&mdev->ee_wait,&wait,TASK_UNINTERRUPTIBLE);
+		prepare_to_wait(&mdev->ee_wait, &wait, TASK_UNINTERRUPTIBLE);
 		spin_unlock_irq(&mdev->req_lock);
 		drbd_kick_lo(mdev);
 		schedule();
@@ -472,14 +472,14 @@
 	}
 }
 
-void drbd_wait_ee_list_empty(drbd_dev *mdev,struct list_head *head)
+void drbd_wait_ee_list_empty(drbd_dev *mdev, struct list_head *head)
 {
 	spin_lock_irq(&mdev->req_lock);
 	_drbd_wait_ee_list_empty(mdev, head);
 	spin_unlock_irq(&mdev->req_lock);
 }
 
-STATIC struct socket* drbd_accept(drbd_dev *mdev,struct socket* sock)
+STATIC struct socket* drbd_accept(drbd_dev *mdev, struct socket* sock)
 {
 	struct socket *newsock;
 	int err = 0;
@@ -536,7 +536,7 @@
 	return rv;
 }
 
-int drbd_recv(drbd_dev *mdev,void *buf, size_t size)
+int drbd_recv(drbd_dev *mdev, void *buf, size_t size)
 {
 	mm_segment_t oldfs;
 	struct iovec iov;
@@ -557,7 +557,7 @@
 	set_fs(KERNEL_DS);
 
 	for(;;) {
-		rv = sock_recvmsg(mdev->data.socket,&msg,size,msg.msg_flags);
+		rv = sock_recvmsg(mdev->data.socket, &msg, size, msg.msg_flags);
 		if (rv == size) break;
 
 		/* Note:
@@ -569,7 +569,7 @@
 			if (rv == -ECONNRESET)
 				INFO("sock was reset by peer\n");
 			else if (rv != -ERESTARTSYS)
-				ERR("sock_recvmsg returned %d\n",rv);
+				ERR("sock_recvmsg returned %d\n", rv);
 			break;
 		} else if (rv == 0) {
 			INFO("sock was shut down by peer\n");
@@ -585,7 +585,7 @@
 
 	set_fs(oldfs);
 
-	if (rv != size) drbd_force_state(mdev,NS(conn,BrokenPipe));
+	if (rv != size) drbd_force_state(mdev, NS(conn, BrokenPipe));
 
 	return rv;
 }
@@ -644,7 +644,7 @@
 STATIC struct socket *drbd_wait_for_connect(drbd_dev *mdev)
 {
 	int err;
-	struct socket *sock,*sock2;
+	struct socket *sock, *sock2;
 
 	err = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock2);
 	if (err) {
@@ -666,11 +666,11 @@
 	if (err) {
 		ERR("Unable to bind sock2 (%d)\n", err);
 		sock_release(sock2);
-		drbd_force_state(mdev,NS(conn,Disconnecting));
+		drbd_force_state(mdev, NS(conn, Disconnecting));
 		return NULL;
 	}
 
-	sock = drbd_accept(mdev,sock2);
+	sock = drbd_accept(mdev, sock2);
 	sock_release(sock2);
 
 	return sock;
@@ -679,14 +679,14 @@
 STATIC int drbd_do_handshake(drbd_dev *mdev);
 STATIC int drbd_do_auth(drbd_dev *mdev);
 
-STATIC int drbd_send_fp(drbd_dev *mdev,struct socket *sock,Drbd_Packet_Cmd cmd)
+STATIC int drbd_send_fp(drbd_dev *mdev, struct socket *sock, Drbd_Packet_Cmd cmd)
 {
 	Drbd_Header *h = (Drbd_Header *) &mdev->data.sbuf.head;
 
-	return _drbd_send_cmd(mdev,sock,cmd,h,sizeof(*h),0);
+	return _drbd_send_cmd(mdev, sock, cmd, h, sizeof(*h), 0);
 }
 
-STATIC Drbd_Packet_Cmd drbd_recv_fp(drbd_dev *mdev,struct socket *sock)
+STATIC Drbd_Packet_Cmd drbd_recv_fp(drbd_dev *mdev, struct socket *sock)
 {
 	Drbd_Header *h = (Drbd_Header *) &mdev->data.sbuf.head;
 	int rr;
@@ -709,13 +709,13 @@
  */
 int drbd_connect(drbd_dev *mdev)
 {
-	struct socket *s, *sock,*msock;
-	int try,h;
+	struct socket *s, *sock, *msock;
+	int try, h;
 
 	D_ASSERT(mdev->state.conn >= Unconnected);
 	D_ASSERT(!mdev->data.socket);
 
-	if (drbd_request_state(mdev,NS(conn,WFConnection)) < SS_Success ) return 0;
+	if (drbd_request_state(mdev, NS(conn, WFConnection)) < SS_Success ) return 0;
 	clear_bit(DISCARD_CONCURRENT, &mdev->flags);
 
 	sock  = NULL;
@@ -755,7 +755,7 @@
 
 		s=drbd_wait_for_connect(mdev);
 		if (s) {
-			switch(drbd_recv_fp(mdev,s)) {
+			switch(drbd_recv_fp(mdev, s)) {
 			case HandShakeS:
 				if (sock) sock_release(sock);
 				sock = s;
@@ -811,7 +811,7 @@
 	mdev->meta.socket = msock;
 	mdev->last_received = jiffies;
 
-	if (drbd_request_state(mdev,NS(conn,WFReportParams)) < SS_Success) return 0;
+	if (drbd_request_state(mdev, NS(conn, WFReportParams)) < SS_Success) return 0;
 	D_ASSERT(mdev->asender.task == NULL);
 
 	h = drbd_do_handshake(mdev);
@@ -827,17 +827,17 @@
 	sock->sk->sk_sndtimeo = mdev->net_conf->timeout*HZ/10;
 	sock->sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT;
 
-	atomic_set(&mdev->packet_seq,0);
+	atomic_set(&mdev->packet_seq, 0);
 	mdev->peer_seq=0;
 
 	drbd_thread_start(&mdev->asender);
 
 	drbd_send_protocol(mdev);
-	drbd_send_sync_param(mdev,&mdev->sync_conf);
+	drbd_send_sync_param(mdev, &mdev->sync_conf);
 	drbd_send_sizes(mdev);
 	drbd_send_uuids(mdev);
 	drbd_send_state(mdev);
-	clear_bit(USE_DEGR_WFC_T,&mdev->flags);
+	clear_bit(USE_DEGR_WFC_T, &mdev->flags);
 
 	return 1;
 }
@@ -846,10 +846,10 @@
 {
 	int r;
 
-	r = drbd_recv(mdev,h,sizeof(*h));
+	r = drbd_recv(mdev, h, sizeof(*h));
 
 	if (unlikely( r != sizeof(*h) )) {
-		ERR("short read expecting header on sock: r=%d\n",r);
+		ERR("short read expecting header on sock: r=%d\n", r);
 		return FALSE;
 	};
 	h->command = be16_to_cpu(h->command);
@@ -882,7 +882,7 @@
 		drbd_kick_lo(mdev);
 
 	spin_lock_irq(&mdev->req_lock);
-	_drbd_wait_ee_list_empty(mdev,&mdev->active_ee);
+	_drbd_wait_ee_list_empty(mdev, &mdev->active_ee);
 	epoch_size = mdev->epoch_size;
 	mdev->epoch_size = 0;
 	spin_unlock_irq(&mdev->req_lock);
@@ -891,10 +891,10 @@
 	 * to make sure this BarrierAck will not be received before the asender
 	 * had a chance to send all the write acks corresponding to this epoch,
 	 * wait_for that bit to clear... */
-	set_bit(WRITE_ACK_PENDING,&mdev->flags);
+	set_bit(WRITE_ACK_PENDING, &mdev->flags);
 	wake_asender(mdev);
 	rv = wait_event_interruptible(mdev->ee_wait,
-			      !test_bit(WRITE_ACK_PENDING,&mdev->flags));
+			      !test_bit(WRITE_ACK_PENDING, &mdev->flags));
 
 	if (rv == 0 && mdev->state.conn >= Connected)
 		rv = drbd_send_b_ack(mdev, p->barrier, epoch_size);
@@ -914,20 +914,20 @@
 	struct bio_vec *bvec;
 	struct page *page;
 	struct bio *bio;
-	int ds,i,rr;
+	int ds, i, rr;
 
-	e = drbd_alloc_ee(mdev,id,sector,data_size,GFP_KERNEL);
+	e = drbd_alloc_ee(mdev, id, sector, data_size, GFP_KERNEL);
 	if (!e) return 0;
 	bio = e->private_bio;
 	ds = data_size;
 	bio_for_each_segment(bvec, bio, i) {
 		page = bvec->bv_page;
-		rr = drbd_recv(mdev,kmap(page),min_t(int,ds,PAGE_SIZE));
+		rr = drbd_recv(mdev, kmap(page), min_t(int, ds, PAGE_SIZE));
 		kunmap(page);
-		if ( rr != min_t(int,ds,PAGE_SIZE) ) {
-			drbd_free_ee(mdev,e);
+		if ( rr != min_t(int, ds, PAGE_SIZE) ) {
+			drbd_free_ee(mdev, e);
 			WARN("short read receiving data: read %d expected %d\n",
-			     rr, min_t(int,ds,PAGE_SIZE));
+			     rr, min_t(int, ds, PAGE_SIZE));
 			return 0;
 		}
 		ds -= rr;
@@ -951,11 +951,11 @@
 
 	data=kmap(page);
 	while(data_size) {
-		rr = drbd_recv(mdev,data,min_t(int,data_size,PAGE_SIZE));
-		if ( rr != min_t(int,data_size,PAGE_SIZE) ) {
+		rr = drbd_recv(mdev, data, min_t(int, data_size, PAGE_SIZE));
+		if ( rr != min_t(int, data_size, PAGE_SIZE) ) {
 			rv = 0;
 			WARN("short read receiving data: read %d expected %d\n",
-			     rr, min_t(int,data_size,PAGE_SIZE));
+			     rr, min_t(int, data_size, PAGE_SIZE));
 			goto out;
 		}
 
@@ -963,7 +963,7 @@
 	}
 	kunmap(page);
  out:
-	drbd_pp_free(mdev,page);
+	drbd_pp_free(mdev, page);
 	return rv;
 }
 
@@ -983,13 +983,13 @@
 {
 	struct bio_vec *bvec;
 	struct bio *bio;
-	int rr,i,expect;
+	int rr, i, expect;
 
 	bio = req->master_bio;
 	D_ASSERT( sector == bio->bi_sector );
 
 	bio_for_each_segment(bvec, bio, i) {
-		expect = min_t(int,data_size,bvec->bv_len);
+		expect = min_t(int, data_size, bvec->bv_len);
 		rr=drbd_recv(mdev,
 			     kmap(bvec->bv_page)+bvec->bv_offset,
 			     expect);
@@ -1019,12 +1019,12 @@
 
 	if (likely( drbd_bio_uptodate(e->private_bio) )) {
 		drbd_set_in_sync(mdev, sector, e->size);
-		ok = drbd_send_ack(mdev,RSWriteAck,e);
+		ok = drbd_send_ack(mdev, RSWriteAck, e);
 	} else {
 		// Record failure to sync
 		drbd_rs_failed_io(mdev, sector, e->size);
 
-		ok = drbd_send_ack(mdev,NegAck,e);
+		ok = drbd_send_ack(mdev, NegAck, e);
 		ok&= drbd_io_error(mdev, FALSE);
 	}
 	dec_unacked(mdev);
@@ -1032,11 +1032,11 @@
 	return ok;
 }
 
-STATIC int recv_resync_read(drbd_dev *mdev,sector_t sector,int data_size)
+STATIC int recv_resync_read(drbd_dev *mdev, sector_t sector, int data_size)
 {
 	struct Tl_epoch_entry *e;
 
-	e = read_in_block(mdev,ID_SYNCER,sector,data_size);
+	e = read_in_block(mdev, ID_SYNCER, sector, data_size);
 	if (!e) return FALSE;
 
 	dec_rs_pending(mdev);
@@ -1049,25 +1049,25 @@
 	 * respective _drbd_clear_done_ee */
 
 	spin_lock_irq(&mdev->req_lock);
-	list_add(&e->w.list,&mdev->sync_ee);
+	list_add(&e->w.list, &mdev->sync_ee);
 	spin_unlock_irq(&mdev->req_lock);
 
-	MTRACE(TraceTypeEE,TraceLvlAll,
+	MTRACE(TraceTypeEE, TraceLvlAll,
 	       INFO("submit EE (RS)WRITE sec=%llus size=%u ee=%p\n",
-		    (unsigned long long)e->sector,e->size,e);
+		    (unsigned long long)e->sector, e->size, e);
 	       );
-	drbd_generic_make_request(mdev,WRITE,DRBD_FAULT_RS_WR,e->private_bio);
+	drbd_generic_make_request(mdev, WRITE, DRBD_FAULT_RS_WR, e->private_bio);
 	/* accounting done in endio */
 
 	maybe_kick_lo(mdev);
 	return TRUE;
 }
 
-STATIC int receive_DataReply(drbd_dev *mdev,Drbd_Header* h)
+STATIC int receive_DataReply(drbd_dev *mdev, Drbd_Header* h)
 {
 	drbd_request_t *req;
 	sector_t sector;
-	unsigned int header_size,data_size;
+	unsigned int header_size, data_size;
 	int ok;
 	Drbd_Data_Packet *p = (Drbd_Data_Packet*)h;
 
@@ -1087,7 +1087,7 @@
 	sector = be64_to_cpu(p->sector);
 
 	spin_lock_irq(&mdev->req_lock);
-	req = _ar_id_to_req(mdev,p->block_id, sector);
+	req = _ar_id_to_req(mdev, p->block_id, sector);
 	spin_unlock_irq(&mdev->req_lock);
 	if (unlikely(!req)) {
 		ERR("Got a corrupt block_id/sector pair(1).\n");
@@ -1097,7 +1097,7 @@
 	/* hlist_del(&req->colision) is done in _req_may_be_done, to avoid
 	 * special casing it there for the various failure cases.
 	 * still no race with drbd_fail_pending_reads */
-	ok = recv_dless_read(mdev,req,sector,data_size);
+	ok = recv_dless_read(mdev, req, sector, data_size);
 
 	if (ok) req_mod(req, data_received, 0);
 	/* else: nothing. handled from drbd_disconnect...
@@ -1107,10 +1107,10 @@
 	return ok;
 }
 
-STATIC int receive_RSDataReply(drbd_dev *mdev,Drbd_Header* h)
+STATIC int receive_RSDataReply(drbd_dev *mdev, Drbd_Header* h)
 {
 	sector_t sector;
-	unsigned int header_size,data_size;
+	unsigned int header_size, data_size;
 	int ok;
 	Drbd_Data_Packet *p = (Drbd_Data_Packet*)h;
 
@@ -1139,15 +1139,15 @@
 		 * in case we are Primary SyncTarget,
 		 * verify there are no pending write request to that area.
 		 */
-		ok = recv_resync_read(mdev,sector,data_size);
+		ok = recv_resync_read(mdev, sector, data_size);
 		if (!ok) dec_local(mdev);
 	} else {
-		if (DRBD_ratelimit(5*HZ,5))
+		if (DRBD_ratelimit(5*HZ, 5))
 			ERR("Can not write resync data to local disk.\n");
 
-		ok = drbd_drain_block(mdev,data_size);
+		ok = drbd_drain_block(mdev, data_size);
 
-		drbd_send_ack_dp(mdev,NegAck,p);
+		drbd_send_ack_dp(mdev, NegAck, p);
 	}
 
 	return ok;
@@ -1164,7 +1164,7 @@
 	struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
 	sector_t sector = e->sector;
 	// unsigned int epoch_size;
-	int ok=1,pcmd;
+	int ok=1, pcmd;
 
 	if (mdev->net_conf->wire_protocol == DRBD_PROT_C) {
 		if (likely(drbd_bio_uptodate(e->private_bio))) {
@@ -1172,9 +1172,9 @@
 				mdev->state.conn <= PausedSyncT &&
 				e->flags & EE_MAY_SET_IN_SYNC) ?
 				RSWriteAck : WriteAck;
-			ok &= drbd_send_ack(mdev,pcmd,e);
+			ok &= drbd_send_ack(mdev, pcmd, e);
 			if (pcmd==RSWriteAck)
-				drbd_set_in_sync(mdev,sector,e->size);
+				drbd_set_in_sync(mdev, sector, e->size);
 		} else {
 			/* FIXME I think we should send a NegAck regardless of
 			 * which protocol is in effect.
@@ -1182,7 +1182,7 @@
 			 * NegAck is sent. basically that means that drbd_process_done_ee
 			 * may not list_del() the ee before this callback did run...
 			 * maybe even move the list_del(e) in here... */
-			ok = drbd_send_ack(mdev,NegAck,e);
+			ok = drbd_send_ack(mdev, NegAck, e);
 			ok&= drbd_io_error(mdev, FALSE);
 			/* we expect it to be marked out of sync anyways...
 			 * maybe assert this?  */
@@ -1212,7 +1212,7 @@
 	int ok=1;
 
 	D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_C);
-	ok = drbd_send_ack(mdev,DiscardAck,e);
+	ok = drbd_send_ack(mdev, DiscardAck, e);
 
 	spin_lock_irq(&mdev->req_lock);
 	D_ASSERT(!hlist_unhashed(&e->colision));
@@ -1253,8 +1253,8 @@
 	int ret = 0;
 	spin_lock(&mdev->peer_seq_lock);
 	for (;;) {
-		prepare_to_wait(&mdev->seq_wait,&wait,TASK_INTERRUPTIBLE);
-		if (seq_le(packet_seq,mdev->peer_seq+1))
+		prepare_to_wait(&mdev->seq_wait, &wait, TASK_INTERRUPTIBLE);
+		if (seq_le(packet_seq, mdev->peer_seq+1))
 			break;
 		spin_unlock(&mdev->peer_seq_lock);
 		if (signal_pending(current)) {
@@ -1272,7 +1272,7 @@
 }
 
 // mirrored write
-STATIC int receive_Data(drbd_dev *mdev,Drbd_Header* h)
+STATIC int receive_Data(drbd_dev *mdev, Drbd_Header* h)
 {
 	sector_t sector;
 	struct Tl_epoch_entry *e;
@@ -1297,20 +1297,20 @@
 		/* data is submitted to disk at the end of this function.
 		 * corresponding dec_local done either below (on error),
 		 * or in drbd_endio_write_sec. */
-		if (DRBD_ratelimit(5*HZ,5))
+		if (DRBD_ratelimit(5*HZ, 5))
 			ERR("Can not write mirrored data block to local disk.\n");
 		spin_lock(&mdev->peer_seq_lock);
 		if (mdev->peer_seq+1 == be32_to_cpu(p->seq_num))
 			mdev->peer_seq++;
 		spin_unlock(&mdev->peer_seq_lock);
 
-		drbd_send_ack_dp(mdev,NegAck,p);
+		drbd_send_ack_dp(mdev, NegAck, p);
 		mdev->epoch_size++; // spin lock ?
-		return drbd_drain_block(mdev,data_size);
+		return drbd_drain_block(mdev, data_size);
 	}
 
 	sector = be64_to_cpu(p->sector);
-	e = read_in_block(mdev,p->block_id,sector,data_size);
+	e = read_in_block(mdev, p->block_id, sector, data_size);
 	if (!e) {
 		dec_local(mdev);
 		return FALSE;
@@ -1338,7 +1338,7 @@
 		 * we may sleep in drbd_wait_peer_seq */
 		const sector_t sector = e->sector;
 		const int size = e->size;
-		const int discard = test_bit(DISCARD_CONCURRENT,&mdev->flags);
+		const int discard = test_bit(DISCARD_CONCURRENT, &mdev->flags);
 		DEFINE_WAIT(wait);
 		drbd_request_t *i;
 		struct hlist_node *n;
@@ -1387,15 +1387,15 @@
 
 		spin_lock_irq(&mdev->req_lock);
 
-		hlist_add_head(&e->colision,ee_hash_slot(mdev,sector));
+		hlist_add_head(&e->colision, ee_hash_slot(mdev, sector));
 
 #define OVERLAPS overlaps(i->sector, i->size, sector, size)
-		slot = tl_hash_slot(mdev,sector);
+		slot = tl_hash_slot(mdev, sector);
 		first = 1;
 		for(;;) {
 			int have_unacked = 0;
 			int have_conflict = 0;
-			prepare_to_wait(&mdev->misc_wait,&wait,TASK_INTERRUPTIBLE);
+			prepare_to_wait(&mdev->misc_wait, &wait, TASK_INTERRUPTIBLE);
 			hlist_for_each_entry(i, n, slot, colision) {
 				if (OVERLAPS) {
 					if (first) {
@@ -1421,7 +1421,7 @@
 				inc_unacked(mdev);
 				mdev->epoch_size++;
 				e->w.cb = e_send_discard_ack;
-				list_add_tail(&e->w.list,&mdev->done_ee);
+				list_add_tail(&e->w.list, &mdev->done_ee);
 
 				spin_unlock_irq(&mdev->req_lock);
 
@@ -1447,7 +1447,7 @@
 			if (first) {
 				first = 0;
 				ALERT("Concurrent write! [W AFTERWARDS] "
-				     "sec=%llus\n",(unsigned long long)sector);
+				     "sec=%llus\n", (unsigned long long)sector);
 			} else if (discard) {
 				/* we had none on the first iteration.
 				 * there must be none now. */
@@ -1515,7 +1515,7 @@
 		e->private_bio->bi_rw |= BIO_RW_BARRIER;
 		mdev->next_barrier_nr = 0;
 	}
-	list_add(&e->w.list,&mdev->active_ee);
+	list_add(&e->w.list, &mdev->active_ee);
 	spin_unlock_irq(&mdev->req_lock);
 
 	if (barrier_nr) {
@@ -1544,17 +1544,17 @@
 
 	if (mdev->state.pdsk == Diskless) {
 		// In case we have the only disk of the cluster,
-		drbd_set_out_of_sync(mdev,e->sector,e->size);
+		drbd_set_out_of_sync(mdev, e->sector, e->size);
 		e->flags |= EE_CALL_AL_COMPLETE_IO;
 		drbd_al_begin_io(mdev, e->sector);
 	}
 
-	MTRACE(TraceTypeEE,TraceLvlAll,
+	MTRACE(TraceTypeEE, TraceLvlAll,
 	       INFO("submit EE (DATA)WRITE sec=%llus size=%u ee=%p\n",
-		    (unsigned long long)e->sector,e->size,e);
+		    (unsigned long long)e->sector, e->size, e);
 	       );
 	/* FIXME drbd_al_begin_io in case we have two primaries... */
-	drbd_generic_make_request(mdev,WRITE,DRBD_FAULT_DT_WR,e->private_bio);
+	drbd_generic_make_request(mdev, WRITE, DRBD_FAULT_DT_WR, e->private_bio);
 	/* accounting done in endio */
 
 	maybe_kick_lo(mdev);
@@ -1565,11 +1565,11 @@
 	 * but we drop the connection anyways, so we don't have a chance to
 	 * receive a barrier... atomic_inc(&mdev->epoch_size); */
 	dec_local(mdev);
-	drbd_free_ee(mdev,e);
+	drbd_free_ee(mdev, e);
 	return FALSE;
 }
 
-STATIC int receive_DataRequest(drbd_dev *mdev,Drbd_Header *h)
+STATIC int receive_DataRequest(drbd_dev *mdev, Drbd_Header *h)
 {
 	sector_t sector;
 	const sector_t capacity = drbd_get_capacity(mdev->this_bdev);
@@ -1588,24 +1588,24 @@
 
 	if (size <= 0 || (size & 0x1ff) != 0 || size > DRBD_MAX_SEGMENT_SIZE) {
 		ERR("%s:%d: sector: %llus, size: %u\n", __FILE__, __LINE__,
-				(unsigned long long)sector,size);
+				(unsigned long long)sector, size);
 		return FALSE;
 	}
 	if ( sector + (size>>9) > capacity) {
 		ERR("%s:%d: sector: %llus, size: %u\n", __FILE__, __LINE__,
-				(unsigned long long)sector,size);
+				(unsigned long long)sector, size);
 		return FALSE;
 	}
 
 	if (!inc_local_if_state(mdev, UpToDate)) {
-		if (DRBD_ratelimit(5*HZ,5))
+		if (DRBD_ratelimit(5*HZ, 5))
 			ERR("Can not satisfy peer's read request, no local data.\n");
-		drbd_send_ack_rp(mdev,h->command == DataRequest ? NegDReply :
-				 NegRSDReply ,p);
+		drbd_send_ack_rp(mdev, h->command == DataRequest ? NegDReply :
+				 NegRSDReply , p);
 		return TRUE;
 	}
 
-	e = drbd_alloc_ee(mdev,p->block_id,sector,size,GFP_KERNEL);
+	e = drbd_alloc_ee(mdev, p->block_id, sector, size, GFP_KERNEL);
 	if (!e) {
 		dec_local(mdev);
 		return FALSE;
@@ -1626,12 +1626,12 @@
 		 * resync data block.
 		 * the drbd_work_queue mechanism is made for this...
 		 */
-		if (!drbd_rs_begin_io(mdev,sector)) {
+		if (!drbd_rs_begin_io(mdev, sector)) {
 			/* we have been interrupted,
 			 * probably connection lost! */
 			D_ASSERT(signal_pending(current));
 			dec_local(mdev);
-			drbd_free_ee(mdev,e);
+			drbd_free_ee(mdev, e);
 			return 0;
 		}
 		break;
@@ -1640,17 +1640,17 @@
 	}
 
 	spin_lock_irq(&mdev->req_lock);
-	list_add(&e->w.list,&mdev->read_ee);
+	list_add(&e->w.list, &mdev->read_ee);
 	spin_unlock_irq(&mdev->req_lock);
 
 	inc_unacked(mdev);
 
-	MTRACE(TraceTypeEE,TraceLvlAll,
+	MTRACE(TraceTypeEE, TraceLvlAll,
 	       INFO("submit EE READ sec=%llus size=%u ee=%p\n",
-		    (unsigned long long)e->sector,e->size,e);
+		    (unsigned long long)e->sector, e->size, e);
 	       );
 	/* FIXME actually, it could be a READA originating from the peer ... */
-	drbd_generic_make_request(mdev,READ,fault_type,e->private_bio);
+	drbd_generic_make_request(mdev, READ, fault_type, e->private_bio);
 	maybe_kick_lo(mdev);
 
 	return TRUE;
@@ -1687,7 +1687,7 @@
 		     "Using discard-least-changes instead\n");
 	case DiscardZeroChg:
 		if (ch_peer == 0 && ch_self == 0) {
-			rv=test_bit(DISCARD_CONCURRENT,&mdev->flags) ? -1 : 1;
+			rv=test_bit(DISCARD_CONCURRENT, &mdev->flags) ? -1 : 1;
 			break;
 		} else {
 			if (ch_peer == 0) { rv =  1; break; }
@@ -1699,7 +1699,7 @@
 		else if (ch_self > ch_peer) rv =  1;
 		else /* ( ch_self == ch_peer ) */ {
 			// Well, then use something else.
-			rv=test_bit(DISCARD_CONCURRENT,&mdev->flags) ? -1 : 1;
+			rv=test_bit(DISCARD_CONCURRENT, &mdev->flags) ? -1 : 1;
 		}
 		break;
 	case DiscardLocal:
@@ -1742,9 +1742,9 @@
 	case CallHelper:
 		hg = drbd_asb_recover_0p(mdev);
 		if (hg == -1 && mdev->state.role==Primary) {
-			self = drbd_set_role(mdev,Secondary,0);
+			self = drbd_set_role(mdev, Secondary, 0);
 			if (self != SS_Success) {
-				drbd_khelper(mdev,"pri-lost-after-sb");
+				drbd_khelper(mdev, "pri-lost-after-sb");
 			} else {
 				WARN("Sucessfully gave up primary role.\n");
 				rv = hg;
@@ -1780,9 +1780,9 @@
 	case CallHelper:
 		hg = drbd_asb_recover_0p(mdev);
 		if (hg == -1) {
-			self = drbd_set_role(mdev,Secondary,0);
+			self = drbd_set_role(mdev, Secondary, 0);
 			if (self != SS_Success) {
-				drbd_khelper(mdev,"pri-lost-after-sb");
+				drbd_khelper(mdev, "pri-lost-after-sb");
 			} else {
 				WARN("Sucessfully gave up primary role.\n");
 				rv = hg;
@@ -1793,7 +1793,7 @@
 	return rv;
 }
 
-STATIC void drbd_uuid_dump(drbd_dev *mdev,char* text,u64* uuid)
+STATIC void drbd_uuid_dump(drbd_dev *mdev, char* text, u64* uuid)
 {
 	INFO("%s %016llX:%016llX:%016llX:%016llX\n",
 	     text,
@@ -1816,7 +1816,7 @@
 STATIC int drbd_uuid_compare(drbd_dev *mdev, int *rule_nr)
 {
 	u64 self, peer;
-	int i,j;
+	int i, j;
 
 	self = mdev->bc->md.uuid[Current] & ~((u64)1);
 	peer = mdev->p_uuid[Current] & ~((u64)1);
@@ -1835,22 +1835,22 @@
 
 	*rule_nr = 4;
 	if (self == peer) { // Common power [off|failure]
-		int rct,dc; // roles at crash time
+		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
 
-		MTRACE(TraceTypeUuid,TraceLvlMetrics, DUMPI(rct); );
+		MTRACE(TraceTypeUuid, TraceLvlMetrics, DUMPI(rct); );
 
 		switch(rct) {
 		case 0: /* !self_pri && !peer_pri */ return 0;
 		case 1: /*  self_pri && !peer_pri */ return 1;
 		case 2: /* !self_pri &&  peer_pri */ return -1;
 		case 3: /*  self_pri &&  peer_pri */
-			dc = test_bit(DISCARD_CONCURRENT,&mdev->flags);
-			MTRACE(TraceTypeUuid,TraceLvlMetrics, DUMPI(dc); );
+			dc = test_bit(DISCARD_CONCURRENT, &mdev->flags);
+			MTRACE(TraceTypeUuid, TraceLvlMetrics, DUMPI(dc); );
 			return dc ? -1 : 1;
 		}
 	}
@@ -1899,25 +1899,25 @@
 STATIC drbd_conns_t drbd_sync_handshake(drbd_dev *mdev, drbd_role_t peer_role,
 					drbd_disks_t peer_disk)
 {
-	int hg,rule_nr;
+	int hg, rule_nr;
 	drbd_conns_t rv = conn_mask;
 	drbd_disks_t mydisk;
 
 	mydisk = mdev->state.disk;
 	if (mydisk == Negotiating) mydisk = mdev->new_state_tmp.disk;
 
-	hg = drbd_uuid_compare(mdev,&rule_nr);
+	hg = drbd_uuid_compare(mdev, &rule_nr);
 
-	MTRACE(TraceTypeUuid,TraceLvlSummary,
+	MTRACE(TraceTypeUuid, TraceLvlSummary,
 	       INFO("drbd_sync_handshake:\n");
-	       drbd_uuid_dump(mdev,"self",mdev->bc->md.uuid);
-	       drbd_uuid_dump(mdev,"peer",mdev->p_uuid);
-	       INFO("uuid_compare()=%d by rule %d\n",hg,rule_nr);
+	       drbd_uuid_dump(mdev, "self", mdev->bc->md.uuid);
+	       drbd_uuid_dump(mdev, "peer", mdev->p_uuid);
+	       INFO("uuid_compare()=%d by rule %d\n", hg, rule_nr);
 	    );
 
 	if (hg == -1000) {
 		ALERT("Unrelated data, dropping connection!\n");
-		drbd_force_state(mdev,NS(conn,Disconnecting));
+		drbd_force_state(mdev, NS(conn, Disconnecting));
 		return conn_mask;
 	}
 
@@ -1951,8 +1951,8 @@
 			if (forced) {
 				WARN("Doing a full sync, since"
 				     " UUIDs where ambiguous.\n");
-				drbd_uuid_dump(mdev,"self",mdev->bc->md.uuid);
-				drbd_uuid_dump(mdev,"peer",mdev->p_uuid);
+				drbd_uuid_dump(mdev, "self", mdev->bc->md.uuid);
+				drbd_uuid_dump(mdev, "peer", mdev->p_uuid);
 				hg=hg*2;
 			}
 		}
@@ -1974,15 +1974,15 @@
 
 	if (hg == -100) {
 		ALERT("Split-Brain detected, dropping connection!\n");
-		drbd_uuid_dump(mdev,"self",mdev->bc->md.uuid);
-		drbd_uuid_dump(mdev,"peer",mdev->p_uuid);
-		drbd_force_state(mdev,NS(conn,Disconnecting));
+		drbd_uuid_dump(mdev, "self", mdev->bc->md.uuid);
+		drbd_uuid_dump(mdev, "peer", mdev->p_uuid);
+		drbd_force_state(mdev, NS(conn, Disconnecting));
 		return conn_mask;
 	}
 
 	if (hg > 0 && mydisk <= Inconsistent) {
 		ERR("I shall become SyncSource, but I am inconsistent!\n");
-		drbd_force_state(mdev,NS(conn,Disconnecting));
+		drbd_force_state(mdev, NS(conn, Disconnecting));
 		return conn_mask;
 	}
 
@@ -1990,11 +1990,11 @@
 	    mdev->state.role == Primary && mdev->state.disk >= Consistent ) {
 		switch(mdev->net_conf->rr_conflict) {
 		case CallHelper:
-			drbd_khelper(mdev,"pri-lost");
+			drbd_khelper(mdev, "pri-lost");
 			// fall through
 		case Disconnect:
 			ERR("I shall become SyncTarget, but I am primary!\n");
-			drbd_force_state(mdev,NS(conn,Disconnecting));
+			drbd_force_state(mdev, NS(conn, Disconnecting));
 			return conn_mask;
 		case Violently:
 			WARN("Becoming SyncTarget, violating the stable-data"
@@ -2003,7 +2003,7 @@
 	}
 
 	if (abs(hg) >= 2) {
-		drbd_md_set_flag(mdev,MDF_FullSync);
+		drbd_md_set_flag(mdev, MDF_FullSync);
 		drbd_md_sync(mdev);
 
 		drbd_bm_set_all(mdev);
@@ -2012,7 +2012,7 @@
 			return conn_mask;
 		}
 
-		drbd_md_clear_flag(mdev,MDF_FullSync);
+		drbd_md_clear_flag(mdev, MDF_FullSync);
 		drbd_md_sync(mdev);
 	}
 
@@ -2102,11 +2102,11 @@
 	return TRUE;
 
  disconnect:
-	drbd_force_state(mdev,NS(conn,Disconnecting));
+	drbd_force_state(mdev, NS(conn, Disconnecting));
 	return FALSE;
 }
 
-STATIC int receive_SyncParam(drbd_dev *mdev,Drbd_Header *h)
+STATIC int receive_SyncParam(drbd_dev *mdev, Drbd_Header *h)
 {
 	int ok = TRUE;
 	Drbd_SyncParam_Packet *p = (Drbd_SyncParam_Packet*)h;
@@ -2155,7 +2155,7 @@
 
 	if (p_size == 0 && mdev->state.disk == Diskless) {
 		ERR("some backing storage is needed\n");
-		drbd_force_state(mdev,NS(conn,Disconnecting));
+		drbd_force_state(mdev, NS(conn, Disconnecting));
 		return FALSE;
 	}
 
@@ -2182,12 +2182,12 @@
 		}
 
 		// Never shrink a device with usable data.
-		if (drbd_new_dev_size(mdev,mdev->bc) <
+		if (drbd_new_dev_size(mdev, mdev->bc) <
 		   drbd_get_capacity(mdev->this_bdev) &&
 		   mdev->state.disk >= Outdated ) {
 			dec_local(mdev);
 			ERR("The peer's disk size is too small!\n");
-			drbd_force_state(mdev,NS(conn,Disconnecting));
+			drbd_force_state(mdev, NS(conn, Disconnecting));
 			mdev->bc->dc.disk_size = my_usize;
 			return FALSE;
 		}
@@ -2209,17 +2209,17 @@
 		dec_local(mdev);
 	} else {
 		// I am diskless, need to accept the peer's size.
-		drbd_set_my_capacity(mdev,p_size);
+		drbd_set_my_capacity(mdev, p_size);
 	}
 
 	if (mdev->p_uuid && mdev->state.conn <= Connected && inc_local(mdev)) {
-		nconn=drbd_sync_handshake(mdev,mdev->state.peer,mdev->state.pdsk);
+		nconn=drbd_sync_handshake(mdev, mdev->state.peer, mdev->state.pdsk);
 		dec_local(mdev);
 
 		if (nconn == conn_mask) return FALSE;
 
-		if (drbd_request_state(mdev,NS(conn,nconn)) < SS_Success) {
-			drbd_force_state(mdev,NS(conn,Disconnecting));
+		if (drbd_request_state(mdev, NS(conn, nconn)) < SS_Success) {
+			drbd_force_state(mdev, NS(conn, Disconnecting));
 			return FALSE;
 		}
 	}
@@ -2230,7 +2230,7 @@
 			drbd_setup_queue_param(mdev, max_seg_s);
 		}
 
-		drbd_setup_order_type(mdev,be32_to_cpu(p->queue_order_type));
+		drbd_setup_order_type(mdev, be32_to_cpu(p->queue_order_type));
 		dec_local(mdev);
 	}
 
@@ -2301,7 +2301,7 @@
 STATIC int receive_req_state(drbd_dev *mdev, Drbd_Header *h)
 {
 	Drbd_Req_State_Packet *p = (Drbd_Req_State_Packet*)h;
-	drbd_state_t mask,val;
+	drbd_state_t mask, val;
 	int rv;
 
 	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
@@ -2311,16 +2311,16 @@
 	mask.i = be32_to_cpu(p->mask);
 	val.i = be32_to_cpu(p->val);
 
-	if (test_bit(DISCARD_CONCURRENT,&mdev->flags)) drbd_state_lock(mdev);
+	if (test_bit(DISCARD_CONCURRENT, &mdev->flags)) drbd_state_lock(mdev);
 
 	mask = convert_state(mask);
 	val = convert_state(val);
 
-	rv = drbd_change_state(mdev,ChgStateVerbose,mask,val);
+	rv = drbd_change_state(mdev, ChgStateVerbose, mask, val);
 
-	if (test_bit(DISCARD_CONCURRENT,&mdev->flags)) drbd_state_unlock(mdev);
+	if (test_bit(DISCARD_CONCURRENT, &mdev->flags)) drbd_state_unlock(mdev);
 
-	drbd_send_sr_reply(mdev,rv);
+	drbd_send_sr_reply(mdev, rv);
 	drbd_md_sync(mdev);
 
 	return TRUE;
@@ -2329,8 +2329,8 @@
 STATIC int receive_state(drbd_dev *mdev, Drbd_Header *h)
 {
 	Drbd_State_Packet *p = (Drbd_State_Packet*)h;
-	drbd_conns_t nconn,oconn;
-	drbd_state_t os,ns,peer_state;
+	drbd_conns_t nconn, oconn;
+	drbd_state_t os, ns, peer_state;
 	int rv;
 
 	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
@@ -2348,8 +2348,8 @@
 
 	if (mdev->p_uuid && oconn <= Connected &&
 	    peer_state.disk >= Negotiating &&
-	    inc_local_if_state(mdev,Negotiating) ) {
-		nconn=drbd_sync_handshake(mdev,peer_state.role,peer_state.disk);
+	    inc_local_if_state(mdev, Negotiating) ) {
+		nconn=drbd_sync_handshake(mdev, peer_state.role, peer_state.disk);
 		dec_local(mdev);
 
 		if (nconn == conn_mask) return FALSE;
@@ -2367,11 +2367,11 @@
 	   ns.disk == Negotiating ) ns.disk = UpToDate;
 	if ((nconn == Connected || nconn == WFBitMapT) &&
 	   ns.pdsk == Negotiating ) ns.pdsk = UpToDate;
-	rv = _drbd_set_state(mdev,ns,ChgStateVerbose | ChgStateHard);
+	rv = _drbd_set_state(mdev, ns, ChgStateVerbose | ChgStateHard);
 	spin_unlock_irq(&mdev->req_lock);
 
 	if (rv < SS_Success) {
-		drbd_force_state(mdev,NS(conn,Disconnecting));
+		drbd_force_state(mdev, NS(conn, Disconnecting));
 		return FALSE;
 	}
 
@@ -2388,7 +2388,7 @@
 	}
 
 	if (rv==SS_Success) {
-		after_state_ch(mdev,os,ns,ChgStateVerbose | ChgStateHard);
+		after_state_ch(mdev, os, ns, ChgStateVerbose | ChgStateHard);
 	}
 
 	mdev->net_conf->want_lose = 0;
@@ -2414,10 +2414,10 @@
 
 	/* Here the _drbd_uuid_ functions are right, current should
 	   _not_ be rotated into the history */
-	_drbd_uuid_set(mdev,Current,be64_to_cpu(p->uuid));
-	_drbd_uuid_set(mdev,Bitmap,0UL);
+	_drbd_uuid_set(mdev, Current, be64_to_cpu(p->uuid));
+	_drbd_uuid_set(mdev, Bitmap, 0UL);
 
-	drbd_start_resync(mdev,SyncTarget);
+	drbd_start_resync(mdev, SyncTarget);
 
 	return TRUE;
 }
@@ -2453,17 +2453,17 @@
 		drbd_bm_merge_lel(mdev, bm_i, num_words, buffer);
 		bm_i += num_words;
 
-		if (!drbd_recv_header(mdev,h))
+		if (!drbd_recv_header(mdev, h))
 			goto out;
 		D_ASSERT(h->command == ReportBitMap);
 	}
 
 	if (mdev->state.conn == WFBitMapS) {
-		drbd_start_resync(mdev,SyncSource);
+		drbd_start_resync(mdev, SyncSource);
 	} else if (mdev->state.conn == WFBitMapT) {
 		ok = drbd_send_bitmap(mdev);
 		if (!ok) goto out;
-		ok = drbd_request_state(mdev,NS(conn,WFSyncUUID));
+		ok = drbd_request_state(mdev, NS(conn, WFSyncUUID));
 		D_ASSERT( ok == SS_Success );
 	} else {
 		ERR("unexpected cstate (%s) in receive_bitmap\n",
@@ -2477,19 +2477,19 @@
 	return ok;
 }
 
-STATIC int receive_skip(drbd_dev *mdev,Drbd_Header *h)
+STATIC int receive_skip(drbd_dev *mdev, Drbd_Header *h)
 {
 	// TODO zero copy sink :)
 	static char sink[128];
-	int size,want,r;
+	int size, want, r;
 
 	WARN("skipping unknown optional packet type %d, l: %d!\n",
 	     h->command, h->length );
 
 	size = h->length;
 	while (size > 0) {
-		want = min_t(int,size,sizeof(sink));
-		r = drbd_recv(mdev,sink,want);
+		want = min_t(int, size, sizeof(sink));
+		r = drbd_recv(mdev, sink, want);
 		ERR_IF(r < 0) break;
 		size -= r;
 	}
@@ -2502,7 +2502,7 @@
 	return TRUE; // cannot fail.
 }
 
-typedef int (*drbd_cmd_handler_f)(drbd_dev*,Drbd_Header*);
+typedef int (*drbd_cmd_handler_f)(drbd_dev*, Drbd_Header*);
 
 static drbd_cmd_handler_f drbd_default_handler[] = {
 	[Data]             = receive_Data,
@@ -2536,7 +2536,7 @@
 	Drbd_Header *header = &mdev->data.rbuf.head;
 
 	while (get_t_state(&mdev->receiver) == Running) {
-		if (!drbd_recv_header(mdev,header))
+		if (!drbd_recv_header(mdev, header))
 			break;
 
 		if (header->command < MAX_CMD)
@@ -2551,17 +2551,17 @@
 		if (unlikely(!handler)) {
 			ERR("unknown packet type %d, l: %d!\n",
 			    header->command, header->length);
-			drbd_force_state(mdev,NS(conn,ProtocolError));
+			drbd_force_state(mdev, NS(conn, ProtocolError));
 			break;
 		}
-		if (unlikely(!handler(mdev,header))) {
+		if (unlikely(!handler(mdev, header))) {
 			ERR("error receiving %s, l: %d!\n",
 			    cmdname(header->command), header->length);
-			drbd_force_state(mdev,NS(conn,ProtocolError));
+			drbd_force_state(mdev, NS(conn, ProtocolError));
 			break;
 		}
 
-		dump_packet(mdev,mdev->data.socket,2,&mdev->data.rbuf, __FILE__, __LINE__);
+		dump_packet(mdev, mdev->data.socket, 2, &mdev->data.rbuf, __FILE__, __LINE__);
 	}
 }
 
@@ -2585,7 +2585,7 @@
 			list_add(&req->w.list, &workset);
 		}
 	}
-	memset(mdev->app_reads_hash,0,APP_R_HSIZE*sizeof(void*));
+	memset(mdev->app_reads_hash, 0, APP_R_HSIZE*sizeof(void*));
 
 	while(!list_empty(&workset)) {
 		le = workset.next;
@@ -2601,7 +2601,7 @@
 {
 	struct drbd_work prev_work_done;
 	enum fencing_policy fp;
-	drbd_state_t os,ns;
+	drbd_state_t os, ns;
 	int rv=SS_UnknownError;
 
 	D_ASSERT(mdev->state.conn < Connected);
@@ -2624,10 +2624,10 @@
 	up(&mdev->data.mutex);
 
 	spin_lock_irq(&mdev->req_lock);
-	_drbd_wait_ee_list_empty(mdev,&mdev->active_ee);
-	_drbd_wait_ee_list_empty(mdev,&mdev->sync_ee);
+	_drbd_wait_ee_list_empty(mdev, &mdev->active_ee);
+	_drbd_wait_ee_list_empty(mdev, &mdev->sync_ee);
 	_drbd_clear_done_ee(mdev);
-	_drbd_wait_ee_list_empty(mdev,&mdev->read_ee);
+	_drbd_wait_ee_list_empty(mdev, &mdev->read_ee);
 	reclaim_net_ee(mdev);
 	spin_unlock_irq(&mdev->req_lock);
 
@@ -2649,21 +2649,21 @@
 	drbd_rs_cancel_all(mdev);
 	mdev->rs_total=0;
 	mdev->rs_failed=0;
-	atomic_set(&mdev->rs_pending_cnt,0);
+	atomic_set(&mdev->rs_pending_cnt, 0);
 	wake_up(&mdev->misc_wait);
 
 	/* make sure syncer is stopped and w_resume_next_sg queued */
 	del_timer_sync(&mdev->resync_timer);
-	set_bit(STOP_SYNC_TIMER,&mdev->flags);
+	set_bit(STOP_SYNC_TIMER, &mdev->flags);
 	resync_timer_fn((unsigned long)mdev);
 
 	/* wait for all w_e_end_data_req, w_e_end_rsdata_req, w_send_barrier,
 	 * w_make_resync_request etc. which may still be on the worker queue
 	 * to be "canceled" */
-	set_bit(WORK_PENDING,&mdev->flags);
+	set_bit(WORK_PENDING, &mdev->flags);
 	prev_work_done.cb = w_prev_work_done;
-	drbd_queue_work(&mdev->data.work,&prev_work_done);
-	wait_event(mdev->misc_wait, !test_bit(WORK_PENDING,&mdev->flags));
+	drbd_queue_work(&mdev->data.work, &prev_work_done);
+	wait_event(mdev->misc_wait, !test_bit(WORK_PENDING, &mdev->flags));
 
 	if (mdev->p_uuid) {
 		kfree(mdev->p_uuid);
@@ -2683,7 +2683,7 @@
 		if ( fp >= Resource &&
 		    mdev->state.pdsk >= DUnknown ) {
 			drbd_disks_t nps = drbd_try_outdate_peer(mdev);
-			drbd_request_state(mdev,NS(pdsk,nps));
+			drbd_request_state(mdev, NS(pdsk, nps));
 		}
 	}
 
@@ -2693,15 +2693,15 @@
 		// Do not restart in case we are Disconnecting
 		ns = os;
 		ns.conn = Unconnected;
-		rv=_drbd_set_state(mdev,ns,ChgStateVerbose);
+		rv=_drbd_set_state(mdev, ns, ChgStateVerbose);
 	}
 	spin_unlock_irq(&mdev->req_lock);
 	if (rv == SS_Success) {
-		after_state_ch(mdev,os,ns,ChgStateVerbose);
+		after_state_ch(mdev, os, ns, ChgStateVerbose);
 	}
 
 	if (os.conn == Disconnecting) {
-		wait_event( mdev->misc_wait,atomic_read(&mdev->net_cnt) == 0 );
+		wait_event( mdev->misc_wait, atomic_read(&mdev->net_cnt) == 0 );
 		if (mdev->ee_hash) {
 			kfree(mdev->ee_hash);
 			mdev->ee_hash = NULL;
@@ -2719,7 +2719,7 @@
 		}
 		kfree(mdev->net_conf);
 		mdev->net_conf=NULL;
-		drbd_request_state(mdev, NS(conn,StandAlone));
+		drbd_request_state(mdev, NS(conn, StandAlone));
 	}
 
 	/* they do trigger all the time.
@@ -2762,7 +2762,7 @@
 		return 0;
 	}
 
-	memset(p,0,sizeof(*p));
+	memset(p, 0, sizeof(*p));
 	p->protocol_version = cpu_to_be32(PRO_VERSION);
 	ok = _drbd_send_cmd( mdev, mdev->data.socket, HandShake,
 	                     (Drbd_Header *)p, sizeof(*p), 0 );
@@ -2787,7 +2787,7 @@
 	rv = drbd_send_handshake(mdev);
 	if (!rv) goto break_c_loop;
 
-	rv = drbd_recv_header(mdev,&p->head);
+	rv = drbd_recv_header(mdev, &p->head);
 	if (!rv) goto break_c_loop;
 
 	if (p->head.command != HandShake) {
@@ -2809,7 +2809,7 @@
 		return 0;
 	}
 
-	dump_packet(mdev,mdev->data.socket,2,&mdev->data.rbuf, __FILE__, __LINE__);
+	dump_packet(mdev, mdev->data.socket, 2, &mdev->data.rbuf, __FILE__, __LINE__);
 
 	p->protocol_version = be32_to_cpu(p->protocol_version);
 
@@ -2882,17 +2882,17 @@
 	rv = crypto_hash_setkey(mdev->cram_hmac_tfm,
 				(u8*)mdev->net_conf->shared_secret, key_len);
 	if (rv) {
-		ERR("crypto_hash_setkey() failed with %d\n",rv);
+		ERR("crypto_hash_setkey() failed with %d\n", rv);
 		rv = 0;
 		goto fail;
 	}
 
 	get_random_bytes(my_challenge, CHALLENGE_LEN);
 
-	rv = drbd_send_cmd2(mdev,AuthChallenge,my_challenge,CHALLENGE_LEN);
+	rv = drbd_send_cmd2(mdev, AuthChallenge, my_challenge, CHALLENGE_LEN);
 	if (!rv) goto fail;
 
-	rv = drbd_recv_header(mdev,&p);
+	rv = drbd_recv_header(mdev, &p);
 	if (!rv) goto fail;
 
 	if (p.command != AuthChallenge) {
@@ -2908,7 +2908,7 @@
 		goto fail;
 	}
 
-	peers_ch = kmalloc(p.length,GFP_KERNEL);
+	peers_ch = kmalloc(p.length, GFP_KERNEL);
 	if (peers_ch == NULL) {
 		ERR("kmalloc of peers_ch failed\n");
 		rv = 0;
@@ -2924,7 +2924,7 @@
 	}
 
 	resp_size = crypto_hash_digestsize(mdev->cram_hmac_tfm);
-	response = kmalloc(resp_size,GFP_KERNEL);
+	response = kmalloc(resp_size, GFP_KERNEL);
 	if (response == NULL) {
 		ERR("kmalloc of response failed\n");
 		rv = 0;
@@ -2937,15 +2937,15 @@
 
 	rv = crypto_hash_digest(&desc, &sg, sg.length, response);
 	if (rv) {
-		ERR( "crypto_hash_digest() failed with %d\n",rv);
+		ERR( "crypto_hash_digest() failed with %d\n", rv);
 		rv = 0;
 		goto fail;
 	}
 
-	rv = drbd_send_cmd2(mdev,AuthResponse,response,resp_size);
+	rv = drbd_send_cmd2(mdev, AuthResponse, response, resp_size);
 	if (!rv) goto fail;
 
-	rv = drbd_recv_header(mdev,&p);
+	rv = drbd_recv_header(mdev, &p);
 	if (!rv) goto fail;
 
 	if (p.command != AuthResponse) {
@@ -2969,7 +2969,7 @@
 		goto fail;
 	}
 
-	right_response = kmalloc(resp_size,GFP_KERNEL);
+	right_response = kmalloc(resp_size, GFP_KERNEL);
 	if (response == NULL) {
 		ERR("kmalloc of right_response failed\n");
 		rv = 0;
@@ -2982,16 +2982,16 @@
 
 	rv = crypto_hash_digest(&desc, &sg, sg.length, right_response);
 	if (rv) {
-		ERR( "crypto_hash_digest() failed with %d\n",rv);
+		ERR( "crypto_hash_digest() failed with %d\n", rv);
 		rv = 0;
 		goto fail;
 	}
 
-	rv = ! memcmp(response,right_response,resp_size);
+	rv = ! memcmp(response, right_response, resp_size);
 
 	if (rv) {
 		INFO("Peer authenticated using %d bytes of '%s' HMAC\n",
-		     resp_size,mdev->net_conf->cram_hmac_alg);
+		     resp_size, mdev->net_conf->cram_hmac_alg);
 	}
 
  fail:
@@ -3021,7 +3021,7 @@
 		}
 		if (h < 0) {
 			WARN("Discarding network configuration.\n");
-			drbd_force_state(mdev,NS(conn,Disconnecting));
+			drbd_force_state(mdev, NS(conn, Disconnecting));
 		}
 	} while ( h == 0 );
 
@@ -3056,9 +3056,9 @@
 	int retcode = be32_to_cpu(p->retcode);
 
 	if (retcode >= SS_Success) {
-		set_bit(CL_ST_CHG_SUCCESS,&mdev->flags);
+		set_bit(CL_ST_CHG_SUCCESS, &mdev->flags);
 	} else {
-		set_bit(CL_ST_CHG_FAIL,&mdev->flags);
+		set_bit(CL_ST_CHG_FAIL, &mdev->flags);
 		ERR("Requested state change failed by peer: %s\n",
 		    set_st_err_name(retcode));
 	}
@@ -3088,10 +3088,10 @@
 	sector_t sector = be64_to_cpu(p->sector);
 	int blksize = be32_to_cpu(p->blksize);
 
-	update_peer_seq(mdev,be32_to_cpu(p->seq_num));
+	update_peer_seq(mdev, be32_to_cpu(p->seq_num));
 
 	if ( is_syncer_block_id(p->block_id)) {
-		drbd_set_in_sync(mdev,sector,blksize);
+		drbd_set_in_sync(mdev, sector, blksize);
 		dec_rs_pending(mdev);
 	} else {
 		spin_lock_irq(&mdev->req_lock);
@@ -3106,15 +3106,15 @@
 		switch (be16_to_cpu(h->command)) {
 		case RSWriteAck:
 			D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_C);
-			_req_mod(req,write_acked_by_peer_and_sis,0);
+			_req_mod(req, write_acked_by_peer_and_sis, 0);
 			break;
 		case WriteAck:
 			D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_C);
-			_req_mod(req,write_acked_by_peer,0);
+			_req_mod(req, write_acked_by_peer, 0);
 			break;
 		case RecvAck:
 			D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_B);
-			_req_mod(req,recv_acked_by_peer,0);
+			_req_mod(req, recv_acked_by_peer, 0);
 			break;
 		case DiscardAck:
 			D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_C);
@@ -3139,10 +3139,10 @@
 	sector_t sector = be64_to_cpu(p->sector);
 	drbd_request_t *req;
 
-	if (DRBD_ratelimit(5*HZ,5))
+	if (DRBD_ratelimit(5*HZ, 5))
 		WARN("Got NegAck packet. Peer is in troubles?\n");
 
-	update_peer_seq(mdev,be32_to_cpu(p->seq_num));
+	update_peer_seq(mdev, be32_to_cpu(p->seq_num));
 
 	if (is_syncer_block_id(p->block_id)) {
 		sector_t sector = be64_to_cpu(p->sector);
@@ -3173,7 +3173,7 @@
 	sector_t sector = be64_to_cpu(p->sector);
 
 	spin_lock_irq(&mdev->req_lock);
-	req = _ar_id_to_req(mdev,p->block_id, sector);
+	req = _ar_id_to_req(mdev, p->block_id, sector);
 	if (unlikely(!req)) {
 		spin_unlock_irq(&mdev->req_lock);
 		ERR("Got a corrupt block_id/sector pair(3).\n");
@@ -3183,13 +3183,13 @@
 	/* FIXME explicitly warn if protocol != C */
 
 	ERR("Got NegDReply; Sector %llus, len %u; Fail original request.\n",
-	    (unsigned long long)sector,be32_to_cpu(p->blksize));
+	    (unsigned long long)sector, be32_to_cpu(p->blksize));
 
 	_req_mod(req, neg_acked, 0);
 	spin_unlock_irq(&mdev->req_lock);
 
 // warning LGE "ugly and wrong"
-	drbd_khelper(mdev,"pri-on-incon-degr");
+	drbd_khelper(mdev, "pri-on-incon-degr");
 
 	return TRUE;
 }
@@ -3206,8 +3206,8 @@
 
 	dec_rs_pending(mdev);
 
-	if (inc_local_if_state(mdev,Failed)) {
-		drbd_rs_complete_io(mdev,sector);
+	if (inc_local_if_state(mdev, Failed)) {
+		drbd_rs_complete_io(mdev, sector);
 		drbd_rs_failed_io(mdev, sector, size);
 		dec_local(mdev);
 	}
@@ -3219,7 +3219,7 @@
 {
 	Drbd_BarrierAck_Packet *p = (Drbd_BarrierAck_Packet*)h;
 
-	tl_release(mdev,p->barrier,be32_to_cpu(p->set_size));
+	tl_release(mdev, p->barrier, be32_to_cpu(p->set_size));
 	dec_ap_pending(mdev);
 
 	return TRUE;
@@ -3235,7 +3235,7 @@
 	drbd_dev *mdev = thi->mdev;
 	Drbd_Header *h = &mdev->meta.rbuf.head;
 
-	int rv,len;
+	int rv, len;
 	void *buf    = h;
 	int received = 0;
 	int expect   = sizeof(Drbd_Header);
@@ -3252,8 +3252,8 @@
 		[NegAck]    ={ sizeof(Drbd_BlockAck_Packet),  got_NegAck },
 		[NegDReply] ={ sizeof(Drbd_BlockAck_Packet),  got_NegDReply },
 		[NegRSDReply]={sizeof(Drbd_BlockAck_Packet),  got_NegRSDReply},
-		[BarrierAck]={ sizeof(Drbd_BarrierAck_Packet),got_BarrierAck },
-		[StateChgReply]={sizeof(Drbd_RqS_Reply_Packet),got_RqSReply },
+		[BarrierAck]={ sizeof(Drbd_BarrierAck_Packet), got_BarrierAck },
+		[StateChgReply]={sizeof(Drbd_RqS_Reply_Packet), got_RqSReply },
 	};
 
 	sprintf(current->comm, "drbd%d_asender", mdev_to_minor(mdev));
@@ -3284,7 +3284,7 @@
 		drbd_tcp_flush(mdev->meta.socket);
 
 		rv = drbd_recv_short(mdev, mdev->meta.socket,
-				     buf,expect-received);
+				     buf, expect-received);
 		clear_bit(SIGNAL_ASENDER, &mdev->flags);
 
 		flush_signals(current);
@@ -3313,7 +3313,7 @@
 				ERR("PingAck did not arrive in time.\n");
 				goto err;
 			}
-			set_bit(SEND_PING,&mdev->flags);
+			set_bit(SEND_PING, &mdev->flags);
 			continue;
 		} else if (rv == -EINTR) {
 			continue;
@@ -3333,14 +3333,14 @@
 			}
 			expect = asender_tbl[cmd].pkt_size;
 			ERR_IF(len != expect-sizeof(Drbd_Header)) {
-				dump_packet(mdev,mdev->meta.socket,1,(void*)h, __FILE__, __LINE__);
+				dump_packet(mdev, mdev->meta.socket, 1, (void*)h, __FILE__, __LINE__);
 				DUMPI(expect);
 			}
 		}
 		if (received == expect) {
 			D_ASSERT(cmd != -1);
-			dump_packet(mdev,mdev->meta.socket,1,(void*)h, __FILE__, __LINE__);
-			if (!asender_tbl[cmd].process(mdev,h)) goto err;
+			dump_packet(mdev, mdev->meta.socket, 1, (void*)h, __FILE__, __LINE__);
+			if (!asender_tbl[cmd].process(mdev, h)) goto err;
 
 			buf      = h;
 			received = 0;
@@ -3353,7 +3353,7 @@
 	err:
 		clear_bit(SIGNAL_ASENDER, &mdev->flags);
 		if (mdev->state.conn >= Connected)
-			drbd_force_state(mdev,NS(conn,NetworkFailure));
+			drbd_force_state(mdev, NS(conn, NetworkFailure));
 	}
 
 	D_ASSERT(mdev->state.conn < Connected);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_req.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 11:38:05 UTC (rev 2985)
@@ -61,7 +61,7 @@
 
 //#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)
+void _print_req_mod(drbd_request_t *req, drbd_req_event_t what)
 {
 	drbd_dev *mdev = req->mdev;
 	const int rw = (req->master_bio == NULL ||
@@ -93,16 +93,16 @@
 }
 
 # ifdef ENABLE_DYNAMIC_TRACE
-#  define print_rq_state(R,T) MTRACE(TraceTypeRq,TraceLvlMetrics,_print_rq_state(R,T);)
-#  define print_req_mod(T,W)  MTRACE(TraceTypeRq,TraceLvlMetrics,_print_req_mod(T,W);)
+#  define print_rq_state(R, T) MTRACE(TraceTypeRq, TraceLvlMetrics, _print_rq_state(R, T);)
+#  define print_req_mod(T, W)  MTRACE(TraceTypeRq, TraceLvlMetrics, _print_req_mod(T, W);)
 # else
-#  define print_rq_state(R,T) _print_rq_state(R,T)
-#  define print_req_mod(T,W)  _print_req_mod(T,W)
+#  define print_rq_state(R, T) _print_rq_state(R, T)
+#  define print_req_mod(T, W)  _print_req_mod(T, W)
 # endif
 
 #else
-#define print_rq_state(R,T)
-#define print_req_mod(T,W)
+#define print_rq_state(R, T)
+#define print_req_mod(T, W)
 #endif
 
 static void _req_is_done(drbd_dev *mdev, drbd_request_t *req, const int rw)
@@ -124,12 +124,12 @@
 		 * Other places where we set out-of-sync:
 		 * READ with local io-error */
 		if (!(s & RQ_NET_OK) || !(s & RQ_LOCAL_OK)) {
-			drbd_set_out_of_sync(mdev,req->sector,req->size);
+			drbd_set_out_of_sync(mdev, req->sector, req->size);
 		}
 
 		if ( (s & RQ_NET_OK) && (s & RQ_LOCAL_OK) &&
 		    (s & RQ_NET_SIS) ) {
-			drbd_set_in_sync(mdev,req->sector,req->size);
+			drbd_set_in_sync(mdev, req->sector, req->size);
 		}
 
 		/* one might be tempted to move the drbd_al_complete_io
@@ -143,7 +143,7 @@
 		 * we would forget to resync the corresponding extent.
 		 */
 		if (s & RQ_LOCAL_MASK) {
-			if (inc_local_if_state(mdev,Failed)) {
+			if (inc_local_if_state(mdev, Failed)) {
 				drbd_al_complete_io(mdev, req->sector);
 				dec_local(mdev);
 			} else {
@@ -193,7 +193,7 @@
 			/* before we can signal completion to the upper layers,
 			 * we may need to close the current epoch */
 			if (req->epoch == mdev->newest_barrier->br_number)
-				set_bit(ISSUE_BARRIER,&mdev->flags);
+				set_bit(ISSUE_BARRIER, &mdev->flags);
 
 			/* we need to do the conflict detection stuff,
 			 * if we have the ee_hash (two_primaries) and
@@ -206,7 +206,7 @@
 				 * there must be no conflicting requests, since
 				 * they must have been failed on the spot */
 #define OVERLAPS overlaps(sector, size, i->sector, i->size)
-				slot = tl_hash_slot(mdev,sector);
+				slot = tl_hash_slot(mdev, sector);
 				hlist_for_each_entry(i, n, slot, colision) {
 					if (OVERLAPS) {
 						ALERT("LOGIC BUG: completed: %p %llus +%u; other: %p %llus +%u\n",
@@ -229,7 +229,7 @@
 				 * we just have to do a wake_up.  */
 #undef OVERLAPS
 #define OVERLAPS overlaps(sector, size, e->sector, e->size)
-				slot = ee_hash_slot(mdev,req->sector);
+				slot = ee_hash_slot(mdev, req->sector);
 				hlist_for_each_entry(e, n, slot, colision) {
 					if (OVERLAPS) {
 						wake_up(&mdev->misc_wait);
@@ -242,7 +242,7 @@
 
 static void _complete_master_bio(drbd_dev *mdev, drbd_request_t *req, int error)
 {
-	dump_bio(mdev,req->master_bio,1);
+	dump_bio(mdev, req->master_bio, 1);
 	bio_endio(req->master_bio, req->master_bio->bi_size, error);
 	req->master_bio = NULL;
 	dec_ap_bio(mdev);
@@ -299,7 +299,7 @@
 
 		if (rw == WRITE) {
 			/* for writes we need to do some extra housekeeping */
-			_about_to_complete_local_write(mdev,req);
+			_about_to_complete_local_write(mdev, req);
 		}
 
 		/* FIXME not yet implemented...
@@ -311,7 +311,7 @@
 		 * then again, if it is a READ, it is not in the TL at all.
 		 * is it still leagal to complete a READ during freeze? */
 
-		_complete_master_bio(mdev,req,
+		_complete_master_bio(mdev, req,
 			  ok ? 0 : ( error ? error : -EIO ) );
 	} else {
 		/* only WRITE requests can end up here without a master_bio */
@@ -323,7 +323,7 @@
 		 * or protocol C WriteAck,
 		 * or protocol A or B BarrierAck,
 		 * or killed from the transfer log due to connection loss. */
-		_req_is_done(mdev,req,rw);
+		_req_is_done(mdev, req, rw);
 	}
 	/* else: network part and not DONE yet. that is
 	 * protocol A or B, barrier ack still pending... */
@@ -376,7 +376,7 @@
 	BUG_ON(mdev->tl_hash == NULL);
 
 #define OVERLAPS overlaps(i->sector, i->size, sector, size)
-	slot = tl_hash_slot(mdev,sector);
+	slot = tl_hash_slot(mdev, sector);
 	hlist_for_each_entry(i, n, slot, colision) {
 		if (OVERLAPS) {
 			ALERT("%s[%u] Concurrent local write detected!"
@@ -393,7 +393,7 @@
 		BUG_ON(mdev->ee_hash == NULL);
 #undef OVERLAPS
 #define OVERLAPS overlaps(e->sector, e->size, sector, size)
-		slot = ee_hash_slot(mdev,sector);
+		slot = ee_hash_slot(mdev, sector);
 		hlist_for_each_entry(e, n, slot, colision) {
 			if (OVERLAPS) {
 				ALERT("%s[%u] Concurrent remote write detected!"
@@ -439,10 +439,10 @@
 	MUST_HOLD(&mdev->req_lock);
 
 	if (error && ( bio_rw(req->master_bio) != READA ) ) {
-		ERR("got an _req_mod() errno of %d\n",error);
+		ERR("got an _req_mod() errno of %d\n", error);
 	}
 
-	print_req_mod(req,what);
+	print_req_mod(req, what);
 
 	switch(what) {
 	default:
@@ -484,7 +484,7 @@
 		req->rq_state |= (RQ_LOCAL_COMPLETED|RQ_LOCAL_OK);
 		req->rq_state &= ~RQ_LOCAL_PENDING;
 
-		_req_may_be_done(req,error);
+		_req_may_be_done(req, error);
 		dec_local(mdev);
 		break;
 
@@ -498,14 +498,14 @@
 		      (unsigned long long)req->sector, req->size);
 		/* and now: check how to handle local io error.
 		 * FIXME see comment below in read_completed_with_error */
-		__drbd_chk_io_error(mdev,FALSE);
-		_req_may_be_done(req,error);
+		__drbd_chk_io_error(mdev, FALSE);
+		_req_may_be_done(req, error);
 		dec_local(mdev);
 		break;
 
 	case read_completed_with_error:
 		if (bio_rw(req->master_bio) != READA) {
-			drbd_set_out_of_sync(mdev,req->sector,req->size);
+			drbd_set_out_of_sync(mdev, req->sector, req->size);
 		}
 		req->rq_state |= RQ_LOCAL_COMPLETED;
 		req->rq_state &= ~RQ_LOCAL_PENDING;
@@ -515,7 +515,7 @@
 		dec_local(mdev);
 		if (bio_rw(req->master_bio) == READA) {
 			/* it is legal to fail READA */
-			_req_may_be_done(req,error);
+			_req_may_be_done(req, error);
 			break;
 		}
 		/* else */
@@ -535,7 +535,7 @@
 		 * private bio then, and round the offset and size so
 		 * we get back enough data to be able to clear the bits again.
 		 */
-		__drbd_chk_io_error(mdev,FALSE);
+		__drbd_chk_io_error(mdev, FALSE);
 		/* fall through: _req_mod(req,queue_for_net_read); */
 
 	case queue_for_net_read:
@@ -548,9 +548,9 @@
 
 		/* so we can verify the handle in the answer packet
 		 * corresponding hlist_del is in _req_may_be_done() */
-		hlist_add_head(&req->colision, ar_hash_slot(mdev,req->sector));
+		hlist_add_head(&req->colision, ar_hash_slot(mdev, req->sector));
 
-		set_bit(UNPLUG_REMOTE,&mdev->flags); /* why? */
+		set_bit(UNPLUG_REMOTE, &mdev->flags); /* why? */
 
 		D_ASSERT(req->rq_state & RQ_NET_PENDING);
 		req->rq_state |= RQ_NET_QUEUED;
@@ -564,7 +564,7 @@
 		/* assert something? */
 		/* from drbd_make_request_common only */
 
-		hlist_add_head(&req->colision,tl_hash_slot(mdev,req->sector));
+		hlist_add_head(&req->colision, tl_hash_slot(mdev, req->sector));
 		/* corresponding hlist_del is in _req_may_be_done() */
 
 		/* NOTE
@@ -585,12 +585,12 @@
 		D_ASSERT(test_bit(ISSUE_BARRIER, &mdev->flags) == 0);
 
 		req->epoch = mdev->newest_barrier->br_number;
-		list_add_tail(&req->tl_requests,&mdev->newest_barrier->requests);
+		list_add_tail(&req->tl_requests, &mdev->newest_barrier->requests);
 
 		/* mark the current epoch as closed,
 		 * in case it outgrew the limit */
 		if (++mdev->newest_barrier->n_req >= mdev->net_conf->max_epoch_size)
-			set_bit(ISSUE_BARRIER,&mdev->flags);
+			set_bit(ISSUE_BARRIER, &mdev->flags);
 
 		D_ASSERT(req->rq_state & RQ_NET_PENDING);
 		req->rq_state |= RQ_NET_QUEUED;
@@ -610,7 +610,7 @@
 		req->rq_state &= ~RQ_NET_QUEUED;
 		/* if we did it right, tl_clear should be scheduled only after this,
 		 * so this should not be necessary! */
-		_req_may_be_done(req,error);
+		_req_may_be_done(req, error);
 		break;
 
 	case handed_over_to_network:
@@ -641,7 +641,7 @@
 		 * "completed_ok" events came in, once we return from
 		 * _drbd_send_zc_bio (drbd_send_dblock), we have to check
 		 * whether it is done already, and end it.  */
-		_req_may_be_done(req,error);
+		_req_may_be_done(req, error);
 		break;
 
 	case connection_lost_while_pending:
@@ -654,7 +654,7 @@
 		 * it will be canceled soon.
 		 * FIXME we should change the code so this can not happen. */
 		if (!(req->rq_state & RQ_NET_QUEUED))
-			_req_may_be_done(req,error);
+			_req_may_be_done(req, error);
 		break;
 
 	case write_acked_by_peer_and_sis:
@@ -674,7 +674,7 @@
 		D_ASSERT(req->rq_state & RQ_NET_PENDING);
 		dec_ap_pending(mdev);
 		req->rq_state &= ~RQ_NET_PENDING;
-		_req_may_be_done(req,error);
+		_req_may_be_done(req, error);
 		break;
 
 	case neg_acked:
@@ -683,7 +683,7 @@
 		req->rq_state &= ~(RQ_NET_OK|RQ_NET_PENDING);
 		/* FIXME THINK! is it DONE now, or is it not? */
 		req->rq_state |= RQ_NET_DONE;
-		_req_may_be_done(req,error);
+		_req_may_be_done(req, error);
 		/* else: done by handed_over_to_network */
 		break;
 
@@ -699,7 +699,7 @@
 		}
 		D_ASSERT(req->rq_state & RQ_NET_SENT);
 		req->rq_state |= RQ_NET_DONE;
-		_req_may_be_done(req,error);
+		_req_may_be_done(req, error);
 		break;
 
 	case data_received:
@@ -707,7 +707,7 @@
 		dec_ap_pending(mdev);
 		req->rq_state &= ~RQ_NET_PENDING;
 		req->rq_state |= (RQ_NET_OK|RQ_NET_DONE);
-		_req_may_be_done(req,error);
+		_req_may_be_done(req, error);
 		break;
 	};
 }
@@ -721,7 +721,7 @@
  */
 STATIC int drbd_may_do_local_read(drbd_dev *mdev, sector_t sector, int size)
 {
-	unsigned long sbnr,ebnr,bnr;
+	unsigned long sbnr, ebnr, bnr;
 	sector_t esector, nr_sectors;
 
 	if (mdev->state.disk == UpToDate) return 1;
@@ -738,7 +738,7 @@
 	ebnr = BM_SECT_TO_BIT(esector);
 
 	for (bnr = sbnr; bnr <= ebnr; bnr++) {
-		if (drbd_bm_test_bit(mdev,bnr)) return 0;
+		if (drbd_bm_test_bit(mdev, bnr)) return 0;
 	}
 	return 1;
 }
@@ -773,7 +773,7 @@
 	/* allocate outside of all locks; get a "reference count" (ap_bio_cnt)
 	 * to avoid races with the disconnect/reconnect code.  */
 	inc_ap_bio(mdev);
-	req = drbd_req_new(mdev,bio);
+	req = drbd_req_new(mdev, bio);
 	if (!req) {
 		dec_ap_bio(mdev);
 		/* only pass the error to the upper layers.
@@ -783,7 +783,7 @@
 		return 0;
 	}
 
-	dump_bio(mdev,bio,0);
+	dump_bio(mdev, bio, 0);
 
 	local = inc_local(mdev);
 	if (!local) {
@@ -795,7 +795,7 @@
 	} else {
 		/* READ || READA */
 		if (local) {
-			if (!drbd_may_do_local_read(mdev,sector,size)) {
+			if (!drbd_may_do_local_read(mdev, sector, size)) {
 				/* we could kick the syncer to
 				 * sync this extent asap, wait for
 				 * it, then continue locally.
@@ -867,10 +867,10 @@
 	 * if we lost that race, we retry.  */
 	if (rw == WRITE && remote &&
 	    mdev->unused_spare_barrier == NULL &&
-	    test_bit(ISSUE_BARRIER,&mdev->flags))
+	    test_bit(ISSUE_BARRIER, &mdev->flags))
 	{
   allocate_barrier:
-		b = kmalloc(sizeof(struct drbd_barrier),GFP_NOIO);
+		b = kmalloc(sizeof(struct drbd_barrier), GFP_NOIO);
 		if (!b) {
 			ERR("Failed to alloc barrier.");
 			err = -ENOMEM;
@@ -902,7 +902,7 @@
 	}
 	if (rw == WRITE && remote &&
 	    mdev->unused_spare_barrier == NULL &&
-	    test_bit(ISSUE_BARRIER,&mdev->flags)) {
+	    test_bit(ISSUE_BARRIER, &mdev->flags)) {
 		/* someone closed the current epoch
 		 * while we were grabbing the spinlock */
 		spin_unlock_irq(&mdev->req_lock);
@@ -921,9 +921,9 @@
 	 * make sure that, if this is a write request and it triggered a
 	 * barrier packet, this request is queued within the same spinlock. */
 	if (remote && mdev->unused_spare_barrier &&
-            test_and_clear_bit(ISSUE_BARRIER,&mdev->flags)) {
+            test_and_clear_bit(ISSUE_BARRIER, &mdev->flags)) {
 		struct drbd_barrier *b = mdev->unused_spare_barrier;
-		b = _tl_add_barrier(mdev,b);
+		b = _tl_add_barrier(mdev, b);
 		mdev->unused_spare_barrier = NULL;
 		b->w.cb =  w_send_barrier;
 		/* inc_ap_pending done here, so we won't
@@ -934,7 +934,7 @@
 		drbd_queue_work(&mdev->data.work, &b->w);
 	} else {
 		D_ASSERT(!(remote && rw == WRITE &&
-			   test_bit(ISSUE_BARRIER,&mdev->flags)));
+			   test_bit(ISSUE_BARRIER, &mdev->flags)));
 	}
 
 	/* NOTE
@@ -973,7 +973,7 @@
 			local = 0;
 		}
 		if (remote) dec_ap_pending(mdev);
-		dump_bio(mdev,req->master_bio,1);
+		dump_bio(mdev, req->master_bio, 1);
 		/* THINK: do we want to fail it (-EIO), or pretend success? */
 		bio_endio(req->master_bio, req->master_bio->bi_size, 0);
 		req->master_bio = NULL;
@@ -989,8 +989,8 @@
 		 * or READ, and no local disk,
 		 * or READ, but not in sync.
 		 */
-		if (rw == WRITE) _req_mod(req,queue_for_net_write, 0);
-		else		 _req_mod(req,queue_for_net_read, 0);
+		if (rw == WRITE) _req_mod(req, queue_for_net_write, 0);
+		else		 _req_mod(req, queue_for_net_read, 0);
 	}
 	spin_unlock_irq(&mdev->req_lock);
 	if (b) kfree(b); /* if someone else has beaten us to it... */
@@ -1035,7 +1035,7 @@
 
 	if (mdev->state.role != Primary &&
 		( !allow_oos || is_write) ) {
-		if (DRBD_ratelimit(5*HZ,5)) {
+		if (DRBD_ratelimit(5*HZ, 5)) {
 			ERR("Process %s[%u] tried to %s; since we are not in Primary state, we cannot allow this\n",
 			    current->comm, current->pid, is_write ? "WRITE" : "READ");
 		}
@@ -1053,7 +1053,7 @@
 	 */
 	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");
 		}
 		/*
@@ -1067,7 +1067,7 @@
 
 int drbd_make_request_26(request_queue_t *q, struct bio *bio)
 {
-	unsigned int s_enr,e_enr;
+	unsigned int s_enr, e_enr;
 	struct Drbd_Conf* mdev = (drbd_dev*) q->queuedata;
 
 	if (drbd_fail_request_early(mdev, bio_data_dir(bio) & WRITE)) {
@@ -1118,14 +1118,14 @@
 		const int mask = sps -1;
 		const sector_t first_sectors = sps - (sect & mask);
 		bp = bio_split(bio, bio_split_pool, first_sectors);
-		drbd_make_request_26(q,&bp->bio1);
-		drbd_make_request_26(q,&bp->bio2);
+		drbd_make_request_26(q, &bp->bio1);
+		drbd_make_request_26(q, &bp->bio2);
 		bio_pair_release(bp);
 		return 0;
 	}}
 
-	return drbd_make_request_common(mdev,bio_rw(bio),bio->bi_size,
-					bio->bi_sector,bio);
+	return drbd_make_request_common(mdev, bio_rw(bio), bio->bi_size,
+					bio->bi_sector, bio);
 }
 
 /* This is called by bio_add_page().  With this function we reduce
@@ -1160,8 +1160,8 @@
 	} else if (limit && inc_local(mdev)) {
 		request_queue_t * const b = mdev->bc->backing_bdev->bd_disk->queue;
 		if (b->merge_bvec_fn && mdev->bc->dc.use_bmbv) {
-			backing_limit = b->merge_bvec_fn(b,bio,bvec);
-			limit = min(limit,backing_limit);
+			backing_limit = b->merge_bvec_fn(b, bio, bvec);
+			limit = min(limit, backing_limit);
 		}
 		dec_local(mdev);
 	}

Modified: branches/drbd-8.0-for-linus/drbd/drbd_req.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_req.h	2007-07-24 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.h	2007-07-24 11:38:05 UTC (rev 2985)
@@ -223,9 +223,9 @@
 
 /* when we receive the answer for a read request,
  * verify that we actually know about it */
-static inline drbd_request_t* _ack_id_to_req(drbd_dev *mdev,u64 id, sector_t sector)
+static inline drbd_request_t* _ack_id_to_req(drbd_dev *mdev, u64 id, sector_t sector)
 {
-	struct hlist_head *slot = tl_hash_slot(mdev,sector);
+	struct hlist_head *slot = tl_hash_slot(mdev, sector);
 	struct hlist_node *n;
 	drbd_request_t * req;
 
@@ -255,9 +255,9 @@
 
 /* when we receive the answer for a read request,
  * verify that we actually know about it */
-static inline drbd_request_t* _ar_id_to_req(drbd_dev *mdev,u64 id, sector_t sector)
+static inline drbd_request_t* _ar_id_to_req(drbd_dev *mdev, u64 id, sector_t sector)
 {
-	struct hlist_head *slot = ar_hash_slot(mdev,sector);
+	struct hlist_head *slot = ar_hash_slot(mdev, sector);
 	struct hlist_node *n;
 	drbd_request_t * req;
 
@@ -296,7 +296,7 @@
 
 static inline void drbd_req_free(drbd_request_t *req)
 {
-	mempool_free(req,drbd_request_mempool);
+	mempool_free(req, drbd_request_mempool);
 }
 
 static inline int overlaps(sector_t s1, int l1, sector_t s2, int l2)
@@ -314,7 +314,7 @@
 {
 	drbd_dev *mdev = req->mdev;
 	spin_lock_irq(&mdev->req_lock);
-	_req_mod(req,what,error);
+	_req_mod(req, what, error);
 	spin_unlock_irq(&mdev->req_lock);
 }
 #endif

Modified: branches/drbd-8.0-for-linus/drbd/drbd_worker.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 11:38:05 UTC (rev 2985)
@@ -99,19 +99,19 @@
 
 	D_ASSERT(e->block_id != ID_VACANT);
 
-	spin_lock_irqsave(&mdev->req_lock,flags);
+	spin_lock_irqsave(&mdev->req_lock, flags);
 	mdev->read_cnt += e->size >> 9;
 	list_del(&e->w.list);
 	if (list_empty(&mdev->read_ee)) wake_up(&mdev->ee_wait);
-	spin_unlock_irqrestore(&mdev->req_lock,flags);
+	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
-	drbd_chk_io_error(mdev,error,FALSE);
-	drbd_queue_work(&mdev->data.work,&e->w);
+	drbd_chk_io_error(mdev, error, FALSE);
+	drbd_queue_work(&mdev->data.work, &e->w);
 	dec_local(mdev);
 
-	MTRACE(TraceTypeEE,TraceLvlAll,
+	MTRACE(TraceTypeEE, TraceLvlAll,
 	       INFO("Moved EE (READ) to worker sec=%llus size=%u ee=%p\n",
-		    (unsigned long long)e->sector,e->size,e);
+		    (unsigned long long)e->sector, e->size, e);
 	       );
 	return 0;
 }
@@ -145,7 +145,7 @@
 
 	D_ASSERT(e->block_id != ID_VACANT);
 
-	spin_lock_irqsave(&mdev->req_lock,flags);
+	spin_lock_irqsave(&mdev->req_lock, flags);
 	mdev->writ_cnt += e->size >> 9;
 	is_syncer_req = is_syncer_block_id(e->block_id);
 
@@ -157,11 +157,11 @@
 	do_al_complete_io = e->flags & EE_CALL_AL_COMPLETE_IO;
 
 	list_del(&e->w.list); /* has been on active_ee or sync_ee */
-	list_add_tail(&e->w.list,&mdev->done_ee);
+	list_add_tail(&e->w.list, &mdev->done_ee);
 
-	MTRACE(TraceTypeEE,TraceLvlAll,
+	MTRACE(TraceTypeEE, TraceLvlAll,
 	       INFO("Moved EE (WRITE) to done_ee sec=%llus size=%u ee=%p\n",
-		    (unsigned long long)e->sector,e->size,e);
+		    (unsigned long long)e->sector, e->size, e);
 	       );
 
 	/* No hlist_del_init(&e->colision) here, we did not send the Ack yet,
@@ -175,14 +175,14 @@
 		? list_empty(&mdev->sync_ee)
 		: list_empty(&mdev->active_ee);
 
-	if (error) __drbd_chk_io_error(mdev,FALSE);
-	spin_unlock_irqrestore(&mdev->req_lock,flags);
+	if (error) __drbd_chk_io_error(mdev, FALSE);
+	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
-	if (is_syncer_req) drbd_rs_complete_io(mdev,e_sector);
+	if (is_syncer_req) drbd_rs_complete_io(mdev, e_sector);
 
 	if (do_wake) wake_up(&mdev->ee_wait);
 
-	if (do_al_complete_io) drbd_al_complete_io(mdev,e_sector);
+	if (do_al_complete_io) drbd_al_complete_io(mdev, e_sector);
 
 	wake_asender(mdev);
 	dec_local(mdev);
@@ -216,13 +216,13 @@
 	         ? write_completed_with_error
 	         : read_completed_with_error
 	       : completed_ok;
-	spin_lock_irqsave(&mdev->req_lock,flags);
+	spin_lock_irqsave(&mdev->req_lock, flags);
 	_req_mod(req, what, error);
-	spin_unlock_irqrestore(&mdev->req_lock,flags);
+	spin_unlock_irqrestore(&mdev->req_lock, flags);
 	return 0;
 }
 
-int w_io_error(drbd_dev* mdev, struct drbd_work* w,int cancel)
+int w_io_error(drbd_dev* mdev, struct drbd_work* w, int cancel)
 {
 	drbd_request_t *req = (drbd_request_t*)w;
 	int ok;
@@ -247,7 +247,7 @@
 	return ok;
 }
 
-int w_read_retry_remote(drbd_dev* mdev, struct drbd_work* w,int cancel)
+int w_read_retry_remote(drbd_dev* mdev, struct drbd_work* w, int cancel)
 {
 	drbd_request_t *req = (drbd_request_t*)w;
 
@@ -257,7 +257,7 @@
 	     mdev->state.pdsk <= Inconsistent ) {
 		_req_mod(req, send_canceled, 0); /* FIXME freeze? ... */
 		spin_unlock_irq(&mdev->req_lock);
-		drbd_khelper(mdev,"pri-on-incon-degr"); /* FIXME REALLY? */
+		drbd_khelper(mdev, "pri-on-incon-degr"); /* FIXME REALLY? */
 		ALERT("WE ARE LOST. Local IO failure, no peer.\n");
 		return 1;
 	}
@@ -266,8 +266,8 @@
 	/* FIXME this is ugly. we should not detach for read io-error,
 	 * but try to WRITE the DataReply to the failed location,
 	 * to give the disk the chance to relocate that block */
-	drbd_io_error(mdev,FALSE); /* tries to schedule a detach and notifies peer */
-	return w_send_read_req(mdev,w,0);
+	drbd_io_error(mdev, FALSE); /* tries to schedule a detach and notifies peer */
+	return w_send_read_req(mdev, w, 0);
 }
 
 int w_resync_inactive(drbd_dev *mdev, struct drbd_work *w, int cancel)
@@ -283,9 +283,9 @@
 	drbd_dev* mdev = (drbd_dev*) data;
 	int queue;
 
-	spin_lock_irqsave(&mdev->req_lock,flags);
+	spin_lock_irqsave(&mdev->req_lock, flags);
 
-	if (likely(!test_and_clear_bit(STOP_SYNC_TIMER,&mdev->flags))) {
+	if (likely(!test_and_clear_bit(STOP_SYNC_TIMER, &mdev->flags))) {
 		queue=1;
 		mdev->resync_work.cb = w_make_resync_request;
 	} else {
@@ -293,23 +293,23 @@
 		mdev->resync_work.cb = w_resync_inactive;
 	}
 
-	spin_unlock_irqrestore(&mdev->req_lock,flags);
+	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
 	/* harmless race: list_empty outside data.work.q_lock */
 	if (list_empty(&mdev->resync_work.list) && queue) {
-		drbd_queue_work(&mdev->data.work,&mdev->resync_work);
+		drbd_queue_work(&mdev->data.work, &mdev->resync_work);
 	}
 }
 
 #define SLEEP_TIME (HZ/10)
 
-int w_make_resync_request(drbd_dev* mdev, struct drbd_work* w,int cancel)
+int w_make_resync_request(drbd_dev* mdev, struct drbd_work* w, int cancel)
 {
 	unsigned long bit;
 	sector_t sector;
 	const sector_t capacity = drbd_get_capacity(mdev->this_bdev);
 	int max_segment_size = mdev->rq_queue->max_segment_size;
-	int number,i,size;
+	int number, i, size;
 	int align;
 
 	PARANOIA_BUG_ON(w != &mdev->resync_work);
@@ -361,13 +361,13 @@
 		sector = BM_BIT_TO_SECT(bit);
 
 		if (drbd_try_rs_begin_io(mdev, sector)) {
-			drbd_bm_set_find(mdev,bit);
+			drbd_bm_set_find(mdev, bit);
 			goto requeue;
 		}
 
-		if (unlikely(drbd_bm_test_bit(mdev,bit) == 0 )) {
+		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);
+			drbd_rs_complete_io(mdev, sector);
 			goto next_sector;
 		}
 
@@ -401,7 +401,7 @@
 			 * obscure reason; ( b == 0 ) would get the out-of-band
 			 * only accidentally right because of the "oddly sized"
 			 * adjustment below */
-			if ( drbd_bm_test_bit(mdev,bit+1) != 1 )
+			if ( drbd_bm_test_bit(mdev, bit+1) != 1 )
 				break;
 			bit++;
 			size += BM_BLOCK_SIZE;
@@ -411,14 +411,14 @@
 		/* if we merged some,
 		 * reset the offset to start the next drbd_bm_find_next from */
 		if (size > BM_BLOCK_SIZE)
-			drbd_bm_set_find(mdev,bit+1);
+			drbd_bm_set_find(mdev, bit+1);
 #endif
 
 		/* adjust very last sectors, in case we are oddly sized */
 		if (sector + (size>>9) > capacity) size = (capacity-sector)<<9;
 		inc_rs_pending(mdev);
-		if (!drbd_send_drequest(mdev,RSDataRequest,
-				       sector,size,ID_SYNCER)) {
+		if (!drbd_send_drequest(mdev, RSDataRequest,
+				       sector, size, ID_SYNCER)) {
 			ERR("drbd_send_drequest() failed, aborting...\n");
 			dec_rs_pending(mdev);
 			dec_local(mdev);
@@ -457,7 +457,7 @@
 
 int drbd_resync_finished(drbd_dev* mdev)
 {
-	unsigned long db,dt,dbdt;
+	unsigned long db, dt, dbdt;
 	int dstate, pdstate;
 	struct drbd_work *w;
 
@@ -476,7 +476,7 @@
 		w = kmalloc(sizeof(struct drbd_work), GFP_ATOMIC);
 		if (w) {
 			w->cb = w_resync_finished;
-			drbd_queue_work(&mdev->data.work,w);
+			drbd_queue_work(&mdev->data.work, w);
 			return 1;
 		}
 		ERR("Warn failed to drbd_rs_del_all() and to kmalloc(w).\n");
@@ -493,7 +493,7 @@
 	D_ASSERT((drbd_bm_total_weight(mdev)-mdev->rs_failed) == 0);
 
 	if (mdev->rs_failed) {
-		INFO("            %lu failed blocks\n",mdev->rs_failed);
+		INFO("            %lu failed blocks\n", mdev->rs_failed);
 
 		if (mdev->state.conn == SyncTarget ||
 		    mdev->state.conn == PausedSyncT) {
@@ -511,16 +511,16 @@
 			if (mdev->p_uuid) {
 				int i;
 				for ( i=Bitmap ; i<=History_end ; i++ ) {
-					_drbd_uuid_set(mdev,i,mdev->p_uuid[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]);
+				drbd_uuid_set(mdev, Bitmap, mdev->bc->md.uuid[Current]);
+				_drbd_uuid_set(mdev, Current, mdev->p_uuid[Current]);
 			} else {
 				ERR("mdev->p_uuid is NULL! BUG\n");
 			}
 		}
 
-		drbd_uuid_set_bm(mdev,0UL);
+		drbd_uuid_set_bm(mdev, 0UL);
 
 		if (mdev->p_uuid) {
 			// Now the two UUID sets are equal, update what we
@@ -536,16 +536,16 @@
 	mdev->rs_failed = 0;
 	mdev->rs_paused = 0;
 
-	if (test_and_clear_bit(WRITE_BM_AFTER_RESYNC,&mdev->flags)) {
+	if (test_and_clear_bit(WRITE_BM_AFTER_RESYNC, &mdev->flags)) {
 		WARN("Writing the whole bitmap, due to failed kmalloc\n");
 		drbd_bm_write(mdev);
 	}
 
 	drbd_bm_recount_bits(mdev);
 
-	drbd_request_state(mdev,NS3(conn,Connected,
-				    disk,dstate,
-				    pdsk,pdstate));
+	drbd_request_state(mdev, NS3(conn, Connected,
+				    disk, dstate,
+				    pdsk, pdstate));
 
 	drbd_md_sync(mdev);
 
@@ -561,7 +561,7 @@
 	int ok;
 
 	if (unlikely(cancel)) {
-		drbd_free_ee(mdev,e);
+		drbd_free_ee(mdev, e);
 		dec_unacked(mdev);
 		return 1;
 	}
@@ -569,16 +569,16 @@
 	if (likely(drbd_bio_uptodate(e->private_bio))) {
 		ok=drbd_send_block(mdev, DataReply, e);
 	} else {
-		if (DRBD_ratelimit(5*HZ,5))
+		if (DRBD_ratelimit(5*HZ, 5))
 			ERR("Sending NegDReply. sector=%llus.\n",
 			    (unsigned long long)e->sector);
 
-		ok=drbd_send_ack(mdev,NegDReply,e);
+		ok=drbd_send_ack(mdev, NegDReply, e);
 
 		/* FIXME we should not detach for read io-errors, in particular
 		 * not now: when the peer asked us for our data, we are likely
 		 * the only remaining disk... */
-		drbd_io_error(mdev,FALSE);
+		drbd_io_error(mdev, FALSE);
 	}
 
 	dec_unacked(mdev);
@@ -586,9 +586,9 @@
 	spin_lock_irq(&mdev->req_lock);
 	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);
+		list_add_tail(&e->w.list, &mdev->net_ee);
 	} else {
-		drbd_free_ee(mdev,e);
+		drbd_free_ee(mdev, e);
 	}
 	spin_unlock_irq(&mdev->req_lock);
 
@@ -605,13 +605,13 @@
 	int ok;
 
 	if (unlikely(cancel)) {
-		drbd_free_ee(mdev,e);
+		drbd_free_ee(mdev, e);
 		dec_unacked(mdev);
 		return 1;
 	}
 
-	if (inc_local_if_state(mdev,Failed)) {
-		drbd_rs_complete_io(mdev,e->sector);
+	if (inc_local_if_state(mdev, Failed)) {
+		drbd_rs_complete_io(mdev, e->sector);
 		dec_local(mdev);
 	}
 
@@ -620,16 +620,16 @@
 			inc_rs_pending(mdev);
 			ok=drbd_send_block(mdev, RSDataReply, e);
 		} else {
-			if (DRBD_ratelimit(5*HZ,5))
+			if (DRBD_ratelimit(5*HZ, 5))
 				ERR("Not sending RSDataReply, partner DISKLESS!\n");
 			ok=1;
 		}
 	} else {
-		if (DRBD_ratelimit(5*HZ,5))
+		if (DRBD_ratelimit(5*HZ, 5))
 			ERR("Sending NegRSDReply. sector %llus.\n",
 			    (unsigned long long)e->sector);
 
-		ok=drbd_send_ack(mdev,NegRSDReply,e);
+		ok=drbd_send_ack(mdev, NegRSDReply, e);
 
 		drbd_io_error(mdev, FALSE);
 
@@ -642,9 +642,9 @@
 	spin_lock_irq(&mdev->req_lock);
 	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);
+		list_add_tail(&e->w.list, &mdev->net_ee);
 	} else {
-		drbd_free_ee(mdev,e);
+		drbd_free_ee(mdev, e);
 	}
 	spin_unlock_irq(&mdev->req_lock);
 
@@ -654,7 +654,7 @@
 
 int w_prev_work_done(drbd_dev *mdev, struct drbd_work *w, int cancel)
 {
-	clear_bit(WORK_PENDING,&mdev->flags);
+	clear_bit(WORK_PENDING, &mdev->flags);
 	wake_up(&mdev->misc_wait);
 	return 1;
 }
@@ -683,7 +683,7 @@
 	/* inc_ap_pending was done where this was queued.
 	 * dec_ap_pending will be done in got_BarrierAck
 	 * or (on connection loss) in w_clear_epoch.  */
-	ok = _drbd_send_cmd(mdev,mdev->data.socket,Barrier,(Drbd_Header*)p,sizeof(*p),0);
+	ok = _drbd_send_cmd(mdev, mdev->data.socket, Barrier, (Drbd_Header*)p, sizeof(*p), 0);
 	drbd_put_data_sock(mdev);
 
 	return ok;
@@ -692,7 +692,7 @@
 int w_send_write_hint(drbd_dev *mdev, struct drbd_work *w, int cancel)
 {
 	if (cancel) return 1;
-	return drbd_send_short_cmd(mdev,UnplugRemote);
+	return drbd_send_short_cmd(mdev, UnplugRemote);
 }
 
 /**
@@ -708,8 +708,8 @@
 		return 1;
 	}
 
-	ok = drbd_send_dblock(mdev,req);
-	req_mod(req,ok ? handed_over_to_network : send_failed, 0);
+	ok = drbd_send_dblock(mdev, req);
+	req_mod(req, ok ? handed_over_to_network : send_failed, 0);
 
 	return ok;
 }
@@ -735,7 +735,7 @@
 	} else {
 		/* ?? we set Timeout or BrokenPipe in drbd_send() */
 		if (mdev->state.conn >= Connected)
-			drbd_force_state(mdev,NS(conn,NetworkFailure));
+			drbd_force_state(mdev, NS(conn, NetworkFailure));
 		/* req_mod(req, send_failed); we should not fail it here,
 		 * we might have to "freeze" on disconnect.
 		 * handled by req_mod(req, connection_lost_while_pending);
@@ -798,7 +798,7 @@
 	for (i=0; i < minor_count; i++) {
 		if ( !(odev = minor_to_mdev(i)) ) continue;
 		if (! _drbd_may_sync_now(odev)) {
-			rv |= ( _drbd_set_state(_NS(odev,aftr_isp,1),
+			rv |= ( _drbd_set_state(_NS(odev, aftr_isp, 1),
 						ChgStateHard|ScheduleAfter)
 				!= SS_NothingToDo ) ;
 		}
@@ -822,7 +822,7 @@
 		if ( !(odev = minor_to_mdev(i)) ) continue;
 		if (odev->state.aftr_isp) {
 			if (_drbd_may_sync_now(odev)) {
-				rv |= ( _drbd_set_state(_NS(odev,aftr_isp,0),
+				rv |= ( _drbd_set_state(_NS(odev, aftr_isp, 0),
 							ChgStateHard|ScheduleAfter)
 					!= SS_NothingToDo ) ;
 			}
@@ -870,7 +870,7 @@
  */
 void drbd_start_resync(drbd_dev *mdev, drbd_conns_t side)
 {
-	drbd_state_t os,ns;
+	drbd_state_t os, ns;
 	int r=0;
 
 	MTRACE(TraceTypeResync, TraceLvlSummary,
@@ -890,7 +890,7 @@
 
 		get_random_bytes(&uuid, sizeof(u64));
 		drbd_uuid_set(mdev, Bitmap, uuid);
-		drbd_send_sync_uuid(mdev,uuid);
+		drbd_send_sync_uuid(mdev, uuid);
 
 		D_ASSERT(mdev->state.disk == UpToDate);
 	}
@@ -908,7 +908,7 @@
 		ns.pdsk = Inconsistent;
 	}
 
-	r = _drbd_set_state(mdev,ns,ChgStateVerbose);
+	r = _drbd_set_state(mdev, ns, ChgStateVerbose);
 	ns = mdev->state;
 
 	if (r == SS_Success) {
@@ -923,7 +923,7 @@
 	drbd_global_unlock();
 
 	if (r == SS_Success) {
-		after_state_ch(mdev,os,ns,ChgStateVerbose);
+		after_state_ch(mdev, os, ns, ChgStateVerbose);
 
 		INFO("Began resync as %s (will sync %lu KB [%lu bits set]).\n",
 		     conns_to_name(ns.conn),
@@ -936,8 +936,8 @@
 		}
 
 		if (ns.conn == SyncTarget) {
-			D_ASSERT(!test_bit(STOP_SYNC_TIMER,&mdev->flags));
-			mod_timer(&mdev->resync_timer,jiffies);
+			D_ASSERT(!test_bit(STOP_SYNC_TIMER, &mdev->flags));
+			mod_timer(&mdev->resync_timer, jiffies);
 		}
 
 		drbd_md_sync(mdev);
@@ -949,7 +949,7 @@
 	drbd_dev *mdev = thi->mdev;
 	struct drbd_work *w = 0;
 	LIST_HEAD(work_list);
-	int intr=0,i;
+	int intr=0, i;
 
 	sprintf(current->comm, "drbd%d_worker", mdev_to_minor(mdev));
 
@@ -997,33 +997,33 @@
 			spin_unlock_irq(&mdev->data.work.q_lock);
 			continue;
 		}
-		w = list_entry(mdev->data.work.q.next,struct drbd_work,list);
+		w = list_entry(mdev->data.work.q.next, struct drbd_work, list);
 		list_del_init(&w->list);
 		spin_unlock_irq(&mdev->data.work.q_lock);
 
-		if (!w->cb(mdev,w, mdev->state.conn < Connected )) {
+		if (!w->cb(mdev, w, mdev->state.conn < Connected )) {
 			//WARN("worker: a callback failed! \n");
 			if (mdev->state.conn >= Connected)
-				drbd_force_state(mdev,NS(conn,NetworkFailure));
+				drbd_force_state(mdev, NS(conn, NetworkFailure));
 		}
 	}
 
 	spin_lock_irq(&mdev->data.work.q_lock);
 	i = 0;
 	while (!list_empty(&mdev->data.work.q)) {
-		list_splice_init(&mdev->data.work.q,&work_list);
+		list_splice_init(&mdev->data.work.q, &work_list);
 		spin_unlock_irq(&mdev->data.work.q_lock);
 
 		while(!list_empty(&work_list)) {
-			w = list_entry(work_list.next, struct drbd_work,list);
+			w = list_entry(work_list.next, struct drbd_work, list);
 			list_del_init(&w->list);
-			w->cb(mdev,w,1);
+			w->cb(mdev, w, 1);
 			i++; /* dead debugging code */
 		}
 
 		spin_lock_irq(&mdev->data.work.q_lock);
 	}
-	sema_init(&mdev->data.work.s,0);
+	sema_init(&mdev->data.work.s, 0);
 	/* DANGEROUS race: if someone did queue his work within the spinlock,
 	 * but up() ed outside the spinlock, we could get an up() on the
 	 * semaphore without corresponding list entry.

Modified: branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-24 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-24 11:38:05 UTC (rev 2985)
@@ -41,11 +41,11 @@
 					sector_t size)
 {
 	/* set_capacity(mdev->this_bdev->bd_disk, size); */
-	set_capacity(mdev->vdisk,size);
+	set_capacity(mdev->vdisk, size);
 	mdev->this_bdev->bd_inode->i_size = (loff_t)size << 9;
 }
 
-#define drbd_bio_uptodate(bio) bio_flagged(bio,BIO_UPTODATE)
+#define drbd_bio_uptodate(bio) bio_flagged(bio, BIO_UPTODATE)
 
 #ifdef CONFIG_HIGHMEM
 /*
@@ -122,7 +122,7 @@
 	}
 
 	if (FAULT_ACTIVE(mdev, fault_type))
-		bio_endio(bio,bio->bi_size,-EIO);
+		bio_endio(bio, bio->bi_size, -EIO);
 	else
 		generic_make_request(bio);
 }

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 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd_nl.h	2007-07-24 11:38:05 UTC (rev 2985)
@@ -27,7 +27,7 @@
 	BIT(		37,	T_MAY_IGNORE,	use_bmbv)
 )
 
-PACKET(detach, 4,)
+PACKET(detach, 4, )
 
 PACKET(net_conf, 5,
 	STRING(		8,	T_MANDATORY,	my_addr,	128)

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 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd_tag_magic.h	2007-07-24 11:38:05 UTC (rev 2985)
@@ -7,30 +7,35 @@
 // declare packet_type enums
 enum packet_types {
 #define PACKET(name, number, fields) P_ ## name = number,
-#define INTEGER(pn,pr,member)
-#define INT64(pn,pr,member)
-#define BIT(pn,pr,member)
-#define STRING(pn,pr,member,len)
+#define INTEGER(pn, pr, member)
+#define INT64(pn, pr, member)
+#define BIT(pn, pr, member)
+#define STRING(pn, pr, member, len)
 #include "drbd_nl.h"
 	P_nl_after_last_packet,
 };
 
 // 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) int member; int tag_and_len ## member;
-#define INT64(pn,pr,member) __u64 member; int tag_and_len ## member;
-#define BIT(pn,pr,member)   unsigned char member : 1; int tag_and_len ## member;
-#define STRING(pn,pr,member,len) unsigned char member[len]; int member ## _len; \
-				 int tag_and_len ## member;
+#define PACKET(name, number, fields)	\
+	struct name ## _tag_len_struct { fields };
+#define INTEGER(pn, pr, member)		\
+	int member; int tag_and_len ## member;
+#define INT64(pn, pr, member)		\
+	__u64 member; int tag_and_len ## member;
+#define BIT(pn, pr, member)		\
+	unsigned char member : 1; int tag_and_len ## member;
+#define STRING(pn, pr, member, len)	\
+	unsigned char member[len]; int member ## _len; \
+	int tag_and_len ## member;
 #include "linux/drbd_nl.h"
 
 // declate tag-list-sizes
 const int tag_list_sizes[] = {
-#define PACKET(name,number,fields) 2 fields ,
-#define INTEGER(pn,pr,member)     +4+4
-#define INT64(pn,pr,member)       +4+8
-#define BIT(pn,pr,member)         +4+1
-#define STRING(pn,pr,member,len)  +4+len
+#define PACKET(name, number, fields) 2 fields ,
+#define INTEGER(pn, pr, member)      +4+4
+#define INT64(pn, pr, member)        +4+8
+#define BIT(pn, pr, member)          +4+1
+#define STRING(pn, pr, member, len)  +4+len
 #include "drbd_nl.h"
 };
 
@@ -52,10 +57,10 @@
 // declare tag enums
 #define PACKET(name, number, fields) fields
 enum drbd_tags {
-#define INTEGER(pn,pr,member)    T_ ## member = pn | TT_INTEGER | pr ,
-#define INT64(pn,pr,member)      T_ ## member = pn | TT_INT64   | pr ,
-#define BIT(pn,pr,member)        T_ ## member = pn | TT_BIT     | pr ,
-#define STRING(pn,pr,member,len) T_ ## member = pn | TT_STRING  | pr ,
+#define INTEGER(pn, pr, member)     T_ ## member = pn | TT_INTEGER | pr ,
+#define INT64(pn, pr, member)       T_ ## member = pn | TT_INT64   | pr ,
+#define BIT(pn, pr, member)         T_ ## member = pn | TT_BIT     | pr ,
+#define STRING(pn, pr, member, len) T_ ## member = pn | TT_STRING  | pr ,
 #include "drbd_nl.h"
 };
 
@@ -68,10 +73,10 @@
 // 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)   },
-#define INT64(pn,pr,member)      [ pn ] = { #member, TT_INT64   | pr, sizeof(__u64) },
-#define BIT(pn,pr,member)        [ pn ] = { #member, TT_BIT     | pr, sizeof(int)   },
-#define STRING(pn,pr,member,len) [ pn ] = { #member, TT_STRING  | pr, len           },
+#define INTEGER(pn, pr, member)     [ pn ] = { #member, TT_INTEGER | pr, sizeof(int)   },
+#define INT64(pn, pr, member)       [ pn ] = { #member, TT_INT64   | pr, sizeof(__u64) },
+#define BIT(pn, pr, member)         [ pn ] = { #member, TT_BIT     | pr, sizeof(int)   },
+#define STRING(pn, pr, member, len) [ pn ] = { #member, TT_STRING  | pr, len           },
 #include "drbd_nl.h"
 };
 

Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 11:38:05 UTC (rev 2985)
@@ -34,8 +34,8 @@
 #define STATIC static
 
 // 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 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)
 
 /**
@@ -52,7 +52,7 @@
 	int i;
 
 	BUG_ON(!e_count);
-	e_size = max(sizeof(struct lc_element),e_size);
+	e_size = max(sizeof(struct lc_element), e_size);
 	bytes  = e_size+sizeof(struct hlist_head);
 	bytes *= e_count;
 	bytes += sizeof(struct lru_cache);
@@ -68,9 +68,9 @@
 		lc->lc_private       = private_p;
 		lc->name             = name;
 		for(i=0;i<e_count;i++) {
-			e = lc_entry(lc,i);
+			e = lc_entry(lc, i);
 			e->lc_number = LC_FREE;
-			list_add(&e->list,&lc->free);
+			list_add(&e->list, &lc->free);
 			// memset(,0,) did the rest of init for us
 		}
 	}
@@ -94,7 +94,7 @@
 	 * misses include "dirty" count (update from an other thread in progress)
 	 * and "changed", when this in fact lead to an successful update of the cache.
 	 */
-	return seq_printf(seq,"\t%s: used:%u/%u "
+	return seq_printf(seq, "\t%s: used:%u/%u "
 		"hits:%lu misses:%lu starving:%lu dirty:%lu changed:%lu\n",
 		lc->name, lc->used, lc->nr_elements,
 		lc->hits, lc->misses, lc->starving, lc->dirty, lc->changed);
@@ -133,7 +133,7 @@
 	if (list_empty(&lc->lru)) return 0;
 
 	n=lc->lru.prev;
-	e=list_entry(n, struct lc_element,list);
+	e=list_entry(n, struct lc_element, list);
 
 	list_del(&e->list);
 	hlist_del(&e->colision);
@@ -156,7 +156,7 @@
 	hlist_del_init(&e->colision);
 	e->lc_number = LC_FREE;
 	e->refcnt = 0;
-	list_add(&e->list,&lc->free);
+	list_add(&e->list, &lc->free);
 	RETURN();
 }
 
@@ -168,7 +168,7 @@
 
 	n=lc->free.next;
 	list_del(n);
-	return list_entry(n, struct lc_element,list);
+	return list_entry(n, struct lc_element, list);
 }
 
 STATIC int lc_unused_element_available(struct lru_cache* lc)
@@ -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);
 	}
 
@@ -234,7 +234,7 @@
 	 * the LRU element, we have to wait ...
 	 */
 	if (!lc_unused_element_available(lc)) {
-		__set_bit(__LC_STARVING,&lc->flags);
+		__set_bit(__LC_STARVING, &lc->flags);
 		RETURN(NULL);
 	}
 
@@ -242,7 +242,7 @@
 	 * which then is replaced.
 	 * we need to update the cache; serialize on lc->flags & LC_DIRTY
 	 */
-	if (test_and_set_bit(__LC_DIRTY,&lc->flags)) {
+	if (test_and_set_bit(__LC_DIRTY, &lc->flags)) {
 		++lc->dirty;
 		RETURN(NULL);
 	}
@@ -250,7 +250,7 @@
 	e = lc_get_unused_element(lc);
 	BUG_ON(!e);
 
-	clear_bit(__LC_STARVING,&lc->flags);
+	clear_bit(__LC_STARVING, &lc->flags);
 	BUG_ON(++e->refcnt != 1);
 	lc->used++;
 
@@ -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);
 }
@@ -292,11 +292,11 @@
 	BUG_ON(e != lc->changing_element);
 	++lc->changed;
 	e->lc_number = lc->new_number;
-	list_add(&e->list,&lc->in_use);
+	list_add(&e->list, &lc->in_use);
 	hlist_add_head( &e->colision, lc->slot + lc_hash_fn(lc, lc->new_number) );
 	lc->changing_element = NULL;
 	lc->new_number = -1;
-	clear_bit(__LC_DIRTY,&lc->flags);
+	clear_bit(__LC_DIRTY, &lc->flags);
 	smp_mb__after_clear_bit();
 	PARANOIA_LEAVE();
 }
@@ -312,9 +312,9 @@
 	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);
+		clear_bit(__LC_STARVING, &lc->flags);
 		smp_mb__after_clear_bit();
 	}
 	RETURN(e->refcnt);
@@ -334,11 +334,11 @@
 
 	if (index < 0 || index >= lc->nr_elements) return;
 
-	e = lc_entry(lc,index);
+	e = lc_entry(lc, index);
 	e->lc_number = enr;
 
 	hlist_del_init(&e->colision);
-	hlist_add_head( &e->colision, lc->slot + lc_hash_fn(lc,enr) );
+	hlist_add_head( &e->colision, lc->slot + lc_hash_fn(lc, enr) );
 	list_move(&e->list, e->refcnt ? &lc->in_use : &lc->lru);
 }
 
@@ -353,16 +353,16 @@
 	struct lc_element *e;
 	int i;
 
-	seq_printf(seq,"\tnn: lc_number refcnt %s\n ",utext);
+	seq_printf(seq, "\tnn: lc_number refcnt %s\n ", utext);
 	for(i=0;i<nr_elements;i++) {
-		e = lc_entry(lc,i);
+		e = lc_entry(lc, i);
 		if (e->lc_number == LC_FREE) {
-			seq_printf(seq,"\t%2d: FREE\n",i );
+			seq_printf(seq, "\t%2d: FREE\n", i );
 		} else {
-			seq_printf(seq,"\t%2d: %4u %4u    ", i,
+			seq_printf(seq, "\t%2d: %4u %4u    ", i,
 				   e->lc_number,
 				   e->refcnt );
-			detail(seq,e);
+			detail(seq, e);
 		}
 	}
 }

Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.h	2007-07-24 09:44:10 UTC (rev 2984)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.h	2007-07-24 11:38:05 UTC (rev 2985)
@@ -122,26 +122,26 @@
  */
 static inline int lc_try_lock(struct lru_cache* lc)
 {
-	return !test_and_set_bit(__LC_DIRTY,&lc->flags);
+	return !test_and_set_bit(__LC_DIRTY, &lc->flags);
 }
 
 static inline void lc_unlock(struct lru_cache* lc)
 {
-	clear_bit(__LC_DIRTY,&lc->flags);
+	clear_bit(__LC_DIRTY, &lc->flags);
 	smp_mb__after_clear_bit();
 }
 
 static inline int lc_is_used(struct lru_cache* lc, unsigned int enr)
 {
-	struct lc_element* e = lc_find(lc,enr);
+	struct lc_element* e = lc_find(lc, enr);
 	return (e && e->refcnt);
 }
 
 #define LC_FREE (-1U)
 
 #define lc_e_base(lc)  ((char*) ( (lc)->slot + (lc)->nr_elements ) )
-#define lc_entry(lc,i) ((struct lc_element*) \
+#define lc_entry(lc, i) ((struct lc_element*) \
                        (lc_e_base(lc) + (i)*(lc)->element_size))
-#define lc_index_of(lc,e) (((char*)(e) - lc_e_base(lc))/(lc)->element_size)
+#define lc_index_of(lc, e) (((char*)(e) - lc_e_base(lc))/(lc)->element_size)
 
 #endif

From drbd-cvs at lists.linbit.com  Tue Jul 24 13:39:45 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 13:39:46 2007
Subject: [DRBD-cvs] svn commit by lars - r2986 -
	branches/drbd-8.0-for-linus/drbd -
	d41e1fb50b5ed83516a8b500dc09b17701fbea47 remove BD_RELE
Message-ID: <20070724113945.0567940095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 13:39:45 +0200 (Tue, 24 Jul 2007)
New Revision: 2986

Modified:
   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
Log:
d41e1fb50b5ed83516a8b500dc09b17701fbea47 remove BD_RELEASE/BD_CLAIM wrapper macros


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:38:05 UTC (rev 2985)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 11:39:45 UTC (rev 2986)
@@ -1320,25 +1320,6 @@
 
 extern void resync_timer_fn(unsigned long data);
 
-#if 0
-#define BD_CLAIM(bdev,holder) ({					\
-	int r = bd_claim(bdev,holder);					\
-	printk(KERN_INFO "drbd: %u = bd_claim(%p,%p); [%p;%u]\n",	\
-		r, bdev, holder, bdev->bd_holder, bdev->bd_holders);	\
-	r; })
-
-#define BD_RELEASE(bdev) do {						\
-	printk(KERN_INFO "drbd: pre: bd_release(%p); [%p;%u]\n",	\
-		bdev, bdev->bd_holder, bdev->bd_holders);		\
-	bd_release(bdev);						\
-	printk(KERN_INFO "drbd: post: bd_release(%p); [%p;%u]\n",	\
-		bdev, bdev->bd_holder, bdev->bd_holders);		\
-	} while (0)
-#else
-#define BD_CLAIM(bdev,holder)	bd_claim(bdev,holder)
-#define BD_RELEASE(bdev)	bd_release(bdev)
-#endif
-
 // 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,

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:38:05 UTC (rev 2985)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 11:39:45 UTC (rev 2986)
@@ -2458,8 +2458,8 @@
 {
 	if (bc == NULL) return;
 
-	BD_RELEASE(bc->backing_bdev);
-	BD_RELEASE(bc->md_bdev);
+	bd_release(bc->backing_bdev);
+	bd_release(bc->md_bdev);
 
 	fput(bc->lo_file);
 	fput(bc->md_file);

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:38:05 UTC (rev 2985)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 11:39:45 UTC (rev 2986)
@@ -771,7 +771,7 @@
 	}
 
 	nbc->backing_bdev = inode->i_bdev;
-	if (BD_CLAIM(nbc->backing_bdev, mdev)) {
+	if (bd_claim(nbc->backing_bdev, mdev)) {
 		printk(KERN_ERR "drbd: bd_claim(%p,%p); failed [%p;%p;%u]\n",
 		       nbc->backing_bdev, mdev, 
 		       nbc->backing_bdev->bd_holder,
@@ -788,7 +788,7 @@
 	}
 
 	nbc->md_bdev = inode2->i_bdev;
-	if (BD_CLAIM(nbc->md_bdev,
+	if (bd_claim(nbc->md_bdev,
 		     (nbc->dc.meta_dev_idx==DRBD_MD_INDEX_INTERNAL ||
 		      nbc->dc.meta_dev_idx==DRBD_MD_INDEX_FLEX_INT) ?
 		     (void *)mdev : (void*) drbd_m_holder )) {
@@ -1015,9 +1015,9 @@
 	drbd_force_state(mdev, NS(disk, Diskless));
 	drbd_md_sync(mdev);
  release_bdev2_fail:
-	if (nbc) BD_RELEASE(nbc->md_bdev);
+	if (nbc) bd_release(nbc->md_bdev);
  release_bdev_fail:
-	if (nbc) BD_RELEASE(nbc->backing_bdev);
+	if (nbc) bd_release(nbc->backing_bdev);
  fail:
 	if (nbc) {
 		if (nbc->lo_file) fput(nbc->lo_file);

From drbd-cvs at lists.linbit.com  Tue Jul 24 13:44:07 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 13:44:08 2007
Subject: [DRBD-cvs] svn commit by lars - r2987 -
	branches/drbd-8.0-for-linus/drbd -
	240537acb9fb644deb8bf9a2374f9f2096035640 fix else shoul
Message-ID: <20070724114407.7523C40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 13:44:06 +0200 (Tue, 24 Jul 2007)
New Revision: 2987

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_main.c
   branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
Log:
240537acb9fb644deb8bf9a2374f9f2096035640 fix else should follow closing brace


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:39:45 UTC (rev 2986)
+++ branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 11:44:06 UTC (rev 2987)
@@ -54,8 +54,7 @@
 	if (FAULT_ACTIVE(mdev, (rw & WRITE)? DRBD_FAULT_MD_WR:DRBD_FAULT_MD_RD)) {
 		bio->bi_rw |= rw;
 		bio_endio(bio, bio->bi_size, -EIO);
-	}
-	else {
+	} else {
 #ifdef BIO_RW_SYNC
 		submit_bio(rw | (1 << BIO_RW_SYNC), bio);
 #else

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:39:45 UTC (rev 2986)
+++ branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 11:44:06 UTC (rev 2987)
@@ -682,9 +682,9 @@
 	if (FAULT_ACTIVE(mdev, (rw&WRITE)?DRBD_FAULT_MD_WR:DRBD_FAULT_MD_RD)) {
 		bio->bi_rw |= rw;
 		bio_endio(bio, bio->bi_size, -EIO);
+	} else {
+		submit_bio(rw, bio);
 	}
-	else
-		submit_bio(rw, bio);
 }
 /* read one sector of the on disk bitmap into memory.
  * on disk bitmap is little endian.

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:39:45 UTC (rev 2986)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 11:44:06 UTC (rev 2987)
@@ -1421,8 +1421,7 @@
 			 * but otherwise process as per normal - need to tell other
 			 * side that a full resync is required! */
 			ERR("Failed to write bitmap to disk!\n");
-		}
-		else {
+		} else {
 			drbd_md_clear_flag(mdev, MDF_FullSync);
 			drbd_md_sync(mdev);
 		}
@@ -2948,8 +2947,7 @@
 		// 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 {
+	} else {
 		pstart = (const unsigned char *)buffer;
 	}
 
@@ -2972,8 +2970,7 @@
 			pbytes += sprintf(pbytes, "%*c ", field_width, ' ');
 			pascii += sprintf(pascii, "%*c", size, ' ');
 			p += size;
-		}
-		else {
+		} else {
 			// Add hex and ascii to strings
 			int val;
 			switch (size) {

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:39:45 UTC (rev 2986)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 11:44:06 UTC (rev 2987)
@@ -2380,8 +2380,7 @@
 			// 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) {
+		} else if (nconn == Connected && peer_state.disk == Negotiating) {
 			// peer is waiting for us to respond...
 			drbd_send_state(mdev);
 		}

From drbd-cvs at lists.linbit.com  Tue Jul 24 13:50:18 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 13:50:25 2007
Subject: [DRBD-cvs] svn commit by lars - r2988 - in
	branches/drbd-8.0-for-linus/drbd: . linux -
	b4104ca446c1a446dde5bf7d792ca28ec0783417 fix "need spac
Message-ID: <20070724115018.A8C5140095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 13:50:16 +0200 (Tue, 24 Jul 2007)
New Revision: 2988

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_worker.c
   branches/drbd-8.0-for-linus/drbd/linux/drbd.h
   branches/drbd-8.0-for-linus/drbd/lru_cache.c
Log:
b4104ca446c1a446dde5bf7d792ca28ec0783417 fix "need spaces around that ="


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:44:06 UTC (rev 2987)
+++ branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 11:50:16 UTC (rev 2988)
@@ -72,7 +72,7 @@
 int drbd_md_sync_page_io(drbd_dev *mdev, struct drbd_backing_dev *bdev,
 			 sector_t sector, int rw)
 {
-	int hardsect, mask, ok, offset=0;
+	int hardsect, mask, ok, offset = 0;
 	struct page *iop = mdev->md_io_page;
 
 	D_ASSERT(semaphore_is_locked(&mdev->md_io_mutex));
@@ -188,7 +188,7 @@
 {
 	struct lc_element *al_ext;
 	struct bm_extent  *bm_ext;
-	unsigned long     al_flags=0;
+	unsigned long     al_flags = 0;
 
 	spin_lock_irq(&mdev->al_lock);
 	bm_ext = (struct bm_extent*) lc_find(mdev->resync, enr/AL_EXT_PER_BM_SECT);
@@ -305,7 +305,7 @@
 	unsigned int extent_nr;
 	struct al_transaction* buffer;
 	sector_t sector;
-	u32 xor_sum=0;
+	u32 xor_sum = 0;
 
 	struct lc_element *updated = ((struct update_al_work*)w)->al_ext;
 	unsigned int new_enr = ((struct update_al_work*)w)->enr;
@@ -329,7 +329,7 @@
 
 	mx = min_t(int, AL_EXTENTS_PT,
 		   mdev->act_log->nr_elements - mdev->al_tr_cycle);
-	for(i=0;i<mx;i++) {
+	for(i = 0;i<mx;i++) {
 		extent_nr = lc_entry(mdev->act_log,
 				     mdev->al_tr_cycle+i)->lc_number;
 		buffer->updates[i+1].pos = cpu_to_be32(mdev->al_tr_cycle+i);
@@ -342,7 +342,7 @@
 		xor_sum ^= LC_FREE;
 	}
 	mdev->al_tr_cycle += AL_EXTENTS_PT;
-	if (mdev->al_tr_cycle >= mdev->act_log->nr_elements) mdev->al_tr_cycle=0;
+	if (mdev->al_tr_cycle >= mdev->act_log->nr_elements) mdev->al_tr_cycle = 0;
 
 	buffer->xor_sum = cpu_to_be32(xor_sum);
 
@@ -356,7 +356,7 @@
 	}
 
 	if ( ++mdev->al_tr_pos > div_ceil(mdev->act_log->nr_elements, AL_EXTENTS_PT) ) {
-		mdev->al_tr_pos=0;
+		mdev->al_tr_pos = 0;
 	}
 	D_ASSERT(mdev->al_tr_pos < MD_AL_MAX_SIZE);
 	mdev->al_tr_number++;
@@ -381,7 +381,7 @@
 {
 	sector_t sector;
 	int rv, i;
-	u32 xor_sum=0;
+	u32 xor_sum = 0;
 
 	sector = bdev->md.md_offset + bdev->md.al_offset + index;
 
@@ -393,7 +393,7 @@
 
 	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));
@@ -409,10 +409,10 @@
 int drbd_al_read_log(struct Drbd_Conf *mdev, struct drbd_backing_dev *bdev)
 {
 	struct al_transaction* buffer;
-	int from=-1, to=-1, i, cnr, overflow=0, rv;
-	u32 from_tnr=-1, to_tnr=0;
-	int active_extents=0;
-	int transactions=0;
+	int from = -1, to = -1, i, cnr, overflow = 0, rv;
+	u32 from_tnr = -1, to_tnr = 0;
+	int active_extents = 0;
+	int transactions = 0;
 	int mx;
 
 	mx = div_ceil(mdev->act_log->nr_elements, AL_EXTENTS_PT);
@@ -424,7 +424,7 @@
 	buffer = page_address(mdev->md_io_page);
 
 	// Find the valid transaction in the log
-	for(i=0;i<=mx;i++) {
+	for(i = 0;i<=mx;i++) {
 		rv = drbd_al_read_tr(mdev, bdev, buffer, i);
 		if (rv == 0) continue;
 		if (rv == -1) {
@@ -434,7 +434,7 @@
 		cnr = be32_to_cpu(buffer->tr_number);
 		// INFO("index %d valid tnr=%d\n",i,cnr);
 
-		if (cnr == -1) overflow=1;
+		if (cnr == -1) overflow = 1;
 
 		if (cnr < from_tnr && !overflow) {
 			from = i;
@@ -458,7 +458,7 @@
 
 	/* this should better be handled by a for loop, no?
 	 */
-	i=from;
+	i = from;
 	while(1) {
 		int j, pos;
 		unsigned int extent_nr;
@@ -471,7 +471,7 @@
 			return 0;
 		}
 
-		trn=be32_to_cpu(buffer->tr_number);
+		trn = be32_to_cpu(buffer->tr_number);
 
 		spin_lock_irq(&mdev->al_lock);
 
@@ -479,7 +479,7 @@
 		   elements there might be an old version of the
 		   updated element (in slot 0). So the element in slot 0
 		   can overwrite old versions. */
-		for(j=AL_EXTENTS_PT;j>=0;j--) {
+		for(j = AL_EXTENTS_PT;j>=0;j--) {
 			pos = be32_to_cpu(buffer->updates[j].pos);
 			extent_nr = be32_to_cpu(buffer->updates[j].extent);
 
@@ -496,13 +496,13 @@
 	cancel:
 		if (i == to) break;
 		i++;
-		if (i > mx) i=0;
+		if (i > mx) i = 0;
 	}
 
 	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) ) {
-		mdev->al_tr_pos=0;
+		mdev->al_tr_pos = 0;
 	}
 
 	/* ok, we are done with it */
@@ -524,7 +524,7 @@
 STATIC int atodb_endio(struct bio *bio, unsigned int bytes_done, int error)
 {
 	struct drbd_atodb_wait *wc = bio->bi_private;
-	struct Drbd_Conf *mdev=wc->mdev;
+	struct Drbd_Conf *mdev = wc->mdev;
 	struct page *page;
 	int uptodate = bio_flagged(bio, BIO_UPTODATE);
 
@@ -538,7 +538,7 @@
 	}
 
 	drbd_chk_io_error(mdev, error, TRUE);
-	if (error && wc->error == 0) wc->error=error;
+	if (error && wc->error == 0) wc->error = error;
 
 	if (atomic_dec_and_test(&wc->count)) {
 		complete(&wc->io_done);
@@ -563,14 +563,14 @@
 			     unsigned int enr,
 			     struct drbd_atodb_wait *wc)
 {
-	int i=0, allocated_page=0;
+	int i = 0, allocated_page = 0;
 	struct bio *bio;
 	struct page *np;
 	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.
-	while( (bio=bios[i]) ) {
+	while( (bio = bios[i]) ) {
 		if (bio->bi_sector == on_disk_sector) return 0;
 		i++;
 	}
@@ -589,7 +589,7 @@
 		if (np == NULL) return -ENOMEM;
 		*page = np;
 		*page_offset = 0;
-		allocated_page=1;
+		allocated_page = 1;
 	}
 
 	offset = S2W(enr);
@@ -632,7 +632,7 @@
 	unsigned int enr;
 	struct bio **bios;
 	struct page *page;
-	unsigned int page_offset=PAGE_SIZE;
+	unsigned int page_offset = PAGE_SIZE;
 	struct drbd_atodb_wait wc;
 
 	ERR_IF (!inc_local_if_state(mdev, Attaching))
@@ -650,7 +650,7 @@
 	wc.mdev = mdev;
 	wc.error = 0;
 
-	for(i=0;i<nr_elements;i++) {
+	for(i = 0;i<nr_elements;i++) {
 		enr = lc_entry(mdev->act_log, i)->lc_number;
 		if (enr == LC_FREE) continue;
 		/* next statement also does atomic_inc wc.count */
@@ -666,7 +666,7 @@
 	wake_up(&mdev->al_wait);
 
 	/* all prepared, submit them */
-	for(i=0;i<nr_elements;i++) {
+	for(i = 0;i<nr_elements;i++) {
 		if (bios[i]==NULL) break;
 		if (FAULT_ACTIVE( mdev, DRBD_FAULT_MD_WR )) {
 			bios[i]->bi_rw = WRITE;
@@ -695,9 +695,9 @@
 
  free_bios_submit_one_by_one:
 	// free everything by calling the endio callback directly.
-	for(i=0;i<nr_elements;i++) {
+	for(i = 0;i<nr_elements;i++) {
 		if (bios[i]==NULL) break;
-		bios[i]->bi_size=0;
+		bios[i]->bi_size = 0;
 		atodb_endio(bios[i], MD_HARDSECT, 0);
 	}
 	kfree(bios);
@@ -705,7 +705,7 @@
  submit_one_by_one:
 	WARN("Using the slow drbd_al_to_on_disk_bm()\n");
 
-	for(i=0;i<mdev->act_log->nr_elements;i++) {
+	for(i = 0;i<mdev->act_log->nr_elements;i++) {
 		enr = lc_entry(mdev->act_log, i)->lc_number;
 		if (enr == LC_FREE) continue;
 		/* Really slow: if we have al-extents 16..19 active,
@@ -725,13 +725,13 @@
 void drbd_al_apply_to_bm(struct Drbd_Conf *mdev)
 {
 	unsigned int enr;
-	unsigned long add=0;
+	unsigned long add = 0;
 	char ppb[10];
 	int i;
 
 	wait_event(mdev->al_wait, lc_try_lock(mdev->act_log));
 
-	for(i=0;i<mdev->act_log->nr_elements;i++) {
+	for(i = 0;i<mdev->act_log->nr_elements;i++) {
 		enr = lc_entry(mdev->act_log, i)->lc_number;
 		if (enr == LC_FREE) continue;
 		add += drbd_bm_ALe_set_all(mdev, enr);
@@ -770,7 +770,7 @@
 
 	D_ASSERT( test_bit(__LC_DIRTY, &mdev->act_log->flags) );
 
-	for(i=0;i<mdev->act_log->nr_elements;i++) {
+	for(i = 0;i<mdev->act_log->nr_elements;i++) {
 		al_ext = lc_entry(mdev->act_log, i);
 		if (al_ext->lc_number == LC_FREE) continue;
 		wait_event(mdev->al_wait, _try_lc_del(mdev, al_ext));
@@ -875,7 +875,7 @@
 		if (ext->rs_left == ext->rs_failed) {
 			ext->rs_failed = 0;
 
-			udw=kmalloc(sizeof(*udw), GFP_ATOMIC);
+			udw = kmalloc(sizeof(*udw), GFP_ATOMIC);
 			if (udw) {
 				udw->enr = ext->lce.lc_number;
 				udw->w.cb = w_update_odbm;
@@ -906,7 +906,7 @@
 	unsigned long sbnr, ebnr, lbnr, bnr;
 	unsigned long count = 0;
 	sector_t esector, nr_sectors;
-	int wake_up=0;
+	int wake_up = 0;
 	unsigned long flags;
 
 	if (size <= 0 || (size & 0x1ff) != 0 || size > DRBD_MAX_SEGMENT_SIZE) {
@@ -946,7 +946,7 @@
 	 * we count rs_{total,left} in bits, not sectors.
 	 */
 	spin_lock_irqsave(&mdev->al_lock, flags);
-	for(bnr=sbnr; bnr <= ebnr; bnr++) {
+	for(bnr = sbnr; bnr <= ebnr; bnr++) {
 		if (drbd_bm_clear_bit(mdev, bnr)) count++;
 	}
 	if (count) {
@@ -956,8 +956,8 @@
 			if ( mdev->rs_mark_left != drbd_bm_total_weight(mdev) &&
 			    mdev->state.conn != PausedSyncT &&
 			    mdev->state.conn != PausedSyncS ) {
-				mdev->rs_mark_time =jiffies;
-				mdev->rs_mark_left =drbd_bm_total_weight(mdev);
+				mdev->rs_mark_time = jiffies;
+				mdev->rs_mark_left = drbd_bm_total_weight(mdev);
 			}
 		}
 		if ( inc_local_if_state(mdev, Attaching) ) {
@@ -966,7 +966,7 @@
 		}
 		/* just wake_up unconditional now,
 		 * various lc_chaged(), lc_put() in drbd_try_clear_on_disk_bm(). */
-		wake_up=1;
+		wake_up = 1;
 	}
 	spin_unlock_irqrestore(&mdev->al_lock, flags);
 	if (wake_up) wake_up(&mdev->al_wait);
@@ -1054,7 +1054,7 @@
 		if (bm_ext->lce.refcnt == 1) mdev->resync_locked++;
 		set_bit(BME_NO_WRITES, &bm_ext->flags);
 	}
-	rs_flags=mdev->resync->flags;
+	rs_flags = mdev->resync->flags;
 	spin_unlock_irq(&mdev->al_lock);
 	if (wakeup) wake_up(&mdev->al_wait);
 
@@ -1074,14 +1074,14 @@
 static inline int _is_in_al(drbd_dev* mdev, unsigned int enr)
 {
 	struct lc_element* al_ext;
-	int rv=0;
+	int rv = 0;
 
 	spin_lock_irq(&mdev->al_lock);
-	if (unlikely(enr == mdev->act_log->new_number)) rv=1;
+	if (unlikely(enr == mdev->act_log->new_number)) rv = 1;
 	else {
 		al_ext = lc_find(mdev->act_log, enr);
 		if (al_ext) {
-			if (al_ext->refcnt) rv=1;
+			if (al_ext->refcnt) rv = 1;
 		}
 	}
 	spin_unlock_irq(&mdev->al_lock);
@@ -1121,7 +1121,7 @@
 
 	if (test_bit(BME_LOCKED, &bm_ext->flags)) return 1;
 
-	for(i=0;i<AL_EXT_PER_BM_SECT;i++) {
+	for(i = 0;i<AL_EXT_PER_BM_SECT;i++) {
 		sig = wait_event_interruptible( mdev->al_wait,
 				!_is_in_al(mdev, enr*AL_EXT_PER_BM_SECT+i) );
 		if (sig) {
@@ -1244,7 +1244,7 @@
 	MTRACE(TraceTypeResync, TraceLvlAll,
 		INFO("checking al for %u\n", enr);
 	);
-	for (i=0;i<AL_EXT_PER_BM_SECT;i++) {
+	for (i = 0;i<AL_EXT_PER_BM_SECT;i++) {
 		if (unlikely(al_enr+i == mdev->act_log->new_number))
 			goto try_again;
 		if (lc_is_used(mdev->act_log, al_enr+i))
@@ -1317,7 +1317,7 @@
 	spin_lock_irq(&mdev->al_lock);
 
 	if (inc_local_if_state(mdev, Failed)) { // Makes sure ->resync is there.
-		for(i=0;i<mdev->resync->nr_elements;i++) {
+		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.
@@ -1326,7 +1326,7 @@
 			clear_bit(BME_NO_WRITES, &bm_ext->flags);
 			lc_del(mdev->resync, &bm_ext->lce);
 		}
-		mdev->resync->used=0;
+		mdev->resync->used = 0;
 		dec_local(mdev);
 	}
 	mdev->resync_locked = 0;
@@ -1353,7 +1353,7 @@
 	spin_lock_irq(&mdev->al_lock);
 
 	if (inc_local_if_state(mdev, Failed)) { // Makes sure ->resync is there.
-		for(i=0;i<mdev->resync->nr_elements;i++) {
+		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;
 			if (bm_ext->lce.lc_number == mdev->resync_wenr) {
@@ -1397,7 +1397,7 @@
 	unsigned long sbnr, ebnr, lbnr, bnr;
 	unsigned long count = 0;
 	sector_t esector, nr_sectors;
-	int wake_up=0;
+	int wake_up = 0;
 
 	MTRACE(TraceTypeResync, TraceLvlSummary,
 	       INFO("drbd_rs_failed_io: sector=%llus, size=%u\n",
@@ -1436,7 +1436,7 @@
 	 * we count rs_{total,left} in bits, not sectors.
 	 */
 	spin_lock_irq(&mdev->al_lock);
-	for(bnr=sbnr; bnr <= ebnr; bnr++) {
+	for(bnr = sbnr; bnr <= ebnr; bnr++) {
 		if (drbd_bm_test_bit(mdev, bnr)>0) count++;
 	}
 	if (count) {
@@ -1449,7 +1449,7 @@
 
 		/* just wake_up unconditional now,
 		 * various lc_chaged(), lc_put() in drbd_try_clear_on_disk_bm(). */
-		wake_up=1;
+		wake_up = 1;
 	}
 	spin_unlock_irq(&mdev->al_lock);
 	if (wake_up) wake_up(&mdev->al_wait);

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:44:06 UTC (rev 2987)
+++ branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 11:50:16 UTC (rev 2988)
@@ -286,7 +286,7 @@
 {
 	const unsigned long mask = (1UL << (b->bm_bits & (BITS_PER_LONG-1))) -1;
 	size_t w = b->bm_bits >> LN2_BPL;
-	int cleared=0;
+	int cleared = 0;
 
 	if (w < b->bm_words) {
 		cleared = hweight_long(b->bm[w] & ~mask);
@@ -295,7 +295,7 @@
 
 	if (w < b->bm_words) {
 		cleared += hweight_long(b->bm[w]);
-		b->bm[w++]=0;
+		b->bm[w++] = 0;
 	}
 
 	return cleared;
@@ -831,7 +831,7 @@
 int drbd_bm_read(struct Drbd_Conf *mdev)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
-	int err=0;
+	int err = 0;
 
 	if (b->bm) {
 	    // bitmap size > 0

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:44:06 UTC (rev 2987)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 11:50:16 UTC (rev 2988)
@@ -171,10 +171,10 @@
 		if (lost)					\
 			WARN("%d messages suppressed in %s:%d.\n", \
 				lost , __FILE__ , __LINE__ );	\
-		__ret=1;					\
+		__ret = 1;					\
 	} else {						\
 		missed++;					\
-		__ret=0;					\
+		__ret = 0;					\
 	}							\
 	__ret;							\
 })
@@ -1406,17 +1406,17 @@
 #define user_isp_mask 1
 #define aftr_isp_mask 1
 
-#define NS(T, S) ({drbd_state_t mask; mask.i=0; mask.T = T##_mask; mask;}), \
-		({drbd_state_t val; val.i=0; val.T = (S); val;})
+#define NS(T, S) ({drbd_state_t mask; mask.i = 0; mask.T = T##_mask; mask;}), \
+		({drbd_state_t val; val.i = 0; val.T = (S); val;})
 #define NS2(T1, S1, T2, S2) \
-		({drbd_state_t mask; mask.i=0; mask.T1 = T1##_mask; \
+		({drbd_state_t mask; mask.i = 0; mask.T1 = T1##_mask; \
 		  mask.T2 = T2##_mask; mask;}), \
-		({drbd_state_t val; val.i=0; val.T1 = (S1); \
+		({drbd_state_t val; val.i = 0; val.T1 = (S1); \
 		  val.T2 = (S2); val;})
 #define NS3(T1, S1, T2, S2, T3, S3) \
-		({drbd_state_t mask; mask.i=0; mask.T1 = T1##_mask; \
+		({drbd_state_t mask; mask.i = 0; mask.T1 = T1##_mask; \
 		  mask.T2 = T2##_mask; mask.T3 = T3##_mask; mask;}), \
-		({drbd_state_t val; val.i=0; val.T1 = (S1); \
+		({drbd_state_t val; val.i = 0; val.T1 = (S1); \
 		  val.T2 = (S2); val.T3 = (S3); val;})
 
 #define _NS(D, T, S) D, ({drbd_state_t ns; ns.i = D->state.i; ns.T = (S); ns;})

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:44:06 UTC (rev 2987)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 11:50:16 UTC (rev 2988)
@@ -104,9 +104,9 @@
 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);
@@ -158,13 +158,13 @@
 {
 	struct drbd_barrier *b;
 
-	b=kmalloc(sizeof(struct drbd_barrier), GFP_KERNEL);
+	b = kmalloc(sizeof(struct drbd_barrier), GFP_KERNEL);
 	if (!b) return 0;
 	INIT_LIST_HEAD(&b->requests);
 	INIT_LIST_HEAD(&b->w.list);
-	b->next=0;
-	b->br_number=4711;
-	b->n_req=0;
+	b->next = 0;
+	b->br_number = 4711;
+	b->n_req = 0;
 
 	mdev->oldest_barrier = b;
 	mdev->newest_barrier = b;
@@ -196,8 +196,8 @@
 
 	INIT_LIST_HEAD(&new->requests);
 	INIT_LIST_HEAD(&new->w.list);
-	new->next=0;
-	new->n_req=0;
+	new->next = 0;
+	new->n_req = 0;
 
 	newest_before = mdev->newest_barrier;
 	/* never send a barrier number == 0, because that is special-cased
@@ -281,8 +281,8 @@
 
 		if (b == mdev->newest_barrier) {
 			D_ASSERT(tmp == NULL);
-			b->br_number=4711;
-			b->n_req=0;
+			b->br_number = 4711;
+			b->n_req = 0;
 			INIT_LIST_HEAD(&b->requests);
 			mdev->oldest_barrier = b;
 			break;
@@ -316,7 +316,7 @@
 {
 	enum io_error_handler eh;
 	unsigned long flags;
-	int send, ok=1;
+	int send, ok = 1;
 
 	eh = PassOn;
 	if (inc_local_if_state(mdev, Failed)) {
@@ -410,7 +410,7 @@
 	if (test_and_clear_bit(CL_ST_CHG_FAIL, &mdev->flags))
 		return SS_CW_FailedByPeer;
 
-	rv=0;
+	rv = 0;
 	spin_lock_irqsave(&mdev->req_lock, flags);
 	os = mdev->state;
 	ns.i = (os.i & ~mask.i) | val.i;
@@ -462,7 +462,7 @@
 			return rv;
 		}
 
-		wait_event(mdev->state_wait, (rv=_req_st_cond(mdev, mask, val)));
+		wait_event(mdev->state_wait, (rv = _req_st_cond(mdev, mask, val)));
 
 		if (rv < SS_Success) {
 			// nearly dead code.
@@ -530,7 +530,7 @@
 	/* See drbd_state_sw_errors in drbd_strings.c */
 
 	enum fencing_policy fp;
-	int rv=SS_Success;
+	int rv = SS_Success;
 
 	fp = DontCare;
 	if (inc_local(mdev)) {
@@ -541,53 +541,53 @@
 	if (inc_net(mdev)) {
 		if ( !mdev->net_conf->two_primaries &&
 		    ns.role == Primary && ns.peer == Primary )
-			rv=SS_TwoPrimaries;
+			rv = SS_TwoPrimaries;
 		dec_net(mdev);
 	}
 
 	if (rv <= 0) /* already found a reason to abort */;
 	else if (ns.role == Secondary && mdev->open_cnt)
-		rv=SS_DeviceInUse;
+		rv = SS_DeviceInUse;
 
 	else if ( ns.role == Primary && ns.conn < Connected &&
-		 ns.disk < UpToDate ) rv=SS_NoUpToDateDisk;
+		 ns.disk < UpToDate ) rv = SS_NoUpToDateDisk;
 
 	else if ( fp >= Resource &&
 		 ns.role == Primary && ns.conn < Connected &&
-		 ns.pdsk >= DUnknown ) rv=SS_PrimaryNOP;
+		 ns.pdsk >= DUnknown ) rv = SS_PrimaryNOP;
 
 	else if ( ns.role == Primary && ns.disk <= Inconsistent &&
-		 ns.pdsk <= Inconsistent ) rv=SS_NoUpToDateDisk;
+		 ns.pdsk <= Inconsistent ) rv = SS_NoUpToDateDisk;
 
 	else if ( ns.conn > Connected &&
 		 ns.disk < UpToDate && ns.pdsk < UpToDate )
-		rv=SS_BothInconsistent;
+		rv = SS_BothInconsistent;
 
 	else if ( ns.conn > Connected &&
 		 (ns.disk == Diskless || ns.pdsk == Diskless ) )
-		rv=SS_SyncingDiskless;
+		rv = SS_SyncingDiskless;
 
 	else if ( (ns.conn == Connected ||
 		  ns.conn == WFBitMapS ||
 		  ns.conn == SyncSource ||
 		  ns.conn == PausedSyncS) &&
-		 ns.disk == Outdated ) rv=SS_ConnectedOutdates;
+		 ns.disk == Outdated ) rv = SS_ConnectedOutdates;
 
 	return rv;
 }
 
 STATIC int is_valid_state_transition(drbd_dev* mdev, drbd_state_t ns, drbd_state_t os)
 {
-	int rv=SS_Success;
+	int rv = SS_Success;
 
 	if ( (ns.conn == StartingSyncT || ns.conn == StartingSyncS ) &&
-	    os.conn > Connected) rv=SS_ResyncRunning;
+	    os.conn > Connected) rv = SS_ResyncRunning;
 
 	if (ns.conn == Disconnecting && os.conn == StandAlone)
-		rv=SS_AlreadyStandAlone;
+		rv = SS_AlreadyStandAlone;
 
 	if (ns.disk > Attaching && os.disk == Diskless)
-		rv=SS_IsDiskLess;
+		rv = SS_IsDiskLess;
 
 	return rv;
 }
@@ -595,7 +595,7 @@
 int _drbd_set_state(drbd_dev* mdev, drbd_state_t ns, enum chg_state_flags flags)
 {
 	drbd_state_t os;
-	int rv=SS_Success, warn_sync_abort=0;
+	int rv = SS_Success, warn_sync_abort = 0;
 	enum fencing_policy fp;
 
 	MUST_HOLD(&mdev->req_lock);
@@ -641,7 +641,7 @@
 	}
 
 	if ( ns.conn > Connected && (ns.disk <= Failed || ns.pdsk <= Failed )) {
-		warn_sync_abort=1;
+		warn_sync_abort = 1;
 		ns.conn = Connected;
 	}
 
@@ -706,11 +706,11 @@
 	}
 
 	if (ns.aftr_isp || ns.peer_isp || ns.user_isp) {
-		if (ns.conn == SyncSource) ns.conn=PausedSyncS;
-		if (ns.conn == SyncTarget) ns.conn=PausedSyncT;
+		if (ns.conn == SyncSource) ns.conn = PausedSyncS;
+		if (ns.conn == SyncTarget) ns.conn = PausedSyncT;
 	} else {
-		if (ns.conn == PausedSyncS) ns.conn=SyncSource;
-		if (ns.conn == PausedSyncT) ns.conn=SyncTarget;
+		if (ns.conn == PausedSyncS) ns.conn = SyncSource;
+		if (ns.conn == PausedSyncT) ns.conn = SyncTarget;
 	}
 
 	if (ns.i == os.i) return SS_NothingToDo;
@@ -748,7 +748,7 @@
 	{
 	char *pbp, pb[300];
 	pbp = pb;
-	*pbp=0;
+	*pbp = 0;
 	PSC(role);
 	PSC(peer);
 	PSC(conn);
@@ -1402,7 +1402,7 @@
 int _drbd_send_bitmap(drbd_dev *mdev)
 {
 	int want;
-	int ok=TRUE, bm_i=0;
+	int ok = TRUE, bm_i = 0;
 	size_t bm_words, num_words;
 	unsigned long *buffer;
 	Drbd_Header *p;
@@ -1452,7 +1452,7 @@
 
 	if (!drbd_get_data_sock(mdev))
 		return 0;
-	ok=_drbd_send_bitmap(mdev);
+	ok = _drbd_send_bitmap(mdev);
 	drbd_put_data_sock(mdev);
 	return ok;
 }
@@ -1488,7 +1488,7 @@
 	p.seq_num  = cpu_to_be32(atomic_add_return(1, &mdev->packet_seq));
 
 	if (!mdev->meta.socket || mdev->state.conn < Connected) return FALSE;
-	ok=drbd_send_cmd(mdev, USE_META_SOCKET, cmd, (Drbd_Header*)&p, sizeof(p));
+	ok = drbd_send_cmd(mdev, USE_META_SOCKET, cmd, (Drbd_Header*)&p, sizeof(p));
 	return ok;
 }
 
@@ -1680,9 +1680,9 @@
  */
 int drbd_send_dblock(drbd_dev *mdev, drbd_request_t *req)
 {
-	int ok=1;
+	int ok = 1;
 	Drbd_Data_Packet p;
-	unsigned int dp_flags=0;
+	unsigned int dp_flags = 0;
 
 	if (!drbd_get_data_sock(mdev))
 		return 0;
@@ -1782,7 +1782,7 @@
 	struct kvec iov;
 #endif
 	struct msghdr msg;
-	int rv, sent=0;
+	int rv, sent = 0;
 
 	if (!sock) return -1000;
 
@@ -1872,7 +1872,7 @@
 {
 	drbd_dev *mdev;
 	unsigned long flags;
-	int rv=0;
+	int rv = 0;
 
 	mdev = minor_to_mdev(MINOR(inode->i_rdev));
 	if (!mdev) return -ENODEV;
@@ -2176,7 +2176,7 @@
 	// drbd's page pool
 	spin_lock_init(&drbd_pp_lock);
 
-	for (i=0;i< number;i++) {
+	for (i = 0;i< number;i++) {
 		page = alloc_page(GFP_HIGHUSER);
 		if (!page) goto Enomem;
 		set_page_private(page, (unsigned long)drbd_pp_pool);
@@ -2217,7 +2217,7 @@
 	if (minor_table) {
 		if (drbd_proc)
 			remove_proc_entry("drbd", &proc_root);
-		i=minor_count;
+		i = minor_count;
 		while (i--) {
 			drbd_dev        *mdev  = minor_to_mdev(i);
 			struct gendisk  **disk = &mdev->vdisk;
@@ -2351,7 +2351,7 @@
 	// 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);
+	mdev->app_reads_hash = kzalloc(APP_R_HSIZE*sizeof(void*), GFP_KERNEL);
 	if (!mdev->app_reads_hash) goto Enomem;
 
 	return mdev;
@@ -2487,7 +2487,7 @@
 	}
 	drbd_free_sock(mdev);
 	drbd_free_bc(mdev->bc);
-	mdev->bc=0;
+	mdev->bc = 0;
 }
 
 /*********************************/
@@ -2533,9 +2533,9 @@
 	buffer = (struct meta_data_on_disk *)page_address(mdev->md_io_page);
 	memset(buffer, 0, 512);
 
-	buffer->la_size=cpu_to_be64(drbd_get_capacity(mdev->this_bdev));
+	buffer->la_size = cpu_to_be64(drbd_get_capacity(mdev->this_bdev));
 	for (i = Current; i < UUID_SIZE; i++)
-		buffer->uuid[i]=cpu_to_be64(mdev->bc->md.uuid[i]);
+		buffer->uuid[i] = cpu_to_be64(mdev->bc->md.uuid[i]);
 	buffer->flags = cpu_to_be32(mdev->bc->md.flags);
 	buffer->magic = cpu_to_be32(DRBD_MD_MAGIC);
 
@@ -2634,7 +2634,7 @@
 
 	bdev->md.la_size_sect = be64_to_cpu(buffer->la_size);
 	for (i = Current; i < UUID_SIZE; i++)
-		bdev->md.uuid[i]=be64_to_cpu(buffer->uuid[i]);
+		bdev->md.uuid[i] = be64_to_cpu(buffer->uuid[i]);
 	bdev->md.flags = be32_to_cpu(buffer->flags);
 	mdev->sync_conf.al_extents = be32_to_cpu(buffer->al_nr_extents);
 	bdev->md.device_uuid = be64_to_cpu(buffer->device_uuid);
@@ -2669,7 +2669,7 @@
 {
 	int i;
 
-	for ( i=History_start ; i<History_end ; i++ ) {
+	for ( i = History_start ; i<History_end ; i++ ) {
 		mdev->bc->md.uuid[i+1] = mdev->bc->md.uuid[i];
 
 		MTRACE(TraceTypeUuid, TraceLvlAll,
@@ -2702,7 +2702,7 @@
 {
 	if (mdev->bc->md.uuid[idx]) {
 		drbd_uuid_move_history(mdev);
-		mdev->bc->md.uuid[History_start]=mdev->bc->md.uuid[idx];
+		mdev->bc->md.uuid[History_start] = mdev->bc->md.uuid[idx];
 		MTRACE(TraceTypeUuid, TraceLvlMetrics,
 		       drbd_print_uuid(mdev, History_start);
 			);
@@ -2739,8 +2739,8 @@
 
 	if (val==0) {
 		drbd_uuid_move_history(mdev);
-		mdev->bc->md.uuid[History_start]=mdev->bc->md.uuid[Bitmap];
-		mdev->bc->md.uuid[Bitmap]=0;
+		mdev->bc->md.uuid[History_start] = mdev->bc->md.uuid[Bitmap];
+		mdev->bc->md.uuid[Bitmap] = 0;
 
 		MTRACE(TraceTypeUuid, TraceLvlMetrics,
 		       drbd_print_uuid(mdev, History_start);
@@ -2920,8 +2920,8 @@
 	const unsigned char *pstart_va;
 	const unsigned char *pend;
 	char bytes_str[LINE_SIZE*3+8], ascii_str[LINE_SIZE+8];
-	char *pbytes=bytes_str, *pascii=ascii_str;
-	int  offset=0;
+	char *pbytes = bytes_str, *pascii = ascii_str;
+	int  offset = 0;
 	long sizemask;
 	int  field_width;
 	int  index;
@@ -2962,7 +2962,7 @@
 
 	// Start at beginning of first line
 	p = pstart;
-	count=0;
+	count = 0;
 
 	while (p < pend_str) {
 		if (p < (const unsigned char *)buffer || p >= pend) {
@@ -3033,7 +3033,7 @@
 
 STATIC char *dump_st(char *p, int len, drbd_state_t mask, drbd_state_t val)
 {
-	char *op=p;
+	char *op = p;
 	*p = '\0';
 	PSM(role);
 	PSM(peer);

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:44:06 UTC (rev 2987)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 11:50:16 UTC (rev 2988)
@@ -197,7 +197,7 @@
 
 	if (fp == Stonith) drbd_request_state(mdev, NS(susp, 1));
 
-	r=drbd_khelper(mdev, "outdate-peer");
+	r = drbd_khelper(mdev, "outdate-peer");
 
 	switch( (r>>8) & 0xff ) {
 	case 3: /* peer is inconsistent */
@@ -236,7 +236,7 @@
 
 int drbd_set_role(drbd_dev *mdev, drbd_role_t new_role, int force)
 {
-	int r=0, forced = 0, try=0;
+	int r = 0, forced = 0, try = 0;
 	drbd_state_t mask, val;
 	drbd_disks_t nps;
 
@@ -373,7 +373,7 @@
 
 	memset(&primary_args, 0, sizeof(struct primary));
 	if (!primary_from_tags(mdev, nlp->tag_list, &primary_args)) {
-		reply->ret_code=UnknownMandatoryTag;
+		reply->ret_code = UnknownMandatoryTag;
 		return 0;
 	}
 
@@ -458,7 +458,7 @@
 	char ppb[10];
 
 	int md_moved, la_size_changed;
-	int rv=0;
+	int rv = 0;
 
 	wait_event(mdev->al_wait, lc_try_lock(mdev->act_log));
 
@@ -530,20 +530,20 @@
 	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;
+	sector_t size = 0;
 
 	m_size = drbd_get_max_capacity(bdev);
 
 	if (p_size && m_size) {
-		size=min_t(sector_t, p_size, m_size);
+		size = min_t(sector_t, p_size, m_size);
 	} else {
 		if (la_size) {
-			size=la_size;
-			if (m_size && m_size < size) size=m_size;
-			if (p_size && p_size < size) size=p_size;
+			size = la_size;
+			if (m_size && m_size < size) size = m_size;
+			if (p_size && p_size < size) size = p_size;
 		} else {
-			if (m_size) size=m_size;
-			if (p_size) size=p_size;
+			if (m_size) size = m_size;
+			if (p_size) size = p_size;
 		}
 	}
 
@@ -595,7 +595,7 @@
 	}
 	spin_lock_irq(&mdev->al_lock);
 	if (t) {
-		for (i=0; i < t->nr_elements; i++) {
+		for (i = 0; i < t->nr_elements; i++) {
 			e = lc_entry(t, i);
 			if (e->refcnt)
 				ERR("refcnt(%d)==%d\n",
@@ -683,15 +683,15 @@
 			     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;
-	int rv, ntries=0;
+	int rv, ntries = 0;
 
 	/* if you want to reconfigure, please tear down first */
 	if (mdev->state.disk > Diskless) {
-		retcode=HaveDiskConfig;
+		retcode = HaveDiskConfig;
 		goto fail;
 	}
 
@@ -702,7 +702,7 @@
 	while(mdev->bc != NULL) {
 		if (ntries++ >= 5) {
 			WARN("drbd_nl_disk_conf: mdev->bc not NULL.\n");
-			retcode=HaveDiskConfig;
+			retcode = HaveDiskConfig;
 			goto fail;
 		}
 		set_current_state(TASK_INTERRUPTIBLE);
@@ -711,7 +711,7 @@
 
 	nbc = kmalloc(sizeof(struct drbd_backing_dev), GFP_KERNEL);
 	if (!nbc) {
-		retcode=KMallocFailed;
+		retcode = KMallocFailed;
 		goto fail;
 	}
 
@@ -726,7 +726,7 @@
 	}
 
 	if (!disk_conf_from_tags(mdev, nlp->tag_list, &nbc->dc)) {
-		retcode=UnknownMandatoryTag;
+		retcode = UnknownMandatoryTag;
 		goto fail;
 	}
 
@@ -734,7 +734,7 @@
 	nbc->md_file = NULL;
 
 	if (nbc->dc.meta_dev_idx < DRBD_MD_INDEX_FLEX_INT) {
-		retcode=LDMDInvalid;
+		retcode = LDMDInvalid;
 		goto fail;
 	}
 
@@ -742,15 +742,15 @@
 	if (IS_ERR(nbc->lo_file)) {
 		ERR("open(\"%s\") failed with %ld\n", nbc->dc.backing_dev,
 		    PTR_ERR(nbc->lo_file));
-		nbc->lo_file=NULL;
-		retcode=LDNameInvalid;
+		nbc->lo_file = NULL;
+		retcode = LDNameInvalid;
 		goto fail;
 	}
 
 	inode = nbc->lo_file->f_dentry->d_inode;
 
 	if (!S_ISBLK(inode->i_mode)) {
-		retcode=LDNoBlockDev;
+		retcode = LDNoBlockDev;
 		goto fail;
 	}
 
@@ -758,15 +758,15 @@
 	if (IS_ERR(nbc->md_file)) {
 		ERR("open(\"%s\") failed with %ld\n", nbc->dc.meta_dev,
 		    PTR_ERR(nbc->md_file));
-		nbc->md_file=NULL;
-		retcode=MDNameInvalid;
+		nbc->md_file = NULL;
+		retcode = MDNameInvalid;
 		goto fail;
 	}
 
 	inode2 = nbc->md_file->f_dentry->d_inode;
 
 	if (!S_ISBLK(inode2->i_mode)) {
-		retcode=MDNoBlockDev;
+		retcode = MDNoBlockDev;
 		goto fail;
 	}
 
@@ -777,13 +777,13 @@
 		       nbc->backing_bdev->bd_holder,
 		       nbc->backing_bdev->bd_contains->bd_holder,
 		       nbc->backing_bdev->bd_holders);
-		retcode=LDMounted;
+		retcode = LDMounted;
 		goto fail;
 	}
 
 	resync_lru = lc_alloc("resync", 31, sizeof(struct bm_extent), mdev);
 	if (!resync_lru) {
-		retcode=KMallocFailed;
+		retcode = KMallocFailed;
 		goto fail;
 	}
 
@@ -792,14 +792,14 @@
 		     (nbc->dc.meta_dev_idx==DRBD_MD_INDEX_INTERNAL ||
 		      nbc->dc.meta_dev_idx==DRBD_MD_INDEX_FLEX_INT) ?
 		     (void *)mdev : (void*) drbd_m_holder )) {
-		retcode=MDMounted;
+		retcode = MDMounted;
 		goto release_bdev_fail;
 	}
 
 	if ( (nbc->backing_bdev==nbc->md_bdev) !=
 	     (nbc->dc.meta_dev_idx==DRBD_MD_INDEX_INTERNAL ||
 	      nbc->dc.meta_dev_idx==DRBD_MD_INDEX_FLEX_INT) ) {
-		retcode=LDMDInvalid;
+		retcode = LDMDInvalid;
 		goto release_bdev2_fail;
 	}
 
@@ -1054,13 +1054,13 @@
 	char hmac_name[HMAC_NAME_L];
 
 	if (mdev->state.conn > StandAlone) {
-		retcode=HaveNetConfig;
+		retcode = HaveNetConfig;
 		goto fail;
 	}
 
 	new_conf = kmalloc(sizeof(struct net_conf), GFP_KERNEL);
 	if (!new_conf) {
-		retcode=KMallocFailed;
+		retcode = KMallocFailed;
 		goto fail;
 	}
 
@@ -1069,36 +1069,36 @@
 		dec_local(mdev);
 	} else {
 		memset(new_conf, 0, sizeof(struct net_conf));
-		new_conf->timeout         = DRBD_TIMEOUT_DEF;
-		new_conf->try_connect_int = DRBD_CONNECT_INT_DEF;
-		new_conf->ping_int        = DRBD_PING_INT_DEF;
-		new_conf->max_epoch_size  = DRBD_MAX_EPOCH_SIZE_DEF;
-		new_conf->max_buffers     = DRBD_MAX_BUFFERS_DEF;
-		new_conf->unplug_watermark= DRBD_UNPLUG_WATERMARK_DEF;
-		new_conf->sndbuf_size     = DRBD_SNDBUF_SIZE_DEF;
-		new_conf->ko_count        = DRBD_KO_COUNT_DEF;
-		new_conf->after_sb_0p     = DRBD_AFTER_SB_0P_DEF;
-		new_conf->after_sb_1p     = DRBD_AFTER_SB_1P_DEF;
-		new_conf->after_sb_2p     = DRBD_AFTER_SB_2P_DEF;
-		new_conf->want_lose       = 0;
-		new_conf->two_primaries   = 0;
-		new_conf->wire_protocol   = DRBD_PROT_C;
-		new_conf->ping_timeo      = DRBD_PING_TIMEO_DEF;
-		new_conf->rr_conflict     = DRBD_RR_CONFLICT_DEF;
+		new_conf->timeout          = DRBD_TIMEOUT_DEF;
+		new_conf->try_connect_int  = DRBD_CONNECT_INT_DEF;
+		new_conf->ping_int         = DRBD_PING_INT_DEF;
+		new_conf->max_epoch_size   = DRBD_MAX_EPOCH_SIZE_DEF;
+		new_conf->max_buffers      = DRBD_MAX_BUFFERS_DEF;
+		new_conf->unplug_watermark = DRBD_UNPLUG_WATERMARK_DEF;
+		new_conf->sndbuf_size      = DRBD_SNDBUF_SIZE_DEF;
+		new_conf->ko_count         = DRBD_KO_COUNT_DEF;
+		new_conf->after_sb_0p      = DRBD_AFTER_SB_0P_DEF;
+		new_conf->after_sb_1p      = DRBD_AFTER_SB_1P_DEF;
+		new_conf->after_sb_2p      = DRBD_AFTER_SB_2P_DEF;
+		new_conf->want_lose        = 0;
+		new_conf->two_primaries    = 0;
+		new_conf->wire_protocol    = DRBD_PROT_C;
+		new_conf->ping_timeo       = DRBD_PING_TIMEO_DEF;
+		new_conf->rr_conflict      = DRBD_RR_CONFLICT_DEF;
 	}
 
 	if (!net_conf_from_tags(mdev, nlp->tag_list, new_conf)) {
-		retcode=UnknownMandatoryTag;
+		retcode = UnknownMandatoryTag;
 		goto fail;
 	}
 
 	if (new_conf->two_primaries && (new_conf->wire_protocol != DRBD_PROT_C)) {
-		retcode=ProtocolCRequired;
+		retcode = ProtocolCRequired;
 		goto fail;
 	};
 
 	if (mdev->state.role == Primary && new_conf->want_lose) {
-		retcode=DiscardNotAllowed;
+		retcode = DiscardNotAllowed;
 		goto fail;
 	}
 
@@ -1107,17 +1107,17 @@
 #define O_ADDR(A) (((struct sockaddr_in *)&A->peer_addr)->sin_addr.s_addr)
 #define O_PORT(A) (((struct sockaddr_in *)&A->peer_addr)->sin_port)
 	retcode = NoError;
-	for(i=0;i<minor_count;i++) {
+	for(i = 0;i<minor_count;i++) {
 		odev = minor_to_mdev(i);
 		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) ) {
-				retcode=LAAlreadyInUse;
+				retcode = LAAlreadyInUse;
 			}
 			if (O_ADDR(new_conf) == O_ADDR(odev->net_conf) &&
 			   O_PORT(new_conf) == O_PORT(odev->net_conf) ) {
-				retcode=OAAlreadyInUse;
+				retcode = OAAlreadyInUse;
 			}
 			dec_net(odev);
 			if (retcode != NoError) goto fail;
@@ -1133,12 +1133,12 @@
 		tfm = crypto_alloc_hash(hmac_name, 0, CRYPTO_ALG_ASYNC);
 		if (IS_ERR(tfm)) {
 			tfm = NULL;
-			retcode=CRAMAlgNotAvail;
+			retcode = CRAMAlgNotAvail;
 			goto fail;
 		}
 
 		if (crypto_tfm_alg_type(crypto_hash_tfm(tfm)) != CRYPTO_ALG_TYPE_HASH ) {
-			retcode=CRAMAlgNotDigest;
+			retcode = CRAMAlgNotDigest;
 			goto fail;
 		}
 	}
@@ -1146,23 +1146,23 @@
 
 	ns = new_conf->max_epoch_size/8;
 	if (mdev->tl_hash_s != ns) {
-		new_tl_hash=kzalloc(ns*sizeof(void*), GFP_KERNEL);
+		new_tl_hash = kzalloc(ns*sizeof(void*), GFP_KERNEL);
 		if (!new_tl_hash) {
-			retcode=KMallocFailed;
+			retcode = KMallocFailed;
 			goto fail;
 		}
 	}
 
 	ns = new_conf->max_buffers/8;
 	if (new_conf->two_primaries && ( mdev->ee_hash_s != ns ) ) {
-		new_ee_hash=kzalloc(ns*sizeof(void*), GFP_KERNEL);
+		new_ee_hash = kzalloc(ns*sizeof(void*), GFP_KERNEL);
 		if (!new_ee_hash) {
-			retcode=KMallocFailed;
+			retcode = KMallocFailed;
 			goto fail;
 		}
 	}
 
-	((char*)new_conf->shared_secret)[SHARED_SECRET_MAX-1]=0;
+	((char*)new_conf->shared_secret)[SHARED_SECRET_MAX-1] = 0;
 
 #if 0
 FIXME LGE
@@ -1272,11 +1272,11 @@
 			  struct drbd_nl_cfg_reply *reply)
 {
 	struct resize rs;
-	int retcode=NoError;
+	int retcode = NoError;
 
 	memset(&rs, 0, sizeof(struct resize));
 	if (!resize_from_tags(mdev, nlp->tag_list, &rs)) {
-		retcode=UnknownMandatoryTag;
+		retcode = UnknownMandatoryTag;
 		goto fail;
 	}
 
@@ -1315,7 +1315,7 @@
 STATIC int drbd_nl_syncer_conf(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
 			       struct drbd_nl_cfg_reply *reply)
 {
-	int retcode=NoError;
+	int retcode = NoError;
 	struct syncer_conf sc;
 	drbd_dev *odev;
 	int err;
@@ -1329,19 +1329,19 @@
 	}
 
 	if (!syncer_conf_from_tags(mdev, nlp->tag_list, &sc)) {
-		retcode=UnknownMandatoryTag;
+		retcode = UnknownMandatoryTag;
 		goto fail;
 	}
 
 	if (sc.after != -1) {
 		if ( sc.after < -1 || minor_to_mdev(sc.after) == NULL ) {
-			retcode=SyncAfterInvalid;
+			retcode = SyncAfterInvalid;
 			goto fail;
 		}
 		odev = minor_to_mdev(sc.after); // check against loops in
 		while(1) {
 			if (odev == mdev) {
-				retcode=SyncAfterCycle;
+				retcode = SyncAfterCycle;
 				goto fail;
 			}
 			if (odev->sync_conf.after == -1) break; // no cycles.
@@ -1402,7 +1402,7 @@
 STATIC int drbd_nl_pause_sync(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
 			      struct drbd_nl_cfg_reply *reply)
 {
-	int retcode=NoError;
+	int retcode = NoError;
 
 	if (drbd_request_state(mdev, NS(user_isp, 1)) == SS_NothingToDo)
 		retcode = PauseFlagAlreadySet;
@@ -1414,7 +1414,7 @@
 STATIC int drbd_nl_resume_sync(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
 			       struct drbd_nl_cfg_reply *reply)
 {
-	int retcode=NoError;
+	int retcode = NoError;
 
 	if (drbd_request_state(mdev, NS(user_isp, 0)) == SS_NothingToDo)
 		retcode = PauseFlagAlreadyClear;
@@ -1515,12 +1515,12 @@
 		*tl++ = T_uuids;
 		*tl++ = UUID_SIZE*sizeof(u64);
 		memcpy(tl, mdev->bc->md.uuid, UUID_SIZE*sizeof(u64));
-		tl=(unsigned short*)((char*)tl + UUID_SIZE*sizeof(u64));
+		tl = (unsigned short*)((char*)tl + UUID_SIZE*sizeof(u64));
 		dec_local(mdev);
 		*tl++ = T_uuids_flags;
 		*tl++ = sizeof(int);
 		memcpy(tl, &mdev->bc->md.flags, sizeof(int));
-		tl=(unsigned short*)((char*)tl + sizeof(int));
+		tl = (unsigned short*)((char*)tl + sizeof(int));
 	}
 	*tl++ = TT_END; /* Close the tag list */
 
@@ -1539,7 +1539,7 @@
 	*tl++ = T_use_degraded;
 	*tl++ = sizeof(char);
 	*((char*)tl) = test_bit(USE_DEGR_WFC_T, &mdev->flags) ? 1 : 0 ;
-	tl=(unsigned short*)((char*)tl + sizeof(char));
+	tl = (unsigned short*)((char*)tl + sizeof(char));
 	*tl++ = TT_END;
 
 	return (int)((char*)tl - (char*)reply->tag_list);
@@ -1629,14 +1629,14 @@
 	}
 
 	if ( !(mdev = ensure_mdev(nlp)) ) {
-		retcode=MinorNotKnown;
+		retcode = MinorNotKnown;
 		goto fail;
 	}
 
 	TRACE(TraceTypeNl, TraceLvlSummary, nl_trace_packet(data););
 
 	if (nlp->packet_type >= P_nl_after_last_packet) {
-		retcode=UnknownNetLinkPacket;
+		retcode = UnknownNetLinkPacket;
 		goto fail;
 	}
 
@@ -1644,7 +1644,7 @@
 	reply_size += cm->reply_body_size;
 
 	if ( !(cn_reply = kmalloc(reply_size, GFP_KERNEL)) ) {
-		retcode=KMallocFailed;
+		retcode = KMallocFailed;
 		goto fail;
 	}
 	reply = (struct drbd_nl_cfg_reply*) cn_reply->data;
@@ -1728,7 +1728,7 @@
 	*tl++ = T_helper;
 	*tl++ = str_len;
 	memcpy(tl, helper_name, str_len);
-	tl=(unsigned short*)((char*)tl + str_len);
+	tl = (unsigned short*)((char*)tl + str_len);
 	*tl++ = TT_END; /* Close the tag list */
 
 	cn_reply->id.idx = CN_IDX_DRBD;
@@ -1777,7 +1777,7 @@
 		*tl++ = T_sync_progress;
 		*tl++ = sizeof(int);
 		memcpy(tl, &res, sizeof(int));
-		tl=(unsigned short*)((char*)tl + sizeof(int));
+		tl = (unsigned short*)((char*)tl + sizeof(int));
 	}
 	*tl++ = TT_END; /* Close the tag list */
 

Modified: branches/drbd-8.0-for-linus/drbd/drbd_proc.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_proc.c	2007-07-24 11:44:06 UTC (rev 2987)
+++ branches/drbd-8.0-for-linus/drbd/drbd_proc.c	2007-07-24 11:50:16 UTC (rev 2988)
@@ -146,7 +146,7 @@
 	/* mean speed since syncer started
 	 * we do account for PausedSync periods */
 	dt = (jiffies - mdev->rs_start - mdev->rs_paused) / HZ;
-	if (dt <= 0) dt=1;
+	if (dt <= 0) dt = 1;
 	db = mdev->rs_total - rs_left;
 	dbdt = Bit2KB(db/dt);
 	if (dbdt > 1000)
@@ -172,7 +172,7 @@
 
 STATIC int drbd_seq_show(struct seq_file *seq, void *v)
 {
-	int i, hole=0;
+	int i, hole = 0;
 	const char *sn;
 	drbd_dev *mdev;
 
@@ -195,11 +195,11 @@
 	for (i = 0; i < minor_count; i++) {
 		mdev = minor_to_mdev(i);
 		if (!mdev) {
-			hole=1;
+			hole = 1;
 			continue;
 		}
 		if (hole) {
-			hole=0;
+			hole = 0;
 			seq_printf( seq, "\n");
 		}
 

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:44:06 UTC (rev 2987)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 11:50:16 UTC (rev 2988)
@@ -70,12 +70,12 @@
 void check_list(drbd_dev *mdev, struct list_head *list, char *t)
 {
 	struct list_head *le, *la;
-	int forward=0, backward=0;
+	int forward = 0, backward = 0;
 
-	le=list;
+	le = list;
 	do {
-		la=le;
-		le=le->next;
+		la = le;
+		le = le->next;
 		if (le->prev != la) {
 			printk(KERN_ERR DEVICE_NAME
 			       "%d: %s list fucked.\n",
@@ -90,10 +90,10 @@
 		}
 	} while(le != list);
 
-	le=list;
+	le = list;
 	do {
-		la=le;
-		le=le->prev;
+		la = le;
+		le = le->prev;
 		if (le->next != la) {
 			printk(KERN_ERR DEVICE_NAME
 			       "%d: %s list fucked.\n",
@@ -122,7 +122,7 @@
  */
 STATIC struct page * drbd_pp_alloc(drbd_dev *mdev, unsigned int gfp_mask)
 {
-	unsigned long flags=0;
+	unsigned long flags = 0;
 	struct page *page;
 	DEFINE_WAIT(wait);
 
@@ -190,7 +190,7 @@
 
 STATIC void drbd_pp_free(drbd_dev *mdev, struct page *page)
 {
-	unsigned long flags=0;
+	unsigned long flags = 0;
 	int free_it;
 
 	spin_lock_irqsave(&drbd_pp_lock, flags);
@@ -327,7 +327,7 @@
 
 void drbd_free_ee(drbd_dev *mdev, struct Tl_epoch_entry* e)
 {
-	struct bio *bio=e->private_bio;
+	struct bio *bio = e->private_bio;
 	struct bio_vec *bvec;
 	int i;
 
@@ -350,7 +350,7 @@
 /* currently on module unload only */
 int drbd_release_ee(drbd_dev *mdev, struct list_head* list)
 {
-	int count=0;
+	int count = 0;
 	struct Tl_epoch_entry* e;
 	struct list_head *le;
 
@@ -400,7 +400,7 @@
 {
 	LIST_HEAD(work_list);
 	struct Tl_epoch_entry *e, *t;
-	int ok=1;
+	int ok = 1;
 	int do_clear_bit = test_bit(WRITE_ACK_PENDING, &mdev->flags);
 
 	spin_lock_irq(&mdev->req_lock);
@@ -722,8 +722,8 @@
 	msock = NULL;
 
 	do {
-		for(try=0;;) { // 3 tries, this should take less than a second!
-			s=drbd_try_connect(mdev);
+		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()
 			set_current_state(TASK_INTERRUPTIBLE);
@@ -753,7 +753,7 @@
 
 		if (sock && msock) break;
 
-		s=drbd_wait_for_connect(mdev);
+		s = drbd_wait_for_connect(mdev);
 		if (s) {
 			switch(drbd_recv_fp(mdev, s)) {
 			case HandShakeS:
@@ -784,13 +784,13 @@
 
 	} while( !sock || !msock );
 
-	msock->sk->sk_reuse=1; /* SO_REUSEADDR */
-	sock->sk->sk_reuse=1; /* SO_REUSEADDR */
+	msock->sk->sk_reuse = 1; /* SO_REUSEADDR */
+	sock->sk->sk_reuse = 1; /* SO_REUSEADDR */
 
 	sock->sk->sk_allocation = GFP_NOIO;
 	msock->sk->sk_allocation = GFP_NOIO;
 
-	sock->sk->sk_priority=TC_PRIO_BULK;
+	sock->sk->sk_priority = TC_PRIO_BULK;
 	// 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;
@@ -802,7 +802,7 @@
 	sock->sk->sk_rcvtimeo = 2*HZ;
 	sock->sk->sk_userlocks |= SOCK_SNDBUF_LOCK | SOCK_RCVBUF_LOCK;
 
-	msock->sk->sk_priority=TC_PRIO_INTERACTIVE;
+	msock->sk->sk_priority = TC_PRIO_INTERACTIVE;
 	msock->sk->sk_sndbuf = 2*32767;
 	msock->sk->sk_sndtimeo = mdev->net_conf->timeout*HZ/10;
 	msock->sk->sk_rcvtimeo = mdev->net_conf->ping_int*HZ;
@@ -828,7 +828,7 @@
 	sock->sk->sk_rcvtimeo = MAX_SCHEDULE_TIMEOUT;
 
 	atomic_set(&mdev->packet_seq, 0);
-	mdev->peer_seq=0;
+	mdev->peer_seq = 0;
 
 	drbd_thread_start(&mdev->asender);
 
@@ -944,12 +944,12 @@
 drbd_drain_block(drbd_dev *mdev, int data_size)
 {
 	struct page *page;
-	int rr, rv=1;
+	int rr, rv = 1;
 	void* data;
 
 	page = drbd_pp_alloc(mdev, GFP_KERNEL);
 
-	data=kmap(page);
+	data = kmap(page);
 	while(data_size) {
 		rr = drbd_recv(mdev, data, min_t(int, data_size, PAGE_SIZE));
 		if ( rr != min_t(int, data_size, PAGE_SIZE) ) {
@@ -990,7 +990,7 @@
 
 	bio_for_each_segment(bvec, bio, i) {
 		expect = min_t(int, data_size, bvec->bv_len);
-		rr=drbd_recv(mdev,
+		rr = drbd_recv(mdev,
 			     kmap(bvec->bv_page)+bvec->bv_offset,
 			     expect);
 		kunmap(bvec->bv_page);
@@ -1164,7 +1164,7 @@
 	struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
 	sector_t sector = e->sector;
 	// unsigned int epoch_size;
-	int ok=1, pcmd;
+	int ok = 1, pcmd;
 
 	if (mdev->net_conf->wire_protocol == DRBD_PROT_C) {
 		if (likely(drbd_bio_uptodate(e->private_bio))) {
@@ -1209,7 +1209,7 @@
 STATIC int e_send_discard_ack(drbd_dev *mdev, struct drbd_work *w, int unused)
 {
 	struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
-	int ok=1;
+	int ok = 1;
 
 	D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_C);
 	ok = drbd_send_ack(mdev, DiscardAck, e);
@@ -1658,7 +1658,7 @@
 
 STATIC int drbd_asb_recover_0p(drbd_dev *mdev)
 {
-	int self, peer, rv=-100;
+	int self, peer, rv = -100;
 	unsigned long ch_self, ch_peer;
 
 	self = mdev->bc->md.uuid[Bitmap] & 1;
@@ -1687,7 +1687,7 @@
 		     "Using discard-least-changes instead\n");
 	case DiscardZeroChg:
 		if (ch_peer == 0 && ch_self == 0) {
-			rv=test_bit(DISCARD_CONCURRENT, &mdev->flags) ? -1 : 1;
+			rv = test_bit(DISCARD_CONCURRENT, &mdev->flags) ? -1 : 1;
 			break;
 		} else {
 			if (ch_peer == 0) { rv =  1; break; }
@@ -1699,7 +1699,7 @@
 		else if (ch_self > ch_peer) rv =  1;
 		else /* ( ch_self == ch_peer ) */ {
 			// Well, then use something else.
-			rv=test_bit(DISCARD_CONCURRENT, &mdev->flags) ? -1 : 1;
+			rv = test_bit(DISCARD_CONCURRENT, &mdev->flags) ? -1 : 1;
 		}
 		break;
 	case DiscardLocal:
@@ -1714,7 +1714,7 @@
 
 STATIC int drbd_asb_recover_1p(drbd_dev *mdev)
 {
-	int self, peer, hg, rv=-100;
+	int self, peer, hg, rv = -100;
 
 	self = mdev->bc->md.uuid[Bitmap] & 1;
 	peer = mdev->p_uuid[Bitmap] & 1;
@@ -1731,8 +1731,8 @@
 		break;
 	case Consensus:
 		hg = drbd_asb_recover_0p(mdev);
-		if (hg == -1 && mdev->state.role==Secondary) rv=hg;
-		if (hg == 1  && mdev->state.role==Primary)   rv=hg;
+		if (hg == -1 && mdev->state.role == Secondary) rv = hg;
+		if (hg == 1  && mdev->state.role == Primary)   rv = hg;
 		break;
 	case Violently:
 		rv = drbd_asb_recover_0p(mdev);
@@ -1757,7 +1757,7 @@
 
 STATIC int drbd_asb_recover_2p(drbd_dev *mdev)
 {
-	int self, peer, hg, rv=-100;
+	int self, peer, hg, rv = -100;
 
 	self = mdev->bc->md.uuid[Bitmap] & 1;
 	peer = mdev->p_uuid[Bitmap] & 1;
@@ -1860,7 +1860,7 @@
 	if (self == peer) return -1;
 
 	*rule_nr = 6;
-	for ( i=History_start ; i<=History_end ; i++ ) {
+	for ( i = History_start ; i<=History_end ; i++ ) {
 		peer = mdev->p_uuid[i] & ~((u64)1);
 		if (self == peer) return -2;
 	}
@@ -1871,7 +1871,7 @@
 	if (self == peer) return 1;
 
 	*rule_nr = 8;
-	for ( i=History_start ; i<=History_end ; i++ ) {
+	for ( i = History_start ; i<=History_end ; i++ ) {
 		self = mdev->bc->md.uuid[i] & ~((u64)1);
 		if (self == peer) return 2;
 	}
@@ -1882,9 +1882,9 @@
 	if (self == peer && self != ((u64)0) ) return 100;
 
 	*rule_nr = 10;
-	for ( i=History_start ; i<=History_end ; i++ ) {
+	for ( i = History_start ; i<=History_end ; i++ ) {
 		self = mdev->p_uuid[i] & ~((u64)1);
-		for ( j=History_start ; j<=History_end ; j++ ) {
+		for ( j = History_start ; j<=History_end ; j++ ) {
 			peer = mdev->p_uuid[j] & ~((u64)1);
 			if (self == peer) return -100;
 		}
@@ -1925,7 +1925,7 @@
 	    (peer_disk==Inconsistent && mydisk>Inconsistent) )  {
 		int f = (hg == -100) || abs(hg) == 2;
 		hg = mydisk > Inconsistent ? 1 : -1;
-		if (f) hg=hg*2;
+		if (f) hg = hg*2;
 		INFO("Becoming sync %s due to disk states.\n",
 		     hg > 0 ? "source" : "target");
 	}
@@ -1953,7 +1953,7 @@
 				     " UUIDs where ambiguous.\n");
 				drbd_uuid_dump(mdev, "self", mdev->bc->md.uuid);
 				drbd_uuid_dump(mdev, "peer", mdev->p_uuid);
-				hg=hg*2;
+				hg = hg*2;
 			}
 		}
 	}
@@ -2150,8 +2150,8 @@
 	if (drbd_recv(mdev, h->payload, h->length) != h->length)
 		return FALSE;
 
-	p_size=be64_to_cpu(p->d_size);
-	p_usize=be64_to_cpu(p->u_size);
+	p_size = be64_to_cpu(p->d_size);
+	p_usize = be64_to_cpu(p->u_size);
 
 	if (p_size == 0 && mdev->state.disk == Diskless) {
 		ERR("some backing storage is needed\n");
@@ -2169,7 +2169,7 @@
 		if (mdev->state.conn == WFReportParams) {
 			/* this is first connect, or an otherwise expected
 			   param exchange.  choose the minimum */
-			p_usize=min_not_zero((sector_t)mdev->bc->dc.disk_size,
+			p_usize = min_not_zero((sector_t)mdev->bc->dc.disk_size,
 					     p_usize);
 		}
 
@@ -2195,7 +2195,7 @@
 	}
 #undef min_not_zero
 
-	mdev->p_size=p_size;
+	mdev->p_size = p_size;
 	if (inc_local(mdev)) {
 		drbd_bm_lock(mdev); // {
 		/*
@@ -2213,7 +2213,7 @@
 	}
 
 	if (mdev->p_uuid && mdev->state.conn <= Connected && inc_local(mdev)) {
-		nconn=drbd_sync_handshake(mdev, mdev->state.peer, mdev->state.pdsk);
+		nconn = drbd_sync_handshake(mdev, mdev->state.peer, mdev->state.pdsk);
 		dec_local(mdev);
 
 		if (nconn == conn_mask) return FALSE;
@@ -2349,7 +2349,7 @@
 	if (mdev->p_uuid && oconn <= Connected &&
 	    peer_state.disk >= Negotiating &&
 	    inc_local_if_state(mdev, Negotiating) ) {
-		nconn=drbd_sync_handshake(mdev, peer_state.role, peer_state.disk);
+		nconn = drbd_sync_handshake(mdev, peer_state.role, peer_state.disk);
 		dec_local(mdev);
 
 		if (nconn == conn_mask) return FALSE;
@@ -2433,7 +2433,7 @@
 {
 	size_t bm_words, bm_i, want, num_words;
 	unsigned long *buffer;
-	int ok=FALSE;
+	int ok = FALSE;
 
 	drbd_bm_lock(mdev);  // {
 
@@ -2469,7 +2469,7 @@
 		    conns_to_name(mdev->state.conn));
 	}
 
-	ok=TRUE;
+	ok = TRUE;
  out:
 	drbd_bm_unlock(mdev); // }
 	vfree(buffer);
@@ -2578,7 +2578,7 @@
 	 * Application READ requests
 	 */
 	spin_lock_irq(&mdev->req_lock);
-	for(i=0;i<APP_R_HSIZE;i++) {
+	for(i = 0;i<APP_R_HSIZE;i++) {
 		slot = mdev->app_reads_hash+i;
 		hlist_for_each_entry(req, n, slot, colision) {
 			list_add(&req->w.list, &workset);
@@ -2601,7 +2601,7 @@
 	struct drbd_work prev_work_done;
 	enum fencing_policy fp;
 	drbd_state_t os, ns;
-	int rv=SS_UnknownError;
+	int rv = SS_UnknownError;
 
 	D_ASSERT(mdev->state.conn < Connected);
 	/* FIXME verify that:
@@ -2646,8 +2646,8 @@
            the disk-IO, while the rs_pending_cnt only tracks the blocks
 	   on the fly. */
 	drbd_rs_cancel_all(mdev);
-	mdev->rs_total=0;
-	mdev->rs_failed=0;
+	mdev->rs_total = 0;
+	mdev->rs_failed = 0;
 	atomic_set(&mdev->rs_pending_cnt, 0);
 	wake_up(&mdev->misc_wait);
 
@@ -2692,7 +2692,7 @@
 		// Do not restart in case we are Disconnecting
 		ns = os;
 		ns.conn = Unconnected;
-		rv=_drbd_set_state(mdev, ns, ChgStateVerbose);
+		rv = _drbd_set_state(mdev, ns, ChgStateVerbose);
 	}
 	spin_unlock_irq(&mdev->req_lock);
 	if (rv == SS_Success) {
@@ -2717,7 +2717,7 @@
 			mdev->cram_hmac_tfm = NULL;
 		}
 		kfree(mdev->net_conf);
-		mdev->net_conf=NULL;
+		mdev->net_conf = NULL;
 		drbd_request_state(mdev, NS(conn, StandAlone));
 	}
 
@@ -2875,8 +2875,8 @@
 	struct hash_desc desc;
 	int rv;
 
-	desc.tfm=mdev->cram_hmac_tfm;
-	desc.flags=0;
+	desc.tfm = mdev->cram_hmac_tfm;
+	desc.flags = 0;
 
 	rv = crypto_hash_setkey(mdev->cram_hmac_tfm,
 				(u8*)mdev->net_conf->shared_secret, key_len);
@@ -3242,17 +3242,17 @@
 	int empty;
 
 	static struct asender_cmd asender_tbl[] = {
-		[Ping]      ={ sizeof(Drbd_Header),           got_Ping },
-		[PingAck]   ={ sizeof(Drbd_Header),           got_PingAck },
-		[RecvAck]   ={ sizeof(Drbd_BlockAck_Packet),  got_BlockAck },
-		[WriteAck]  ={ sizeof(Drbd_BlockAck_Packet),  got_BlockAck },
-		[RSWriteAck]={ sizeof(Drbd_BlockAck_Packet),  got_BlockAck },
-		[DiscardAck]={ sizeof(Drbd_BlockAck_Packet),  got_BlockAck },
-		[NegAck]    ={ sizeof(Drbd_BlockAck_Packet),  got_NegAck },
-		[NegDReply] ={ sizeof(Drbd_BlockAck_Packet),  got_NegDReply },
-		[NegRSDReply]={sizeof(Drbd_BlockAck_Packet),  got_NegRSDReply},
-		[BarrierAck]={ sizeof(Drbd_BarrierAck_Packet), got_BarrierAck },
-		[StateChgReply]={sizeof(Drbd_RqS_Reply_Packet), got_RqSReply },
+	[Ping]          = { sizeof(Drbd_Header),            got_Ping },
+	[PingAck]       = { sizeof(Drbd_Header),            got_PingAck },
+	[RecvAck]       = { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
+	[WriteAck]      = { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
+	[RSWriteAck]    = { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
+	[DiscardAck]    = { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
+	[NegAck]        = { sizeof(Drbd_BlockAck_Packet),   got_NegAck },
+	[NegDReply]     = { sizeof(Drbd_BlockAck_Packet),   got_NegDReply },
+	[NegRSDReply]   = { sizeof(Drbd_BlockAck_Packet),   got_NegRSDReply},
+	[BarrierAck]    = { sizeof(Drbd_BarrierAck_Packet), got_BarrierAck },
+	[StateChgReply] = { sizeof(Drbd_RqS_Reply_Packet),  got_RqSReply },
 	};
 
 	sprintf(current->comm, "drbd%d_asender", mdev_to_minor(mdev));

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:44:06 UTC (rev 2987)
+++ branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 11:50:16 UTC (rev 2988)
@@ -77,8 +77,8 @@
  */
 int drbd_endio_read_sec(struct bio *bio, unsigned int bytes_done, int error)
 {
-	unsigned long flags=0;
-	struct Tl_epoch_entry *e=NULL;
+	unsigned long flags = 0;
+	struct Tl_epoch_entry *e = NULL;
 	struct Drbd_Conf* mdev;
 	int uptodate = bio_flagged(bio, BIO_UPTODATE);
 
@@ -121,8 +121,8 @@
  */
 int drbd_endio_write_sec(struct bio *bio, unsigned int bytes_done, int error)
 {
-	unsigned long flags=0;
-	struct Tl_epoch_entry *e=NULL;
+	unsigned long flags = 0;
+	struct Tl_epoch_entry *e = NULL;
 	drbd_dev *mdev;
 	sector_t e_sector;
 	int do_wake;
@@ -195,7 +195,7 @@
 int drbd_endio_pri(struct bio *bio, unsigned int bytes_done, int error)
 {
 	unsigned long flags;
-	drbd_request_t *req=bio->bi_private;
+	drbd_request_t *req = bio->bi_private;
 	drbd_dev *mdev = req->mdev;
 	drbd_req_event_t what;
 	int uptodate = bio_flagged(bio, BIO_UPTODATE);
@@ -286,10 +286,10 @@
 	spin_lock_irqsave(&mdev->req_lock, flags);
 
 	if (likely(!test_and_clear_bit(STOP_SYNC_TIMER, &mdev->flags))) {
-		queue=1;
+		queue = 1;
 		mdev->resync_work.cb = w_make_resync_request;
 	} else {
-		queue=0;
+		queue = 0;
 		mdev->resync_work.cb = w_resync_inactive;
 	}
 
@@ -342,7 +342,7 @@
 		return 1;
 	}
 
-	for(i=0;i<number;i++) {
+	for(i = 0;i<number;i++) {
 
 	next_sector:
 		size = BM_BLOCK_SIZE;
@@ -384,7 +384,7 @@
 		 * "indirect" devices, this is dead code, since
 		 * q->max_segment_size will be PAGE_SIZE.
 		 */
-		align=1;
+		align = 1;
 		for (;;) {
 			if (size + BM_BLOCK_SIZE > max_segment_size)
 				break;
@@ -483,7 +483,7 @@
 	}
 
 	dt = (jiffies - mdev->rs_start - mdev->rs_paused) / HZ;
-	if (dt <= 0) dt=1;
+	if (dt <= 0) dt = 1;
 	db = mdev->rs_total;
 	dbdt = Bit2KB(db/dt);
 	mdev->rs_paused /= HZ;
@@ -510,7 +510,7 @@
 		    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]);
@@ -526,8 +526,8 @@
 			// 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];
+			for ( i = Current ; i<=History_end ; i++ ) {
+				mdev->p_uuid[i] = mdev->bc->md.uuid[i];
 			}
 		}
 	}
@@ -567,13 +567,13 @@
 	}
 
 	if (likely(drbd_bio_uptodate(e->private_bio))) {
-		ok=drbd_send_block(mdev, DataReply, e);
+		ok = drbd_send_block(mdev, DataReply, e);
 	} else {
 		if (DRBD_ratelimit(5*HZ, 5))
 			ERR("Sending NegDReply. sector=%llus.\n",
 			    (unsigned long long)e->sector);
 
-		ok=drbd_send_ack(mdev, NegDReply, e);
+		ok = drbd_send_ack(mdev, NegDReply, e);
 
 		/* FIXME we should not detach for read io-errors, in particular
 		 * not now: when the peer asked us for our data, we are likely
@@ -618,18 +618,18 @@
 	if (likely(drbd_bio_uptodate(e->private_bio))) {
 		if (likely( mdev->state.pdsk >= Inconsistent )) {
 			inc_rs_pending(mdev);
-			ok=drbd_send_block(mdev, RSDataReply, e);
+			ok = drbd_send_block(mdev, RSDataReply, e);
 		} else {
 			if (DRBD_ratelimit(5*HZ, 5))
 				ERR("Not sending RSDataReply, partner DISKLESS!\n");
-			ok=1;
+			ok = 1;
 		}
 	} else {
 		if (DRBD_ratelimit(5*HZ, 5))
 			ERR("Sending NegRSDReply. sector %llus.\n",
 			    (unsigned long long)e->sector);
 
-		ok=drbd_send_ack(mdev, NegRSDReply, e);
+		ok = drbd_send_ack(mdev, NegRSDReply, e);
 
 		drbd_io_error(mdev, FALSE);
 
@@ -663,7 +663,7 @@
 {
 	struct drbd_barrier *b = (struct drbd_barrier *)w;
 	Drbd_Barrier_Packet *p = &mdev->data.sbuf.Barrier;
-	int ok=1;
+	int ok = 1;
 
 	/* really avoid racing with tl_clear.  w.cb may have been referenced
 	 * just before it was reassigned and requeued, so double check that.
@@ -751,7 +751,7 @@
 	int i;
 
 	local_irq_disable();
-	for (i=0; i < minor_count; i++) {
+	for (i = 0; i < minor_count; i++) {
 		if (!(mdev = minor_to_mdev(i))) continue;
 		spin_lock(&mdev->req_lock);
 	}
@@ -762,7 +762,7 @@
 	drbd_dev *mdev;
 	int i;
 
-	for (i=0; i < minor_count; i++) {
+	for (i = 0; i < minor_count; i++) {
 		if (!(mdev = minor_to_mdev(i))) continue;
 		spin_unlock(&mdev->req_lock);
 	}
@@ -795,7 +795,7 @@
 	drbd_dev *odev;
 	int i, rv = 0;
 
-	for (i=0; i < minor_count; i++) {
+	for (i = 0; i < minor_count; i++) {
 		if ( !(odev = minor_to_mdev(i)) ) continue;
 		if (! _drbd_may_sync_now(odev)) {
 			rv |= ( _drbd_set_state(_NS(odev, aftr_isp, 1),
@@ -818,7 +818,7 @@
 	drbd_dev *odev;
 	int i, rv = 0;
 
-	for (i=0; i < minor_count; i++) {
+	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)) {
@@ -871,7 +871,7 @@
 void drbd_start_resync(drbd_dev *mdev, drbd_conns_t side)
 {
 	drbd_state_t os, ns;
-	int r=0;
+	int r = 0;
 
 	MTRACE(TraceTypeResync, TraceLvlSummary,
 	       INFO("Resync starting: side=%s\n",
@@ -949,7 +949,7 @@
 	drbd_dev *mdev = thi->mdev;
 	struct drbd_work *w = 0;
 	LIST_HEAD(work_list);
-	int intr=0, i;
+	int intr = 0, i;
 
 	sprintf(current->comm, "drbd%d_worker", mdev_to_minor(mdev));
 

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:44:06 UTC (rev 2987)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd.h	2007-07-24 11:50:16 UTC (rev 2988)
@@ -72,7 +72,7 @@
 /* KEEP the order, do not delete or insert!
  * Or change the API_VERSION, too. */
 enum ret_codes {
-	RetCodeBase=100,
+	RetCodeBase = 100,
 	NoError,         // 101 ...
 	LAAlreadyInUse,
 	OAAlreadyInUse,
@@ -122,10 +122,10 @@
 #define DRBD_PROT_C   3
 
 typedef enum {
-	Unknown=0,
-	Primary=1,     // role
-	Secondary=2,   // role
-	role_mask=3,
+	Unknown = 0,
+	Primary = 1,     // role
+	Secondary = 2,   // role
+	role_mask = 3,
 } drbd_role_t;
 
 /* The order of these constants is important.
@@ -158,7 +158,7 @@
 	SyncTarget,     // state must be the same for source and target. (+2)
 	PausedSyncS,    // All SyncStates are tested with this comparison
 	PausedSyncT,    // xx >= SyncSource && xx <= PausedSyncT
-	conn_mask=31
+	conn_mask = 31
 } drbd_conns_t;
 
 typedef enum {
@@ -172,7 +172,7 @@
 	DUnknown,       /* Only used for the peer, never for myself */
 	Consistent,     /* Might be Outdated, might be UpToDate ... */
 	UpToDate,       /* Only this disk state allows applications' IO ! */
-	disk_mask=15
+	disk_mask = 15
 } drbd_disks_t;
 
 typedef union {
@@ -192,22 +192,22 @@
 } drbd_state_t;
 
 typedef enum {
-	SS_CW_NoNeed=4,
-	SS_CW_Success=3,
-	SS_NothingToDo=2,
-	SS_Success=1,
-	SS_UnknownError=0, // Used to sleep longer in _drbd_request_state
-	SS_TwoPrimaries=-1,
-	SS_NoUpToDateDisk=-2,
-	SS_BothInconsistent=-4,
-	SS_SyncingDiskless=-5,
-	SS_ConnectedOutdates=-6,
-	SS_PrimaryNOP=-7,
-	SS_ResyncRunning=-8,
-	SS_AlreadyStandAlone=-9,
-	SS_CW_FailedByPeer=-10,
-	SS_IsDiskLess=-11,
-	SS_DeviceInUse=-12
+	SS_CW_NoNeed = 4,
+	SS_CW_Success = 3,
+	SS_NothingToDo = 2,
+	SS_Success = 1,
+	SS_UnknownError = 0, // Used to sleep longer in _drbd_request_state
+	SS_TwoPrimaries = -1,
+	SS_NoUpToDateDisk = -2,
+	SS_BothInconsistent = -4,
+	SS_SyncingDiskless = -5,
+	SS_ConnectedOutdates = -6,
+	SS_PrimaryNOP = -7,
+	SS_ResyncRunning = -8,
+	SS_AlreadyStandAlone = -9,
+	SS_CW_FailedByPeer = -10,
+	SS_IsDiskLess = -11,
+	SS_DeviceInUse = -12
 } set_st_err_t;
 
 /* from drbd_strings.c */

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:44:06 UTC (rev 2987)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 11:50:16 UTC (rev 2988)
@@ -67,7 +67,7 @@
 		lc->new_number	     = -1;
 		lc->lc_private       = private_p;
 		lc->name             = name;
-		for(i=0;i<e_count;i++) {
+		for(i = 0;i<e_count;i++) {
 			e = lc_entry(lc, i);
 			e->lc_number = LC_FREE;
 			list_add(&e->list, &lc->free);
@@ -132,8 +132,8 @@
 
 	if (list_empty(&lc->lru)) return 0;
 
-	n=lc->lru.prev;
-	e=list_entry(n, struct lc_element, list);
+	n = lc->lru.prev;
+	e = list_entry(n, struct lc_element, list);
 
 	list_del(&e->list);
 	hlist_del(&e->colision);
@@ -166,7 +166,7 @@
 
 	if (list_empty(&lc->free)) return lc_evict(lc);
 
-	n=lc->free.next;
+	n = lc->free.next;
 	list_del(n);
 	return list_entry(n, struct lc_element, list);
 }
@@ -354,7 +354,7 @@
 	int i;
 
 	seq_printf(seq, "\tnn: lc_number refcnt %s\n ", utext);
-	for(i=0;i<nr_elements;i++) {
+	for(i = 0;i<nr_elements;i++) {
 		e = lc_entry(lc, i);
 		if (e->lc_number == LC_FREE) {
 			seq_printf(seq, "\t%2d: FREE\n", i );

From drbd-cvs at lists.linbit.com  Tue Jul 24 14:51:38 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 14:51:43 2007
Subject: [DRBD-cvs] svn commit by lars - r2989 - in
	branches/drbd-8.0-for-linus/drbd: . linux -
	376cd1f1a5c72806ce46dead3f53d9c1256629f6 fix C99 // com
Message-ID: <20070724125138.5187540095@garcon1.linbit.com>

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@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@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,

From drbd-cvs at lists.linbit.com  Tue Jul 24 15:06:55 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 15:06:58 2007
Subject: [DRBD-cvs] svn commit by lars - r2990 -
	branches/drbd-8.0-for-linus/drbd -
	f278e43a436d3486d397010377c7a08c48e9b58f fix many 'brac
Message-ID: <20070724130655.79F9C40095@garcon1.linbit.com>

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;

From drbd-cvs at lists.linbit.com  Tue Jul 24 15:18:48 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 15:18:50 2007
Subject: [DRBD-cvs] svn commit by lars - r2991 - in
	branches/drbd-8.0-for-linus/drbd: . linux -
	10f7422a447552217cfde072c650c0f02c8ea602 fix pointer de
Message-ID: <20070724131848.6890E40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 15:18:46 +0200 (Tue, 24 Jul 2007)
New Revision: 2991

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_req.h
   branches/drbd-8.0-for-linus/drbd/drbd_strings.c
   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_tag_magic.h
   branches/drbd-8.0-for-linus/drbd/lru_cache.c
   branches/drbd-8.0-for-linus/drbd/lru_cache.h
Log:
10f7422a447552217cfde072c650c0f02c8ea602 fix pointer declarations/casts foo* ==> foo *


Modified: branches/drbd-8.0-for-linus/drbd/drbd_actlog.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 13:18:46 UTC (rev 2991)
@@ -175,7 +175,7 @@
 
 struct update_al_work {
 	struct drbd_work w;
-	struct lc_element * al_ext;
+	struct lc_element *al_ext;
 	struct completion event;
 	unsigned int enr;
 };
@@ -183,14 +183,14 @@
 STATIC int w_al_write_transaction(struct Drbd_Conf *, struct drbd_work *, int);
 
 static inline
-struct lc_element* _al_get(struct Drbd_Conf *mdev, unsigned int enr)
+struct lc_element *_al_get(struct Drbd_Conf *mdev, unsigned int enr)
 {
 	struct lc_element *al_ext;
 	struct bm_extent  *bm_ext;
 	unsigned long     al_flags = 0;
 
 	spin_lock_irq(&mdev->al_lock);
-	bm_ext = (struct bm_extent*) lc_find(mdev->resync, enr/AL_EXT_PER_BM_SECT);
+	bm_ext = (struct bm_extent *) lc_find(mdev->resync, enr/AL_EXT_PER_BM_SECT);
 	if (unlikely(bm_ext!=NULL)) {
 		if (test_bit(BME_NO_WRITES, &bm_ext->flags)) {
 			spin_unlock_irq(&mdev->al_lock);
@@ -299,15 +299,15 @@
 {
 	int i, n, mx;
 	unsigned int extent_nr;
-	struct al_transaction* buffer;
+	struct al_transaction *buffer;
 	sector_t sector;
 	u32 xor_sum = 0;
 
-	struct lc_element *updated = ((struct update_al_work*)w)->al_ext;
-	unsigned int new_enr = ((struct update_al_work*)w)->enr;
+	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, ... */
-	buffer = (struct al_transaction*)page_address(mdev->md_io_page);
+	buffer = (struct al_transaction *)page_address(mdev->md_io_page);
 
 	buffer->magic = __constant_cpu_to_be32(DRBD_MAGIC);
 	buffer->tr_number = cpu_to_be32(mdev->al_tr_number);
@@ -357,7 +357,7 @@
 
 	up(&mdev->md_io_mutex);
 
-	complete(&((struct update_al_work*)w)->event);
+	complete(&((struct update_al_work *)w)->event);
 
 	return 1;
 }
@@ -370,7 +370,7 @@
  */
 STATIC int drbd_al_read_tr(struct Drbd_Conf *mdev,
 			   struct drbd_backing_dev *bdev,
-			   struct al_transaction* b,
+			   struct al_transaction *b,
 			   int index)
 {
 	sector_t sector;
@@ -400,7 +400,7 @@
  */
 int drbd_al_read_log(struct Drbd_Conf *mdev, struct drbd_backing_dev *bdev)
 {
-	struct al_transaction* buffer;
+	struct al_transaction *buffer;
 	int from = -1, to = -1, i, cnr, overflow = 0, rv;
 	u32 from_tnr = -1, to_tnr = 0;
 	int active_extents = 0;
@@ -627,7 +627,7 @@
 
 	nr_elements = mdev->act_log->nr_elements;
 
-	bios = kzalloc(sizeof(struct bio*) * nr_elements, GFP_KERNEL);
+	bios = kzalloc(sizeof(struct bio *) * nr_elements, GFP_KERNEL);
 	if (!bios) goto submit_one_by_one;
 
 	atomic_set(&wc.count, 0);
@@ -766,7 +766,7 @@
 
 STATIC int w_update_odbm(drbd_dev *mdev, struct drbd_work *w, int unused)
 {
-	struct update_odbm_work *udw = (struct update_odbm_work*)w;
+	struct update_odbm_work *udw = (struct update_odbm_work *)w;
 
 	if ( !inc_local_if_state(mdev, Attaching) ) {
 		if (DRBD_ratelimit(5*HZ, 5))
@@ -801,8 +801,8 @@
 STATIC void drbd_try_clear_on_disk_bm(struct Drbd_Conf *mdev, sector_t sector,
 				      int count, int success)
 {
-	struct bm_extent* ext;
-	struct update_odbm_work * udw;
+	struct bm_extent *ext;
+	struct update_odbm_work *udw;
 
 	unsigned int enr;
 
@@ -885,7 +885,7 @@
  * called by worker on SyncTarget and receiver on SyncSource.
  *
  */
-void __drbd_set_in_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line)
+void __drbd_set_in_sync(drbd_dev *mdev, sector_t sector, int size, const char *file, const unsigned int line)
 {
 	/* Is called from worker and receiver context _only_ */
 	unsigned long sbnr, ebnr, lbnr, bnr;
@@ -963,7 +963,7 @@
  * called by tl_clear and drbd_send_dblock (==drbd_make_request).
  * so this can be _any_ process.
  */
-void __drbd_set_out_of_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line)
+void __drbd_set_out_of_sync(drbd_dev *mdev, sector_t sector, int size, const char *file, const unsigned int line)
 {
 	unsigned long sbnr, ebnr, lbnr;
 	sector_t esector, nr_sectors;
@@ -1015,7 +1015,7 @@
 }
 
 static inline
-struct bm_extent* _bme_get(struct Drbd_Conf *mdev, unsigned int enr)
+struct bm_extent *_bme_get(struct Drbd_Conf *mdev, unsigned int enr)
 {
 	struct bm_extent  *bm_ext;
 	int wakeup = 0;
@@ -1026,12 +1026,12 @@
 		spin_unlock_irq(&mdev->al_lock);
 		return NULL;
 	}
-	bm_ext = (struct bm_extent*) lc_get(mdev->resync, enr);
+	bm_ext = (struct bm_extent *) lc_get(mdev->resync, enr);
 	if (bm_ext) {
 		if (bm_ext->lce.lc_number != enr) {
 			bm_ext->rs_left = drbd_bm_e_weight(mdev, enr);
 			bm_ext->rs_failed = 0;
-			lc_changed(mdev->resync, (struct lc_element*)bm_ext);
+			lc_changed(mdev->resync, (struct lc_element *)bm_ext);
 			wakeup = 1;
 		}
 		if (bm_ext->lce.refcnt == 1) mdev->resync_locked++;
@@ -1053,7 +1053,7 @@
 
 static inline int _is_in_al(drbd_dev* mdev, unsigned int enr)
 {
-	struct lc_element* al_ext;
+	struct lc_element *al_ext;
 	int rv = 0;
 
 	spin_lock_irq(&mdev->al_lock);
@@ -1087,7 +1087,7 @@
 int drbd_rs_begin_io(drbd_dev* mdev, sector_t sector)
 {
 	unsigned int enr = BM_SECT_TO_EXT(sector);
-	struct bm_extent* bm_ext;
+	struct bm_extent *bm_ext;
 	int i, sig;
 
 	MTRACE(TraceTypeResync, TraceLvlAll,
@@ -1135,7 +1135,7 @@
 {
 	unsigned int enr = BM_SECT_TO_EXT(sector);
 	const unsigned int al_enr = enr*AL_EXT_PER_BM_SECT;
-	struct bm_extent* bm_ext;
+	struct bm_extent *bm_ext;
 	int i;
 
 	MTRACE(TraceTypeResync, TraceLvlAll,
@@ -1162,7 +1162,7 @@
 			INFO("dropping %u, aparently got 'synced' "
 			     "by application io\n", mdev->resync_wenr);
 		);
-		bm_ext = (struct bm_extent*)lc_find(mdev->resync, mdev->resync_wenr);
+		bm_ext = (struct bm_extent *)lc_find(mdev->resync, mdev->resync_wenr);
 		if (bm_ext) {
 			D_ASSERT(!test_bit(BME_LOCKED, &bm_ext->flags));
 			D_ASSERT(test_bit(BME_NO_WRITES, &bm_ext->flags));
@@ -1174,7 +1174,7 @@
 			ALERT("LOGIC BUG\n");
 		}
 	}
-	bm_ext = (struct bm_extent*)lc_try_get(mdev->resync, enr);
+	bm_ext = (struct bm_extent *)lc_try_get(mdev->resync, enr);
 	if (bm_ext) {
 		if (test_bit(BME_LOCKED, &bm_ext->flags))
 			goto proceed;
@@ -1195,7 +1195,7 @@
 	} else {
 		if (mdev->resync_locked > mdev->resync->nr_elements-3)
 			goto try_again;
-		bm_ext = (struct bm_extent*)lc_get(mdev->resync, enr);
+		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)
@@ -1207,7 +1207,7 @@
 		if (bm_ext->lce.lc_number != enr) {
 			bm_ext->rs_left = drbd_bm_e_weight(mdev, enr);
 			bm_ext->rs_failed = 0;
-			lc_changed(mdev->resync, (struct lc_element*)bm_ext);
+			lc_changed(mdev->resync, (struct lc_element *)bm_ext);
 			wake_up(&mdev->al_wait);
 			D_ASSERT(test_bit(BME_LOCKED, &bm_ext->flags) == 0);
 		}
@@ -1244,7 +1244,7 @@
 void drbd_rs_complete_io(drbd_dev* mdev, sector_t sector)
 {
 	unsigned int enr = BM_SECT_TO_EXT(sector);
-	struct bm_extent* bm_ext;
+	struct bm_extent *bm_ext;
 	unsigned long flags;
 
 	MTRACE(TraceTypeResync, TraceLvlAll,
@@ -1253,7 +1253,7 @@
 	    );
 
 	spin_lock_irqsave(&mdev->al_lock, flags);
-	bm_ext = (struct bm_extent*) lc_find(mdev->resync, enr);
+	bm_ext = (struct bm_extent *) lc_find(mdev->resync, enr);
 	if (!bm_ext) {
 		spin_unlock_irqrestore(&mdev->al_lock, flags);
 		ERR("drbd_rs_complete_io() called, but extent not found\n");
@@ -1283,7 +1283,7 @@
  */
 void drbd_rs_cancel_all(drbd_dev* mdev)
 {
-	struct bm_extent* bm_ext;
+	struct bm_extent *bm_ext;
 	int i;
 
 	MTRACE(TraceTypeResync, TraceLvlMetrics,
@@ -1295,7 +1295,7 @@
 	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);
+			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->rs_left = 0;
@@ -1320,7 +1320,7 @@
  */
 int drbd_rs_del_all(drbd_dev* mdev)
 {
-	struct bm_extent* bm_ext;
+	struct bm_extent *bm_ext;
 	int i;
 
 	MTRACE(TraceTypeResync, TraceLvlMetrics,
@@ -1332,7 +1332,7 @@
 	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);
+			bm_ext = (struct bm_extent *) lc_entry(mdev->resync, i);
 			if (bm_ext->lce.lc_number == LC_FREE) continue;
 			if (bm_ext->lce.lc_number == mdev->resync_wenr) {
 				INFO("dropping %u in drbd_rs_del_all, "

Modified: branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 13:18:46 UTC (rev 2991)
@@ -108,7 +108,7 @@
 #define BM_LOCKED 0
 #define BM_MD_IO_ERROR (BITS_PER_LONG-1) /* 31? 63? */
 
-void __drbd_bm_lock(drbd_dev *mdev, char* file, int line)
+void __drbd_bm_lock(drbd_dev *mdev, char *file, int line)
 {
        struct drbd_bitmap *b = mdev->bitmap;
        spin_lock_irq(&b->bm_lock);
@@ -145,7 +145,7 @@
 
 #if DUMP_MD >= 3
 /* debugging aid */
-STATIC void bm_end_info(drbd_dev *mdev, const char* where)
+STATIC void bm_end_info(drbd_dev *mdev, const char *where)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	size_t w = (b->bm_bits-1) >> LN2_BPL;
@@ -224,7 +224,7 @@
  * this masks out the remaining bits.
  * Rerturns the number of bits cleared.
  */
-STATIC int bm_clear_surplus(struct drbd_bitmap * b)
+STATIC int bm_clear_surplus(struct drbd_bitmap *b)
 {
 	const unsigned long mask = (1UL << (b->bm_bits & (BITS_PER_LONG-1))) -1;
 	size_t w = b->bm_bits >> LN2_BPL;
@@ -243,7 +243,7 @@
 	return cleared;
 }
 
-STATIC void bm_set_surplus(struct drbd_bitmap * b)
+STATIC void bm_set_surplus(struct drbd_bitmap *b)
 {
 	const unsigned long mask = (1UL << (b->bm_bits & (BITS_PER_LONG-1))) -1;
 	size_t w = b->bm_bits >> LN2_BPL;
@@ -255,7 +255,7 @@
 		b->bm[w++] = ~(0UL);
 }
 
-STATIC unsigned long bm_count_bits(struct drbd_bitmap * b, int just_read)
+STATIC unsigned long bm_count_bits(struct drbd_bitmap *b, int just_read)
 {
 	unsigned long *bm = b->bm;
 	unsigned long *ep = b->bm + b->bm_words;
@@ -271,7 +271,7 @@
 	return bits;
 }
 
-void _drbd_bm_recount_bits(drbd_dev *mdev, char* file, int line)
+void _drbd_bm_recount_bits(drbd_dev *mdev, char *file, int line)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long flags, bits;
@@ -430,7 +430,7 @@
  * buffer[i] is expected to be little endian unsigned long.
  */
 void drbd_bm_merge_lel( drbd_dev *mdev, size_t offset, size_t number,
-			unsigned long* buffer )
+			unsigned long *buffer )
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long *bm;
@@ -468,7 +468,7 @@
  * buffer[i] is expected to be little endian unsigned long.
  */
 void drbd_bm_set_lel( drbd_dev *mdev, size_t offset, size_t number,
-		      unsigned long* buffer )
+		      unsigned long *buffer )
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long *bm;
@@ -506,7 +506,7 @@
  * buffer[i] will be little endian unsigned long.
  */
 void drbd_bm_get_lel( drbd_dev *mdev, size_t offset, size_t number,
-		      unsigned long* buffer )
+		      unsigned long *buffer )
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long *bm;
@@ -581,7 +581,7 @@
 	/* we are process context. we always get a bio */
 	/* THINK: do we need GFP_NOIO here? */
 	struct bio *bio = bio_alloc(GFP_KERNEL, 1);
-	struct page *page = vmalloc_to_page((char*)(b->bm) + (PAGE_SIZE*page_nr));
+	struct page *page = vmalloc_to_page((char *)(b->bm) + (PAGE_SIZE*page_nr));
 	unsigned int len;
 	sector_t on_disk_sector = mdev->bc->md.md_offset + mdev->bc->md.bm_offset;
 	on_disk_sector += ((sector_t)page_nr) << (PAGE_SHIFT-9);
@@ -1032,7 +1032,7 @@
 	e = min((size_t)S2W(enr+1), b->bm_words);
 	count = 0;
 	if (s < b->bm_words) {
-		const unsigned long* w = b->bm+s;
+		const unsigned long *w = b->bm+s;
 		int n = e-s;
 		while (n--) count += hweight_long(*w++);
 	} else {
@@ -1061,7 +1061,7 @@
 	e = min_t(size_t, s + BM_WORDS_PER_AL_EXT, b->bm_words);
 	count = 0;
 	if (s < b->bm_words) {
-		const unsigned long* w = b->bm+s;
+		const unsigned long *w = b->bm+s;
 		int n = e-s;
 		while (n--) count += hweight_long(*w++);
 		n = e-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 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 13:18:46 UTC (rev 2991)
@@ -316,7 +316,7 @@
 	HandShake  = 0xfffe  /* FIXED for the next century! */
 } Drbd_Packet_Cmd;
 
-static inline const char* cmdname(Drbd_Packet_Cmd cmd)
+static inline const char *cmdname(Drbd_Packet_Cmd cmd)
 {
 	/* THINK may need to become several global tables
 	 * when we want to support more than
@@ -812,10 +812,10 @@
 	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;
+	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;
 
 	/* blocks to sync in this run [unit BM_BLOCK_SIZE] */
@@ -834,10 +834,10 @@
 	struct Drbd_thread receiver;
 	struct Drbd_thread worker;
 	struct Drbd_thread asender;
-	struct drbd_bitmap* bitmap;
+	struct drbd_bitmap *bitmap;
 
 	/* Used to track operations of resync... */
-	struct lru_cache* resync;
+	struct lru_cache *resync;
 	/* Number of locked elements in resync LRU */
 	unsigned int resync_locked;
 	/* resync extent number waiting for application requests */
@@ -869,11 +869,11 @@
 	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 */
-	struct crypto_hash* cram_hmac_tfm;
+	struct crypto_hash *cram_hmac_tfm;
 	wait_queue_head_t seq_wait;
 	atomic_t packet_seq;
 	unsigned int peer_seq;
@@ -953,7 +953,7 @@
 extern struct drbd_barrier *_tl_add_barrier(drbd_dev *, struct drbd_barrier *);
 extern void drbd_free_sock(drbd_dev *mdev);
 extern int drbd_send(drbd_dev *mdev, struct socket *sock,
-		     void* buf, size_t size, unsigned msg_flags);
+		     void *buf, size_t size, unsigned msg_flags);
 extern int drbd_send_protocol(drbd_dev *mdev);
 extern int drbd_send_uuids(drbd_dev *mdev);
 extern int drbd_send_sync_uuid(drbd_dev *mdev, u64 val);
@@ -967,7 +967,7 @@
 extern int drbd_send_cmd(drbd_dev *mdev, int use_data_socket,
 			  Drbd_Packet_Cmd cmd, Drbd_Header *h, size_t size);
 extern int drbd_send_cmd2(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
-			  char* data, size_t size);
+			  char *data, size_t size);
 extern int drbd_send_sync_param(drbd_dev *mdev, struct syncer_conf *sc);
 extern int drbd_send_b_ack(drbd_dev *mdev, u32 barrier_nr,
 			   u32 set_size);
@@ -988,13 +988,13 @@
 extern int drbd_send_bitmap(drbd_dev *mdev);
 extern int _drbd_send_bitmap(drbd_dev *mdev);
 extern int drbd_send_sr_reply(drbd_dev *mdev, int retcode);
-extern void drbd_free_bc(struct drbd_backing_dev* bc);
+extern void drbd_free_bc(struct drbd_backing_dev *bc);
 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) */
 extern void drbd_md_sync(drbd_dev *mdev);
-extern int  drbd_md_read(drbd_dev *mdev, struct drbd_backing_dev * bdev);
+extern int  drbd_md_read(drbd_dev *mdev, struct drbd_backing_dev *bdev);
 /* 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);
@@ -1160,21 +1160,21 @@
 extern int drbd_bm_rs_done(drbd_dev *mdev);
 /* for receive_bitmap */
 extern void drbd_bm_merge_lel (drbd_dev *mdev, size_t offset, size_t number,
-				unsigned long* buffer);
+				unsigned long *buffer);
 /* 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);
+				unsigned long *buffer);
 /*
  * only used by drbd_bm_read_sect
 extern void drbd_bm_set_lel   (drbd_dev *mdev, size_t offset, size_t number,
 				unsigned long* buffer);
 */
 
-extern void __drbd_bm_lock    (drbd_dev *mdev, char* file, int line);
+extern void __drbd_bm_lock    (drbd_dev *mdev, char *file, int line);
 extern void drbd_bm_unlock    (drbd_dev *mdev);
 #define drbd_bm_lock(mdev)    __drbd_bm_lock(mdev, __FILE__, __LINE__ )
 
-extern void _drbd_bm_recount_bits(drbd_dev *mdev, char* file, int line);
+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 */
 
@@ -1188,7 +1188,7 @@
 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;
@@ -1272,11 +1272,11 @@
 
 /* Packet dumping support */
 extern void _dump_packet(drbd_dev *mdev, struct socket *sock,
-			 int recv, Drbd_Polymorph_Packet *p, char* file, int line);
+			 int recv, Drbd_Polymorph_Packet *p, char *file, int line);
 
 static inline void
 dump_packet(drbd_dev *mdev, struct socket *sock,
-	    int recv, Drbd_Polymorph_Packet *p, char* file, int line)
+	    int recv, Drbd_Polymorph_Packet *p, char *file, int line)
 {
 	MTRACE(TraceTypePacket, TraceLvlSummary,
 	       _dump_packet(mdev, sock, recv, p, file, line);
@@ -1300,7 +1300,7 @@
 
 
 /* drbd_nl.c */
-extern char* ppsize(char* buf, unsigned long long size);
+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*);
 extern void drbd_setup_queue_param(drbd_dev *mdev, unsigned int);
@@ -1309,7 +1309,7 @@
 		      unsigned int cmd, unsigned long arg);
 drbd_disks_t drbd_try_outdate_peer(drbd_dev *mdev);
 extern long drbd_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg);
-extern int drbd_khelper(drbd_dev *mdev, char* cmd);
+extern int drbd_khelper(drbd_dev *mdev, char *cmd);
 
 /* drbd_worker.c */
 extern int drbd_worker(struct Drbd_thread *thi);
@@ -1339,13 +1339,13 @@
 extern void resync_timer_fn(unsigned long data);
 
 /* 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,
+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,
 					    sector_t sector,
 					    unsigned int data_size,
 					    unsigned int gfp_mask);
-extern void drbd_free_ee(drbd_dev *mdev, struct Tl_epoch_entry* e);
+extern void drbd_free_ee(drbd_dev *mdev, struct Tl_epoch_entry *e);
 extern void drbd_wait_ee_list_empty(drbd_dev *mdev, struct list_head *head);
 extern void _drbd_wait_ee_list_empty(drbd_dev *mdev, struct list_head *head);
 extern void drbd_set_recv_tcq(drbd_dev *mdev, int tcq_enabled);
@@ -1358,7 +1358,7 @@
 	int val = 1;
 
 	set_fs(KERNEL_DS);
-	tcp_setsockopt(sock->sk, SOL_TCP, TCP_CORK, (char*)&val, sizeof(val) );
+	tcp_setsockopt(sock->sk, SOL_TCP, TCP_CORK, (char *)&val, sizeof(val) );
 	set_fs(oldfs);
 #else
 	tcp_sk(sock->sk)->nonagle |= TCP_NAGLE_CORK;
@@ -1372,7 +1372,7 @@
 	int val = 0;
 
 	set_fs(KERNEL_DS);
-	tcp_setsockopt(sock->sk, SOL_TCP, TCP_CORK, (char*)&val, sizeof(val) );
+	tcp_setsockopt(sock->sk, SOL_TCP, TCP_CORK, (char *)&val, sizeof(val) );
 	set_fs(oldfs);
 #else
 	tcp_sk(sock->sk)->nonagle &= ~TCP_NAGLE_CORK;
@@ -1383,8 +1383,8 @@
 /* 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);
+extern const char *conns_to_name(drbd_conns_t s);
+extern const char *roles_to_name(drbd_role_t s);
 
 /* drbd_actlog.c */
 extern void drbd_al_begin_io(struct Drbd_Conf *mdev, sector_t sector);
@@ -1396,10 +1396,10 @@
 extern int drbd_rs_del_all(drbd_dev* mdev);
 extern void drbd_rs_failed_io(drbd_dev* mdev, sector_t sector, int size);
 extern int drbd_al_read_log(struct Drbd_Conf *mdev, struct drbd_backing_dev *);
-extern void __drbd_set_in_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line);
+extern void __drbd_set_in_sync(drbd_dev *mdev, sector_t sector, int size, const char *file, const unsigned int line);
 #define drbd_set_in_sync(mdev, sector, size) \
 	__drbd_set_in_sync(mdev, sector, size, __FILE__, __LINE__ )
-extern void __drbd_set_out_of_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line);
+extern void __drbd_set_out_of_sync(drbd_dev *mdev, sector_t sector, int size, const char *file, const unsigned int line);
 #define drbd_set_out_of_sync(mdev, sector, size) \
 	__drbd_set_out_of_sync(mdev, sector, size, __FILE__, __LINE__ )
 extern void drbd_al_apply_to_bm(struct Drbd_Conf *mdev);
@@ -1498,7 +1498,7 @@
 	}
 }
 
-static inline int semaphore_is_locked(struct semaphore* s)
+static inline int semaphore_is_locked(struct semaphore *s)
 {
 	if (!down_trylock(s)) {
 		up(s);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 13:18:46 UTC (rev 2991)
@@ -63,9 +63,9 @@
 	enum chg_state_flags flags;
 };
 
-int drbdd_init(struct Drbd_thread*);
-int drbd_worker(struct Drbd_thread*);
-int drbd_asender(struct Drbd_thread*);
+int drbdd_init(struct Drbd_thread *);
+int drbd_worker(struct Drbd_thread *);
+int drbd_asender(struct Drbd_thread *);
 
 int drbd_init(void);
 STATIC int drbd_open(struct inode *inode, struct file *file);
@@ -138,7 +138,7 @@
    Note: This is a single linked list, the next pointer is the private
          member of struct page.
  */
-struct page* drbd_pp_pool;
+struct page *drbd_pp_pool;
 spinlock_t   drbd_pp_lock;
 int          drbd_pp_vacant;
 wait_queue_head_t drbd_pp_wait;
@@ -788,7 +788,7 @@
 	}
 
 	if (flags & ScheduleAfter) {
-		struct after_state_chg_work* ascw;
+		struct after_state_chg_work *ascw;
 
 		ascw = kmalloc(sizeof(*ascw), GFP_ATOMIC);
 		if (ascw) {
@@ -807,9 +807,9 @@
 
 STATIC int w_after_state_ch(drbd_dev *mdev, struct drbd_work *w, int unused)
 {
-	struct after_state_chg_work* ascw;
+	struct after_state_chg_work *ascw;
 
-	ascw = (struct after_state_chg_work*) w;
+	ascw = (struct after_state_chg_work *) w;
 	after_state_ch(mdev, ascw->os, ascw->ns, ascw->flags);
 	kfree(ascw);
 
@@ -1035,7 +1035,7 @@
 }
 
 
-STATIC int drbd_thread_setup(void* arg)
+STATIC int drbd_thread_setup(void *arg)
 {
 	struct Drbd_thread *thi = (struct Drbd_thread *) arg;
 	drbd_dev *mdev = thi->mdev;
@@ -1185,7 +1185,7 @@
 	h->command = cpu_to_be16(cmd);
 	h->length  = cpu_to_be16(size-sizeof(Drbd_Header));
 
-	dump_packet(mdev, sock, 0, (void*)h, __FILE__, __LINE__);
+	dump_packet(mdev, sock, 0, (void *)h, __FILE__, __LINE__);
 	sent = drbd_send(mdev, sock, h, size, msg_flags);
 
 	ok = ( sent == size );
@@ -1224,7 +1224,7 @@
 	return ok;
 }
 
-int drbd_send_cmd2(drbd_dev *mdev, Drbd_Packet_Cmd cmd, char* data,
+int drbd_send_cmd2(drbd_dev *mdev, Drbd_Packet_Cmd cmd, char *data,
 		   size_t size)
 {
 	Drbd_Header h;
@@ -1237,7 +1237,7 @@
 	if (!drbd_get_data_sock(mdev))
 		return 0;
 
-	dump_packet(mdev, mdev->data.socket, 0, (void*)&h, __FILE__, __LINE__);
+	dump_packet(mdev, mdev->data.socket, 0, (void *)&h, __FILE__, __LINE__);
 
 	ok = ( sizeof(h) == drbd_send(mdev, mdev->data.socket, &h, sizeof(h), 0) );
 	ok = ok && ( size == drbd_send(mdev, mdev->data.socket, data, size, 0) );
@@ -1381,7 +1381,7 @@
 
 	bm_words = drbd_bm_words(mdev);
 	p  = vmalloc(PAGE_SIZE); /* sleeps. cannot fail. */
-	buffer = (unsigned long*)p->payload;
+	buffer = (unsigned long *)p->payload;
 
 	if (drbd_md_test_flag(mdev->bc, MDF_FullSync)) {
 		drbd_bm_set_all(mdev);
@@ -1673,7 +1673,7 @@
 		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__);
+	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) {
@@ -1712,7 +1712,7 @@
 	if (!drbd_get_data_sock(mdev))
 		return 0;
 
-	dump_packet(mdev, mdev->data.socket, 0, (void*)&p, __FILE__, __LINE__);
+	dump_packet(mdev, mdev->data.socket, 0, (void *)&p, __FILE__, __LINE__);
 	ok = sizeof(p) == drbd_send(mdev, mdev->data.socket, &p, sizeof(p), MSG_MORE);
 	if (ok) ok = _drbd_send_zc_bio(mdev, e->private_bio);
 
@@ -1737,7 +1737,7 @@
  * you must have down()ed the appropriate [m]sock_mutex elsewhere!
  */
 int drbd_send(drbd_dev *mdev, struct socket *sock,
-	      void* buf, size_t size, unsigned msg_flags)
+	      void *buf, size_t size, unsigned msg_flags)
 {
 #if !HAVE_KERNEL_SENDMSG
 	mm_segment_t oldfs;
@@ -2080,7 +2080,7 @@
 
 	while(drbd_pp_pool) {
 		page = drbd_pp_pool;
-		drbd_pp_pool = (struct page*)page_private(page);
+		drbd_pp_pool = (struct page *)page_private(page);
 		__free_page(page);
 		drbd_pp_vacant--;
 	}
@@ -2314,7 +2314,7 @@
 	/* 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);
+	mdev->app_reads_hash = kzalloc(APP_R_HSIZE*sizeof(void *), GFP_KERNEL);
 	if (!mdev->app_reads_hash) goto Enomem;
 
 	return mdev;
@@ -2415,7 +2415,7 @@
 	return err;
 }
 
-void drbd_free_bc(struct drbd_backing_dev* bc)
+void drbd_free_bc(struct drbd_backing_dev *bc)
 {
 	if (bc == NULL) return;
 
@@ -2478,7 +2478,7 @@
  */
 void drbd_md_sync(drbd_dev *mdev)
 {
-	struct meta_data_on_disk * buffer;
+	struct meta_data_on_disk *buffer;
 	sector_t sector;
 	int i;
 
@@ -2548,7 +2548,7 @@
  */
 int drbd_md_read(drbd_dev *mdev, struct drbd_backing_dev *bdev)
 {
-	struct meta_data_on_disk * buffer;
+	struct meta_data_on_disk *buffer;
 	int i, rv = NoError;
 
 	if (!inc_local_if_state(mdev, Attaching)) return MDIOError;
@@ -3031,7 +3031,7 @@
 
 void
 _dump_packet(drbd_dev *mdev, struct socket *sock,
-	    int recv, Drbd_Polymorph_Packet *p, char* file, int line)
+	    int recv, Drbd_Polymorph_Packet *p, char *file, int line)
 {
 	char *sockname = sock == mdev->meta.socket ? "meta" : "data";
 	int cmd = (recv == 2) ? p->head.command : be16_to_cpu(p->head.command);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 13:18:46 UTC (rev 2991)
@@ -47,7 +47,7 @@
 
 /* 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) \
+int name ## _from_tags (drbd_dev *mdev, unsigned short *tags, struct name *arg) \
 { \
 	int tag; \
 	int dlen; \
@@ -62,21 +62,21 @@
 				return 0; \
 			} \
 		} \
-		tags = (unsigned short*)((char*)tags + dlen); \
+		tags = (unsigned short *)((char *)tags + dlen); \
 	} \
 	return 1; \
 }
 #define INTEGER(pn, pr, member) \
 	case pn: /* D_ASSERT( tag_type(tag) == TT_INTEGER ); */ \
-		 arg->member = *(int*)(tags); \
+		 arg->member = *(int *)(tags); \
 		 break;
 #define INT64(pn, pr, member) \
 	case pn: /* D_ASSERT( tag_type(tag) == TT_INT64 ); */ \
-		 arg->member = *(u64*)(tags); \
+		 arg->member = *(u64 *)(tags); \
 		 break;
 #define BIT(pn, pr, member) \
 	case pn: /* D_ASSERT( tag_type(tag) == TT_BIT ); */ \
-		 arg->member = *(char*)(tags) ? 1 : 0; \
+		 arg->member = *(char *)(tags) ? 1 : 0; \
 		 break;
 #define STRING(pn, pr, member, len) \
 	case pn: /* D_ASSERT( tag_type(tag) == TT_STRING ); */ \
@@ -88,7 +88,7 @@
 /* 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) \
+name ## _to_tags (drbd_dev *mdev, struct name *arg, unsigned short *tags) \
 { \
 	fields \
 	return tags; \
@@ -97,27 +97,27 @@
 #define INTEGER(pn, pr, member) \
 	*tags++ = pn | pr | TT_INTEGER; \
 	*tags++ = sizeof(int); \
-	*(int*)tags = arg->member; \
-	tags = (unsigned short*)((char*)tags+sizeof(int));
+	*(int *)tags = arg->member; \
+	tags = (unsigned short *)((char *)tags+sizeof(int));
 #define INT64(pn, pr, member) \
 	*tags++ = pn | pr | TT_INT64; \
 	*tags++ = sizeof(u64); \
-	*(u64*)tags = arg->member; \
-	tags = (unsigned short*)((char*)tags+sizeof(u64));
+	*(u64 *)tags = arg->member; \
+	tags = (unsigned short *)((char *)tags+sizeof(u64));
 #define BIT(pn, pr, member) \
 	*tags++ = pn | pr | TT_BIT; \
 	*tags++ = sizeof(char); \
-	*(char*)tags = arg->member; \
-	tags = (unsigned short*)((char*)tags+sizeof(char));
+	*(char *)tags = arg->member; \
+	tags = (unsigned short *)((char *)tags+sizeof(char));
 #define STRING(pn, pr, member, len) \
 	*tags++ = pn | pr | TT_STRING; \
 	*tags++ = arg->member ## _len; \
 	memcpy(tags, arg->member, arg->member ## _len); \
-	tags = (unsigned short*)((char*)tags + arg->member ## _len);
+	tags = (unsigned short *)((char *)tags + arg->member ## _len);
 #include "linux/drbd_nl.h"
 
 extern void drbd_init_set_defaults(drbd_dev *mdev);
-void drbd_bcast_ev_helper(drbd_dev *mdev, char* helper_name);
+void drbd_bcast_ev_helper(drbd_dev *mdev, char *helper_name);
 void drbd_nl_send_reply(struct cn_msg *, int);
 
 char *nl_packet_name(int packet_type) {
@@ -139,7 +139,7 @@
 
 void nl_trace_packet(void *data) {
 	struct cn_msg *req = data;
-	struct drbd_nl_cfg_req *nlp = (struct drbd_nl_cfg_req*)req->data;
+	struct drbd_nl_cfg_req *nlp = (struct drbd_nl_cfg_req *)req->data;
 
 	printk(KERN_INFO DEVICE_NAME "%d: "
 	       "Netlink: << %s (%d) - seq: %x, ack: %x, len: %x\n",
@@ -151,7 +151,7 @@
 
 void nl_trace_reply(void *data) {
 	struct cn_msg *req = data;
-	struct drbd_nl_cfg_reply *nlp = (struct drbd_nl_cfg_reply*)req->data;
+	struct drbd_nl_cfg_reply *nlp = (struct drbd_nl_cfg_reply *)req->data;
 
 	printk(KERN_INFO DEVICE_NAME "%d: "
 	       "Netlink: >> %s (%d) - seq: %x, ack: %x, len: %x\n",
@@ -162,7 +162,7 @@
 	       req->seq, req->ack, req->len);
 }
 
-int drbd_khelper(drbd_dev *mdev, char* cmd)
+int drbd_khelper(drbd_dev *mdev, char *cmd)
 {
 	char mb[12];
 	char *argv[] = {usermode_helper, cmd, mb, NULL };
@@ -428,7 +428,7 @@
 	}
 }
 
-char* ppsize(char* buf, unsigned long long size)
+char *ppsize(char *buf, unsigned long long size)
 {
 	/* Needs 9 bytes at max. */
 	static char units[] = { 'K', 'M', 'G', 'T', 'P', 'E' };
@@ -444,7 +444,7 @@
 
 /* You should call drbd_md_sync() after calling this.
  */
-int drbd_determin_dev_size(struct Drbd_Conf* mdev)
+int drbd_determin_dev_size(struct Drbd_Conf *mdev)
 {
 	sector_t prev_first_sect, prev_size; /* previous meta location */
 	sector_t la_size;
@@ -519,7 +519,7 @@
 }
 
 sector_t
-drbd_new_dev_size(struct Drbd_Conf* mdev, struct drbd_backing_dev *bdev)
+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. */
@@ -673,9 +673,9 @@
 			     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;
+	struct lru_cache *resync_lru = NULL;
 	drbd_state_t ns, os;
 	int rv, ntries = 0;
 
@@ -781,7 +781,7 @@
 	if (bd_claim(nbc->md_bdev,
 		     (nbc->dc.meta_dev_idx==DRBD_MD_INDEX_INTERNAL ||
 		      nbc->dc.meta_dev_idx==DRBD_MD_INDEX_FLEX_INT) ?
-		     (void *)mdev : (void*) drbd_m_holder )) {
+		     (void *)mdev : (void *) drbd_m_holder )) {
 		retcode = MDMounted;
 		goto release_bdev_fail;
 	}
@@ -1102,7 +1102,7 @@
 
 	ns = new_conf->max_epoch_size/8;
 	if (mdev->tl_hash_s != ns) {
-		new_tl_hash = kzalloc(ns*sizeof(void*), GFP_KERNEL);
+		new_tl_hash = kzalloc(ns*sizeof(void *), GFP_KERNEL);
 		if (!new_tl_hash) {
 			retcode = KMallocFailed;
 			goto fail;
@@ -1111,14 +1111,14 @@
 
 	ns = new_conf->max_buffers/8;
 	if (new_conf->two_primaries && ( mdev->ee_hash_s != ns ) ) {
-		new_ee_hash = kzalloc(ns*sizeof(void*), GFP_KERNEL);
+		new_ee_hash = kzalloc(ns*sizeof(void *), GFP_KERNEL);
 		if (!new_ee_hash) {
 			retcode = KMallocFailed;
 			goto fail;
 		}
 	}
 
-	((char*)new_conf->shared_secret)[SHARED_SECRET_MAX-1] = 0;
+	((char *)new_conf->shared_secret)[SHARED_SECRET_MAX-1] = 0;
 
 #if 0
 	/* for the connection loss logic in drbd_recv
@@ -1441,7 +1441,7 @@
 
 	*tl++ = TT_END; /* Close the tag list */
 
-	return (int)((char*)tl - (char*)reply->tag_list);
+	return (int)((char *)tl - (char *)reply->tag_list);
 }
 
 STATIC int drbd_nl_get_state(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
@@ -1451,10 +1451,10 @@
 
 	tl = reply->tag_list;
 
-	tl = get_state_to_tags(mdev, (struct get_state*)&mdev->state, tl);
+	tl = get_state_to_tags(mdev, (struct get_state *)&mdev->state, tl);
 	*tl++ = TT_END; /* Close the tag list */
 
-	return (int)((char*)tl - (char*)reply->tag_list);
+	return (int)((char *)tl - (char *)reply->tag_list);
 }
 
 STATIC int drbd_nl_get_uuids(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
@@ -1469,16 +1469,16 @@
 		*tl++ = T_uuids;
 		*tl++ = UUID_SIZE*sizeof(u64);
 		memcpy(tl, mdev->bc->md.uuid, UUID_SIZE*sizeof(u64));
-		tl = (unsigned short*)((char*)tl + UUID_SIZE*sizeof(u64));
+		tl = (unsigned short *)((char *)tl + UUID_SIZE*sizeof(u64));
 		dec_local(mdev);
 		*tl++ = T_uuids_flags;
 		*tl++ = sizeof(int);
 		memcpy(tl, &mdev->bc->md.flags, sizeof(int));
-		tl = (unsigned short*)((char*)tl + sizeof(int));
+		tl = (unsigned short *)((char *)tl + sizeof(int));
 	}
 	*tl++ = TT_END; /* Close the tag list */
 
-	return (int)((char*)tl - (char*)reply->tag_list);
+	return (int)((char *)tl - (char *)reply->tag_list);
 }
 
 
@@ -1492,11 +1492,11 @@
 	/* 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 ;
-	tl = (unsigned short*)((char*)tl + sizeof(char));
+	*((char *)tl) = test_bit(USE_DEGR_WFC_T, &mdev->flags) ? 1 : 0 ;
+	tl = (unsigned short *)((char *)tl + sizeof(char));
 	*tl++ = TT_END;
 
-	return (int)((char*)tl - (char*)reply->tag_list);
+	return (int)((char *)tl - (char *)reply->tag_list);
 }
 
 STATIC drbd_dev *ensure_mdev(struct drbd_nl_cfg_req *nlp)
@@ -1567,10 +1567,10 @@
 void drbd_connector_callback(void *data)
 {
 	struct cn_msg *req = data;
-	struct drbd_nl_cfg_req *nlp = (struct drbd_nl_cfg_req*)req->data;
+	struct drbd_nl_cfg_req *nlp = (struct drbd_nl_cfg_req *)req->data;
 	struct cn_handler_struct *cm;
 	struct cn_msg *cn_reply;
-	struct drbd_nl_cfg_reply* reply;
+	struct drbd_nl_cfg_reply *reply;
 	drbd_dev *mdev;
 	int retcode, rr;
 	int reply_size = sizeof(struct cn_msg)
@@ -1601,7 +1601,7 @@
 		retcode = KMallocFailed;
 		goto fail;
 	}
-	reply = (struct drbd_nl_cfg_reply*) cn_reply->data;
+	reply = (struct drbd_nl_cfg_reply *) cn_reply->data;
 
 	reply->packet_type = cm->reply_body_size ? nlp->packet_type : P_nl_after_last_packet;
 	reply->minor = nlp->drbd_minor;
@@ -1639,12 +1639,12 @@
 		    sizeof(struct get_state_tag_len_struct)+
 		    sizeof(short int)];
 	struct cn_msg *cn_reply = (struct cn_msg *) buffer;
-	struct drbd_nl_cfg_reply* reply = (struct drbd_nl_cfg_reply*)cn_reply->data;
+	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"); */
 
-	tl = get_state_to_tags(mdev, (struct get_state*)&mdev->state, tl);
+	tl = get_state_to_tags(mdev, (struct get_state *)&mdev->state, tl);
 	*tl++ = TT_END; /* Close the tag list */
 
 	cn_reply->id.idx = CN_IDX_DRBD;
@@ -1653,7 +1653,7 @@
 	cn_reply->seq = atomic_add_return(1, &drbd_nl_seq);
 	cn_reply->ack = 0; /* not used here. */
 	cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
-		(int)((char*)tl - (char*)reply->tag_list);
+		(int)((char *)tl - (char *)reply->tag_list);
 	cn_reply->flags = 0;
 
 	reply->packet_type = P_get_state;
@@ -1665,14 +1665,14 @@
 	cn_netlink_send(cn_reply, CN_IDX_DRBD, GFP_KERNEL);
 }
 
-void drbd_bcast_ev_helper(drbd_dev *mdev, char* helper_name)
+void drbd_bcast_ev_helper(drbd_dev *mdev, char *helper_name)
 {
 	char buffer[sizeof(struct cn_msg)+
 		    sizeof(struct drbd_nl_cfg_reply)+
 		    sizeof(struct call_helper_tag_len_struct)+
 		    sizeof(short int)];
 	struct cn_msg *cn_reply = (struct cn_msg *) buffer;
-	struct drbd_nl_cfg_reply* reply = (struct drbd_nl_cfg_reply*)cn_reply->data;
+	struct drbd_nl_cfg_reply* reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
 	unsigned short *tl = reply->tag_list;
 	int str_len;
 
@@ -1682,7 +1682,7 @@
 	*tl++ = T_helper;
 	*tl++ = str_len;
 	memcpy(tl, helper_name, str_len);
-	tl = (unsigned short*)((char*)tl + str_len);
+	tl = (unsigned short *)((char *)tl + str_len);
 	*tl++ = TT_END; /* Close the tag list */
 
 	cn_reply->id.idx = CN_IDX_DRBD;
@@ -1691,7 +1691,7 @@
 	cn_reply->seq = atomic_add_return(1, &drbd_nl_seq);
 	cn_reply->ack = 0; /* not used here. */
 	cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
-		(int)((char*)tl - (char*)reply->tag_list);
+		(int)((char *)tl - (char *)reply->tag_list);
 	cn_reply->flags = 0;
 
 	reply->packet_type = P_call_helper;
@@ -1710,7 +1710,7 @@
 		    sizeof(struct sync_progress_tag_len_struct)+
 		    sizeof(short int)];
 	struct cn_msg *cn_reply = (struct cn_msg *) buffer;
-	struct drbd_nl_cfg_reply* reply = (struct drbd_nl_cfg_reply*)cn_reply->data;
+	struct drbd_nl_cfg_reply* reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
 	unsigned short *tl = reply->tag_list;
 	int res;
 	unsigned long rs_left;
@@ -1731,7 +1731,7 @@
 		*tl++ = T_sync_progress;
 		*tl++ = sizeof(int);
 		memcpy(tl, &res, sizeof(int));
-		tl = (unsigned short*)((char*)tl + sizeof(int));
+		tl = (unsigned short *)((char *)tl + sizeof(int));
 	}
 	*tl++ = TT_END; /* Close the tag list */
 
@@ -1741,7 +1741,7 @@
 	cn_reply->seq = atomic_add_return(1, &drbd_nl_seq);
 	cn_reply->ack = 0; /* not used here. */
 	cn_reply->len = sizeof(struct drbd_nl_cfg_reply) +
-		(int)((char*)tl - (char*)reply->tag_list);
+		(int)((char *)tl - (char *)reply->tag_list);
 	cn_reply->flags = 0;
 
 	reply->packet_type = P_sync_progress;
@@ -1794,7 +1794,7 @@
 {
 	char buffer[sizeof(struct cn_msg)+sizeof(struct drbd_nl_cfg_reply)];
 	struct cn_msg *cn_reply = (struct cn_msg *) buffer;
-	struct drbd_nl_cfg_reply* reply = (struct drbd_nl_cfg_reply*)cn_reply->data;
+	struct drbd_nl_cfg_reply* reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
 	int rr;
 
 	cn_reply->id = req->id;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_proc.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_proc.c	2007-07-24 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/drbd_proc.c	2007-07-24 13:18:46 UTC (rev 2991)
@@ -56,7 +56,7 @@
  *	[=====>..............] 33.5% (23456/123456)
  *	finish: 2:20:20 speed: 6,345 (6,456) K/sec
  */
-STATIC void drbd_syncer_progress(struct Drbd_Conf* mdev, struct seq_file *seq)
+STATIC void drbd_syncer_progress(struct Drbd_Conf *mdev, struct seq_file *seq)
 {
 	unsigned long res , db, dt, dbdt, rt, rs_left;
 
@@ -158,7 +158,7 @@
 }
 
 #if 0
-STATIC void resync_dump_detail(struct seq_file *seq, struct lc_element * e)
+STATIC void resync_dump_detail(struct seq_file *seq, struct lc_element *e)
 {
 	struct bm_extent *bme = (struct bm_extent *)e;
 

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 13:18:46 UTC (rev 2991)
@@ -120,7 +120,7 @@
 /**
  * drbd_bp_alloc: Returns a page. Fails only if a signal comes in.
  */
-STATIC struct page * drbd_pp_alloc(drbd_dev *mdev, unsigned int gfp_mask)
+STATIC struct page *drbd_pp_alloc(drbd_dev *mdev, unsigned int gfp_mask)
 {
 	unsigned long flags = 0;
 	struct page *page;
@@ -138,7 +138,7 @@
 	   this is only called from drbd_alloc_ee,
 	   and that is strictly process context! */
 	if ( (page = drbd_pp_pool) ) {
-		drbd_pp_pool = (struct page*)page_private(page);
+		drbd_pp_pool = (struct page *)page_private(page);
 		drbd_pp_vacant--;
 	}
 	spin_unlock_irqrestore(&drbd_pp_lock, flags);
@@ -152,7 +152,7 @@
 		/* try the pool again, maybe the drbd_kick_lo set some free */
 		spin_lock_irqsave(&drbd_pp_lock, flags);
 		if ( (page = drbd_pp_pool) ) {
-			drbd_pp_pool = (struct page*)page_private(page);
+			drbd_pp_pool = (struct page *)page_private(page);
 			drbd_pp_vacant--;
 		}
 		spin_unlock_irqrestore(&drbd_pp_lock, flags);
@@ -231,14 +231,14 @@
  drbd_wait_ee_list_empty()
 */
 
-struct Tl_epoch_entry* drbd_alloc_ee(drbd_dev *mdev,
+struct Tl_epoch_entry *drbd_alloc_ee(drbd_dev *mdev,
 				     u64 id,
 				     sector_t sector,
 				     unsigned int data_size,
 				     unsigned int gfp_mask)
 {
 	request_queue_t *q;
-	struct Tl_epoch_entry* e;
+	struct Tl_epoch_entry *e;
 	struct bio_vec *bvec;
 	struct page *page;
 	struct bio *bio;
@@ -324,7 +324,7 @@
 	return NULL;
 }
 
-void drbd_free_ee(drbd_dev *mdev, struct Tl_epoch_entry* e)
+void drbd_free_ee(drbd_dev *mdev, struct Tl_epoch_entry *e)
 {
 	struct bio *bio = e->private_bio;
 	struct bio_vec *bvec;
@@ -347,10 +347,10 @@
 }
 
 /* currently on module unload only */
-int drbd_release_ee(drbd_dev *mdev, struct list_head* list)
+int drbd_release_ee(drbd_dev *mdev, struct list_head *list)
 {
 	int count = 0;
-	struct Tl_epoch_entry* e;
+	struct Tl_epoch_entry *e;
 	struct list_head *le;
 
 	spin_lock_irq(&mdev->req_lock);
@@ -478,7 +478,7 @@
 	spin_unlock_irq(&mdev->req_lock);
 }
 
-STATIC struct socket* drbd_accept(drbd_dev *mdev, struct socket* sock)
+STATIC struct socket *drbd_accept(drbd_dev *mdev, struct socket *sock)
 {
 	struct socket *newsock;
 	int err = 0;
@@ -943,7 +943,7 @@
 {
 	struct page *page;
 	int rr, rv = 1;
-	void* data;
+	void *data;
 
 	page = drbd_pp_alloc(mdev, GFP_KERNEL);
 
@@ -1008,7 +1008,7 @@
  * drbd_process_done_ee() by asender only */
 STATIC int e_end_resync_block(drbd_dev *mdev, struct drbd_work *w, int unused)
 {
-	struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
+	struct Tl_epoch_entry *e = (struct Tl_epoch_entry *)w;
 	sector_t sector = e->sector;
 	int ok;
 
@@ -1158,7 +1158,7 @@
  */
 STATIC int e_end_block(drbd_dev *mdev, struct drbd_work *w, int unused)
 {
-	struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
+	struct Tl_epoch_entry *e = (struct Tl_epoch_entry *)w;
 	sector_t sector = e->sector;
 	/* unsigned int epoch_size; */
 	int ok = 1, pcmd;
@@ -1205,7 +1205,7 @@
 
 STATIC int e_send_discard_ack(drbd_dev *mdev, struct drbd_work *w, int unused)
 {
-	struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
+	struct Tl_epoch_entry *e = (struct Tl_epoch_entry *)w;
 	int ok = 1;
 
 	D_ASSERT(mdev->net_conf->wire_protocol == DRBD_PROT_C);
@@ -1789,7 +1789,7 @@
 	return rv;
 }
 
-STATIC void drbd_uuid_dump(drbd_dev *mdev, char* text, u64* uuid)
+STATIC void drbd_uuid_dump(drbd_dev *mdev, char *text, u64 *uuid)
 {
 	INFO("%s %016llX:%016llX:%016llX:%016llX\n",
 	     text,
@@ -2556,7 +2556,7 @@
 {
 	struct hlist_head *slot;
 	struct hlist_node *n;
-	drbd_request_t * req;
+	drbd_request_t *req;
 	struct list_head *le;
 	LIST_HEAD(workset);
 	int i;
@@ -2571,7 +2571,7 @@
 			list_add(&req->w.list, &workset);
 		}
 	}
-	memset(mdev->app_reads_hash, 0, APP_R_HSIZE*sizeof(void*));
+	memset(mdev->app_reads_hash, 0, APP_R_HSIZE*sizeof(void *));
 
 	while(!list_empty(&workset)) {
 		le = workset.next;
@@ -2865,7 +2865,7 @@
 	desc.flags = 0;
 
 	rv = crypto_hash_setkey(mdev->cram_hmac_tfm,
-				(u8*)mdev->net_conf->shared_secret, key_len);
+				(u8 *)mdev->net_conf->shared_secret, key_len);
 	if (rv) {
 		ERR("crypto_hash_setkey() failed with %d\n", rv);
 		rv = 0;
@@ -3317,13 +3317,13 @@
 			}
 			expect = asender_tbl[cmd].pkt_size;
 			ERR_IF(len != expect-sizeof(Drbd_Header)) {
-				dump_packet(mdev, mdev->meta.socket, 1, (void*)h, __FILE__, __LINE__);
+				dump_packet(mdev, mdev->meta.socket, 1, (void *)h, __FILE__, __LINE__);
 				DUMPI(expect);
 			}
 		}
 		if (received == expect) {
 			D_ASSERT(cmd != -1);
-			dump_packet(mdev, mdev->meta.socket, 1, (void*)h, __FILE__, __LINE__);
+			dump_packet(mdev, mdev->meta.socket, 1, (void *)h, __FILE__, __LINE__);
 			if (!asender_tbl[cmd].process(mdev, h)) goto err;
 
 			buf      = h;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_req.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 13:18:46 UTC (rev 2991)
@@ -1058,7 +1058,7 @@
 int drbd_make_request_26(request_queue_t *q, struct bio *bio)
 {
 	unsigned int s_enr, e_enr;
-	struct Drbd_Conf* mdev = (drbd_dev*) q->queuedata;
+	struct Drbd_Conf *mdev = (drbd_dev*) q->queuedata;
 
 	if (drbd_fail_request_early(mdev, bio_data_dir(bio) & WRITE)) {
 		bio_endio(bio, bio->bi_size, -EPERM);
@@ -1133,7 +1133,7 @@
  * we should use DRBD_MAX_SEGMENT_SIZE instead of AL_EXTENT_SIZE */
 int drbd_merge_bvec(request_queue_t *q, struct bio *bio, struct bio_vec *bvec)
 {
-	struct Drbd_Conf* mdev = (drbd_dev*) q->queuedata;
+	struct Drbd_Conf *mdev = (drbd_dev*) q->queuedata;
 	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 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.h	2007-07-24 13:18:46 UTC (rev 2991)
@@ -207,14 +207,14 @@
 #define RQ_NET_MASK        (((1UL << __RQ_NET_MAX)-1) & ~RQ_LOCAL_MASK) /* 0x1f8 */
 
 /* epoch entries */
-static inline struct hlist_head* ee_hash_slot(drbd_dev *mdev, sector_t sector)
+static inline struct hlist_head *ee_hash_slot(drbd_dev *mdev, sector_t sector)
 {
 	BUG_ON(mdev->ee_hash_s == 0);
 	return mdev->ee_hash + ((unsigned int)(sector>>HT_SHIFT) % mdev->ee_hash_s);
 }
 
 /* transfer log (drbd_request objects) */
-static inline struct hlist_head* tl_hash_slot(drbd_dev *mdev, sector_t sector)
+static inline struct hlist_head *tl_hash_slot(drbd_dev *mdev, sector_t sector)
 {
 	BUG_ON(mdev->tl_hash_s == 0);
 	return mdev->tl_hash +
@@ -223,11 +223,11 @@
 
 /* when we receive the answer for a read request,
  * verify that we actually know about it */
-static inline drbd_request_t* _ack_id_to_req(drbd_dev *mdev, u64 id, sector_t sector)
+static inline drbd_request_t *_ack_id_to_req(drbd_dev *mdev, u64 id, sector_t sector)
 {
 	struct hlist_head *slot = tl_hash_slot(mdev, sector);
 	struct hlist_node *n;
-	drbd_request_t * req;
+	drbd_request_t *req;
 
 	hlist_for_each_entry(req, n, slot, colision) {
 		if ((unsigned long)req == (unsigned long)id) {
@@ -242,12 +242,12 @@
 		}
 	}
 	ERR("_ack_id_to_req: failed to find req %p, sector %llus in list\n",
-		(void*)(unsigned long)id, (unsigned long long)sector);
+		(void *)(unsigned long)id, (unsigned long long)sector);
 	return NULL;
 }
 
 /* application reads (drbd_request objects) */
-static struct hlist_head* ar_hash_slot(drbd_dev *mdev, sector_t sector)
+static struct hlist_head *ar_hash_slot(drbd_dev *mdev, sector_t sector)
 {
 	return mdev->app_reads_hash
 		+ ((unsigned int)(sector) % APP_R_HSIZE);
@@ -255,11 +255,11 @@
 
 /* when we receive the answer for a read request,
  * verify that we actually know about it */
-static inline drbd_request_t* _ar_id_to_req(drbd_dev *mdev, u64 id, sector_t sector)
+static inline drbd_request_t *_ar_id_to_req(drbd_dev *mdev, u64 id, sector_t sector)
 {
 	struct hlist_head *slot = ar_hash_slot(mdev, sector);
 	struct hlist_node *n;
-	drbd_request_t * req;
+	drbd_request_t *req;
 
 	hlist_for_each_entry(req, n, slot, colision) {
 		if ((unsigned long)req == (unsigned long)id) {
@@ -270,7 +270,7 @@
 	return NULL;
 }
 
-static inline drbd_request_t* drbd_req_new(drbd_dev *mdev, struct bio *bio_src)
+static inline drbd_request_t *drbd_req_new(drbd_dev *mdev, struct bio *bio_src)
 {
 	struct bio *bio;
 	drbd_request_t *req = mempool_alloc(drbd_request_mempool, GFP_NOIO);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_strings.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_strings.c	2007-07-24 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/drbd_strings.c	2007-07-24 13:18:46 UTC (rev 2991)
@@ -83,23 +83,23 @@
 	[-SS_DeviceInUse] = "Device is held open by someone"
 };
 
-const char* conns_to_name(drbd_conns_t s) {
+const char *conns_to_name(drbd_conns_t s) {
 	/* enums are unsigned... */
 	return s > PausedSyncT  ? "TOO_LARGE"
 		                : drbd_conn_s_names[s];
 }
 
-const char* roles_to_name(drbd_role_t s) {
+const char *roles_to_name(drbd_role_t s) {
 	return s > Secondary  ? "TOO_LARGE"
 		              : drbd_role_s_names[s];
 }
 
-const char* disks_to_name(drbd_disks_t s) {
+const char *disks_to_name(drbd_disks_t s) {
 	return s > UpToDate    ? "TOO_LARGE"
 		               : drbd_disk_s_names[s];
 }
 
-const char* set_st_err_name(set_st_err_t err) {
+const char *set_st_err_name(set_st_err_t err) {
 	return err < SS_DeviceInUse ? "TOO_SMALL" :
 	       err > SS_TwoPrimaries ? "TOO_LARGE"
 		        : drbd_state_sw_errors[-err];

Modified: branches/drbd-8.0-for-linus/drbd/drbd_worker.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 13:18:46 UTC (rev 2991)
@@ -68,7 +68,7 @@
 	/* error parameter ignored:
 	 * drbd_md_sync_page_io explicitly tests bio_uptodate(bio); */
 
-	complete((struct completion*)bio->bi_private);
+	complete((struct completion *)bio->bi_private);
 	return 0;
 }
 
@@ -79,7 +79,7 @@
 {
 	unsigned long flags = 0;
 	struct Tl_epoch_entry *e = NULL;
-	struct Drbd_Conf* mdev;
+	struct Drbd_Conf *mdev;
 	int uptodate = bio_flagged(bio, BIO_UPTODATE);
 
 	e = bio->bi_private;
@@ -222,9 +222,9 @@
 	return 0;
 }
 
-int w_io_error(drbd_dev* mdev, struct drbd_work* w, int cancel)
+int w_io_error(drbd_dev *mdev, struct drbd_work *w, int cancel)
 {
-	drbd_request_t *req = (drbd_request_t*)w;
+	drbd_request_t *req = (drbd_request_t *)w;
 	int ok;
 
 	/* FIXME send a "set_out_of_sync" packet to the peer
@@ -247,9 +247,9 @@
 	return ok;
 }
 
-int w_read_retry_remote(drbd_dev* mdev, struct drbd_work* w, int cancel)
+int w_read_retry_remote(drbd_dev *mdev, struct drbd_work *w, int cancel)
 {
-	drbd_request_t *req = (drbd_request_t*)w;
+	drbd_request_t *req = (drbd_request_t *)w;
 
 	spin_lock_irq(&mdev->req_lock);
 	if ( cancel ||
@@ -302,7 +302,7 @@
 
 #define SLEEP_TIME (HZ/10)
 
-int w_make_resync_request(drbd_dev* mdev, struct drbd_work* w, int cancel)
+int w_make_resync_request(drbd_dev *mdev, struct drbd_work *w, int cancel)
 {
 	unsigned long bit;
 	sector_t sector;
@@ -551,7 +551,7 @@
  */
 int w_e_end_data_req(drbd_dev *mdev, struct drbd_work *w, int cancel)
 {
-	struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
+	struct Tl_epoch_entry *e = (struct Tl_epoch_entry *)w;
 	int ok;
 
 	if (unlikely(cancel)) {
@@ -595,7 +595,7 @@
  */
 int w_e_end_rsdata_req(drbd_dev *mdev, struct drbd_work *w, int cancel)
 {
-	struct Tl_epoch_entry *e = (struct Tl_epoch_entry*)w;
+	struct Tl_epoch_entry *e = (struct Tl_epoch_entry *)w;
 	int ok;
 
 	if (unlikely(cancel)) {

Modified: branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-24 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-24 13:18:46 UTC (rev 2991)
@@ -14,7 +14,7 @@
 #endif
 
 /* see get_sb_bdev and bd_claim */
-extern char* drbd_sec_holder;
+extern char *drbd_sec_holder;
 
 /* bi_end_io handlers */
 extern int drbd_md_io_complete (struct bio *bio, unsigned int bytes_done, int error);

Modified: branches/drbd-8.0-for-linus/drbd/linux/drbd.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/linux/drbd.h	2007-07-24 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd.h	2007-07-24 13:18:46 UTC (rev 2991)
@@ -222,10 +222,10 @@
 } set_st_err_t;
 
 /* from drbd_strings.c */
-extern const char* conns_to_name(drbd_conns_t);
-extern const char* roles_to_name(drbd_role_t);
-extern const char* disks_to_name(drbd_disks_t);
-extern const char* set_st_err_name(set_st_err_t);
+extern const char *conns_to_name(drbd_conns_t);
+extern const char *roles_to_name(drbd_role_t);
+extern const char *disks_to_name(drbd_disks_t);
+extern const char *set_st_err_name(set_st_err_t);
 
 #ifndef BDEVNAME_SIZE
 # define BDEVNAME_SIZE 32

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 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd_tag_magic.h	2007-07-24 13:18:46 UTC (rev 2991)
@@ -65,7 +65,7 @@
 };
 
 struct tag {
-	const char* name;
+	const char *name;
 	int type_n_flags;
 	int max_len;
 };

Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 13:18:46 UTC (rev 2991)
@@ -43,7 +43,7 @@
  * struct lru_cache, and the hash table slots.
  * returns pointer to a newly initialized lru_cache object with said parameters.
  */
-struct lru_cache* lc_alloc(const char *name, unsigned int e_count,
+struct lru_cache *lc_alloc(const char *name, unsigned int e_count,
 			   size_t e_size, void *private_p)
 {
 	unsigned long bytes;
@@ -81,12 +81,12 @@
  * lc_free: Frees memory allocated by lc_alloc.
  * @lc: The lru_cache object
  */
-void lc_free(struct lru_cache* lc)
+void lc_free(struct lru_cache *lc)
 {
 	vfree(lc);
 }
 
-size_t	lc_printf_stats(struct seq_file *seq, struct lru_cache* lc)
+size_t	lc_printf_stats(struct seq_file *seq, struct lru_cache *lc)
 {
 	/* NOTE:
 	 * total calls to lc_get are
@@ -100,7 +100,7 @@
 		lc->hits, lc->misses, lc->starving, lc->dirty, lc->changed);
 }
 
-static unsigned int lc_hash_fn(struct lru_cache* lc, unsigned int enr)
+static unsigned int lc_hash_fn(struct lru_cache *lc, unsigned int enr)
 {
 	return enr % lc->nr_elements;
 }
@@ -112,7 +112,7 @@
  * @lc: The lru_cache object
  * @enr: element number
  */
-struct lc_element* lc_find(struct lru_cache* lc, unsigned int enr)
+struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr)
 {
 	struct hlist_node *n;
 	struct lc_element *e;
@@ -125,7 +125,7 @@
 	return NULL;
 }
 
-STATIC struct lc_element * lc_evict(struct lru_cache* lc)
+STATIC struct lc_element *lc_evict(struct lru_cache *lc)
 {
 	struct list_head  *n;
 	struct lc_element *e;
@@ -147,7 +147,7 @@
  * @lc: The lru_cache object
  * @e: The element to remove
  */
-void lc_del(struct lru_cache* lc, struct lc_element *e)
+void lc_del(struct lru_cache *lc, struct lc_element *e)
 {
 	/* FIXME what to do with refcnt != 0 ? */
 	PARANOIA_ENTRY();
@@ -160,7 +160,7 @@
 	RETURN();
 }
 
-STATIC struct lc_element* lc_get_unused_element(struct lru_cache* lc)
+STATIC struct lc_element *lc_get_unused_element(struct lru_cache *lc)
 {
 	struct list_head *n;
 
@@ -171,7 +171,7 @@
 	return list_entry(n, struct lc_element, list);
 }
 
-STATIC int lc_unused_element_available(struct lru_cache* lc)
+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 */
@@ -207,7 +207,7 @@
  * @lc: The lru_cache object
  * @enr: element number
  */
-struct lc_element* lc_get(struct lru_cache* lc, unsigned int enr)
+struct lc_element *lc_get(struct lru_cache *lc, unsigned int enr)
 {
 	struct lc_element *e;
 
@@ -264,7 +264,7 @@
  * but only gets a new reference on an existing element.
  * you either get the requested element, or NULL.
  */
-struct lc_element* lc_try_get(struct lru_cache* lc, unsigned int enr)
+struct lc_element *lc_try_get(struct lru_cache *lc, unsigned int enr)
 {
 	struct lc_element *e;
 
@@ -286,7 +286,7 @@
 	RETURN(e);
 }
 
-void lc_changed(struct lru_cache* lc, struct lc_element* e)
+void lc_changed(struct lru_cache *lc, struct lc_element *e)
 {
 	PARANOIA_ENTRY();
 	BUG_ON(e != lc->changing_element);
@@ -302,7 +302,7 @@
 }
 
 
-unsigned int lc_put(struct lru_cache* lc, struct lc_element* e)
+unsigned int lc_put(struct lru_cache *lc, struct lc_element *e)
 {
 	BUG_ON(!lc);
 	BUG_ON(!lc->nr_elements);
@@ -328,7 +328,7 @@
  * @enr: element number
  * @index: The elements' position in the cache
  */
-void lc_set(struct lru_cache* lc, unsigned int enr, int index)
+void lc_set(struct lru_cache *lc, unsigned int enr, int index)
 {
 	struct lc_element *e;
 
@@ -346,7 +346,7 @@
 /**
  * lc_dump: Dump a complete LRU cache to seq in textual form.
  */
-void lc_dump(struct lru_cache* lc, struct seq_file *seq, char* utext,
+void lc_dump(struct lru_cache *lc, struct seq_file *seq, char *utext,
 	     void (*detail) (struct seq_file *, struct lc_element *) )
 {
 	unsigned int nr_elements = lc->nr_elements;

Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.h	2007-07-24 13:06:52 UTC (rev 2990)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.h	2007-07-24 13:18:46 UTC (rev 2991)
@@ -98,50 +98,50 @@
 #define LC_DIRTY    (1<<__LC_DIRTY)
 #define LC_STARVING (1<<__LC_STARVING)
 
-extern struct lru_cache* lc_alloc(const char *name, unsigned int e_count,
+extern struct lru_cache *lc_alloc(const char *name, unsigned int e_count,
 				  size_t e_size, void *private_p);
-extern void lc_free(struct lru_cache* lc);
-extern void lc_set (struct lru_cache* lc, unsigned int enr, int index);
-extern void lc_del (struct lru_cache* lc, struct lc_element *element);
+extern void lc_free(struct lru_cache *lc);
+extern void lc_set (struct lru_cache *lc, unsigned int enr, int index);
+extern void lc_del (struct lru_cache *lc, struct lc_element *element);
 
-extern struct lc_element* lc_try_get(struct lru_cache* lc, unsigned int enr);
-extern struct lc_element* lc_find(struct lru_cache* lc, unsigned int enr);
-extern struct lc_element* lc_get (struct lru_cache* lc, unsigned int enr);
-extern unsigned int       lc_put (struct lru_cache* lc, struct lc_element* e);
-extern void            lc_changed(struct lru_cache* lc, struct lc_element* e);
+extern struct lc_element *lc_try_get(struct lru_cache *lc, unsigned int enr);
+extern struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr);
+extern struct lc_element *lc_get (struct lru_cache *lc, unsigned int enr);
+extern unsigned int       lc_put (struct lru_cache *lc, struct lc_element *e);
+extern void            lc_changed(struct lru_cache *lc, struct lc_element *e);
 
 struct seq_file;
-extern size_t lc_printf_stats(struct seq_file *seq, struct lru_cache* lc);
+extern size_t lc_printf_stats(struct seq_file *seq, struct lru_cache *lc);
 
-void lc_dump(struct lru_cache* lc, struct seq_file *seq, char* utext,
+void lc_dump(struct lru_cache *lc, struct seq_file *seq, char *utext,
 	     void (*detail) (struct seq_file *, struct lc_element *) );
 
 /* This can be used to stop lc_get from changing the set of active elements.
  * Note that the reference counts and order on the lru list may still change.
  * returns true if we aquired the lock.
  */
-static inline int lc_try_lock(struct lru_cache* lc)
+static inline int lc_try_lock(struct lru_cache *lc)
 {
 	return !test_and_set_bit(__LC_DIRTY, &lc->flags);
 }
 
-static inline void lc_unlock(struct lru_cache* lc)
+static inline void lc_unlock(struct lru_cache *lc)
 {
 	clear_bit(__LC_DIRTY, &lc->flags);
 	smp_mb__after_clear_bit();
 }
 
-static inline int lc_is_used(struct lru_cache* lc, unsigned int enr)
+static inline int lc_is_used(struct lru_cache *lc, unsigned int enr)
 {
-	struct lc_element* e = lc_find(lc, enr);
+	struct lc_element *e = lc_find(lc, enr);
 	return (e && e->refcnt);
 }
 
 #define LC_FREE (-1U)
 
-#define lc_e_base(lc)  ((char*) ( (lc)->slot + (lc)->nr_elements ) )
-#define lc_entry(lc, i) ((struct lc_element*) \
+#define lc_e_base(lc)  ((char *) ( (lc)->slot + (lc)->nr_elements ) )
+#define lc_entry(lc, i) ((struct lc_element *) \
                        (lc_e_base(lc) + (i)*(lc)->element_size))
-#define lc_index_of(lc, e) (((char*)(e) - lc_e_base(lc))/(lc)->element_size)
+#define lc_index_of(lc, e) (((char *)(e) - lc_e_base(lc))/(lc)->element_size)
 
 #endif

From drbd-cvs at lists.linbit.com  Tue Jul 24 15:20:56 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 15:21:02 2007
Subject: [DRBD-cvs] svn commit by lars - r2992 -
	branches/drbd-8.0-for-linus/drbd -
	a6249fb8b2d743b694abd6ca02e44701acb7edfd fix 'need spac
Message-ID: <20070724132056.9D28140095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 15:20:54 +0200 (Tue, 24 Jul 2007)
New Revision: 2992

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_worker.c
   branches/drbd-8.0-for-linus/drbd/lru_cache.c
Log:
a6249fb8b2d743b694abd6ca02e44701acb7edfd fix 'need spaces around that ...'


Modified: branches/drbd-8.0-for-linus/drbd/drbd_actlog.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 13:18:46 UTC (rev 2991)
+++ branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 13:20:54 UTC (rev 2992)
@@ -191,7 +191,7 @@
 
 	spin_lock_irq(&mdev->al_lock);
 	bm_ext = (struct bm_extent *) lc_find(mdev->resync, enr/AL_EXT_PER_BM_SECT);
-	if (unlikely(bm_ext!=NULL)) {
+	if (unlikely(bm_ext != NULL)) {
 		if (test_bit(BME_NO_WRITES, &bm_ext->flags)) {
 			spin_unlock_irq(&mdev->al_lock);
 			return 0;
@@ -222,7 +222,7 @@
 	struct lc_element *al_ext;
 	struct update_al_work al_work;
 
-	D_ASSERT(atomic_read(&mdev->local_cnt)>0);
+	D_ASSERT(atomic_read(&mdev->local_cnt) > 0);
 
 	MTRACE(TraceTypeALExts, TraceLvlMetrics,
 	       INFO("al_begin_io( sec=%llus (al_enr=%u) (rs_enr=%d) )\n",
@@ -325,14 +325,14 @@
 
 	mx = min_t(int, AL_EXTENTS_PT,
 		   mdev->act_log->nr_elements - mdev->al_tr_cycle);
-	for(i = 0;i<mx;i++) {
+	for(i = 0;i < mx;i++) {
 		extent_nr = lc_entry(mdev->act_log,
 				     mdev->al_tr_cycle+i)->lc_number;
 		buffer->updates[i+1].pos = cpu_to_be32(mdev->al_tr_cycle+i);
 		buffer->updates[i+1].extent = cpu_to_be32(extent_nr);
 		xor_sum ^= extent_nr;
 	}
-	for(;i<AL_EXTENTS_PT;i++) {
+	for(;i < AL_EXTENTS_PT;i++) {
 		buffer->updates[i+1].pos = __constant_cpu_to_be32(-1);
 		buffer->updates[i+1].extent = __constant_cpu_to_be32(LC_FREE);
 		xor_sum ^= LC_FREE;
@@ -386,7 +386,7 @@
 
 	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));
 
@@ -416,7 +416,7 @@
 	buffer = page_address(mdev->md_io_page);
 
 	/* Find the valid transaction in the log */
-	for(i = 0;i<=mx;i++) {
+	for(i = 0;i <= mx;i++) {
 		rv = drbd_al_read_tr(mdev, bdev, buffer, i);
 		if (rv == 0) continue;
 		if (rv == -1) {
@@ -468,7 +468,7 @@
 		   elements there might be an old version of the
 		   updated element (in slot 0). So the element in slot 0
 		   can overwrite old versions. */
-		for(j = AL_EXTENTS_PT;j>=0;j--) {
+		for(j = AL_EXTENTS_PT;j >= 0;j--) {
 			pos = be32_to_cpu(buffer->updates[j].pos);
 			extent_nr = be32_to_cpu(buffer->updates[j].extent);
 
@@ -562,7 +562,7 @@
 	}
 
 	bio = bio_alloc(GFP_KERNEL, 1);
-	if (bio==NULL) return -ENOMEM;
+	if (bio == NULL) return -ENOMEM;
 
 	bio->bi_bdev = mdev->bc->md_bdev;
 	bio->bi_sector = on_disk_sector;
@@ -585,7 +585,7 @@
 	kunmap(*page);
 
 	/* no memory leak, page gets cleaned up by caller */
-	if (bio_add_page(bio, *page, MD_HARDSECT, *page_offset)!=MD_HARDSECT)
+	if (bio_add_page(bio, *page, MD_HARDSECT, *page_offset) != MD_HARDSECT)
 		return -EINVAL;
 
 	if (!allocated_page) get_page(*page);
@@ -635,7 +635,7 @@
 	wc.mdev = mdev;
 	wc.error = 0;
 
-	for(i = 0;i<nr_elements;i++) {
+	for(i = 0;i < nr_elements;i++) {
 		enr = lc_entry(mdev->act_log, i)->lc_number;
 		if (enr == LC_FREE) continue;
 		/* next statement also does atomic_inc wc.count */
@@ -651,8 +651,8 @@
 	wake_up(&mdev->al_wait);
 
 	/* all prepared, submit them */
-	for(i = 0;i<nr_elements;i++) {
-		if (bios[i]==NULL) break;
+	for(i = 0;i < nr_elements;i++) {
+		if (bios[i] == NULL) break;
 		if (FAULT_ACTIVE( mdev, DRBD_FAULT_MD_WR )) {
 			bios[i]->bi_rw = WRITE;
 			bio_endio(bios[i], bios[i]->bi_size, -EIO);
@@ -680,8 +680,8 @@
 
  free_bios_submit_one_by_one:
 	/* free everything by calling the endio callback directly. */
-	for(i = 0;i<nr_elements;i++) {
-		if (bios[i]==NULL) break;
+	for(i = 0;i < nr_elements;i++) {
+		if (bios[i] == NULL) break;
 		bios[i]->bi_size = 0;
 		atodb_endio(bios[i], MD_HARDSECT, 0);
 	}
@@ -690,7 +690,7 @@
  submit_one_by_one:
 	WARN("Using the slow drbd_al_to_on_disk_bm()\n");
 
-	for(i = 0;i<mdev->act_log->nr_elements;i++) {
+	for(i = 0;i < mdev->act_log->nr_elements;i++) {
 		enr = lc_entry(mdev->act_log, i)->lc_number;
 		if (enr == LC_FREE) continue;
 		/* Really slow: if we have al-extents 16..19 active,
@@ -716,7 +716,7 @@
 
 	wait_event(mdev->al_wait, lc_try_lock(mdev->act_log));
 
-	for(i = 0;i<mdev->act_log->nr_elements;i++) {
+	for(i = 0;i < mdev->act_log->nr_elements;i++) {
 		enr = lc_entry(mdev->act_log, i)->lc_number;
 		if (enr == LC_FREE) continue;
 		add += drbd_bm_ALe_set_all(mdev, enr);
@@ -755,7 +755,7 @@
 
 	D_ASSERT( test_bit(__LC_DIRTY, &mdev->act_log->flags) );
 
-	for(i = 0;i<mdev->act_log->nr_elements;i++) {
+	for(i = 0;i < mdev->act_log->nr_elements;i++) {
 		al_ext = lc_entry(mdev->act_log, i);
 		if (al_ext->lc_number == LC_FREE) continue;
 		wait_event(mdev->al_wait, _try_lc_del(mdev, al_ext));
@@ -1101,7 +1101,7 @@
 
 	if (test_bit(BME_LOCKED, &bm_ext->flags)) return 1;
 
-	for(i = 0;i<AL_EXT_PER_BM_SECT;i++) {
+	for(i = 0;i < AL_EXT_PER_BM_SECT;i++) {
 		sig = wait_event_interruptible( mdev->al_wait,
 				!_is_in_al(mdev, enr*AL_EXT_PER_BM_SECT+i) );
 		if (sig) {
@@ -1220,7 +1220,7 @@
 	MTRACE(TraceTypeResync, TraceLvlAll,
 		INFO("checking al for %u\n", enr);
 	);
-	for (i = 0;i<AL_EXT_PER_BM_SECT;i++) {
+	for (i = 0;i < AL_EXT_PER_BM_SECT;i++) {
 		if (unlikely(al_enr+i == mdev->act_log->new_number))
 			goto try_again;
 		if (lc_is_used(mdev->act_log, al_enr+i))
@@ -1294,7 +1294,7 @@
 
 	if (inc_local_if_state(mdev, Failed)) {
 		/* ok, ->resync is there. */
-		for(i = 0;i<mdev->resync->nr_elements;i++) {
+		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. */
@@ -1331,7 +1331,7 @@
 
 	if (inc_local_if_state(mdev, Failed)) {
 		/* ok, ->resync is there. */
-		for(i = 0;i<mdev->resync->nr_elements;i++) {
+		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;
 			if (bm_ext->lce.lc_number == mdev->resync_wenr) {
@@ -1356,7 +1356,7 @@
 			D_ASSERT(!test_bit(BME_NO_WRITES, &bm_ext->flags));
 			lc_del(mdev->resync, &bm_ext->lce);
 		}
-		D_ASSERT(mdev->resync->used==0);
+		D_ASSERT(mdev->resync->used == 0);
 		dec_local(mdev);
 	}
 	spin_unlock_irq(&mdev->al_lock);
@@ -1414,7 +1414,7 @@
 	 */
 	spin_lock_irq(&mdev->al_lock);
 	for(bnr = sbnr; bnr <= ebnr; bnr++) {
-		if (drbd_bm_test_bit(mdev, bnr)>0) count++;
+	 	if (drbd_bm_test_bit(mdev, bnr) > 0) count++;
 	}
 	if (count) {
 		mdev->rs_failed += count;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 13:18:46 UTC (rev 2991)
+++ branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 13:20:54 UTC (rev 2992)
@@ -932,7 +932,7 @@
 	ERR_IF(!b->bm) return 1;
 
 	spin_lock(&b->bm_lock);
-	for (bitnr = s; bitnr <=e; bitnr++) {
+	for (bitnr = s; bitnr <= e; bitnr++) {
 		ERR_IF (bitnr >= b->bm_bits) {
 			ERR("bitnr=%lu bm_bits=%lu\n", bitnr, b->bm_bits);
 		} else {

Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 13:18:46 UTC (rev 2991)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 13:20:54 UTC (rev 2992)
@@ -189,7 +189,7 @@
 	 ERR("ASSERT( " #exp " ) in %s:%d\n", __FILE__, __LINE__)
 #endif
 #define ERR_IF(exp) if (({ \
-	int _b = (exp)!=0; \
+	int _b = (exp) != 0; \
 	if (_b) ERR("%s: (" #exp ") in %s:%d\n", __func__, __FILE__, __LINE__); \
 	 _b; \
 	}))
@@ -1679,7 +1679,7 @@
 }
 
 #define ERR_IF_CNT_IS_NEGATIVE(which)				\
-	if (atomic_read(&mdev->which)<0)				\
+	if (atomic_read(&mdev->which) < 0)				\
 		ERR("in %s:%d: " #which " = %d < 0 !\n",	\
 		    __func__ , __LINE__ ,			\
 		    atomic_read(&mdev->which))
@@ -1761,7 +1761,7 @@
 {
 	if (atomic_dec_and_test(&mdev->local_cnt))
 		wake_up(&mdev->misc_wait);
-	D_ASSERT(atomic_read(&mdev->local_cnt)>=0);
+	D_ASSERT(atomic_read(&mdev->local_cnt) >= 0);
 }
 /**
  * inc_local: Returns TRUE when local IO is possible. If it returns
@@ -1840,7 +1840,7 @@
 	int mxb = drbd_get_max_buffers(mdev);
 	int ap_bio = atomic_dec_return(&mdev->ap_bio_cnt);
 
-	D_ASSERT(ap_bio>=0);
+	D_ASSERT(ap_bio >= 0);
 	if (ap_bio < mxb) wake_up(&mdev->misc_wait);
 }
 

Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 13:18:46 UTC (rev 2991)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 13:20:54 UTC (rev 2992)
@@ -381,7 +381,7 @@
 	rv = _drbd_set_state(mdev, ns, f);
 	ns = mdev->state;
 	spin_unlock_irqrestore(&mdev->req_lock, flags);
-	if (rv==SS_Success && !(f&ScheduleAfter)) after_state_ch(mdev, os, ns, f);
+	if (rv == SS_Success && !(f&ScheduleAfter)) after_state_ch(mdev, os, ns, f);
 
 	return rv;
 }
@@ -414,9 +414,9 @@
 	if ( !cl_wide_st_chg(mdev, os, ns) ) rv = SS_CW_NoNeed;
 	if (!rv) {
 		rv = is_valid_state(mdev, ns);
-		if (rv==SS_Success) {
+		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);
@@ -477,7 +477,7 @@
 	ns = mdev->state;
 	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
-	if (rv==SS_Success && !(f&ScheduleAfter)) after_state_ch(mdev, os, ns, f);
+	if (rv == SS_Success && !(f&ScheduleAfter)) after_state_ch(mdev, os, ns, f);
 
 	return rv;
 }
@@ -885,8 +885,8 @@
 	}
 
 	/* Lost contact to peer's copy of the data */
-	if ( (os.pdsk>=Inconsistent && os.pdsk!=DUnknown && os.pdsk!=Outdated) &&
-	     (ns.pdsk<Inconsistent || ns.pdsk==DUnknown || ns.pdsk==Outdated) ) {
+	if ( (os.pdsk >= Inconsistent && os.pdsk != DUnknown && os.pdsk != Outdated) &&
+	     (ns.pdsk < Inconsistent || ns.pdsk == DUnknown || ns.pdsk == Outdated) ) {
 		if (mdev->p_uuid) {
 			kfree(mdev->p_uuid);
 			mdev->p_uuid = NULL;
@@ -2139,7 +2139,7 @@
 	/* drbd's page pool */
 	spin_lock_init(&drbd_pp_lock);
 
-	for (i = 0;i< number;i++) {
+	for (i = 0;i < number;i++) {
 		page = alloc_page(GFP_HIGHUSER);
 		if (!page) goto Enomem;
 		set_page_private(page, (unsigned long)drbd_pp_pool);
@@ -2343,7 +2343,7 @@
 		return -EINVAL;
 	}
 
-	if (1 > minor_count||minor_count > 255) {
+	if (1 > minor_count || minor_count > 255) {
 		printk(KERN_ERR DEVICE_NAME
 			": invalid minor_count (%d)\n", minor_count);
 #ifdef MODULE
@@ -2632,7 +2632,7 @@
 {
 	int i;
 
-	for ( i = History_start ; i<History_end ; i++ ) {
+	for ( i = History_start ; i < History_end ; i++ ) {
 		mdev->bc->md.uuid[i+1] = mdev->bc->md.uuid[i];
 
 		MTRACE(TraceTypeUuid, TraceLvlAll,
@@ -2696,9 +2696,9 @@
 
 void drbd_uuid_set_bm(drbd_dev *mdev, u64 val)
 {
-	if (mdev->bc->md.uuid[Bitmap]==0 && val==0) return;
+	if (mdev->bc->md.uuid[Bitmap] == 0 && val == 0) return;
 
-	if (val==0) {
+	if (val == 0) {
 		drbd_uuid_move_history(mdev);
 		mdev->bc->md.uuid[History_start] = mdev->bc->md.uuid[Bitmap];
 		mdev->bc->md.uuid[Bitmap] = 0;
@@ -2971,7 +2971,7 @@
 			pstart_va += (p-pstart);
 			pstart = p;
 			count  = 0;
-			offset+= LINE_SIZE;
+			offset += LINE_SIZE;
 
 			/* Re-init strings */
 			pbytes = bytes_str;
@@ -3159,7 +3159,7 @@
 
 	INFO("%s %s Bio:%p - %soffset " SECTOR_FORMAT ", size %x\n",
 	     complete? "<<<":">>>",
-	     bio_rw(bio)==WRITE?"Write":"Read", bio,
+	     bio_rw(bio) == WRITE?"Write":"Read", bio,
 	     complete? (drbd_bio_uptodate(bio)? "Success, ":"Failed, ") : "",
 	     bio->bi_sector << SECTOR_SHIFT,
 	     bio->bi_size);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 13:18:46 UTC (rev 2991)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 13:20:54 UTC (rev 2992)
@@ -156,7 +156,7 @@
 	printk(KERN_INFO DEVICE_NAME "%d: "
 	       "Netlink: >> %s (%d) - seq: %x, ack: %x, len: %x\n",
 	       nlp->minor,
-	       nlp->packet_type==P_nl_after_last_packet?
+	       nlp->packet_type == P_nl_after_last_packet?
 	           "Empty-Reply" : nl_packet_name(nlp->packet_type),
 	       nlp->packet_type,
 	       req->seq, req->ack, req->len);
@@ -582,7 +582,7 @@
 	n = lc_alloc("act_log", mdev->sync_conf.al_extents,
 		     sizeof(struct lc_element), mdev);
 
-	if (n==NULL) {
+	if (n == NULL) {
 		ERR("Cannot allocate act_log lru!\n");
 		return -ENOMEM;
 	}
@@ -779,16 +779,16 @@
 
 	nbc->md_bdev = inode2->i_bdev;
 	if (bd_claim(nbc->md_bdev,
-		     (nbc->dc.meta_dev_idx==DRBD_MD_INDEX_INTERNAL ||
-		      nbc->dc.meta_dev_idx==DRBD_MD_INDEX_FLEX_INT) ?
+		     (nbc->dc.meta_dev_idx == DRBD_MD_INDEX_INTERNAL ||
+		      nbc->dc.meta_dev_idx == DRBD_MD_INDEX_FLEX_INT) ?
 		     (void *)mdev : (void *) drbd_m_holder )) {
 		retcode = MDMounted;
 		goto release_bdev_fail;
 	}
 
-	if ( (nbc->backing_bdev==nbc->md_bdev) !=
-	     (nbc->dc.meta_dev_idx==DRBD_MD_INDEX_INTERNAL ||
-	      nbc->dc.meta_dev_idx==DRBD_MD_INDEX_FLEX_INT) ) {
+	if ( (nbc->backing_bdev == nbc->md_bdev) !=
+	     (nbc->dc.meta_dev_idx == DRBD_MD_INDEX_INTERNAL ||
+	      nbc->dc.meta_dev_idx == DRBD_MD_INDEX_FLEX_INT) ) {
 		retcode = LDMDInvalid;
 		goto release_bdev2_fail;
 	}
@@ -947,7 +947,7 @@
 	rv = _drbd_set_state(mdev, ns, ChgStateVerbose);
 	ns = mdev->state;
 	spin_unlock_irq(&mdev->req_lock);
-	if (rv==SS_Success) after_state_ch(mdev, os, ns, ChgStateVerbose);
+	if (rv == SS_Success) after_state_ch(mdev, os, ns, ChgStateVerbose);
 
 	if (rv < SS_Success)
 		goto unlock_bm;
@@ -1063,7 +1063,7 @@
 #define O_ADDR(A) (((struct sockaddr_in *)&A->peer_addr)->sin_addr.s_addr)
 #define O_PORT(A) (((struct sockaddr_in *)&A->peer_addr)->sin_port)
 	retcode = NoError;
-	for(i = 0;i<minor_count;i++) {
+	for(i = 0;i < minor_count;i++) {
 		odev = minor_to_mdev(i);
 		if (!odev || odev == mdev) continue;
 		if ( inc_net(odev)) {
@@ -1144,7 +1144,7 @@
 		new_conf->ping_int = new_conf->ping_int+1;
 #endif
 
-	D_ASSERT(mdev->net_conf==NULL);
+	D_ASSERT(mdev->net_conf == NULL);
 	mdev->net_conf = new_conf;
 
 	mdev->send_cnt = 0;
@@ -1209,7 +1209,7 @@
 	if (retcode < SS_Success) goto fail;
 
 	if ( wait_event_interruptible( mdev->misc_wait,
-				      mdev->state.conn==StandAlone) ) {
+				      mdev->state.conn == StandAlone) ) {
 		retcode = GotSignal;
 		goto fail;
 	}
@@ -1407,7 +1407,7 @@
 
 	ns = mdev->state;
 	spin_unlock_irq(&mdev->req_lock);
-	if (retcode==SS_Success) after_state_ch(mdev, os, ns, ChgStateVerbose);
+	if (retcode == SS_Success) after_state_ch(mdev, os, ns, ChgStateVerbose);
 
 	if (retcode == -999) {
 		retcode = DiskLowerThanOutdated;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 13:18:46 UTC (rev 2991)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 13:20:54 UTC (rev 2992)
@@ -931,7 +931,7 @@
 		ds -= rr;
 	}
 
-	mdev->recv_cnt+=data_size>>9;
+	mdev->recv_cnt += data_size>>9;
 	return e;
 }
 
@@ -1021,8 +1021,8 @@
 		/* Record failure to sync */
 		drbd_rs_failed_io(mdev, sector, e->size);
 
-		ok = drbd_send_ack(mdev, NegAck, e);
-		ok&= drbd_io_error(mdev, FALSE);
+		ok  = drbd_send_ack(mdev, NegAck, e);
+		ok &= drbd_io_error(mdev, FALSE);
 	}
 	dec_unacked(mdev);
 
@@ -1170,7 +1170,7 @@
 				e->flags & EE_MAY_SET_IN_SYNC) ?
 				RSWriteAck : WriteAck;
 			ok &= drbd_send_ack(mdev, pcmd, e);
-			if (pcmd==RSWriteAck)
+			if (pcmd == RSWriteAck)
 				drbd_set_in_sync(mdev, sector, e->size);
 		} else {
 			/* FIXME I think we should send a NegAck regardless of
@@ -1179,8 +1179,8 @@
 			 * NegAck is sent. basically that means that drbd_process_done_ee
 			 * may not list_del() the ee before this callback did run...
 			 * maybe even move the list_del(e) in here... */
-			ok = drbd_send_ack(mdev, NegAck, e);
-			ok&= drbd_io_error(mdev, FALSE);
+			ok  = drbd_send_ack(mdev, NegAck, e);
+			ok &= drbd_io_error(mdev, FALSE);
 			/* we expect it to be marked out of sync anyways...
 			 * maybe assert this?  */
 		}
@@ -1734,10 +1734,10 @@
 		rv = drbd_asb_recover_0p(mdev);
 		break;
 	case DiscardSecondary:
-		return mdev->state.role==Primary ? 1 : -1;
+		return mdev->state.role == Primary ? 1 : -1;
 	case CallHelper:
 		hg = drbd_asb_recover_0p(mdev);
-		if (hg == -1 && mdev->state.role==Primary) {
+		if (hg == -1 && mdev->state.role == Primary) {
 			self = drbd_set_role(mdev, Secondary, 0);
 			if (self != SS_Success) {
 				drbd_khelper(mdev, "pri-lost-after-sb");
@@ -1856,7 +1856,7 @@
 	if (self == peer) return -1;
 
 	*rule_nr = 6;
-	for ( i = History_start ; i<=History_end ; i++ ) {
+	for ( i = History_start ; i <= History_end ; i++ ) {
 		peer = mdev->p_uuid[i] & ~((u64)1);
 		if (self == peer) return -2;
 	}
@@ -1867,7 +1867,7 @@
 	if (self == peer) return 1;
 
 	*rule_nr = 8;
-	for ( i = History_start ; i<=History_end ; i++ ) {
+	for ( i = History_start ; i <= History_end ; i++ ) {
 		self = mdev->bc->md.uuid[i] & ~((u64)1);
 		if (self == peer) return 2;
 	}
@@ -1878,9 +1878,9 @@
 	if (self == peer && self != ((u64)0) ) return 100;
 
 	*rule_nr = 10;
-	for ( i = History_start ; i<=History_end ; i++ ) {
+	for ( i = History_start ; i <= History_end ; i++ ) {
 		self = mdev->p_uuid[i] & ~((u64)1);
-		for ( j = History_start ; j<=History_end ; j++ ) {
+		for ( j = History_start ; j <= History_end ; j++ ) {
 			peer = mdev->p_uuid[j] & ~((u64)1);
 			if (self == peer) return -100;
 		}
@@ -1917,8 +1917,8 @@
 		return conn_mask;
 	}
 
-	if ( (mydisk==Inconsistent && peer_disk>Inconsistent) ||
-	    (peer_disk==Inconsistent && mydisk>Inconsistent) )  {
+	if ( (mydisk == Inconsistent && peer_disk > Inconsistent) ||
+	    (peer_disk == Inconsistent && mydisk > Inconsistent) )  {
 		int f = (hg == -100) || abs(hg) == 2;
 		hg = mydisk > Inconsistent ? 1 : -1;
 		if (f) hg = hg*2;
@@ -1927,7 +1927,7 @@
 	}
 
 	if (hg == 100 || (hg == -100 && mdev->net_conf->always_asbp) ) {
-		int pcount = (mdev->state.role==Primary) + (peer_role==Primary);
+		int pcount = (mdev->state.role == Primary) + (peer_role == Primary);
 		int forced = (hg == -100);
 
 		switch (pcount) {
@@ -2374,7 +2374,7 @@
 		}
 	}
 
-	if (rv==SS_Success)
+	if (rv == SS_Success)
 		after_state_ch(mdev, os, ns, ChgStateVerbose | ChgStateHard);
 
 	mdev->net_conf->want_lose = 0;
@@ -2432,7 +2432,7 @@
 		num_words = min_t(size_t, BM_PACKET_WORDS, bm_words-bm_i );
 		want = num_words * sizeof(long);
 		ERR_IF(want != h->length) goto out;
-		if (want==0) break;
+		if (want == 0) break;
 		if (drbd_recv(mdev, buffer, want) != want)
 			goto out;
 
@@ -2565,7 +2565,7 @@
 	 * Application READ requests
 	 */
 	spin_lock_irq(&mdev->req_lock);
-	for(i = 0;i<APP_R_HSIZE;i++) {
+	for(i = 0;i < APP_R_HSIZE;i++) {
 		slot = mdev->app_reads_hash+i;
 		hlist_for_each_entry(req, n, slot, colision) {
 			list_add(&req->w.list, &workset);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_req.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 13:18:46 UTC (rev 2991)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 13:20:54 UTC (rev 2992)
@@ -991,8 +991,8 @@
 		 * was not detached below us? */
 		req->private_bio->bi_bdev = mdev->bc->backing_bdev;
 
-		if (FAULT_ACTIVE(mdev, rw==WRITE ? DRBD_FAULT_DT_WR :
-				       ( rw==READ ? DRBD_FAULT_DT_RD :
+		if (FAULT_ACTIVE(mdev, rw == WRITE ? DRBD_FAULT_DT_WR :
+				       ( rw == READ ? DRBD_FAULT_DT_RD :
   				                   DRBD_FAULT_DT_RA ) ))
 			bio_endio(req->private_bio, req->private_bio->bi_size, -EIO);
 		else

Modified: branches/drbd-8.0-for-linus/drbd/drbd_worker.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 13:18:46 UTC (rev 2991)
+++ branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 13:20:54 UTC (rev 2992)
@@ -325,7 +325,7 @@
 
         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);
 
@@ -339,7 +339,7 @@
 		return 1;
 	}
 
-	for(i = 0;i<number;i++) {
+	for(i = 0;i < number;i++) {
 
 	next_sector:
 		size = BM_BLOCK_SIZE;
@@ -506,7 +506,7 @@
 		    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]);
@@ -521,7 +521,7 @@
 			/* 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];
 		}
 	}
@@ -868,7 +868,7 @@
 
 	MTRACE(TraceTypeResync, TraceLvlSummary,
 	       INFO("Resync starting: side=%s\n",
-		    side==SyncTarget?"SyncTarget":"SyncSource");
+		    side == SyncTarget?"SyncTarget":"SyncSource");
 	    );
 
 	drbd_bm_recount_bits(mdev);

Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 13:18:46 UTC (rev 2991)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 13:20:54 UTC (rev 2992)
@@ -67,7 +67,7 @@
 		lc->new_number	     = -1;
 		lc->lc_private       = private_p;
 		lc->name             = name;
-		for(i = 0;i<e_count;i++) {
+		for(i = 0;i < e_count;i++) {
 			e = lc_entry(lc, i);
 			e->lc_number = LC_FREE;
 			list_add(&e->list, &lc->free);
@@ -354,7 +354,7 @@
 	int i;
 
 	seq_printf(seq, "\tnn: lc_number refcnt %s\n ", utext);
-	for(i = 0;i<nr_elements;i++) {
+	for(i = 0;i < nr_elements;i++) {
 		e = lc_entry(lc, i);
 		if (e->lc_number == LC_FREE) {
 			seq_printf(seq, "\t%2d: FREE\n", i );

From drbd-cvs at lists.linbit.com  Tue Jul 24 15:25:51 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 15:25:54 2007
Subject: [DRBD-cvs] svn commit by lars - r2993 - in
	branches/drbd-8.0-for-linus/drbd: . linux -
	eae4495f2ea3c2fa62fb1b8824e950d17471528b fix spaces -> 
Message-ID: <20070724132551.8E48C40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 15:25:49 +0200 (Tue, 24 Jul 2007)
New Revision: 2993

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_strings.c
   branches/drbd-8.0-for-linus/drbd/drbd_worker.c
   branches/drbd-8.0-for-linus/drbd/linux/drbd_nl.h
   branches/drbd-8.0-for-linus/drbd/lru_cache.c
   branches/drbd-8.0-for-linus/drbd/lru_cache.h
Log:
eae4495f2ea3c2fa62fb1b8824e950d17471528b fix spaces -> tabs; fix trailing whitespace
b4d0b6bd635e16e9a468fe512eea23c4b9e47381 and more single whitespace fixes


Modified: branches/drbd-8.0-for-linus/drbd/drbd_actlog.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 13:20:54 UTC (rev 2992)
+++ branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 13:25:49 UTC (rev 2993)
@@ -226,7 +226,7 @@
 
 	MTRACE(TraceTypeALExts, TraceLvlMetrics,
 	       INFO("al_begin_io( sec=%llus (al_enr=%u) (rs_enr=%d) )\n",
-		    (unsigned long long) sector, enr, 
+		    (unsigned long long) sector, enr,
 		    (int)BM_SECT_TO_EXT(sector));
 	       );
 
@@ -274,7 +274,7 @@
 
 	MTRACE(TraceTypeALExts, TraceLvlMetrics,
 	       INFO("al_complete_io( sec=%llus (al_enr=%u) (rs_enr=%d) )\n",
-		    (unsigned long long) sector, enr, 
+		    (unsigned long long) sector, enr,
 		    (int)BM_SECT_TO_EXT(sector));
 	       );
 
@@ -325,14 +325,14 @@
 
 	mx = min_t(int, AL_EXTENTS_PT,
 		   mdev->act_log->nr_elements - mdev->al_tr_cycle);
-	for(i = 0;i < mx;i++) {
+	for (i = 0; i < mx; i++) {
 		extent_nr = lc_entry(mdev->act_log,
 				     mdev->al_tr_cycle+i)->lc_number;
 		buffer->updates[i+1].pos = cpu_to_be32(mdev->al_tr_cycle+i);
 		buffer->updates[i+1].extent = cpu_to_be32(extent_nr);
 		xor_sum ^= extent_nr;
 	}
-	for(;i < AL_EXTENTS_PT;i++) {
+	for (; i < AL_EXTENTS_PT; i++) {
 		buffer->updates[i+1].pos = __constant_cpu_to_be32(-1);
 		buffer->updates[i+1].extent = __constant_cpu_to_be32(LC_FREE);
 		xor_sum ^= LC_FREE;
@@ -386,7 +386,7 @@
 
 	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));
 
@@ -416,7 +416,7 @@
 	buffer = page_address(mdev->md_io_page);
 
 	/* Find the valid transaction in the log */
-	for(i = 0;i <= mx;i++) {
+	for (i = 0; i <= mx; i++) {
 		rv = drbd_al_read_tr(mdev, bdev, buffer, i);
 		if (rv == 0) continue;
 		if (rv == -1) {
@@ -448,7 +448,7 @@
 	/* Read the valid transactions.
 	 * INFO("Reading from %d to %d.\n",from,to); */
 	i = from;
-	while(1) {
+	while (1) {
 		int j, pos;
 		unsigned int extent_nr;
 		unsigned int trn;
@@ -468,7 +468,7 @@
 		   elements there might be an old version of the
 		   updated element (in slot 0). So the element in slot 0
 		   can overwrite old versions. */
-		for(j = AL_EXTENTS_PT;j >= 0;j--) {
+		for (j = AL_EXTENTS_PT; j >= 0; j--) {
 			pos = be32_to_cpu(buffer->updates[j].pos);
 			extent_nr = be32_to_cpu(buffer->updates[j].extent);
 
@@ -556,7 +556,7 @@
 	int offset;
 
 	/* check if that enr is already covered by an already created bio. */
-	while( (bio = bios[i]) ) {
+	while ( (bio = bios[i]) ) {
 		if (bio->bi_sector == on_disk_sector) return 0;
 		i++;
 	}
@@ -579,7 +579,7 @@
 	}
 
 	offset = S2W(enr);
-	drbd_bm_get_lel( mdev, offset, 
+	drbd_bm_get_lel( mdev, offset,
 			 min_t(size_t, S2W(1), drbd_bm_words(mdev) - offset),
 			 kmap(*page) + *page_offset );
 	kunmap(*page);
@@ -635,7 +635,7 @@
 	wc.mdev = mdev;
 	wc.error = 0;
 
-	for(i = 0;i < nr_elements;i++) {
+	for (i = 0; i < nr_elements; i++) {
 		enr = lc_entry(mdev->act_log, i)->lc_number;
 		if (enr == LC_FREE) continue;
 		/* next statement also does atomic_inc wc.count */
@@ -651,7 +651,7 @@
 	wake_up(&mdev->al_wait);
 
 	/* all prepared, submit them */
-	for(i = 0;i < nr_elements;i++) {
+	for (i = 0; i < nr_elements; i++) {
 		if (bios[i] == NULL) break;
 		if (FAULT_ACTIVE( mdev, DRBD_FAULT_MD_WR )) {
 			bios[i]->bi_rw = WRITE;
@@ -680,7 +680,7 @@
 
  free_bios_submit_one_by_one:
 	/* free everything by calling the endio callback directly. */
-	for(i = 0;i < nr_elements;i++) {
+	for (i = 0; i < nr_elements; i++) {
 		if (bios[i] == NULL) break;
 		bios[i]->bi_size = 0;
 		atodb_endio(bios[i], MD_HARDSECT, 0);
@@ -690,7 +690,7 @@
  submit_one_by_one:
 	WARN("Using the slow drbd_al_to_on_disk_bm()\n");
 
-	for(i = 0;i < mdev->act_log->nr_elements;i++) {
+	for (i = 0; i < mdev->act_log->nr_elements; i++) {
 		enr = lc_entry(mdev->act_log, i)->lc_number;
 		if (enr == LC_FREE) continue;
 		/* Really slow: if we have al-extents 16..19 active,
@@ -716,7 +716,7 @@
 
 	wait_event(mdev->al_wait, lc_try_lock(mdev->act_log));
 
-	for(i = 0;i < mdev->act_log->nr_elements;i++) {
+	for (i = 0; i < mdev->act_log->nr_elements; i++) {
 		enr = lc_entry(mdev->act_log, i)->lc_number;
 		if (enr == LC_FREE) continue;
 		add += drbd_bm_ALe_set_all(mdev, enr);
@@ -755,7 +755,7 @@
 
 	D_ASSERT( test_bit(__LC_DIRTY, &mdev->act_log->flags) );
 
-	for(i = 0;i < mdev->act_log->nr_elements;i++) {
+	for (i = 0; i < mdev->act_log->nr_elements; i++) {
 		al_ext = lc_entry(mdev->act_log, i);
 		if (al_ext->lc_number == LC_FREE) continue;
 		wait_event(mdev->al_wait, _try_lc_del(mdev, al_ext));
@@ -930,7 +930,7 @@
 	 * we count rs_{total,left} in bits, not sectors.
 	 */
 	spin_lock_irqsave(&mdev->al_lock, flags);
-	for(bnr = sbnr; bnr <= ebnr; bnr++) {
+	for (bnr = sbnr; bnr <= ebnr; bnr++) {
 		if (drbd_bm_clear_bit(mdev, bnr)) count++;
 	}
 	if (count) {
@@ -1051,7 +1051,7 @@
 	return bm_ext;
 }
 
-static inline int _is_in_al(drbd_dev* mdev, unsigned int enr)
+static inline int _is_in_al(drbd_dev *mdev, unsigned int enr)
 {
 	struct lc_element *al_ext;
 	int rv = 0;
@@ -1084,7 +1084,7 @@
  * returns 1 if successful.
  * returns 0 if interrupted.
  */
-int drbd_rs_begin_io(drbd_dev* mdev, sector_t sector)
+int drbd_rs_begin_io(drbd_dev *mdev, sector_t sector)
 {
 	unsigned int enr = BM_SECT_TO_EXT(sector);
 	struct bm_extent *bm_ext;
@@ -1101,7 +1101,7 @@
 
 	if (test_bit(BME_LOCKED, &bm_ext->flags)) return 1;
 
-	for(i = 0;i < AL_EXT_PER_BM_SECT;i++) {
+	for (i = 0; i < AL_EXT_PER_BM_SECT; i++) {
 		sig = wait_event_interruptible( mdev->al_wait,
 				!_is_in_al(mdev, enr*AL_EXT_PER_BM_SECT+i) );
 		if (sig) {
@@ -1131,7 +1131,7 @@
  * returns zero if we could set BME_LOCKED and can proceed,
  * -EAGAIN if we need to try again.
  */
-int drbd_try_rs_begin_io(drbd_dev* mdev, sector_t sector)
+int drbd_try_rs_begin_io(drbd_dev *mdev, sector_t sector)
 {
 	unsigned int enr = BM_SECT_TO_EXT(sector);
 	const unsigned int al_enr = enr*AL_EXT_PER_BM_SECT;
@@ -1220,7 +1220,7 @@
 	MTRACE(TraceTypeResync, TraceLvlAll,
 		INFO("checking al for %u\n", enr);
 	);
-	for (i = 0;i < AL_EXT_PER_BM_SECT;i++) {
+	for (i = 0; i < AL_EXT_PER_BM_SECT; i++) {
 		if (unlikely(al_enr+i == mdev->act_log->new_number))
 			goto try_again;
 		if (lc_is_used(mdev->act_log, al_enr+i))
@@ -1241,7 +1241,7 @@
 	return -EAGAIN;
 }
 
-void drbd_rs_complete_io(drbd_dev* mdev, sector_t sector)
+void drbd_rs_complete_io(drbd_dev *mdev, sector_t sector)
 {
 	unsigned int enr = BM_SECT_TO_EXT(sector);
 	struct bm_extent *bm_ext;
@@ -1281,7 +1281,7 @@
  * drbd_rs_cancel_all: Removes extents from the resync LRU. Even
  * if they are BME_LOCKED.
  */
-void drbd_rs_cancel_all(drbd_dev* mdev)
+void drbd_rs_cancel_all(drbd_dev *mdev)
 {
 	struct bm_extent *bm_ext;
 	int i;
@@ -1294,7 +1294,7 @@
 
 	if (inc_local_if_state(mdev, Failed)) {
 		/* ok, ->resync is there. */
-		for(i = 0;i < mdev->resync->nr_elements;i++) {
+		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. */
@@ -1318,7 +1318,7 @@
  * returns -EAGAIN.
  * In case all elements got removed it returns zero.
  */
-int drbd_rs_del_all(drbd_dev* mdev)
+int drbd_rs_del_all(drbd_dev *mdev)
 {
 	struct bm_extent *bm_ext;
 	int i;
@@ -1331,7 +1331,7 @@
 
 	if (inc_local_if_state(mdev, Failed)) {
 		/* ok, ->resync is there. */
-		for(i = 0;i < mdev->resync->nr_elements;i++) {
+		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;
 			if (bm_ext->lce.lc_number == mdev->resync_wenr) {
@@ -1369,7 +1369,7 @@
  * called on SyncTarget when resync write fails or NegRSDReply received
  *
  */
-void drbd_rs_failed_io(drbd_dev* mdev, sector_t sector, int size)
+void drbd_rs_failed_io(drbd_dev *mdev, sector_t sector, int size)
 {
 	/* Is called from worker and receiver context _only_ */
 	unsigned long sbnr, ebnr, lbnr, bnr;
@@ -1413,8 +1413,8 @@
 	 * we count rs_{total,left} in bits, not sectors.
 	 */
 	spin_lock_irq(&mdev->al_lock);
-	for(bnr = sbnr; bnr <= ebnr; bnr++) {
-	 	if (drbd_bm_test_bit(mdev, bnr) > 0) count++;
+	for (bnr = sbnr; bnr <= ebnr; bnr++) {
+		if (drbd_bm_test_bit(mdev, bnr) > 0) count++;
 	}
 	if (count) {
 		mdev->rs_failed += count;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 13:20:54 UTC (rev 2992)
+++ branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 13:25:49 UTC (rev 2993)
@@ -352,7 +352,7 @@
 			spin_unlock_irq(&b->bm_lock);
 			goto out;
 		} else {
-		        /* one extra long to catch off by one errors */
+			/* one extra long to catch off by one errors */
 			bytes = (words+1)*sizeof(long);
 			nbm = vmalloc(bytes);
 			if (!nbm) {
@@ -446,7 +446,7 @@
 
 	spin_lock_irq(&b->bm_lock);
 	bm = b->bm + offset;
-	while(n--) {
+	while (n--) {
 		bits = hweight_long(*bm);
 		word = *bm | lel_to_cpu(*buffer++);
 		*bm++ = word;
@@ -484,7 +484,7 @@
 
 	spin_lock_irq(&b->bm_lock);
 	bm = b->bm + offset;
-	while(n--) {
+	while (n--) {
 		bits = hweight_long(*bm);
 		word = lel_to_cpu(*buffer++);
 		*bm++ = word;
@@ -528,7 +528,7 @@
 
 	spin_lock_irq(&b->bm_lock);
 	bm = b->bm + offset;
-	while(number--) *buffer++ = cpu_to_lel(*bm++);
+	while (number--) *buffer++ = cpu_to_lel(*bm++);
 	spin_unlock_irq(&b->bm_lock);
 }
 
@@ -902,9 +902,9 @@
  * only called from drbd_set_out_of_sync.
  * strange_state blubber is already in place there...
 	strange_state = ( mdev->cstate  > Connected ) ||
-	                ( mdev->cstate == Connected &&
-	                 !(test_bit(DISKLESS,&mdev->flags) ||
-	                   test_bit(PARTNER_DISKLESS,&mdev->flags)) );
+			( mdev->cstate == Connected &&
+			 !(test_bit(DISKLESS,&mdev->flags) ||
+			   test_bit(PARTNER_DISKLESS,&mdev->flags)) );
 	if (strange_state)
 		ERR("%s in drbd_bm_set_bit\n", conns_to_name(mdev->cstate));
 */

Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 13:20:54 UTC (rev 2992)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 13:25:49 UTC (rev 2993)
@@ -181,7 +181,7 @@
 
 
 #ifdef DBG_ASSERTS
-extern void drbd_assert_breakpoint(drbd_dev*, char *, char *, int );
+extern void drbd_assert_breakpoint(drbd_dev *, char *, char *, int );
 # define D_ASSERT(exp)	if (!(exp)) \
 	 drbd_assert_breakpoint(mdev, #exp, __FILE__, __LINE__)
 #else
@@ -598,7 +598,7 @@
  * drbd_request and Tl_epoch_entry are descendants of drbd_work.
  */
 struct drbd_work;
-typedef int (*drbd_work_cb)(drbd_dev*, struct drbd_work*, int cancel);
+typedef int (*drbd_work_cb)(drbd_dev *, struct drbd_work *, int cancel);
 struct drbd_work {
 	struct list_head list;
 	drbd_work_cb cb;
@@ -934,14 +934,14 @@
 	ScheduleAfter	= 4,
 };
 
-extern int drbd_change_state(drbd_dev* mdev, enum chg_state_flags f,
+extern int drbd_change_state(drbd_dev *mdev, enum chg_state_flags f,
 			     drbd_state_t mask, drbd_state_t val);
-extern void drbd_force_state(drbd_dev*, drbd_state_t, drbd_state_t);
-extern int _drbd_request_state(drbd_dev*, drbd_state_t, drbd_state_t,
+extern void drbd_force_state(drbd_dev *, drbd_state_t, drbd_state_t);
+extern int _drbd_request_state(drbd_dev *, drbd_state_t, drbd_state_t,
 			       enum chg_state_flags);
-extern int _drbd_set_state(drbd_dev*, drbd_state_t, enum chg_state_flags );
-extern void print_st_err(drbd_dev*, drbd_state_t, drbd_state_t, int );
-extern void after_state_ch(drbd_dev* mdev, drbd_state_t os, drbd_state_t ns,
+extern int _drbd_set_state(drbd_dev *, drbd_state_t, enum chg_state_flags );
+extern void print_st_err(drbd_dev *, drbd_state_t, drbd_state_t, int );
+extern void after_state_ch(drbd_dev *mdev, drbd_state_t os, drbd_state_t ns,
 			   enum chg_state_flags);
 extern int  drbd_thread_start(struct Drbd_thread *thi);
 extern void _drbd_thread_stop(struct Drbd_thread *thi, int restart, int wait);
@@ -989,7 +989,7 @@
 extern int _drbd_send_bitmap(drbd_dev *mdev);
 extern int drbd_send_sr_reply(drbd_dev *mdev, int retcode);
 extern void drbd_free_bc(struct drbd_backing_dev *bc);
-extern int drbd_io_error(drbd_dev* mdev, int forcedetach);
+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) */
@@ -1301,8 +1301,8 @@
 
 /* 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*);
+extern sector_t drbd_new_dev_size(struct Drbd_Conf *, struct drbd_backing_dev *);
+extern int drbd_determin_dev_size(drbd_dev *);
 extern void drbd_setup_queue_param(drbd_dev *mdev, unsigned int);
 extern int drbd_set_role(drbd_dev *mdev, drbd_role_t new_role, int force);
 extern int drbd_ioctl(struct inode *inode, struct file *file,
@@ -1315,8 +1315,8 @@
 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 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 ? */
 extern int drbd_md_sync_page_io(drbd_dev *mdev, struct drbd_backing_dev *bdev,
@@ -1392,9 +1392,9 @@
 extern void drbd_rs_complete_io(struct Drbd_Conf *mdev, sector_t sector);
 extern int drbd_rs_begin_io(struct Drbd_Conf *mdev, sector_t sector);
 extern int drbd_try_rs_begin_io(struct Drbd_Conf *mdev, sector_t sector);
-extern void drbd_rs_cancel_all(drbd_dev* mdev);
-extern int drbd_rs_del_all(drbd_dev* mdev);
-extern void drbd_rs_failed_io(drbd_dev* mdev, sector_t sector, int size);
+extern void drbd_rs_cancel_all(drbd_dev *mdev);
+extern int drbd_rs_del_all(drbd_dev *mdev);
+extern void drbd_rs_failed_io(drbd_dev *mdev, sector_t sector, int size);
 extern int drbd_al_read_log(struct Drbd_Conf *mdev, struct drbd_backing_dev *);
 extern void __drbd_set_in_sync(drbd_dev *mdev, sector_t sector, int size, const char *file, const unsigned int line);
 #define drbd_set_in_sync(mdev, sector, size) \
@@ -1424,26 +1424,26 @@
 #define user_isp_mask 1
 #define aftr_isp_mask 1
 
-#define NS(T, S) ({drbd_state_t mask; mask.i = 0; mask.T = T##_mask; mask;}), \
-		({drbd_state_t val; val.i = 0; val.T = (S); val;})
+#define NS(T, S) ({drbd_state_t mask; mask.i = 0; mask.T = T##_mask; mask; }), \
+		({drbd_state_t val; val.i = 0; val.T = (S); val; })
 #define NS2(T1, S1, T2, S2) \
 		({drbd_state_t mask; mask.i = 0; mask.T1 = T1##_mask; \
-		  mask.T2 = T2##_mask; mask;}), \
+		  mask.T2 = T2##_mask; mask; }), \
 		({drbd_state_t val; val.i = 0; val.T1 = (S1); \
-		  val.T2 = (S2); val;})
+		  val.T2 = (S2); val; })
 #define NS3(T1, S1, T2, S2, T3, S3) \
 		({drbd_state_t mask; mask.i = 0; mask.T1 = T1##_mask; \
-		  mask.T2 = T2##_mask; mask.T3 = T3##_mask; mask;}), \
+		  mask.T2 = T2##_mask; mask.T3 = T3##_mask; mask; }), \
 		({drbd_state_t val; val.i = 0; val.T1 = (S1); \
-		  val.T2 = (S2); val.T3 = (S3); val;})
+		  val.T2 = (S2); val.T3 = (S3); val; })
 
-#define _NS(D, T, S) D, ({drbd_state_t ns; ns.i = D->state.i; ns.T = (S); ns;})
+#define _NS(D, T, S) D, ({drbd_state_t ns; ns.i = D->state.i; ns.T = (S); ns; })
 #define _NS2(D, T1, S1, T2, S2) \
 		D, ({drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
-		ns.T2 = (S2); ns;})
+		ns.T2 = (S2); ns; })
 #define _NS3(D, T1, S1, T2, S2, T3, S3) \
 		D, ({drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
-		ns.T2 = (S2); ns.T3 = (S3); ns;})
+		ns.T2 = (S2); ns.T3 = (S3); ns; })
 
 static inline void drbd_state_lock(drbd_dev *mdev)
 {
@@ -1457,7 +1457,7 @@
 	wake_up(&mdev->misc_wait);
 }
 
-static inline int drbd_request_state(drbd_dev* mdev, drbd_state_t mask,
+static inline int drbd_request_state(drbd_dev *mdev, drbd_state_t mask,
 				     drbd_state_t val)
 {
 	return _drbd_request_state(mdev, mask, val, ChgStateVerbose);
@@ -1467,9 +1467,9 @@
  * drbd_chk_io_error: Handles the on_io_error setting, should be called from
  * all io completion handlers. See also drbd_io_error().
  */
-static inline void __drbd_chk_io_error(drbd_dev* mdev, int forcedetach)
+static inline void __drbd_chk_io_error(drbd_dev *mdev, int forcedetach)
 {
-	switch(mdev->bc->dc.on_io_error) {
+	switch (mdev->bc->dc.on_io_error) {
 	case PassOn: /* FIXME would this be better named "Ignore"? */
 		if (!forcedetach) {
 			if (printk_ratelimit())
@@ -1488,7 +1488,7 @@
 	}
 }
 
-static inline void drbd_chk_io_error(drbd_dev* mdev, int error, int forcedetach)
+static inline void drbd_chk_io_error(drbd_dev *mdev, int error, int forcedetach)
 {
 	if (error) {
 		unsigned long flags;
@@ -1673,7 +1673,7 @@
  *  _req_mod(req, connection_lost_while_pending)
  *     [from tl_clear_barrier]
  */
-static inline void inc_ap_pending(drbd_dev* mdev)
+static inline void inc_ap_pending(drbd_dev *mdev)
 {
 	atomic_inc(&mdev->ap_pending_cnt);
 }
@@ -1685,7 +1685,7 @@
 		    atomic_read(&mdev->which))
 
 #define dec_ap_pending(mdev)	do {				\
-	typecheck(drbd_dev*, mdev);				\
+	typecheck(drbd_dev *, mdev);				\
 	if (atomic_dec_and_test(&mdev->ap_pending_cnt))		\
 		wake_up(&mdev->misc_wait);			\
 	ERR_IF_CNT_IS_NEGATIVE(ap_pending_cnt); } while (0)
@@ -1696,13 +1696,13 @@
  * SyncSource sends RSDataReply   (and expects WriteAck whith ID_SYNCER)
  *					   (or NegAck with ID_SYNCER)
  */
-static inline void inc_rs_pending(drbd_dev* mdev)
+static inline void inc_rs_pending(drbd_dev *mdev)
 {
 	atomic_inc(&mdev->rs_pending_cnt);
 }
 
 #define dec_rs_pending(mdev)	do {				\
-	typecheck(drbd_dev*, mdev);				\
+	typecheck(drbd_dev *, mdev);				\
 	atomic_dec(&mdev->rs_pending_cnt);			\
 	ERR_IF_CNT_IS_NEGATIVE(rs_pending_cnt); } while (0)
 
@@ -1715,23 +1715,23 @@
  *  receive_DataRequest (receive_RSDataRequest) we need to send back Data
  *  receive_Barrier_*	we need to send a BarrierAck
  */
-static inline void inc_unacked(drbd_dev* mdev)
+static inline void inc_unacked(drbd_dev *mdev)
 {
 	atomic_inc(&mdev->unacked_cnt);
 }
 
 #define dec_unacked(mdev)	do {				\
-	typecheck(drbd_dev*, mdev);				\
+	typecheck(drbd_dev *, mdev);				\
 	atomic_dec(&mdev->unacked_cnt);				\
 	ERR_IF_CNT_IS_NEGATIVE(unacked_cnt); } while (0)
 
 #define sub_unacked(mdev, n)	do {				\
-	typecheck(drbd_dev*, mdev);				\
+	typecheck(drbd_dev *, mdev);				\
 	atomic_sub(n, &mdev->unacked_cnt);			\
 	ERR_IF_CNT_IS_NEGATIVE(unacked_cnt); } while (0)
 
 
-static inline void dec_net(drbd_dev* mdev)
+static inline void dec_net(drbd_dev *mdev)
 {
 	if (atomic_dec_and_test(&mdev->net_cnt))
 		wake_up(&mdev->misc_wait);
@@ -1741,7 +1741,7 @@
  * inc_net: Returns TRUE when it is ok to access mdev->net_conf. You
  * should call dec_net() when finished looking at mdev->net_conf.
  */
-static inline int inc_net(drbd_dev* mdev)
+static inline int inc_net(drbd_dev *mdev)
 {
 	int have_net_conf;
 
@@ -1757,7 +1757,7 @@
  * this is mood...
  */
 
-static inline void dec_local(drbd_dev* mdev)
+static inline void dec_local(drbd_dev *mdev)
 {
 	if (atomic_dec_and_test(&mdev->local_cnt))
 		wake_up(&mdev->misc_wait);
@@ -1767,7 +1767,7 @@
  * inc_local: Returns TRUE when local IO is possible. If it returns
  * TRUE you should call dec_local() after IO is completed.
  */
-static inline int inc_local_if_state(drbd_dev* mdev, drbd_disks_t mins)
+static inline int inc_local_if_state(drbd_dev *mdev, drbd_disks_t mins)
 {
 	int io_allowed;
 
@@ -1777,7 +1777,7 @@
 		dec_local(mdev);
 	return io_allowed;
 }
-static inline int inc_local(drbd_dev* mdev)
+static inline int inc_local(drbd_dev *mdev)
 {
 	return inc_local_if_state(mdev, Inconsistent);
 }
@@ -1785,7 +1785,7 @@
 /* this throttles on-the-fly application requests
  * according to max_buffers settings;
  * maybe re-implement using semaphores? */
-static inline int drbd_get_max_buffers(drbd_dev* mdev)
+static inline int drbd_get_max_buffers(drbd_dev *mdev)
 {
 	int mxb = 1000000; /* arbitrary limit on open requests */
 	if (inc_net(mdev)) {
@@ -1795,7 +1795,7 @@
 	return mxb;
 }
 
-static inline int __inc_ap_bio_cond(drbd_dev* mdev) {
+static inline int __inc_ap_bio_cond(drbd_dev *mdev) {
 	int mxb = drbd_get_max_buffers(mdev);
 	if (mdev->state.susp) return 0;
 	if (mdev->state.conn == WFBitMapS) return 0;
@@ -1810,7 +1810,7 @@
 /* I'd like to use wait_event_lock_irq,
  * but I'm not sure when it got introduced,
  * and not sure when it has 3 or 4 arguments */
-static inline void inc_ap_bio(drbd_dev* mdev)
+static inline void inc_ap_bio(drbd_dev *mdev)
 {
 	/* compare with after_state_ch,
 	 * os.conn != WFBitMapS && ns.conn == WFBitMapS */
@@ -1835,7 +1835,7 @@
 	spin_unlock_irq(&mdev->req_lock);
 }
 
-static inline void dec_ap_bio(drbd_dev* mdev)
+static inline void dec_ap_bio(drbd_dev *mdev)
 {
 	int mxb = drbd_get_max_buffers(mdev);
 	int ap_bio = atomic_dec_return(&mdev->ap_bio_cnt);
@@ -1860,7 +1860,7 @@
 /* CAUTION: please no side effects in arguments! */
 #define seq_max(a, b) ((u32)(seq_gt((a), (b)) ? (a) : (b)))
 
-static inline void update_peer_seq(drbd_dev* mdev, unsigned int new_seq)
+static inline void update_peer_seq(drbd_dev *mdev, unsigned int new_seq)
 {
 	unsigned int m;
 	spin_lock(&mdev->peer_seq_lock);
@@ -1870,7 +1870,7 @@
 	if (m == new_seq) wake_up(&mdev->seq_wait);
 }
 
-static inline int drbd_queue_order_type(drbd_dev* mdev)
+static inline int drbd_queue_order_type(drbd_dev *mdev)
 {
 	/* sorry, we currently have no working implementation
 	 * of distributed TCQ stuff */

Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 13:20:54 UTC (rev 2992)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 13:25:49 UTC (rev 2993)
@@ -136,7 +136,7 @@
    1) I want to hand out the preallocated objects first.
    2) I want to be able to interrupt sleeping allocation with a signal.
    Note: This is a single linked list, the next pointer is the private
-         member of struct page.
+	 member of struct page.
  */
 struct page *drbd_pp_pool;
 spinlock_t   drbd_pp_lock;
@@ -310,7 +310,7 @@
  *	 anyways.  This is to make sure that you get a resynchronisation of
  *	 the full device the next time you connect.
  */
-int drbd_io_error(drbd_dev* mdev, int forcedetach)
+int drbd_io_error(drbd_dev *mdev, int forcedetach)
 {
 	enum io_error_handler eh;
 	unsigned long flags;
@@ -358,7 +358,7 @@
  * Returns TRUE if this state change should be preformed as a cluster wide
  * transaction. Of course it returns 0 as soon as the connection is lost.
  */
-STATIC int cl_wide_st_chg(drbd_dev* mdev, drbd_state_t os, drbd_state_t ns)
+STATIC int cl_wide_st_chg(drbd_dev *mdev, drbd_state_t os, drbd_state_t ns)
 {
 	return ( os.conn >= Connected && ns.conn >= Connected &&
 		 ( ( os.role != Primary && ns.role == Primary ) ||
@@ -368,7 +368,7 @@
 		(os.conn >= Connected && ns.conn == Disconnecting);
 }
 
-int drbd_change_state(drbd_dev* mdev, enum chg_state_flags f,
+int drbd_change_state(drbd_dev *mdev, enum chg_state_flags f,
 		      drbd_state_t mask, drbd_state_t val)
 {
 	unsigned long flags;
@@ -386,16 +386,16 @@
 	return rv;
 }
 
-void drbd_force_state(drbd_dev* mdev, drbd_state_t mask, drbd_state_t val)
+void drbd_force_state(drbd_dev *mdev, drbd_state_t mask, drbd_state_t val)
 {
 	drbd_change_state(mdev, ChgStateHard, mask, val);
 }
 
-STATIC int is_valid_state(drbd_dev* mdev, drbd_state_t ns);
-STATIC int is_valid_state_transition(drbd_dev*, drbd_state_t, drbd_state_t);
+STATIC int is_valid_state(drbd_dev *mdev, drbd_state_t ns);
+STATIC int is_valid_state_transition(drbd_dev *, drbd_state_t, drbd_state_t);
 STATIC int drbd_send_state_req(drbd_dev *, drbd_state_t, drbd_state_t);
 
-set_st_err_t _req_st_cond(drbd_dev* mdev, drbd_state_t mask, drbd_state_t val)
+set_st_err_t _req_st_cond(drbd_dev *mdev, drbd_state_t mask, drbd_state_t val)
 {
 	drbd_state_t os, ns;
 	unsigned long flags;
@@ -430,7 +430,7 @@
  * transition this function even does a cluster wide transaction.
  * It has a cousin named drbd_request_state(), which is always verbose.
  */
-int _drbd_request_state(drbd_dev* mdev, drbd_state_t mask, drbd_state_t val,
+int _drbd_request_state(drbd_dev *mdev, drbd_state_t mask, drbd_state_t val,
 		       enum chg_state_flags f)
 {
 	unsigned long flags;
@@ -483,7 +483,7 @@
 }
 
 
-STATIC void print_st(drbd_dev* mdev, char *name, drbd_state_t ns)
+STATIC void print_st(drbd_dev *mdev, char *name, drbd_state_t ns)
 {
 	ERR(" %s = { cs:%s st:%s/%s ds:%s/%s %c%c%c%c }\n",
 	    name,
@@ -499,7 +499,7 @@
 	    );
 }
 
-void print_st_err(drbd_dev* mdev, drbd_state_t os, drbd_state_t ns, int err)
+void print_st_err(drbd_dev *mdev, drbd_state_t os, drbd_state_t ns, int err)
 {
 	ERR("State change failed: %s\n", set_st_err_name(err));
 	print_st(mdev, " state", os);
@@ -518,11 +518,11 @@
 #define PSC(A) \
 	({ if (ns.A != os.A) { \
 		pbp += sprintf(pbp, #A "( %s -> %s ) ", \
-		              A##s_to_name(os.A), \
-		              A##s_to_name(ns.A)); \
+			      A##s_to_name(os.A), \
+			      A##s_to_name(ns.A)); \
 	} })
 
-STATIC int is_valid_state(drbd_dev* mdev, drbd_state_t ns)
+STATIC int is_valid_state(drbd_dev *mdev, drbd_state_t ns)
 {
 	/* See drbd_state_sw_errors in drbd_strings.c */
 
@@ -573,7 +573,7 @@
 	return rv;
 }
 
-STATIC int is_valid_state_transition(drbd_dev* mdev, drbd_state_t ns, drbd_state_t os)
+STATIC int is_valid_state_transition(drbd_dev *mdev, drbd_state_t ns, drbd_state_t os)
 {
 	int rv = SS_Success;
 
@@ -589,7 +589,7 @@
 	return rv;
 }
 
-int _drbd_set_state(drbd_dev* mdev, drbd_state_t ns, enum chg_state_flags flags)
+int _drbd_set_state(drbd_dev *mdev, drbd_state_t ns, enum chg_state_flags flags)
 {
 	drbd_state_t os;
 	int rv = SS_Success, warn_sync_abort = 0;
@@ -641,7 +641,7 @@
 
 	if ( ns.conn >= Connected &&
 	    ( ns.disk == Consistent || ns.disk == Outdated ) ) {
-		switch(ns.conn) {
+		switch (ns.conn) {
 		case WFBitMapT:
 		case PausedSyncT:
 			ns.disk = Outdated;
@@ -663,7 +663,7 @@
 
 	if ( ns.conn >= Connected &&
 	    ( ns.pdsk == Consistent || ns.pdsk == Outdated ) ) {
-		switch(ns.conn) {
+		switch (ns.conn) {
 		case Connected:
 		case WFBitMapT:
 		case PausedSyncT:
@@ -816,7 +816,7 @@
 	return 1;
 }
 
-void after_state_ch(drbd_dev* mdev, drbd_state_t os, drbd_state_t ns,
+void after_state_ch(drbd_dev *mdev, drbd_state_t os, drbd_state_t ns,
 		    enum chg_state_flags flags)
 {
 	enum fencing_policy fp;
@@ -1050,7 +1050,7 @@
 	spin_unlock(&thi->t_lock);
 	complete(&thi->startstop); /* notify: thi->task is set. */
 
-	while(1) {
+	while (1) {
 		retval = thi->function(thi);
 		if (get_t_state(thi) != Restarting) break;
 		thi->t_state = Running;
@@ -1088,8 +1088,8 @@
 	/* INFO("drbd_thread_start: %s [%d]: %s %d -> Running\n",
 	     current->comm, current->pid,
 	     thi == &mdev->receiver ? "receiver" :
-             thi == &mdev->asender  ? "asender"  :
-             thi == &mdev->worker   ? "worker"   : "NONSENSE",
+	     thi == &mdev->asender  ? "asender"  :
+	     thi == &mdev->worker   ? "worker"	 : "NONSENSE",
 	     thi->t_state); */
 
 	if (thi->t_state == None) {
@@ -1199,7 +1199,7 @@
  * when we hold the appropriate socket mutex.
  */
 int drbd_send_cmd(drbd_dev *mdev, int use_data_socket,
-		  Drbd_Packet_Cmd cmd, Drbd_Header* h, size_t size)
+		  Drbd_Packet_Cmd cmd, Drbd_Header *h, size_t size)
 {
 	int ok = 0;
 	struct socket *sock;
@@ -1253,7 +1253,7 @@
 
 	p.rate      = cpu_to_be32(sc->rate);
 
-	return drbd_send_cmd(mdev, USE_DATA_SOCKET, SyncParam, (Drbd_Header*)&p, sizeof(p));
+	return drbd_send_cmd(mdev, USE_DATA_SOCKET, SyncParam, (Drbd_Header *)&p, sizeof(p));
 }
 
 int drbd_send_protocol(drbd_dev *mdev)
@@ -1268,7 +1268,7 @@
 	p.two_primaries = cpu_to_be32(mdev->net_conf->two_primaries);
 
 	return drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportProtocol,
-			     (Drbd_Header*)&p, sizeof(p));
+			     (Drbd_Header *)&p, sizeof(p));
 }
 
 int drbd_send_uuids(drbd_dev *mdev)
@@ -1292,7 +1292,7 @@
 	dec_local(mdev);
 
 	return drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportUUIDs,
-			     (Drbd_Header*)&p, sizeof(p));
+			     (Drbd_Header *)&p, sizeof(p));
 }
 
 int drbd_send_sync_uuid(drbd_dev *mdev, u64 val)
@@ -1302,7 +1302,7 @@
 	p.uuid = cpu_to_be64(val);
 
 	return drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportSyncUUID,
-			     (Drbd_Header*)&p, sizeof(p));
+			     (Drbd_Header *)&p, sizeof(p));
 }
 
 int drbd_send_sizes(drbd_dev *mdev)
@@ -1332,7 +1332,7 @@
 	p.queue_order_type = cpu_to_be32(q_order_type);
 
 	ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportSizes,
-			   (Drbd_Header*)&p, sizeof(p));
+			   (Drbd_Header *)&p, sizeof(p));
 	return ok;
 }
 
@@ -1343,7 +1343,7 @@
 	p.state    = cpu_to_be32(mdev->state.i);
 
 	return drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportState,
-			     (Drbd_Header*)&p, sizeof(p));
+			     (Drbd_Header *)&p, sizeof(p));
 }
 
 STATIC int drbd_send_state_req(drbd_dev *mdev, drbd_state_t mask, drbd_state_t val)
@@ -1354,7 +1354,7 @@
 	p.val     = cpu_to_be32(val.i);
 
 	return drbd_send_cmd(mdev, USE_DATA_SOCKET, StateChgRequest,
-			     (Drbd_Header*)&p, sizeof(p));
+			     (Drbd_Header *)&p, sizeof(p));
 }
 
 int drbd_send_sr_reply(drbd_dev *mdev, int retcode)
@@ -1364,7 +1364,7 @@
 	p.retcode    = cpu_to_be32(retcode);
 
 	return drbd_send_cmd(mdev, USE_META_SOCKET, StateChgReply,
-			     (Drbd_Header*)&p, sizeof(p));
+			     (Drbd_Header *)&p, sizeof(p));
 }
 
 
@@ -1434,7 +1434,7 @@
 	p.barrier  = barrier_nr;
 	p.set_size = cpu_to_be32(set_size);
 
-	ok = drbd_send_cmd(mdev, USE_META_SOCKET, BarrierAck, (Drbd_Header*)&p, sizeof(p));
+	ok = drbd_send_cmd(mdev, USE_META_SOCKET, BarrierAck, (Drbd_Header *)&p, sizeof(p));
 	return ok;
 }
 
@@ -1457,7 +1457,7 @@
 	p.seq_num  = cpu_to_be32(atomic_add_return(1, &mdev->packet_seq));
 
 	if (!mdev->meta.socket || mdev->state.conn < Connected) return FALSE;
-	ok = drbd_send_cmd(mdev, USE_META_SOCKET, cmd, (Drbd_Header*)&p, sizeof(p));
+	ok = drbd_send_cmd(mdev, USE_META_SOCKET, cmd, (Drbd_Header *)&p, sizeof(p));
 	return ok;
 }
 
@@ -1465,7 +1465,7 @@
 		     Drbd_Data_Packet *dp)
 {
 	const int header_size = sizeof(Drbd_Data_Packet) - sizeof(Drbd_Header);
-	int data_size  = ((Drbd_Header*)dp)->length - header_size;
+	int data_size  = ((Drbd_Header *)dp)->length - header_size;
 
 	return _drbd_send_ack(mdev, cmd, dp->sector, cpu_to_be32(data_size),
 			      dp->block_id);
@@ -1497,7 +1497,7 @@
 
 	/* FIXME BIO_RW_SYNC ? */
 
-	ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, (Drbd_Header*)&p, sizeof(p));
+	ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, (Drbd_Header *)&p, sizeof(p));
 	return ok;
 }
 
@@ -1550,7 +1550,7 @@
    As a workaround, we disable sendpage on pages with page_count == 0 or PageSlab.
 */
 int _drbd_no_send_page(drbd_dev *mdev, struct page *page,
-                   int offset, size_t size)
+		   int offset, size_t size)
 {
        int ret;
        ret = drbd_send(mdev, mdev->data.socket, kmap(page) + offset, size, 0);
@@ -1620,7 +1620,7 @@
 		len    -= sent;
 		offset += sent;
 		/* FIXME test "last_received" ... */
-	} while(len > 0 /* THINK && mdev->cstate >= Connected*/);
+	} while (len > 0 /* THINK && mdev->cstate >= Connected*/);
 	set_fs(oldfs);
 
   out:
@@ -1813,7 +1813,7 @@
 		sent += rv;
 		iov.iov_base += rv;
 		iov.iov_len  -= rv;
-	} while(sent < size);
+	} while (sent < size);
 
 #if !HAVE_KERNEL_SENDMSG
 	set_fs(oldfs);
@@ -2078,7 +2078,7 @@
 {
 	struct page *page;
 
-	while(drbd_pp_pool) {
+	while (drbd_pp_pool) {
 		page = drbd_pp_pool;
 		drbd_pp_pool = (struct page *)page_private(page);
 		__free_page(page);
@@ -2139,7 +2139,7 @@
 	/* drbd's page pool */
 	spin_lock_init(&drbd_pp_lock);
 
-	for (i = 0;i < number;i++) {
+	for (i = 0; i < number; i++) {
 		page = alloc_page(GFP_HIGHUSER);
 		if (!page) goto Enomem;
 		set_page_private(page, (unsigned long)drbd_pp_pool);
@@ -2744,7 +2744,7 @@
 
 STATIC void md_sync_timer_fn(unsigned long data)
 {
-	drbd_dev* mdev = (drbd_dev*) data;
+	drbd_dev *mdev = (drbd_dev *) data;
 
 	drbd_queue_work_front(&mdev->data.work, &mdev->md_sync_work);
 }
@@ -2845,30 +2845,30 @@
 
 
 /*
-
-drbd_print_buffer
-
-This routine dumps binary data to the debugging output. Can be
-called at interrupt level.
-
-Arguments:
-
-    prefix      - String is output at the beginning of each line output
-    flags       - Control operation of the routine. Currently defined
-                  Flags are:
-                  DBGPRINT_BUFFADDR; if set, each line starts with the
-                      virtual address of the line being outupt. If clear,
-                      each line starts with the offset from the beginning
-                      of the buffer.
-    size        - Indicates the size of each entry in the buffer. Supported
-                  values are sizeof(char), sizeof(short) and sizeof(int)
-    buffer      - Start address of buffer
-    buffer_va   - Virtual address of start of buffer (normally the same
-                  as Buffer, but having it separate allows it to hold
-                  file address for example)
-    length      - length of buffer
-
-*/
+ *
+ * drbd_print_buffer
+ *
+ * This routine dumps binary data to the debugging output. Can be
+ * called at interrupt level.
+ *
+ * Arguments:
+ *
+ *     prefix      - String is output at the beginning of each line output
+ *     flags       - Control operation of the routine. Currently defined
+ *                   Flags are:
+ *                   DBGPRINT_BUFFADDR; if set, each line starts with the
+ *                       virtual address of the line being outupt. If clear,
+ *                       each line starts with the offset from the beginning
+ *                       of the buffer.
+ *     size        - Indicates the size of each entry in the buffer. Supported
+ *                   values are sizeof(char), sizeof(short) and sizeof(int)
+ *     buffer      - Start address of buffer
+ *     buffer_va   - Virtual address of start of buffer (normally the same
+ *                   as Buffer, but having it separate allows it to hold
+ *                   file address for example)
+ *     length      - length of buffer
+ *
+ */
 void
 drbd_print_buffer(const char *prefix, unsigned int flags, int size,
 		  const void *buffer, const void *buffer_va,

Modified: branches/drbd-8.0-for-linus/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 13:20:54 UTC (rev 2992)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 13:25:49 UTC (rev 2993)
@@ -52,9 +52,9 @@
 	int tag; \
 	int dlen; \
 	\
-	while( (tag = *tags++) != TT_END ) { \
+	while ( (tag = *tags++) != TT_END ) { \
 		dlen = *tags++; \
-		switch( tag_number(tag) ) { \
+		switch ( tag_number(tag) ) { \
 		fields \
 		default: \
 			if (tag & T_MANDATORY) { \
@@ -157,7 +157,7 @@
 	       "Netlink: >> %s (%d) - seq: %x, ack: %x, len: %x\n",
 	       nlp->minor,
 	       nlp->packet_type == P_nl_after_last_packet?
-	           "Empty-Reply" : nl_packet_name(nlp->packet_type),
+		   "Empty-Reply" : nl_packet_name(nlp->packet_type),
 	       nlp->packet_type,
 	       req->seq, req->ack, req->len);
 }
@@ -199,7 +199,7 @@
 
 	r = drbd_khelper(mdev, "outdate-peer");
 
-	switch( (r>>8) & 0xff ) {
+	switch ( (r>>8) & 0xff ) {
 	case 3: /* peer is inconsistent */
 		nps = Inconsistent;
 		break;
@@ -268,7 +268,7 @@
 
 			val.pdsk = nps;
 			mask.pdsk = disk_mask;
-			
+
 			continue;
 		}
 
@@ -306,7 +306,7 @@
 
 	/* Wait until nothing is on the fly :) */
 	if ( wait_event_interruptible( mdev->misc_wait,
-			         atomic_read(&mdev->ap_pending_cnt) == 0 ) ) {
+				 atomic_read(&mdev->ap_pending_cnt) == 0 ) ) {
 		r = GotSignal;
 		goto fail;
 	}
@@ -390,7 +390,7 @@
 				       struct drbd_backing_dev *bdev)
 {
 	sector_t md_size_sect = 0;
-	switch(bdev->dc.meta_dev_idx) {
+	switch (bdev->dc.meta_dev_idx) {
 	default:
 		/* v07 style fixed size indexed meta data */
 		bdev->md.md_size_sect = MD_RESERVED_SECT;
@@ -410,7 +410,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);
@@ -495,7 +495,7 @@
 
 	/* 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;
+		|| prev_size	   != mdev->bc->md.md_size_sect;
 
 	if (md_moved) {
 		WARN("Moving meta-data.\n");
@@ -630,7 +630,7 @@
 	       DUMPI(b->seg_boundary_mask);
 	       );
 
-	q->max_sectors       = max_seg_s >> 9;
+	q->max_sectors	     = max_seg_s >> 9;
 	q->max_phys_segments = max_seg_s >> PAGE_SHIFT;
 	q->max_hw_segments   = max_seg_s >> PAGE_SHIFT;
 	q->max_segment_size  = max_seg_s;
@@ -685,11 +685,11 @@
 		goto fail;
 	}
 
-       /* 
-        * We may have gotten here very quickly from a detach. Wait for a bit
-        * then fail.
-        */
-	while(mdev->bc != NULL) {
+       /*
+	* We may have gotten here very quickly from a detach. Wait for a bit
+	* then fail.
+	*/
+	while (mdev->bc != NULL) {
 		if (ntries++ >= 5) {
 			WARN("drbd_nl_disk_conf: mdev->bc not NULL.\n");
 			retcode = HaveDiskConfig;
@@ -763,7 +763,7 @@
 	nbc->backing_bdev = inode->i_bdev;
 	if (bd_claim(nbc->backing_bdev, mdev)) {
 		printk(KERN_ERR "drbd: bd_claim(%p,%p); failed [%p;%p;%u]\n",
-		       nbc->backing_bdev, mdev, 
+		       nbc->backing_bdev, mdev,
 		       nbc->backing_bdev->bd_holder,
 		       nbc->backing_bdev->bd_contains->bd_holder,
 		       nbc->backing_bdev->bd_holders);
@@ -955,8 +955,8 @@
 	drbd_bm_unlock(mdev);
 
 	if (inc_local_if_state(mdev, Attaching)) {
-		if (mdev->state.role == Primary) mdev->bc->md.uuid[Current] |=  (u64)1;
-		else                            mdev->bc->md.uuid[Current] &= ~(u64)1;
+		if (mdev->state.role == Primary) mdev->bc->md.uuid[Current] |=	(u64)1;
+		else				mdev->bc->md.uuid[Current] &= ~(u64)1;
 		dec_local(mdev);
 	}
 
@@ -1025,22 +1025,22 @@
 		dec_local(mdev);
 	} else {
 		memset(new_conf, 0, sizeof(struct net_conf));
-		new_conf->timeout          = DRBD_TIMEOUT_DEF;
+		new_conf->timeout	   = DRBD_TIMEOUT_DEF;
 		new_conf->try_connect_int  = DRBD_CONNECT_INT_DEF;
-		new_conf->ping_int         = DRBD_PING_INT_DEF;
+		new_conf->ping_int	   = DRBD_PING_INT_DEF;
 		new_conf->max_epoch_size   = DRBD_MAX_EPOCH_SIZE_DEF;
-		new_conf->max_buffers      = DRBD_MAX_BUFFERS_DEF;
+		new_conf->max_buffers	   = DRBD_MAX_BUFFERS_DEF;
 		new_conf->unplug_watermark = DRBD_UNPLUG_WATERMARK_DEF;
-		new_conf->sndbuf_size      = DRBD_SNDBUF_SIZE_DEF;
-		new_conf->ko_count         = DRBD_KO_COUNT_DEF;
-		new_conf->after_sb_0p      = DRBD_AFTER_SB_0P_DEF;
-		new_conf->after_sb_1p      = DRBD_AFTER_SB_1P_DEF;
-		new_conf->after_sb_2p      = DRBD_AFTER_SB_2P_DEF;
-		new_conf->want_lose        = 0;
+		new_conf->sndbuf_size	   = DRBD_SNDBUF_SIZE_DEF;
+		new_conf->ko_count	   = DRBD_KO_COUNT_DEF;
+		new_conf->after_sb_0p	   = DRBD_AFTER_SB_0P_DEF;
+		new_conf->after_sb_1p	   = DRBD_AFTER_SB_1P_DEF;
+		new_conf->after_sb_2p	   = DRBD_AFTER_SB_2P_DEF;
+		new_conf->want_lose	   = 0;
 		new_conf->two_primaries    = 0;
 		new_conf->wire_protocol    = DRBD_PROT_C;
-		new_conf->ping_timeo       = DRBD_PING_TIMEO_DEF;
-		new_conf->rr_conflict      = DRBD_RR_CONFLICT_DEF;
+		new_conf->ping_timeo	   = DRBD_PING_TIMEO_DEF;
+		new_conf->rr_conflict	   = DRBD_RR_CONFLICT_DEF;
 	}
 
 	if (!net_conf_from_tags(mdev, nlp->tag_list, new_conf)) {
@@ -1063,7 +1063,7 @@
 #define O_ADDR(A) (((struct sockaddr_in *)&A->peer_addr)->sin_addr.s_addr)
 #define O_PORT(A) (((struct sockaddr_in *)&A->peer_addr)->sin_port)
 	retcode = NoError;
-	for(i = 0;i < minor_count;i++) {
+	for (i = 0; i < minor_count; i++) {
 		odev = minor_to_mdev(i);
 		if (!odev || odev == mdev) continue;
 		if ( inc_net(odev)) {
@@ -1127,10 +1127,10 @@
 	 *
 	 * XXX maybe rather store the value scaled to jiffies?
 	 * Note: MAX_SCHEDULE_TIMEOUT/HZ*HZ != MAX_SCHEDULE_TIMEOUT
-	 *       and HZ > 10; which is unlikely to change...
-	 *       Thus, if interrupted by a signal,
-	 *       sock_{send,recv}msg returns -EINTR,
-	 *       if the timeout expires, -EAGAIN.
+	 *	 and HZ > 10; which is unlikely to change...
+	 *	 Thus, if interrupted by a signal,
+	 *	 sock_{send,recv}msg returns -EINTR,
+	 *	 if the timeout expires, -EAGAIN.
 	 */
 	/* unlikely: someone disabled the timeouts ...
 	 * just put some huge values in there. */
@@ -1293,7 +1293,7 @@
 			goto fail;
 		}
 		odev = minor_to_mdev(sc.after); /* check against loops in */
-		while(1) {
+		while (1) {
 			if (odev == mdev) {
 				retcode = SyncAfterCycle;
 				goto fail;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 13:20:54 UTC (rev 2992)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 13:25:49 UTC (rev 2993)
@@ -88,7 +88,7 @@
 			       mdev_to_minor(mdev), t);
 			break;
 		}
-	} while(le != list);
+	} while (le != list);
 
 	le = list;
 	do {
@@ -106,7 +106,7 @@
 			       mdev_to_minor(mdev), t);
 			break;
 		}
-	} while(le != list);
+	} while (le != list);
 
 	if (forward != backward) {
 		printk(KERN_ERR DEVICE_NAME "%d: forward=%d, backward=%d\n",
@@ -261,7 +261,7 @@
 	bio->bi_sector = sector;
 
 	ds = data_size;
-	while(ds) {
+	while (ds) {
 		page = drbd_pp_alloc(mdev, gfp_mask);
 		if (!page) {
 			ERR("alloc_ee: Allocation of a page failed\n");
@@ -354,7 +354,7 @@
 	struct list_head *le;
 
 	spin_lock_irq(&mdev->req_lock);
-	while(!list_empty(list)) {
+	while (!list_empty(list)) {
 		le = list->next;
 		list_del(le);
 		e = list_entry(le, struct Tl_epoch_entry, w.list);
@@ -440,7 +440,7 @@
 
 	reclaim_net_ee(mdev);
 
-	while(!list_empty(&mdev->done_ee)) {
+	while (!list_empty(&mdev->done_ee)) {
 		le = mdev->done_ee.next;
 		list_del(le);
 		e = list_entry(le, struct Tl_epoch_entry, w.list);
@@ -555,13 +555,13 @@
 	oldfs = get_fs();
 	set_fs(KERNEL_DS);
 
-	for(;;) {
+	for (;;) {
 		rv = sock_recvmsg(mdev->data.socket, &msg, size, msg.msg_flags);
 		if (rv == size) break;
 
 		/* Note:
-		 * ECONNRESET   other side closed the connection
-		 * ERESTARTSYS  (on  sock) we got a signal
+		 * ECONNRESET	other side closed the connection
+		 * ERESTARTSYS	(on  sock) we got a signal
 		 */
 
 		if (rv < 0) {
@@ -573,7 +573,7 @@
 		} else if (rv == 0) {
 			INFO("sock was shut down by peer\n");
 			break;
-		} else  {
+		} else	{
 			/* signal came in, or peer/link went down,
 			 * after we read a partial message
 			 */
@@ -607,11 +607,11 @@
 	sock->sk->sk_sndtimeo =  mdev->net_conf->try_connect_int*HZ;
 
        /* explicitly bind to the configured IP as source IP
-	   for the outgoing connections.
-	   This is needed for multihomed hosts and to be
-	   able to use lo: interfaces for drbd.
-          Make sure to use 0 as portnumber, so linux selects
-	   a free one dynamically.
+	*  for the outgoing connections.
+	*  This is needed for multihomed hosts and to be
+	*  able to use lo: interfaces for drbd.
+	* Make sure to use 0 as portnumber, so linux selects
+	*  a free one dynamically.
 	*/
 	memcpy (&src_in, &(mdev->net_conf->my_addr), sizeof(struct sockaddr_in));
 	src_in.sin_port = 0;
@@ -720,7 +720,7 @@
 	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() */
@@ -753,7 +753,7 @@
 
 		s = drbd_wait_for_connect(mdev);
 		if (s) {
-			switch(drbd_recv_fp(mdev, s)) {
+			switch (drbd_recv_fp(mdev, s)) {
 			case HandShakeS:
 				if (sock) sock_release(sock);
 				sock = s;
@@ -780,7 +780,7 @@
 			}
 		}
 
-	} while( !sock || !msock );
+	} while ( !sock || !msock );
 
 	msock->sk->sk_reuse = 1; /* SO_REUSEADDR */
 	sock->sk->sk_reuse = 1; /* SO_REUSEADDR */
@@ -863,11 +863,11 @@
 	return TRUE;
 }
 
-STATIC int receive_Barrier_no_tcq(drbd_dev *mdev, Drbd_Header* h)
+STATIC int receive_Barrier_no_tcq(drbd_dev *mdev, Drbd_Header *h)
 {
 	int rv;
 	int epoch_size;
-	Drbd_Barrier_Packet *p = (Drbd_Barrier_Packet*)h;
+	Drbd_Barrier_Packet *p = (Drbd_Barrier_Packet *)h;
 
 	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
 
@@ -948,7 +948,7 @@
 	page = drbd_pp_alloc(mdev, GFP_KERNEL);
 
 	data = kmap(page);
-	while(data_size) {
+	while (data_size) {
 		rr = drbd_recv(mdev, data, min_t(int, data_size, PAGE_SIZE));
 		if ( rr != min_t(int, data_size, PAGE_SIZE) ) {
 			rv = 0;
@@ -1060,13 +1060,13 @@
 	return TRUE;
 }
 
-STATIC int receive_DataReply(drbd_dev *mdev, Drbd_Header* h)
+STATIC int receive_DataReply(drbd_dev *mdev, Drbd_Header *h)
 {
 	drbd_request_t *req;
 	sector_t sector;
 	unsigned int header_size, data_size;
 	int ok;
-	Drbd_Data_Packet *p = (Drbd_Data_Packet*)h;
+	Drbd_Data_Packet *p = (Drbd_Data_Packet *)h;
 
 	header_size = sizeof(*p) - sizeof(*h);
 	data_size   = h->length  - header_size;
@@ -1104,12 +1104,12 @@
 	return ok;
 }
 
-STATIC int receive_RSDataReply(drbd_dev *mdev, Drbd_Header* h)
+STATIC int receive_RSDataReply(drbd_dev *mdev, Drbd_Header *h)
 {
 	sector_t sector;
 	unsigned int header_size, data_size;
 	int ok;
-	Drbd_Data_Packet *p = (Drbd_Data_Packet*)h;
+	Drbd_Data_Packet *p = (Drbd_Data_Packet *)h;
 
 	header_size = sizeof(*p) - sizeof(*h);
 	data_size   = h->length  - header_size;
@@ -1269,11 +1269,11 @@
 }
 
 /* mirrored write */
-STATIC int receive_Data(drbd_dev *mdev, Drbd_Header* h)
+STATIC int receive_Data(drbd_dev *mdev, Drbd_Header *h)
 {
 	sector_t sector;
 	struct Tl_epoch_entry *e;
-	Drbd_Data_Packet *p = (Drbd_Data_Packet*)h;
+	Drbd_Data_Packet *p = (Drbd_Data_Packet *)h;
 	int header_size, data_size;
 	unsigned int barrier_nr = 0;
 	unsigned int epoch_size = 0;
@@ -1365,18 +1365,18 @@
 		 *
 		 * if any conflicting request is found that has not yet been acked,
 		 * AND I have the "discard concurrent writes" flag:
-		 *       queue (via done_ee) the DiscardAck; OUT.
+		 *	 queue (via done_ee) the DiscardAck; OUT.
 		 *
 		 * if any conflicting request is found:
-		 *       block the receiver, waiting on misc_wait
-		 *       until no more conflicting requests are there,
-		 *       or we get interrupted (disconnect).
+		 *	 block the receiver, waiting on misc_wait
+		 *	 until no more conflicting requests are there,
+		 *	 or we get interrupted (disconnect).
 		 *
-		 *       we do not just write after local io completion of those
-		 *       requests, but only after req is done completely, i.e.
-		 *       we wait for the DiscardAck to arrive!
+		 *	 we do not just write after local io completion of those
+		 *	 requests, but only after req is done completely, i.e.
+		 *	 we wait for the DiscardAck to arrive!
 		 *
-		 *       then proceed normally, i.e. submit.
+		 *	 then proceed normally, i.e. submit.
 		 */
 		if (drbd_wait_peer_seq(mdev, be32_to_cpu(p->seq_num)))
 			goto out_interrupted;
@@ -1388,7 +1388,7 @@
 #define OVERLAPS overlaps(i->sector, i->size, sector, size)
 		slot = tl_hash_slot(mdev, sector);
 		first = 1;
-		for(;;) {
+		for (;;) {
 			int have_unacked = 0;
 			int have_conflict = 0;
 			prepare_to_wait(&mdev->misc_wait, &wait, TASK_INTERRUPTIBLE);
@@ -1522,7 +1522,7 @@
 		(void)drbd_send_b_ack(mdev, cpu_to_be32(barrier_nr), epoch_size);
 	}
 
-	switch(mdev->net_conf->wire_protocol) {
+	switch (mdev->net_conf->wire_protocol) {
 	case DRBD_PROT_C:
 		inc_unacked(mdev);
 		/* corresponding dec_unacked() in e_end_block()
@@ -1572,7 +1572,7 @@
 	struct Tl_epoch_entry *e;
 	int size;
 	unsigned int fault_type;
-	Drbd_BlockRequest_Packet *p = (Drbd_BlockRequest_Packet*)h;
+	Drbd_BlockRequest_Packet *p = (Drbd_BlockRequest_Packet *)h;
 
 	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
 
@@ -1691,7 +1691,7 @@
 		}
 		if (mdev->net_conf->after_sb_0p == DiscardZeroChg) break;
 	case DiscardLeastChg:
-		if      ( ch_self < ch_peer ) rv = -1;
+		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. */
@@ -1800,14 +1800,14 @@
 }
 
 /*
-  100   after split brain try auto recover
-    2   SyncSource set BitMap
-    1   SyncSource use BitMap
-    0   no Sync
-   -1   SyncTarget use BitMap
-   -2   SyncTarget set BitMap
- -100   after split brain, disconnect
--1000   unrelated data
+  100	after split brain try auto recover
+    2	SyncSource set BitMap
+    1	SyncSource use BitMap
+    0	no Sync
+   -1	SyncTarget use BitMap
+   -2	SyncTarget set BitMap
+ -100	after split brain, disconnect
+-1000	unrelated data
  */
 STATIC int drbd_uuid_compare(drbd_dev *mdev, int *rule_nr)
 {
@@ -1840,7 +1840,7 @@
 
 		MTRACE(TraceTypeUuid, TraceLvlMetrics, DUMPI(rct); );
 
-		switch(rct) {
+		switch (rct) {
 		case 0: /* !self_pri && !peer_pri */ return 0;
 		case 1: /*  self_pri && !peer_pri */ return 1;
 		case 2: /* !self_pri &&  peer_pri */ return -1;
@@ -1981,7 +1981,7 @@
 
 	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) {
+		switch (mdev->net_conf->rr_conflict) {
 		case CallHelper:
 			drbd_khelper(mdev, "pri-lost");
 			/* fall through */
@@ -2045,7 +2045,7 @@
 
 STATIC int receive_protocol(drbd_dev *mdev, Drbd_Header *h)
 {
-	Drbd_Protocol_Packet *p = (Drbd_Protocol_Packet*)h;
+	Drbd_Protocol_Packet *p = (Drbd_Protocol_Packet *)h;
 
 	int p_proto, p_after_sb_0p, p_after_sb_1p, p_after_sb_2p;
 	int p_want_lose, p_two_primaries;
@@ -2054,11 +2054,11 @@
 	if (drbd_recv(mdev, h->payload, h->length) != h->length)
 		return FALSE;
 
-	p_proto         = be32_to_cpu(p->protocol);
-	p_after_sb_0p   = be32_to_cpu(p->after_sb_0p);
-	p_after_sb_1p   = be32_to_cpu(p->after_sb_1p);
-	p_after_sb_2p   = be32_to_cpu(p->after_sb_2p);
-	p_want_lose     = be32_to_cpu(p->want_lose);
+	p_proto		= be32_to_cpu(p->protocol);
+	p_after_sb_0p	= be32_to_cpu(p->after_sb_0p);
+	p_after_sb_1p	= be32_to_cpu(p->after_sb_1p);
+	p_after_sb_2p	= be32_to_cpu(p->after_sb_2p);
+	p_want_lose	= be32_to_cpu(p->want_lose);
 	p_two_primaries = be32_to_cpu(p->two_primaries);
 
 	if (p_proto != mdev->net_conf->wire_protocol) {
@@ -2101,14 +2101,14 @@
 STATIC int receive_SyncParam(drbd_dev *mdev, Drbd_Header *h)
 {
 	int ok = TRUE;
-	Drbd_SyncParam_Packet *p = (Drbd_SyncParam_Packet*)h;
+	Drbd_SyncParam_Packet *p = (Drbd_SyncParam_Packet *)h;
 
 	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
 	if (drbd_recv(mdev, h->payload, h->length) != h->length)
 		return FALSE;
 
 	/* XXX harmless race with ioctl ... */
-	mdev->sync_conf.rate      = be32_to_cpu(p->rate);
+	mdev->sync_conf.rate	  = be32_to_cpu(p->rate);
 
 	return ok;
 }
@@ -2132,7 +2132,7 @@
 
 STATIC int receive_sizes(drbd_dev *mdev, Drbd_Header *h)
 {
-	Drbd_Sizes_Packet *p = (Drbd_Sizes_Packet*)h;
+	Drbd_Sizes_Packet *p = (Drbd_Sizes_Packet *)h;
 	unsigned int max_seg_s;
 	sector_t p_size, p_usize, my_usize;
 	drbd_conns_t nconn;
@@ -2237,7 +2237,7 @@
 
 STATIC int receive_uuids(drbd_dev *mdev, Drbd_Header *h)
 {
-	Drbd_GenCnt_Packet *p = (Drbd_GenCnt_Packet*)h;
+	Drbd_GenCnt_Packet *p = (Drbd_GenCnt_Packet *)h;
 	u64 *p_uuid;
 	int i;
 
@@ -2288,7 +2288,7 @@
 
 STATIC int receive_req_state(drbd_dev *mdev, Drbd_Header *h)
 {
-	Drbd_Req_State_Packet *p = (Drbd_Req_State_Packet*)h;
+	Drbd_Req_State_Packet *p = (Drbd_Req_State_Packet *)h;
 	drbd_state_t mask, val;
 	int rv;
 
@@ -2316,7 +2316,7 @@
 
 STATIC int receive_state(drbd_dev *mdev, Drbd_Header *h)
 {
-	Drbd_State_Packet *p = (Drbd_State_Packet*)h;
+	Drbd_State_Packet *p = (Drbd_State_Packet *)h;
 	drbd_conns_t nconn, oconn;
 	drbd_state_t os, ns, peer_state;
 	int rv;
@@ -2387,7 +2387,7 @@
 
 STATIC int receive_sync_uuid(drbd_dev *mdev, Drbd_Header *h)
 {
-	Drbd_SyncUUID_Packet *p = (Drbd_SyncUUID_Packet*)h;
+	Drbd_SyncUUID_Packet *p = (Drbd_SyncUUID_Packet *)h;
 
 	wait_event( mdev->misc_wait,
 		    mdev->state.conn < Connected || mdev->state.conn == WFSyncUUID);
@@ -2425,8 +2425,8 @@
 	drbd_bm_lock(mdev);
 
 	bm_words = drbd_bm_words(mdev);
-	bm_i     = 0;
-	buffer   = vmalloc(BM_PACKET_WORDS*sizeof(long));
+	bm_i	 = 0;
+	buffer	 = vmalloc(BM_PACKET_WORDS*sizeof(long));
 
 	while (1) {
 		num_words = min_t(size_t, BM_PACKET_WORDS, bm_words-bm_i );
@@ -2488,27 +2488,27 @@
 	return TRUE; /* cannot fail. */
 }
 
-typedef int (*drbd_cmd_handler_f)(drbd_dev*, Drbd_Header*);
+typedef int (*drbd_cmd_handler_f)(drbd_dev *, Drbd_Header *);
 
 static drbd_cmd_handler_f drbd_default_handler[] = {
-	[Data]             = receive_Data,
-	[DataReply]        = receive_DataReply,
-	[RSDataReply]      = receive_RSDataReply,
-	[RecvAck]          = NULL, /* via msock: got_RecvAck, */
-	[WriteAck]         = NULL, /* via msock: got_WriteAck, */
-	[Barrier]          = receive_Barrier_no_tcq,
-	[BarrierAck]       = NULL, /* via msock: got_BarrierAck, */
-	[ReportBitMap]     = receive_bitmap,
-	[Ping]             = NULL, /* via msock: got_Ping, */
-	[PingAck]          = NULL, /* via msock: got_PingAck, */
-	[UnplugRemote]     = receive_UnplugRemote,
-	[DataRequest]      = receive_DataRequest,
+	[Data]		   = receive_Data,
+	[DataReply]	   = receive_DataReply,
+	[RSDataReply]	   = receive_RSDataReply,
+	[RecvAck]	   = NULL, /* via msock: got_RecvAck, */
+	[WriteAck]	   = NULL, /* via msock: got_WriteAck, */
+	[Barrier]	   = receive_Barrier_no_tcq,
+	[BarrierAck]	   = NULL, /* via msock: got_BarrierAck, */
+	[ReportBitMap]	   = receive_bitmap,
+	[Ping]		   = NULL, /* via msock: got_Ping, */
+	[PingAck]	   = NULL, /* via msock: got_PingAck, */
+	[UnplugRemote]	   = receive_UnplugRemote,
+	[DataRequest]	   = receive_DataRequest,
 	[RSDataRequest]    = receive_DataRequest, /* receive_RSDataRequest, */
-	[SyncParam]        = receive_SyncParam,
+	[SyncParam]	   = receive_SyncParam,
 	[ReportProtocol]   = receive_protocol,
-	[ReportUUIDs]      = receive_uuids,
-	[ReportSizes]      = receive_sizes,
-	[ReportState]      = receive_state,
+	[ReportUUIDs]	   = receive_uuids,
+	[ReportSizes]	   = receive_sizes,
+	[ReportState]	   = receive_state,
 	[StateChgRequest]  = receive_req_state,
 	[ReportSyncUUID]   = receive_sync_uuid,
 };
@@ -2565,7 +2565,7 @@
 	 * Application READ requests
 	 */
 	spin_lock_irq(&mdev->req_lock);
-	for(i = 0;i < APP_R_HSIZE;i++) {
+	for (i = 0; i < APP_R_HSIZE; i++) {
 		slot = mdev->app_reads_hash+i;
 		hlist_for_each_entry(req, n, slot, colision) {
 			list_add(&req->w.list, &workset);
@@ -2573,7 +2573,7 @@
 	}
 	memset(mdev->app_reads_hash, 0, APP_R_HSIZE*sizeof(void *));
 
-	while(!list_empty(&workset)) {
+	while (!list_empty(&workset)) {
 		le = workset.next;
 		req = list_entry(le, drbd_request_t, w.list);
 		list_del(le);
@@ -2623,15 +2623,15 @@
 	drbd_fail_pending_reads(mdev);
 
 	/* We do not have data structures that would allow us to
-	   get the rs_pending_cnt down to 0 again.
-	   * On SyncTarget we do not have any data structures describing
-	     the pending RSDataRequest's we have sent.
-	   * On SyncSource there is no data structure that tracks
-	     the RSDataReply blocks that we sent to the SyncTarget.
-	   And no, it is not the sum of the reference counts in the
-	   resync_LRU. The resync_LRU tracks the whole operation including
-           the disk-IO, while the rs_pending_cnt only tracks the blocks
-	   on the fly. */
+	 * get the rs_pending_cnt down to 0 again.
+	 *  * On SyncTarget we do not have any data structures describing
+	 *    the pending RSDataRequest's we have sent.
+	 *  * On SyncSource there is no data structure that tracks
+	 *    the RSDataReply blocks that we sent to the SyncTarget.
+	 *  And no, it is not the sum of the reference counts in the
+	 *  resync_LRU. The resync_LRU tracks the whole operation including
+	 *  the disk-IO, while the rs_pending_cnt only tracks the blocks
+	 *  on the fly. */
 	drbd_rs_cancel_all(mdev);
 	mdev->rs_total = 0;
 	mdev->rs_failed = 0;
@@ -2750,7 +2750,7 @@
 	memset(p, 0, sizeof(*p));
 	p->protocol_version = cpu_to_be32(PRO_VERSION);
 	ok = _drbd_send_cmd( mdev, mdev->data.socket, HandShake,
-	                     (Drbd_Header *)p, sizeof(*p), 0 );
+			     (Drbd_Header *)p, sizeof(*p), 0 );
 	up(&mdev->data.mutex);
 	return ok;
 }
@@ -3033,9 +3033,9 @@
 
 /* ********* acknowledge sender ******** */
 
-STATIC int got_RqSReply(drbd_dev *mdev, Drbd_Header* h)
+STATIC int got_RqSReply(drbd_dev *mdev, Drbd_Header *h)
 {
-	Drbd_RqS_Reply_Packet *p = (Drbd_RqS_Reply_Packet*)h;
+	Drbd_RqS_Reply_Packet *p = (Drbd_RqS_Reply_Packet *)h;
 
 	int retcode = be32_to_cpu(p->retcode);
 
@@ -3051,13 +3051,13 @@
 	return TRUE;
 }
 
-STATIC int got_Ping(drbd_dev *mdev, Drbd_Header* h)
+STATIC int got_Ping(drbd_dev *mdev, Drbd_Header *h)
 {
 	return drbd_send_ping_ack(mdev);
 
 }
 
-STATIC int got_PingAck(drbd_dev *mdev, Drbd_Header* h)
+STATIC int got_PingAck(drbd_dev *mdev, Drbd_Header *h)
 {
 	/* restore idle timeout */
 	mdev->meta.socket->sk->sk_rcvtimeo = mdev->net_conf->ping_int*HZ;
@@ -3065,10 +3065,10 @@
 	return TRUE;
 }
 
-STATIC int got_BlockAck(drbd_dev *mdev, Drbd_Header* h)
+STATIC int got_BlockAck(drbd_dev *mdev, Drbd_Header *h)
 {
 	drbd_request_t *req;
-	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet*)h;
+	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet *)h;
 	sector_t sector = be64_to_cpu(p->sector);
 	int blksize = be32_to_cpu(p->blksize);
 
@@ -3117,9 +3117,9 @@
 	return TRUE;
 }
 
-STATIC int got_NegAck(drbd_dev *mdev, Drbd_Header* h)
+STATIC int got_NegAck(drbd_dev *mdev, Drbd_Header *h)
 {
-	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet*)h;
+	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet *)h;
 	sector_t sector = be64_to_cpu(p->sector);
 	drbd_request_t *req;
 
@@ -3150,10 +3150,10 @@
 	return TRUE;
 }
 
-STATIC int got_NegDReply(drbd_dev *mdev, Drbd_Header* h)
+STATIC int got_NegDReply(drbd_dev *mdev, Drbd_Header *h)
 {
 	drbd_request_t *req;
-	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet*)h;
+	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet *)h;
 	sector_t sector = be64_to_cpu(p->sector);
 
 	spin_lock_irq(&mdev->req_lock);
@@ -3178,11 +3178,11 @@
 	return TRUE;
 }
 
-STATIC int got_NegRSDReply(drbd_dev *mdev, Drbd_Header* h)
+STATIC int got_NegRSDReply(drbd_dev *mdev, Drbd_Header *h)
 {
 	sector_t sector;
 	int size;
-	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet*)h;
+	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet *)h;
 
 	sector = be64_to_cpu(p->sector);
 	size = be32_to_cpu(p->blksize);
@@ -3199,9 +3199,9 @@
 	return TRUE;
 }
 
-STATIC int got_BarrierAck(drbd_dev *mdev, Drbd_Header* h)
+STATIC int got_BarrierAck(drbd_dev *mdev, Drbd_Header *h)
 {
-	Drbd_BarrierAck_Packet *p = (Drbd_BarrierAck_Packet*)h;
+	Drbd_BarrierAck_Packet *p = (Drbd_BarrierAck_Packet *)h;
 
 	tl_release(mdev, p->barrier, be32_to_cpu(p->set_size));
 	dec_ap_pending(mdev);
@@ -3211,7 +3211,7 @@
 
 struct asender_cmd {
 	size_t pkt_size;
-	int (*process)(drbd_dev *mdev, Drbd_Header* h);
+	int (*process)(drbd_dev *mdev, Drbd_Header *h);
 };
 
 int drbd_asender(struct Drbd_thread *thi)
@@ -3227,16 +3227,16 @@
 	int empty;
 
 	static struct asender_cmd asender_tbl[] = {
-	[Ping]          = { sizeof(Drbd_Header),            got_Ping },
-	[PingAck]       = { sizeof(Drbd_Header),            got_PingAck },
-	[RecvAck]       = { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
-	[WriteAck]      = { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
-	[RSWriteAck]    = { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
-	[DiscardAck]    = { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
-	[NegAck]        = { sizeof(Drbd_BlockAck_Packet),   got_NegAck },
-	[NegDReply]     = { sizeof(Drbd_BlockAck_Packet),   got_NegDReply },
-	[NegRSDReply]   = { sizeof(Drbd_BlockAck_Packet),   got_NegRSDReply},
-	[BarrierAck]    = { sizeof(Drbd_BarrierAck_Packet), got_BarrierAck },
+	[Ping]		= { sizeof(Drbd_Header),	    got_Ping },
+	[PingAck]	= { sizeof(Drbd_Header),	    got_PingAck },
+	[RecvAck]	= { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
+	[WriteAck]	= { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
+	[RSWriteAck]	= { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
+	[DiscardAck]	= { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
+	[NegAck]	= { sizeof(Drbd_BlockAck_Packet),   got_NegAck },
+	[NegDReply]	= { sizeof(Drbd_BlockAck_Packet),   got_NegDReply },
+	[NegRSDReply]	= { sizeof(Drbd_BlockAck_Packet),   got_NegRSDReply},
+	[BarrierAck]	= { sizeof(Drbd_BarrierAck_Packet), got_BarrierAck },
 	[StateChgReply] = { sizeof(Drbd_RqS_Reply_Packet),  got_RqSReply },
 	};
 
@@ -3252,7 +3252,7 @@
 				mdev->net_conf->ping_timeo*HZ/10;
 		}
 
-		while(1) {
+		while (1) {
 			if (!drbd_process_done_ee(mdev)) {
 				ERR("process_done_ee() = NOT_OK\n");
 				goto err;
@@ -3276,18 +3276,18 @@
 		drbd_tcp_cork(mdev->meta.socket);
 
 		/* Note:
-		 * -EINTR        (on meta) we got a signal
-		 * -EAGAIN       (on meta) rcvtimeo expired
-		 * -ECONNRESET   other side closed the connection
+		 * -EINTR	 (on meta) we got a signal
+		 * -EAGAIN	 (on meta) rcvtimeo expired
+		 * -ECONNRESET	 other side closed the connection
 		 * -ERESTARTSYS  (on data) we got a signal
-		 * rv <  0       other than above: unexpected error!
+		 * rv <  0	 other than above: unexpected error!
 		 * rv == expected: full header or command
 		 * rv <  expected: "woken" by signal during receive
-		 * rv == 0       : "connection shut down by peer"
+		 * rv == 0	 : "connection shut down by peer"
 		 */
 		if (likely(rv > 0)) {
 			received += rv;
-			buf      += rv;
+			buf	 += rv;
 		} else if (rv == 0) {
 			ERR("meta connection shut down by peer.\n");
 			goto err;
@@ -3326,10 +3326,10 @@
 			dump_packet(mdev, mdev->meta.socket, 1, (void *)h, __FILE__, __LINE__);
 			if (!asender_tbl[cmd].process(mdev, h)) goto err;
 
-			buf      = h;
+			buf	 = h;
 			received = 0;
-			expect   = sizeof(Drbd_Header);
-			cmd      = -1;
+			expect	 = sizeof(Drbd_Header);
+			cmd	 = -1;
 		}
 	}
 

Modified: branches/drbd-8.0-for-linus/drbd/drbd_req.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 13:20:54 UTC (rev 2992)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 13:25:49 UTC (rev 2993)
@@ -145,7 +145,7 @@
 				dec_local(mdev);
 			} else {
 				WARN("Should have called drbd_al_complete_io(, %llu), "
-				     "but my Disk seems to have failed:(\n", 
+				     "but my Disk seems to have failed :(\n",
 				     (unsigned long long) req->sector);
 			}
 		}
@@ -439,7 +439,7 @@
 
 	print_req_mod(req, what);
 
-	switch(what) {
+	switch (what) {
 	default:
 		ERR("LOGIC BUG in %s:%u\n", __FILE__ , __LINE__ );
 		return;
@@ -912,7 +912,7 @@
 	 * make sure that, if this is a write request and it triggered a
 	 * barrier packet, this request is queued within the same spinlock. */
 	if (remote && mdev->unused_spare_barrier &&
-            test_and_clear_bit(ISSUE_BARRIER, &mdev->flags)) {
+	    test_and_clear_bit(ISSUE_BARRIER, &mdev->flags)) {
 		struct drbd_barrier *b = mdev->unused_spare_barrier;
 		b = _tl_add_barrier(mdev, b);
 		mdev->unused_spare_barrier = NULL;
@@ -993,7 +993,7 @@
 
 		if (FAULT_ACTIVE(mdev, rw == WRITE ? DRBD_FAULT_DT_WR :
 				       ( rw == READ ? DRBD_FAULT_DT_RD :
-  				                   DRBD_FAULT_DT_RA ) ))
+						   DRBD_FAULT_DT_RA ) ))
 			bio_endio(req->private_bio, req->private_bio->bi_size, -EIO);
 		else
 			generic_make_request(req->private_bio);
@@ -1017,7 +1017,7 @@
  * return 1
  * otherwise return 0
  */
-static int drbd_fail_request_early(drbd_dev* mdev, int is_write)
+static int drbd_fail_request_early(drbd_dev *mdev, int is_write)
 {
 	/* Unconfigured */
 	if (mdev->state.conn == Disconnecting &&
@@ -1058,7 +1058,7 @@
 int drbd_make_request_26(request_queue_t *q, struct bio *bio)
 {
 	unsigned int s_enr, e_enr;
-	struct Drbd_Conf *mdev = (drbd_dev*) q->queuedata;
+	struct Drbd_Conf *mdev = (drbd_dev *) q->queuedata;
 
 	if (drbd_fail_request_early(mdev, bio_data_dir(bio) & WRITE)) {
 		bio_endio(bio, bio->bi_size, -EPERM);
@@ -1133,7 +1133,7 @@
  * we should use DRBD_MAX_SEGMENT_SIZE instead of AL_EXTENT_SIZE */
 int drbd_merge_bvec(request_queue_t *q, struct bio *bio, struct bio_vec *bvec)
 {
-	struct Drbd_Conf *mdev = (drbd_dev*) q->queuedata;
+	struct Drbd_Conf *mdev = (drbd_dev *) q->queuedata;
 	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_strings.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_strings.c	2007-07-24 13:20:54 UTC (rev 2992)
+++ branches/drbd-8.0-for-linus/drbd/drbd_strings.c	2007-07-24 13:25:49 UTC (rev 2993)
@@ -78,29 +78,26 @@
 	[-SS_ResyncRunning] = "Can not start resync since it is already active",
 	[-SS_AlreadyStandAlone] = "Can not disconnect a StandAlone device",
 	[-SS_CW_FailedByPeer] = "State changed was refused by peer node",
-	[-SS_IsDiskLess] = 
+	[-SS_IsDiskLess] =
 		"Device is diskless, the requesed operation requires a disk",
 	[-SS_DeviceInUse] = "Device is held open by someone"
 };
 
 const char *conns_to_name(drbd_conns_t s) {
 	/* enums are unsigned... */
-	return s > PausedSyncT  ? "TOO_LARGE"
-		                : drbd_conn_s_names[s];
+	return s > PausedSyncT ? "TOO_LARGE" : drbd_conn_s_names[s];
 }
 
 const char *roles_to_name(drbd_role_t s) {
-	return s > Secondary  ? "TOO_LARGE"
-		              : drbd_role_s_names[s];
+	return s > Secondary   ? "TOO_LARGE" : drbd_role_s_names[s];
 }
 
 const char *disks_to_name(drbd_disks_t s) {
-	return s > UpToDate    ? "TOO_LARGE"
-		               : drbd_disk_s_names[s];
+	return s > UpToDate    ? "TOO_LARGE" : drbd_disk_s_names[s];
 }
 
 const char *set_st_err_name(set_st_err_t err) {
 	return err < SS_DeviceInUse ? "TOO_SMALL" :
 	       err > SS_TwoPrimaries ? "TOO_LARGE"
-		        : drbd_state_sw_errors[-err];
+			: drbd_state_sw_errors[-err];
 }

Modified: branches/drbd-8.0-for-linus/drbd/drbd_worker.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 13:20:54 UTC (rev 2992)
+++ branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 13:25:49 UTC (rev 2993)
@@ -213,8 +213,8 @@
 	/* to avoid recursion in _req_mod */
 	what = error
 	       ? (bio_data_dir(bio) == WRITE)
-	         ? write_completed_with_error
-	         : read_completed_with_error
+		 ? write_completed_with_error
+		 : read_completed_with_error
 	       : completed_ok;
 	spin_lock_irqsave(&mdev->req_lock, flags);
 	_req_mod(req, what, error);
@@ -280,7 +280,7 @@
 void resync_timer_fn(unsigned long data)
 {
 	unsigned long flags;
-	drbd_dev* mdev = (drbd_dev*) data;
+	drbd_dev *mdev = (drbd_dev *) data;
 	int queue;
 
 	spin_lock_irqsave(&mdev->req_lock, flags);
@@ -323,7 +323,7 @@
 	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);
+	number = SLEEP_TIME*mdev->sync_conf.rate / ((BM_BLOCK_SIZE/1024)*HZ);
 
 	if (atomic_read(&mdev->rs_pending_cnt) > number)
 		goto requeue;
@@ -339,7 +339,7 @@
 		return 1;
 	}
 
-	for(i = 0;i < number;i++) {
+	for (i = 0; i < number; i++) {
 
 	next_sector:
 		size = BM_BLOCK_SIZE;
@@ -451,7 +451,7 @@
 	return 1;
 }
 
-int drbd_resync_finished(drbd_dev* mdev)
+int drbd_resync_finished(drbd_dev *mdev)
 {
 	unsigned long db, dt, dbdt;
 	int dstate, pdstate;
@@ -677,7 +677,7 @@
 	/* inc_ap_pending was done where this was queued.
 	 * dec_ap_pending will be done in got_BarrierAck
 	 * or (on connection loss) in w_clear_epoch.  */
-	ok = _drbd_send_cmd(mdev, mdev->data.socket, Barrier, (Drbd_Header*)p, sizeof(*p), 0);
+	ok = _drbd_send_cmd(mdev, mdev->data.socket, Barrier, (Drbd_Header *)p, sizeof(*p), 0);
 	drbd_put_data_sock(mdev);
 
 	return ok;
@@ -767,7 +767,7 @@
 {
 	drbd_dev *odev = mdev;
 
-	while(1) {
+	while (1) {
 		if (odev->sync_conf.after == -1) return 1;
 		odev = minor_to_mdev(odev->sync_conf.after);
 		ERR_IF(!odev) return 1;
@@ -824,14 +824,14 @@
 	return rv;
 }
 
-void resume_next_sg(drbd_dev* mdev)
+void resume_next_sg(drbd_dev *mdev)
 {
 	drbd_global_lock();
 	_drbd_resume_next(mdev);
 	drbd_global_unlock();
 }
 
-void suspend_other_sg(drbd_dev* mdev)
+void suspend_other_sg(drbd_dev *mdev)
 {
 	drbd_global_lock();
 	_drbd_pause_after(mdev);
@@ -1006,7 +1006,7 @@
 		list_splice_init(&mdev->data.work.q, &work_list);
 		spin_unlock_irq(&mdev->data.work.q_lock);
 
-		while(!list_empty(&work_list)) {
+		while (!list_empty(&work_list)) {
 			w = list_entry(work_list.next, struct drbd_work, list);
 			list_del_init(&w->list);
 			w->cb(mdev, w, 1);

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 13:20:54 UTC (rev 2992)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd_nl.h	2007-07-24 13:25:49 UTC (rev 2993)
@@ -1,7 +1,7 @@
 /*
    PAKET( name,
-          TYPE ( pn, pr, member )
-          ...
+	  TYPE ( pn, pr, member )
+	  ...
    )
 
    You may never reissue one of the pn arguments

Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 13:20:54 UTC (rev 2992)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 13:25:49 UTC (rev 2993)
@@ -67,7 +67,7 @@
 		lc->new_number	     = -1;
 		lc->lc_private       = private_p;
 		lc->name             = name;
-		for(i = 0;i < e_count;i++) {
+		for (i = 0; i < e_count; i++) {
 			e = lc_entry(lc, i);
 			e->lc_number = LC_FREE;
 			list_add(&e->list, &lc->free);
@@ -354,7 +354,7 @@
 	int i;
 
 	seq_printf(seq, "\tnn: lc_number refcnt %s\n ", utext);
-	for(i = 0;i < nr_elements;i++) {
+	for (i = 0; i < nr_elements; i++) {
 		e = lc_entry(lc, i);
 		if (e->lc_number == LC_FREE) {
 			seq_printf(seq, "\t%2d: FREE\n", i );

Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.h	2007-07-24 13:20:54 UTC (rev 2992)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.h	2007-07-24 13:25:49 UTC (rev 2993)
@@ -33,13 +33,13 @@
   Once created, the api consists of
     lc_find(,nr) -- finds the object with the given number, if present
     lc_get(,nr)  -- finds the object and increases the usage count
-                    if not present, actions are taken to make sure that
+		    if not present, actions are taken to make sure that
 		    the cache is updated, the user is notified of this by a callback.
 		    Return value is NULL in this case.
 		    As soon as the user informs the cache that it has been updated,
 		    the next lc_get on that very object number will be successfull.
     lc_put(,lc_element*)
-                 -- decreases the usage count of this object, and returns the new value.
+		 -- decreases the usage count of this object, and returns the new value.
 
     NOTE: It is the USERS responsibility to make sure that calls do not happen concurrently.
  */
@@ -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;
 };
@@ -107,8 +107,8 @@
 extern struct lc_element *lc_try_get(struct lru_cache *lc, unsigned int enr);
 extern struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr);
 extern struct lc_element *lc_get (struct lru_cache *lc, unsigned int enr);
-extern unsigned int       lc_put (struct lru_cache *lc, struct lc_element *e);
-extern void            lc_changed(struct lru_cache *lc, struct lc_element *e);
+extern unsigned int	  lc_put (struct lru_cache *lc, struct lc_element *e);
+extern void	       lc_changed(struct lru_cache *lc, struct lc_element *e);
 
 struct seq_file;
 extern size_t lc_printf_stats(struct seq_file *seq, struct lru_cache *lc);
@@ -141,7 +141,7 @@
 
 #define lc_e_base(lc)  ((char *) ( (lc)->slot + (lc)->nr_elements ) )
 #define lc_entry(lc, i) ((struct lc_element *) \
-                       (lc_e_base(lc) + (i)*(lc)->element_size))
+		       (lc_e_base(lc) + (i)*(lc)->element_size))
 #define lc_index_of(lc, e) (((char *)(e) - lc_e_base(lc))/(lc)->element_size)
 
 #endif

From drbd-cvs at lists.linbit.com  Tue Jul 24 15:35:49 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 15:35:52 2007
Subject: [DRBD-cvs] svn commit by lars - r2994 - in
	branches/drbd-8.0-for-linus/drbd: . linux -
	3da7dab9c86db93c16b742119734fd2f60a59d1e and even more 
Message-ID: <20070724133549.7242140095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 15:35:47 +0200 (Tue, 24 Jul 2007)
New Revision: 2994

Modified:
   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_strings.c
   branches/drbd-8.0-for-linus/drbd/drbd_worker.c
   branches/drbd-8.0-for-linus/drbd/linux/drbd_tag_magic.h
Log:
3da7dab9c86db93c16b742119734fd2f60a59d1e and even more whitespace fixes; no more initialising to 0 or NULL; no more assignments in if (...)
5554f5d5101ab68150361579866517fc1128a32a unindent labels


Modified: branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 13:25:49 UTC (rev 2993)
+++ branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 13:35:47 UTC (rev 2994)
@@ -264,7 +264,8 @@
 	while ( bm < ep ) {
 		/* on little endian, this is *bm = *bm;
 		 * and should be optimized away by the compiler */
-		if (just_read) *bm = lel_to_cpu(*bm);
+		if (just_read)
+			*bm = lel_to_cpu(*bm);
 		bits += hweight_long(*bm++);
 	}
 
@@ -384,7 +385,8 @@
 		b->bm_words = words;
 		b->bm_dev_capacity = capacity;
 		bm_clear_surplus(b);
-		if (!growing) b->bm_set = bm_count_bits(b, 0);
+		if (!growing)
+			b->bm_set = bm_count_bits(b, 0);
 		bm_end_info(mdev, __FUNCTION__ );
 		spin_unlock_irq(&b->bm_lock);
 		INFO("resync bitmap: bits=%lu words=%lu\n", bits, words);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 13:25:49 UTC (rev 2993)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 13:35:47 UTC (rev 2994)
@@ -1264,7 +1264,8 @@
 /* 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) {
+static inline void dump_bio(drbd_dev *mdev, struct bio *bio, int complete)
+{
 	MTRACE(TraceTypeRq, TraceLvlSummary,
 	       _dump_bio(mdev, bio, complete);
 		);
@@ -1607,12 +1608,14 @@
 	spin_unlock_irqrestore(&q->q_lock, flags);
 }
 
-static inline void wake_asender(drbd_dev *mdev) {
+static inline void wake_asender(drbd_dev *mdev)
+{
 	if (test_bit(SIGNAL_ASENDER, &mdev->flags))
 		force_sig(DRBD_SIG, mdev->asender.task);
 }
 
-static inline void request_ping(drbd_dev *mdev) {
+static inline void request_ping(drbd_dev *mdev)
+{
 	set_bit(SEND_PING, &mdev->flags);
 	wake_asender(mdev);
 }
@@ -1679,7 +1682,7 @@
 }
 
 #define ERR_IF_CNT_IS_NEGATIVE(which)				\
-	if (atomic_read(&mdev->which) < 0)				\
+	if (atomic_read(&mdev->which) < 0)			\
 		ERR("in %s:%d: " #which " = %d < 0 !\n",	\
 		    __func__ , __LINE__ ,			\
 		    atomic_read(&mdev->which))
@@ -1795,7 +1798,8 @@
 	return mxb;
 }
 
-static inline int __inc_ap_bio_cond(drbd_dev *mdev) {
+static inline int __inc_ap_bio_cond(drbd_dev *mdev)
+{
 	int mxb = drbd_get_max_buffers(mdev);
 	if (mdev->state.susp) return 0;
 	if (mdev->state.conn == WFBitMapS) return 0;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 13:25:49 UTC (rev 2993)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 13:35:47 UTC (rev 2994)
@@ -89,7 +89,7 @@
 module_param(allow_oos, int, 0);
 
 #ifdef DRBD_ENABLE_FAULTS
-int enable_faults = 0;
+int enable_faults;
 int fault_rate;
 int fault_count;
 int fault_devs;
@@ -101,12 +101,12 @@
 
 /* module parameter, defined */
 int minor_count = 32;
-int allow_oos = 0;
+int allow_oos;
 
 #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;		/* Bitmap of trace types to enable */
+int trace_level;	/* Current trace level */
+int trace_devs;		/* Bitmap of devices to trace */
 
 module_param(trace_level, int, 0644);
 module_param(trace_type, int, 0644);
@@ -125,7 +125,7 @@
 /* in 2.6.x, our device mapping and config info contains our virtual gendisks
  * as member "struct gendisk *vdisk;"
  */
-struct Drbd_Conf **minor_table = NULL;
+struct Drbd_Conf **minor_table;
 
 struct kmem_cache *drbd_request_cache;
 struct kmem_cache *drbd_ee_cache;
@@ -335,8 +335,10 @@
 	if (!send) return ok;
 
 	ok = drbd_send_state(mdev);
-	if (ok) WARN("Notified peer that my disk is broken.\n");
-	else ERR("Sending state in drbd_io_error() failed\n");
+	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
@@ -443,7 +445,8 @@
 
 	if (cl_wide_st_chg(mdev, os, ns)) {
 		rv = is_valid_state(mdev, ns);
-		if (rv == SS_Success) rv = is_valid_state_transition(mdev, ns, os);
+		if (rv == SS_Success)
+			rv = is_valid_state_transition(mdev, ns, os);
 		spin_unlock_irqrestore(&mdev->req_lock, flags);
 
 		if (rv < SS_Success) {
@@ -722,7 +725,8 @@
 				print_st(mdev, "new", ns);
 				rv = SS_Success;
 			}
-		} else rv = is_valid_state_transition(mdev, ns, os);
+		} else
+			rv = is_valid_state_transition(mdev, ns, os);
 	}
 
 	if (rv < SS_Success) {
@@ -1098,6 +1102,8 @@
 		thi->t_state = Running;
 		spin_unlock(&thi->t_lock);
 		flush_signals(current); /* otherw. may get -ERESTARTNOINTR */
+
+		/* FIXME rewrite to use kthread interface */
 		pid = kernel_thread(drbd_thread_setup, (void *) thi, CLONE_FS);
 		if (pid < 0) {
 			ERR("Couldn't start thread (%d)\n", pid);
@@ -1142,7 +1148,8 @@
 		if (thi->task != current) {
 			if (wait) init_completion(&thi->startstop);
 			force_sig(DRBD_SIGKILL, thi->task);
-		} else D_ASSERT(!wait);
+		} else
+			D_ASSERT(!wait);
 	}
 	spin_unlock(&thi->t_lock);
 
@@ -1567,9 +1574,9 @@
 
 #ifdef SHOW_SENDPAGE_USAGE
 	unsigned long now = jiffies;
-	static unsigned long total = 0;
-	static unsigned long fallback = 0;
-	static unsigned long last_rep = 0;
+	static unsigned long total;
+	static unsigned long fallback;
+	static unsigned long last_rep;
 
 	/* report statistics every hour,
 	 * if we had at least one fallback.
@@ -1714,7 +1721,8 @@
 
 	dump_packet(mdev, mdev->data.socket, 0, (void *)&p, __FILE__, __LINE__);
 	ok = sizeof(p) == drbd_send(mdev, mdev->data.socket, &p, sizeof(p), MSG_MORE);
-	if (ok) ok = _drbd_send_zc_bio(mdev, e->private_bio);
+	if (ok)
+		ok = _drbd_send_zc_bio(mdev, e->private_bio);
 
 	drbd_put_data_sock(mdev);
 	return ok;
@@ -1913,12 +1921,8 @@
 	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->state = (drbd_state_t){ { Secondary,
-					Unknown,
-					StandAlone,
-					Diskless,
-					DUnknown,
-					0 } };
+	mdev->state = (drbd_state_t) {
+		{ Secondary, Unknown, StandAlone, Diskless, DUnknown, 0 } };
 }
 
 void drbd_init_set_defaults(drbd_dev *mdev)
@@ -2377,7 +2381,8 @@
 	minor_table = kzalloc(sizeof(drbd_dev *)*minor_count, GFP_KERNEL);
 	if (!minor_table) goto Enomem;
 
-	if ((err = drbd_create_mempools()))
+	err = drbd_create_mempools();
+	if (err)
 		goto Enomem;
 
 #if CONFIG_PROC_FS
@@ -2556,7 +2561,7 @@
 	down(&mdev->md_io_mutex);
 	buffer = (struct meta_data_on_disk *)page_address(mdev->md_io_page);
 
-	if ( ! drbd_md_sync_page_io(mdev, bdev, bdev->md.md_offset, READ) ) {
+	if (!drbd_md_sync_page_io(mdev, bdev, bdev->md.md_offset, READ)) {
 		/* NOTE: cant do normal error processing here as this is
 		   called BEFORE disk is attached */
 		ERR("Error while reading metadata.\n");
@@ -2824,7 +2829,8 @@
 
 #ifdef ENABLE_DYNAMIC_TRACE
 
-STATIC char *_drbd_uuid_str(unsigned int idx) {
+STATIC char *_drbd_uuid_str(unsigned int idx)
+{
 	static char *uuid_str[] = {
 		"Current",
 		"Bitmap",
@@ -3020,7 +3026,8 @@
 	} \
 } while (0)
 
-char *_dump_block_id(u64 block_id, char *buff) {
+char *_dump_block_id(u64 block_id, char *buff)
+{
     if (is_syncer_block_id(block_id))
 	strcpy(buff, "SyncerId");
     else

Modified: branches/drbd-8.0-for-linus/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 13:25:49 UTC (rev 2993)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 13:35:47 UTC (rev 2994)
@@ -120,14 +120,15 @@
 void drbd_bcast_ev_helper(drbd_dev *mdev, char *helper_name);
 void drbd_nl_send_reply(struct cn_msg *, int);
 
-char *nl_packet_name(int packet_type) {
+char *nl_packet_name(int packet_type)
+{
 /* Generate packet type strings */
 #define PACKET(name, number, fields) \
 	[ P_ ## name ] = # name,
-#define INTEGER Argh!
-#define BIT Argh!
-#define INT64 Argh!
-#define STRING Argh!
+#define INTEGER Argh !
+#define BIT Argh !
+#define INT64 Argh !
+#define STRING Argh !
 
 	static char *nl_tag_name[P_nl_after_last_packet] = {
 #include "linux/drbd_nl.h"
@@ -137,7 +138,8 @@
 	    nl_tag_name[packet_type] : "*Unknown*";
 }
 
-void nl_trace_packet(void *data) {
+void nl_trace_packet(void *data)
+{
 	struct cn_msg *req = data;
 	struct drbd_nl_cfg_req *nlp = (struct drbd_nl_cfg_req *)req->data;
 
@@ -149,7 +151,8 @@
 	       req->seq, req->ack, req->len);
 }
 
-void nl_trace_reply(void *data) {
+void nl_trace_reply(void *data)
+{
 	struct cn_msg *req = data;
 	struct drbd_nl_cfg_reply *nlp = (struct drbd_nl_cfg_reply *)req->data;
 
@@ -808,7 +811,8 @@
 		goto release_bdev2_fail;
 	}
 
-	if ((retcode = drbd_request_state(mdev, NS(disk, Attaching))) < SS_Success )
+	retcode = drbd_request_state(mdev, NS(disk, Attaching));
+	if (retcode < SS_Success )
 		goto release_bdev2_fail;
 
 	drbd_md_set_sector_offsets(mdev, nbc);
@@ -955,8 +959,10 @@
 	drbd_bm_unlock(mdev);
 
 	if (inc_local_if_state(mdev, Attaching)) {
-		if (mdev->state.role == Primary) mdev->bc->md.uuid[Current] |=	(u64)1;
-		else				mdev->bc->md.uuid[Current] &= ~(u64)1;
+		if (mdev->state.role == Primary)
+			mdev->bc->md.uuid[Current] |=	(u64)1;
+		else
+			mdev->bc->md.uuid[Current] &= ~(u64)1;
 		dec_local(mdev);
 	}
 
@@ -1582,7 +1588,8 @@
 		return;
 	}
 
-	if ( !(mdev = ensure_mdev(nlp)) ) {
+	mdev = ensure_mdev(nlp);
+	if (!mdev) {
 		retcode = MinorNotKnown;
 		goto fail;
 	}
@@ -1597,7 +1604,8 @@
 	cm = cnd_table + nlp->packet_type;
 	reply_size += cm->reply_body_size;
 
-	if ( !(cn_reply = kmalloc(reply_size, GFP_KERNEL)) ) {
+	cn_reply = kmalloc(reply_size, GFP_KERNEL);
+	if (!cn_reply) {
 		retcode = KMallocFailed;
 		goto fail;
 	}
@@ -1639,7 +1647,7 @@
 		    sizeof(struct get_state_tag_len_struct)+
 		    sizeof(short int)];
 	struct cn_msg *cn_reply = (struct cn_msg *) buffer;
-	struct drbd_nl_cfg_reply* reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
+	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"); */
@@ -1672,7 +1680,7 @@
 		    sizeof(struct call_helper_tag_len_struct)+
 		    sizeof(short int)];
 	struct cn_msg *cn_reply = (struct cn_msg *) buffer;
-	struct drbd_nl_cfg_reply* reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
+	struct drbd_nl_cfg_reply *reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
 	unsigned short *tl = reply->tag_list;
 	int str_len;
 
@@ -1710,7 +1718,7 @@
 		    sizeof(struct sync_progress_tag_len_struct)+
 		    sizeof(short int)];
 	struct cn_msg *cn_reply = (struct cn_msg *) buffer;
-	struct drbd_nl_cfg_reply* reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
+	struct drbd_nl_cfg_reply *reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
 	unsigned short *tl = reply->tag_list;
 	int res;
 	unsigned long rs_left;
@@ -1794,7 +1802,7 @@
 {
 	char buffer[sizeof(struct cn_msg)+sizeof(struct drbd_nl_cfg_reply)];
 	struct cn_msg *cn_reply = (struct cn_msg *) buffer;
-	struct drbd_nl_cfg_reply* reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
+	struct drbd_nl_cfg_reply *reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
 	int rr;
 
 	cn_reply->id = req->id;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 13:25:49 UTC (rev 2993)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 13:35:47 UTC (rev 2994)
@@ -137,12 +137,14 @@
 	   FIXME but why irq _save_ ?
 	   this is only called from drbd_alloc_ee,
 	   and that is strictly process context! */
-	if ( (page = drbd_pp_pool) ) {
+	page = drbd_pp_pool;
+	if (page) {
 		drbd_pp_pool = (struct page *)page_private(page);
 		drbd_pp_vacant--;
 	}
 	spin_unlock_irqrestore(&drbd_pp_lock, flags);
-	if (page) goto got_page;
+	if (page)
+		goto got_page;
 
 	drbd_kick_lo(mdev);
 
@@ -151,7 +153,8 @@
 
 		/* try the pool again, maybe the drbd_kick_lo set some free */
 		spin_lock_irqsave(&drbd_pp_lock, flags);
-		if ( (page = drbd_pp_pool) ) {
+		page = drbd_pp_pool;
+		if (page) {
 			drbd_pp_pool = (struct page *)page_private(page);
 			drbd_pp_vacant--;
 		}
@@ -163,7 +166,8 @@
 		 * don't wait, if none is available, though.
 		 */
 		if ( atomic_read(&mdev->pp_in_use) < mdev->net_conf->max_buffers ) {
-			if ( (page = alloc_page(GFP_TRY)) )
+			page = alloc_page(GFP_TRY);
+			if (page)
 				break;
 		}
 
@@ -617,7 +621,7 @@
 	src_in.sin_port = 0;
 
 	err = sock->ops->bind(sock,
-			      (struct sockaddr * ) &src_in,
+			      (struct sockaddr *) &src_in,
 			      sizeof (struct sockaddr_in));
 	if (err) {
 		ERR("Unable to bind source sock (%d)\n", err);
@@ -1745,7 +1749,8 @@
 				WARN("Sucessfully gave up primary role.\n");
 				rv = hg;
 			}
-		} else rv = hg;
+		} else
+			rv = hg;
 	}
 
 	return rv;
@@ -1783,7 +1788,8 @@
 				WARN("Sucessfully gave up primary role.\n");
 				rv = hg;
 			}
-		} else rv = hg;
+		} else
+			rv = hg;
 	}
 
 	return rv;
@@ -2514,7 +2520,7 @@
 };
 
 static drbd_cmd_handler_f *drbd_cmd_handler = drbd_default_handler;
-static drbd_cmd_handler_f *drbd_opt_cmd_handler = NULL;
+static drbd_cmd_handler_f *drbd_opt_cmd_handler;
 
 STATIC void drbdd(drbd_dev *mdev)
 {
@@ -2972,7 +2978,7 @@
 		goto fail;
 	}
 
-	rv = ! memcmp(response, right_response, resp_size);
+	rv = !memcmp(response, right_response, resp_size);
 
 	if (rv)
 		INFO("Peer authenticated using %d bytes of '%s' HMAC\n",

Modified: branches/drbd-8.0-for-linus/drbd/drbd_req.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 13:25:49 UTC (rev 2993)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 13:35:47 UTC (rev 2994)
@@ -291,8 +291,10 @@
 
 		/* remove the request from the conflict detection
 		 * respective block_id verification hash */
-		if (!hlist_unhashed(&req->colision)) hlist_del(&req->colision);
-		else D_ASSERT((s & RQ_NET_MASK) == 0);
+		if (!hlist_unhashed(&req->colision))
+			hlist_del(&req->colision);
+		else
+			D_ASSERT((s & RQ_NET_MASK) == 0);
 
 		/* for writes we need to do some extra housekeeping */
 		if (rw == WRITE)
@@ -859,9 +861,8 @@
 	 * if we lost that race, we retry.  */
 	if (rw == WRITE && remote &&
 	    mdev->unused_spare_barrier == NULL &&
-	    test_bit(ISSUE_BARRIER, &mdev->flags))
-	{
-  allocate_barrier:
+	    test_bit(ISSUE_BARRIER, &mdev->flags)) {
+allocate_barrier:
 		b = kmalloc(sizeof(struct drbd_barrier), GFP_NOIO);
 		if (!b) {
 			ERR("Failed to alloc barrier.");
@@ -980,8 +981,10 @@
 		 * or READ, and no local disk,
 		 * or READ, but not in sync.
 		 */
-		if (rw == WRITE) _req_mod(req, queue_for_net_write, 0);
-		else		 _req_mod(req, queue_for_net_read, 0);
+		if (rw == WRITE)
+			_req_mod(req, queue_for_net_write, 0);
+		else
+			_req_mod(req, queue_for_net_read, 0);
 	}
 	spin_unlock_irq(&mdev->req_lock);
 	if (b) kfree(b); /* if someone else has beaten us to it... */
@@ -1111,7 +1114,8 @@
 		drbd_make_request_26(q, &bp->bio2);
 		bio_pair_release(bp);
 		return 0;
-	}}
+	}
+	}
 
 	return drbd_make_request_common(mdev, bio_rw(bio), bio->bi_size,
 					bio->bi_sector, bio);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_strings.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_strings.c	2007-07-24 13:25:49 UTC (rev 2993)
+++ branches/drbd-8.0-for-linus/drbd/drbd_strings.c	2007-07-24 13:35:47 UTC (rev 2994)
@@ -83,20 +83,24 @@
 	[-SS_DeviceInUse] = "Device is held open by someone"
 };
 
-const char *conns_to_name(drbd_conns_t s) {
+const char *conns_to_name(drbd_conns_t s)
+{
 	/* enums are unsigned... */
 	return s > PausedSyncT ? "TOO_LARGE" : drbd_conn_s_names[s];
 }
 
-const char *roles_to_name(drbd_role_t s) {
+const char *roles_to_name(drbd_role_t s)
+{
 	return s > Secondary   ? "TOO_LARGE" : drbd_role_s_names[s];
 }
 
-const char *disks_to_name(drbd_disks_t s) {
+const char *disks_to_name(drbd_disks_t s)
+{
 	return s > UpToDate    ? "TOO_LARGE" : drbd_disk_s_names[s];
 }
 
-const char *set_st_err_name(set_st_err_t err) {
+const char *set_st_err_name(set_st_err_t err)
+{
 	return err < SS_DeviceInUse ? "TOO_SMALL" :
 	       err > SS_TwoPrimaries ? "TOO_LARGE"
 			: drbd_state_sw_errors[-err];

Modified: branches/drbd-8.0-for-linus/drbd/drbd_worker.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 13:25:49 UTC (rev 2993)
+++ branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 13:35:47 UTC (rev 2994)
@@ -411,7 +411,8 @@
 #endif
 
 		/* adjust very last sectors, in case we are oddly sized */
-		if (sector + (size>>9) > capacity) size = (capacity-sector)<<9;
+		if (sector + (size>>9) > capacity)
+			size = (capacity-sector)<<9;
 		inc_rs_pending(mdev);
 		if (!drbd_send_drequest(mdev, RSDataRequest,
 				       sector, size, ID_SYNCER)) {
@@ -746,7 +747,9 @@
 
 	local_irq_disable();
 	for (i = 0; i < minor_count; i++) {
-		if (!(mdev = minor_to_mdev(i))) continue;
+		mdev = minor_to_mdev(i);
+		if (!mdev)
+			continue;
 		spin_lock(&mdev->req_lock);
 	}
 }
@@ -757,7 +760,9 @@
 	int i;
 
 	for (i = 0; i < minor_count; i++) {
-		if (!(mdev = minor_to_mdev(i))) continue;
+		mdev = minor_to_mdev(i);
+		if (!mdev)
+			continue;
 		spin_unlock(&mdev->req_lock);
 	}
 	local_irq_enable();
@@ -813,7 +818,9 @@
 	int i, rv = 0;
 
 	for (i = 0; i < minor_count; i++) {
-		if ( !(odev = minor_to_mdev(i)) ) continue;
+		odev = minor_to_mdev(i);
+		if (!odev)
+			continue;
 		if (odev->state.aftr_isp) {
 			if (_drbd_may_sync_now(odev))
 				rv |= ( _drbd_set_state(_NS(odev, aftr_isp, 0),

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 13:25:49 UTC (rev 2993)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd_tag_magic.h	2007-07-24 13:35:47 UTC (rev 2994)
@@ -32,10 +32,10 @@
 /* declate tag-list-sizes */
 const int tag_list_sizes[] = {
 #define PACKET(name, number, fields) 2 fields ,
-#define INTEGER(pn, pr, member)      +4+4
-#define INT64(pn, pr, member)        +4+8
-#define BIT(pn, pr, member)          +4+1
-#define STRING(pn, pr, member, len)  +4+len
+#define INTEGER(pn, pr, member)      + 4 + 4
+#define INT64(pn, pr, member)        + 4 + 8
+#define BIT(pn, pr, member)          + 4 + 1
+#define STRING(pn, pr, member, len)  + 4 + len
 #include "drbd_nl.h"
 };
 

From drbd-cvs at lists.linbit.com  Tue Jul 24 15:38:37 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 15:38:40 2007
Subject: [DRBD-cvs] svn commit by lars - r2995 -
	branches/drbd-8.0-for-linus/drbd -
	247dd801ab93db7e38b53bf818aef93def9b2ace fix space betw
Message-ID: <20070724133837.2FEBF40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 15:38:35 +0200 (Tue, 24 Jul 2007)
New Revision: 2995

Modified:
   branches/drbd-8.0-for-linus/drbd/drbd_int.h
   branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
   branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
   branches/drbd-8.0-for-linus/drbd/lru_cache.h
Log:
247dd801ab93db7e38b53bf818aef93def9b2ace fix space between function name and opening brace


Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 13:35:47 UTC (rev 2994)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 13:38:35 UTC (rev 2995)
@@ -1117,7 +1117,7 @@
 #if DRBD_MAX_SECTORS_BM < DRBD_MAX_SECTORS_32
 #define DRBD_MAX_SECTORS      DRBD_MAX_SECTORS_BM
 #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_BM
-#elif ( !defined(CONFIG_LBD) ) && ( BITS_PER_LONG == 32 )
+#elif   !defined(CONFIG_LBD) && BITS_PER_LONG == 32
 #define DRBD_MAX_SECTORS      DRBD_MAX_SECTORS_32
 #define DRBD_MAX_SECTORS_FLEX DRBD_MAX_SECTORS_32
 #else
@@ -1135,43 +1135,43 @@
 /* Number of elements in the app_reads_hash */
 #define APP_R_HSIZE 15
 
-extern int  drbd_bm_init      (drbd_dev *mdev);
-extern int  drbd_bm_resize    (drbd_dev *mdev, sector_t sectors);
-extern void drbd_bm_cleanup   (drbd_dev *mdev);
-extern void drbd_bm_set_all   (drbd_dev *mdev);
-extern void drbd_bm_clear_all (drbd_dev *mdev);
+extern int  drbd_bm_init(drbd_dev *mdev);
+extern int  drbd_bm_resize(drbd_dev *mdev, sector_t sectors);
+extern void drbd_bm_cleanup(drbd_dev *mdev);
+extern void drbd_bm_set_all(drbd_dev *mdev);
+extern void drbd_bm_clear_all(drbd_dev *mdev);
 extern void drbd_bm_reset_find(drbd_dev *mdev);
-extern int  drbd_bm_set_bit   (drbd_dev *mdev, unsigned long bitnr);
+extern int  drbd_bm_set_bit(drbd_dev *mdev, unsigned long bitnr);
 extern int  drbd_bm_set_bits_in_irq(
 		drbd_dev *mdev, unsigned long s, unsigned long e);
-extern int  drbd_bm_test_bit  (drbd_dev *mdev, unsigned long bitnr);
-extern int  drbd_bm_clear_bit (drbd_dev *mdev, unsigned long bitnr);
-extern int  drbd_bm_e_weight  (drbd_dev *mdev, unsigned long enr);
-extern int  drbd_bm_read_sect (drbd_dev *mdev, unsigned long enr);
+extern int  drbd_bm_test_bit(drbd_dev *mdev, unsigned long bitnr);
+extern int  drbd_bm_clear_bit(drbd_dev *mdev, unsigned long bitnr);
+extern int  drbd_bm_e_weight(drbd_dev *mdev, unsigned long enr);
+extern int  drbd_bm_read_sect(drbd_dev *mdev, unsigned long enr);
 extern int  drbd_bm_write_sect(drbd_dev *mdev, unsigned long enr);
-extern int  drbd_bm_read      (drbd_dev *mdev);
-extern int  drbd_bm_write     (drbd_dev *mdev);
-extern unsigned long drbd_bm_ALe_set_all (drbd_dev *mdev, unsigned long al_enr);
-extern size_t	     drbd_bm_words	 (drbd_dev *mdev);
-extern sector_t      drbd_bm_capacity	 (drbd_dev *mdev);
-extern unsigned long drbd_bm_find_next	 (drbd_dev *mdev);
+extern int  drbd_bm_read(drbd_dev *mdev);
+extern int  drbd_bm_write(drbd_dev *mdev);
+extern unsigned long drbd_bm_ALe_set_all(drbd_dev *mdev, unsigned long al_enr);
+extern size_t	     drbd_bm_words(drbd_dev *mdev);
+extern sector_t      drbd_bm_capacity(drbd_dev *mdev);
+extern unsigned long drbd_bm_find_next(drbd_dev *mdev);
 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 */
-extern void drbd_bm_merge_lel (drbd_dev *mdev, size_t offset, size_t number,
+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 */
-extern void drbd_bm_get_lel   (drbd_dev *mdev, size_t offset, size_t number,
+extern void drbd_bm_get_lel(drbd_dev *mdev, size_t offset, size_t number,
 				unsigned long *buffer);
 /*
  * only used by drbd_bm_read_sect
-extern void drbd_bm_set_lel   (drbd_dev *mdev, size_t offset, size_t number,
+extern void drbd_bm_set_lel(drbd_dev *mdev, size_t offset, size_t number,
 				unsigned long* buffer);
 */
 
-extern void __drbd_bm_lock    (drbd_dev *mdev, char *file, int line);
-extern void drbd_bm_unlock    (drbd_dev *mdev);
+extern void __drbd_bm_lock(drbd_dev *mdev, char *file, int line);
+extern void drbd_bm_unlock(drbd_dev *mdev);
 #define drbd_bm_lock(mdev)    __drbd_bm_lock(mdev, __FILE__, __LINE__ )
 
 extern void _drbd_bm_recount_bits(drbd_dev *mdev, char *file, int line);
@@ -1323,19 +1323,19 @@
 extern int drbd_md_sync_page_io(drbd_dev *mdev, struct drbd_backing_dev *bdev,
 				sector_t sector, int rw);
 /* 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);
-extern int w_e_end_rsdata_req	 (drbd_dev *, struct drbd_work *, int);
-extern int w_resync_inactive	 (drbd_dev *, struct drbd_work *, int);
-extern int w_resume_next_sg	 (drbd_dev *, struct drbd_work *, int);
-extern int w_io_error		 (drbd_dev *, struct drbd_work *, int);
-extern int w_send_write_hint	 (drbd_dev *, struct drbd_work *, int);
-extern int w_make_resync_request (drbd_dev *, struct drbd_work *, int);
-extern int w_send_dblock	 (drbd_dev *, struct drbd_work *, int);
-extern int w_send_barrier	 (drbd_dev *, struct drbd_work *, int);
-extern int w_send_read_req	 (drbd_dev *, struct drbd_work *, int);
-extern int w_prev_work_done	 (drbd_dev *, struct drbd_work *, int);
+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);
+extern int w_e_end_rsdata_req(drbd_dev *, struct drbd_work *, int);
+extern int w_resync_inactive(drbd_dev *, struct drbd_work *, int);
+extern int w_resume_next_sg(drbd_dev *, struct drbd_work *, int);
+extern int w_io_error(drbd_dev *, struct drbd_work *, int);
+extern int w_send_write_hint(drbd_dev *, struct drbd_work *, int);
+extern int w_make_resync_request(drbd_dev *, struct drbd_work *, int);
+extern int w_send_dblock(drbd_dev *, struct drbd_work *, int);
+extern int w_send_barrier(drbd_dev *, struct drbd_work *, int);
+extern int w_send_read_req(drbd_dev *, struct drbd_work *, int);
+extern int w_prev_work_done(drbd_dev *, struct drbd_work *, int);
 
 extern void resync_timer_fn(unsigned long data);
 

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 13:35:47 UTC (rev 2994)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 13:38:35 UTC (rev 2995)
@@ -617,12 +617,12 @@
 	* Make sure to use 0 as portnumber, so linux selects
 	*  a free one dynamically.
 	*/
-	memcpy (&src_in, &(mdev->net_conf->my_addr), sizeof(struct sockaddr_in));
+	memcpy(&src_in, &(mdev->net_conf->my_addr), sizeof(struct sockaddr_in));
 	src_in.sin_port = 0;
 
 	err = sock->ops->bind(sock,
 			      (struct sockaddr *) &src_in,
-			      sizeof (struct sockaddr_in));
+			      sizeof(struct sockaddr_in));
 	if (err) {
 		ERR("Unable to bind source sock (%d)\n", err);
 		sock_release(sock);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-24 13:35:47 UTC (rev 2994)
+++ branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-24 13:38:35 UTC (rev 2995)
@@ -17,11 +17,11 @@
 extern char *drbd_sec_holder;
 
 /* bi_end_io handlers */
-extern int drbd_md_io_complete (struct bio *bio, unsigned int bytes_done, int error);
+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);
+extern int drbd_endio_read_sec(struct bio *bio, unsigned int bytes_done, int error);
 extern int drbd_endio_write_sec(struct bio *bio, unsigned int bytes_done, int error);
-extern int drbd_endio_pri      (struct bio *bio, unsigned int bytes_done, int error);
+extern int drbd_endio_pri(struct bio *bio, unsigned int bytes_done, int error);
 
 static inline sector_t drbd_get_hardsect(struct block_device *bdev)
 {

Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.h	2007-07-24 13:35:47 UTC (rev 2994)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.h	2007-07-24 13:38:35 UTC (rev 2995)
@@ -101,14 +101,14 @@
 extern struct lru_cache *lc_alloc(const char *name, unsigned int e_count,
 				  size_t e_size, void *private_p);
 extern void lc_free(struct lru_cache *lc);
-extern void lc_set (struct lru_cache *lc, unsigned int enr, int index);
-extern void lc_del (struct lru_cache *lc, struct lc_element *element);
+extern void lc_set(struct lru_cache *lc, unsigned int enr, int index);
+extern void lc_del(struct lru_cache *lc, struct lc_element *element);
 
 extern struct lc_element *lc_try_get(struct lru_cache *lc, unsigned int enr);
 extern struct lc_element *lc_find(struct lru_cache *lc, unsigned int enr);
-extern struct lc_element *lc_get (struct lru_cache *lc, unsigned int enr);
-extern unsigned int	  lc_put (struct lru_cache *lc, struct lc_element *e);
-extern void	       lc_changed(struct lru_cache *lc, struct lc_element *e);
+extern struct lc_element *lc_get(struct lru_cache *lc, unsigned int enr);
+extern unsigned int lc_put(struct lru_cache *lc, struct lc_element *e);
+extern void lc_changed(struct lru_cache *lc, struct lc_element *e);
 
 struct seq_file;
 extern size_t lc_printf_stats(struct seq_file *seq, struct lru_cache *lc);

From drbd-cvs at lists.linbit.com  Tue Jul 24 16:15:40 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 16:15:50 2007
Subject: [DRBD-cvs] svn commit by lars - r2996 - in
	branches/drbd-8.0-for-linus/drbd: . linux -
	1a7a493aafb9a6d16b62253a7724acf5dfa4a434 get rid of typ
Message-ID: <20070724141540.28B6C40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 16:15:33 +0200 (Tue, 24 Jul 2007)
New Revision: 2996

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_req.h
   branches/drbd-8.0-for-linus/drbd/drbd_strings.c
   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/lru_cache.c
Log:
1a7a493aafb9a6d16b62253a7724acf5dfa4a434 get rid of typedefs, done
461d3d369db8379eb6f218b6c84fdf432c9bd855 get rid of typedefs, first round


Modified: branches/drbd-8.0-for-linus/drbd/drbd_actlog.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 14:15:33 UTC (rev 2996)
@@ -34,10 +34,10 @@
  * ;)
  * this is mostly from drivers/md/md.c
  */
-STATIC int _drbd_md_sync_page_io(drbd_dev *mdev,
-				 struct drbd_backing_dev *bdev,
-				 struct page *page, sector_t sector,
-				 int rw, int size)
+int _drbd_md_sync_page_io(struct drbd_conf *mdev,
+			  struct drbd_backing_dev *bdev,
+			  struct page *page, sector_t sector,
+			  int rw, int size)
 {
 	struct bio *bio = bio_alloc(GFP_NOIO, 1);
 	struct completion event;
@@ -69,7 +69,7 @@
 	return ok;
 }
 
-int drbd_md_sync_page_io(drbd_dev *mdev, struct drbd_backing_dev *bdev,
+int drbd_md_sync_page_io(struct drbd_conf *mdev, struct drbd_backing_dev *bdev,
 			 sector_t sector, int rw)
 {
 	int hardsect, mask, ok, offset = 0;
@@ -180,10 +180,10 @@
 	unsigned int enr;
 };
 
-STATIC int w_al_write_transaction(struct Drbd_Conf *, struct drbd_work *, int);
+int w_al_write_transaction(struct drbd_conf *, struct drbd_work *, int);
 
 static inline
-struct lc_element *_al_get(struct Drbd_Conf *mdev, unsigned int enr)
+struct lc_element *_al_get(struct drbd_conf *mdev, unsigned int enr)
 {
 	struct lc_element *al_ext;
 	struct bm_extent  *bm_ext;
@@ -216,7 +216,7 @@
 /* FIXME
  * this should be able to return failure when meta data update has failed.
  */
-void drbd_al_begin_io(struct Drbd_Conf *mdev, sector_t sector)
+void drbd_al_begin_io(struct drbd_conf *mdev, sector_t sector)
 {
 	unsigned int enr = (sector >> (AL_EXTENT_SIZE_B-9));
 	struct lc_element *al_ext;
@@ -266,7 +266,7 @@
 	}
 }
 
-void drbd_al_complete_io(struct Drbd_Conf *mdev, sector_t sector)
+void drbd_al_complete_io(struct drbd_conf *mdev, sector_t sector)
 {
 	unsigned int enr = (sector >> (AL_EXTENT_SIZE_B-9));
 	struct lc_element *extent;
@@ -294,8 +294,8 @@
 	spin_unlock_irqrestore(&mdev->al_lock, flags);
 }
 
-STATIC int
-w_al_write_transaction(struct Drbd_Conf *mdev, struct drbd_work *w, int unused)
+int
+w_al_write_transaction(struct drbd_conf *mdev, struct drbd_work *w, int unused)
 {
 	int i, n, mx;
 	unsigned int extent_nr;
@@ -368,10 +368,10 @@
  * Returns -1 on IO error, 0 on checksum error and 1 if it is a valid
  * record.
  */
-STATIC int drbd_al_read_tr(struct Drbd_Conf *mdev,
-			   struct drbd_backing_dev *bdev,
-			   struct al_transaction *b,
-			   int index)
+int drbd_al_read_tr(struct drbd_conf *mdev,
+		    struct drbd_backing_dev *bdev,
+		    struct al_transaction *b,
+		    int index)
 {
 	sector_t sector;
 	int rv, i;
@@ -398,7 +398,7 @@
  * representation. Returns 1 on success, returns 0 when
  * reading the log failed due to IO errors.
  */
-int drbd_al_read_log(struct Drbd_Conf *mdev, struct drbd_backing_dev *bdev)
+int drbd_al_read_log(struct drbd_conf *mdev, struct drbd_backing_dev *bdev)
 {
 	struct al_transaction *buffer;
 	int from = -1, to = -1, i, cnr, overflow = 0, rv;
@@ -504,14 +504,14 @@
 struct drbd_atodb_wait {
 	atomic_t           count;
 	struct completion  io_done;
-	struct Drbd_Conf   *mdev;
+	struct drbd_conf   *mdev;
 	int                error;
 };
 
-STATIC int atodb_endio(struct bio *bio, unsigned int bytes_done, int error)
+int atodb_endio(struct bio *bio, unsigned int bytes_done, int error)
 {
 	struct drbd_atodb_wait *wc = bio->bi_private;
-	struct Drbd_Conf *mdev = wc->mdev;
+	struct drbd_conf *mdev = wc->mdev;
 	struct page *page;
 	int uptodate = bio_flagged(bio, BIO_UPTODATE);
 
@@ -542,7 +542,7 @@
 #define S2W(s)	((s)<<(BM_EXT_SIZE_B-BM_BLOCK_SIZE_B-LN2_BPL))
 /* activity log to on disk bitmap -- prepare bio unless that sector
  * is already covered by previously prepared bios */
-STATIC int atodb_prepare_unless_covered(struct Drbd_Conf *mdev,
+int atodb_prepare_unless_covered(struct drbd_conf *mdev,
 			     struct bio **bios,
 			     struct page **page,
 			     unsigned int *page_offset,
@@ -611,7 +611,7 @@
  * called when we detach (unconfigure) local storage,
  * or when we go from Primary to Secondary state.
  */
-void drbd_al_to_on_disk_bm(struct Drbd_Conf *mdev)
+void drbd_al_to_on_disk_bm(struct drbd_conf *mdev)
 {
 	int i, nr_elements;
 	unsigned int enr;
@@ -707,7 +707,7 @@
  * drbd_al_apply_to_bm: Sets the bits in the bitmap that are described
  * by the active extents of the AL.
  */
-void drbd_al_apply_to_bm(struct Drbd_Conf *mdev)
+void drbd_al_apply_to_bm(struct drbd_conf *mdev)
 {
 	unsigned int enr;
 	unsigned long add = 0;
@@ -729,7 +729,7 @@
 	     ppsize(ppb, Bit2KB(add)));
 }
 
-static inline int _try_lc_del(struct Drbd_Conf *mdev, struct lc_element *al_ext)
+static inline int _try_lc_del(struct drbd_conf *mdev, struct lc_element *al_ext)
 {
 	int rv;
 
@@ -748,7 +748,7 @@
  * write any transactions)
  * You need to lock mdev->act_log with lc_try_lock() / lc_unlock()
  */
-void drbd_al_shrink(struct Drbd_Conf *mdev)
+void drbd_al_shrink(struct drbd_conf *mdev)
 {
 	struct lc_element *al_ext;
 	int i;
@@ -764,7 +764,7 @@
 	wake_up(&mdev->al_wait);
 }
 
-STATIC int w_update_odbm(drbd_dev *mdev, struct drbd_work *w, int unused)
+int w_update_odbm(struct drbd_conf *mdev, struct drbd_work *w, int unused)
 {
 	struct update_odbm_work *udw = (struct update_odbm_work *)w;
 
@@ -798,7 +798,7 @@
  *
  * TODO will be obsoleted once we have a caching lru of the on disk bitmap
  */
-STATIC void drbd_try_clear_on_disk_bm(struct Drbd_Conf *mdev, sector_t sector,
+void drbd_try_clear_on_disk_bm(struct drbd_conf *mdev, sector_t sector,
 				      int count, int success)
 {
 	struct bm_extent *ext;
@@ -885,7 +885,7 @@
  * called by worker on SyncTarget and receiver on SyncSource.
  *
  */
-void __drbd_set_in_sync(drbd_dev *mdev, sector_t sector, int size, const char *file, const unsigned int line)
+void __drbd_set_in_sync(struct drbd_conf *mdev, sector_t sector, int size, const char *file, const unsigned int line)
 {
 	/* Is called from worker and receiver context _only_ */
 	unsigned long sbnr, ebnr, lbnr, bnr;
@@ -963,7 +963,7 @@
  * called by tl_clear and drbd_send_dblock (==drbd_make_request).
  * so this can be _any_ process.
  */
-void __drbd_set_out_of_sync(drbd_dev *mdev, sector_t sector, int size, const char *file, const unsigned int line)
+void __drbd_set_out_of_sync(struct drbd_conf *mdev, sector_t sector, int size, const char *file, const unsigned int line)
 {
 	unsigned long sbnr, ebnr, lbnr;
 	sector_t esector, nr_sectors;
@@ -1015,7 +1015,7 @@
 }
 
 static inline
-struct bm_extent *_bme_get(struct Drbd_Conf *mdev, unsigned int enr)
+struct bm_extent *_bme_get(struct drbd_conf *mdev, unsigned int enr)
 {
 	struct bm_extent  *bm_ext;
 	int wakeup = 0;
@@ -1051,7 +1051,7 @@
 	return bm_ext;
 }
 
-static inline int _is_in_al(drbd_dev *mdev, unsigned int enr)
+static inline int _is_in_al(struct drbd_conf *mdev, unsigned int enr)
 {
 	struct lc_element *al_ext;
 	int rv = 0;
@@ -1084,7 +1084,7 @@
  * returns 1 if successful.
  * returns 0 if interrupted.
  */
-int drbd_rs_begin_io(drbd_dev *mdev, sector_t sector)
+int drbd_rs_begin_io(struct drbd_conf *mdev, sector_t sector)
 {
 	unsigned int enr = BM_SECT_TO_EXT(sector);
 	struct bm_extent *bm_ext;
@@ -1131,7 +1131,7 @@
  * returns zero if we could set BME_LOCKED and can proceed,
  * -EAGAIN if we need to try again.
  */
-int drbd_try_rs_begin_io(drbd_dev *mdev, sector_t sector)
+int drbd_try_rs_begin_io(struct drbd_conf *mdev, sector_t sector)
 {
 	unsigned int enr = BM_SECT_TO_EXT(sector);
 	const unsigned int al_enr = enr*AL_EXT_PER_BM_SECT;
@@ -1241,7 +1241,7 @@
 	return -EAGAIN;
 }
 
-void drbd_rs_complete_io(drbd_dev *mdev, sector_t sector)
+void drbd_rs_complete_io(struct drbd_conf *mdev, sector_t sector)
 {
 	unsigned int enr = BM_SECT_TO_EXT(sector);
 	struct bm_extent *bm_ext;
@@ -1281,7 +1281,7 @@
  * drbd_rs_cancel_all: Removes extents from the resync LRU. Even
  * if they are BME_LOCKED.
  */
-void drbd_rs_cancel_all(drbd_dev *mdev)
+void drbd_rs_cancel_all(struct drbd_conf *mdev)
 {
 	struct bm_extent *bm_ext;
 	int i;
@@ -1318,7 +1318,7 @@
  * returns -EAGAIN.
  * In case all elements got removed it returns zero.
  */
-int drbd_rs_del_all(drbd_dev *mdev)
+int drbd_rs_del_all(struct drbd_conf *mdev)
 {
 	struct bm_extent *bm_ext;
 	int i;
@@ -1369,7 +1369,7 @@
  * called on SyncTarget when resync write fails or NegRSDReply received
  *
  */
-void drbd_rs_failed_io(drbd_dev *mdev, sector_t sector, int size)
+void drbd_rs_failed_io(struct drbd_conf *mdev, sector_t sector, int size)
 {
 	/* Is called from worker and receiver context _only_ */
 	unsigned long sbnr, ebnr, lbnr, bnr;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 14:15:33 UTC (rev 2996)
@@ -108,7 +108,7 @@
 #define BM_LOCKED 0
 #define BM_MD_IO_ERROR (BITS_PER_LONG-1) /* 31? 63? */
 
-void __drbd_bm_lock(drbd_dev *mdev, char *file, int line)
+void __drbd_bm_lock(struct drbd_conf *mdev, char *file, int line)
 {
        struct drbd_bitmap *b = mdev->bitmap;
        spin_lock_irq(&b->bm_lock);
@@ -128,7 +128,7 @@
        spin_unlock_irq(&b->bm_lock);
 }
 
-void drbd_bm_unlock(drbd_dev *mdev)
+void drbd_bm_unlock(struct drbd_conf *mdev)
 {
        struct drbd_bitmap *b = mdev->bitmap;
        spin_lock_irq(&b->bm_lock);
@@ -145,7 +145,7 @@
 
 #if DUMP_MD >= 3
 /* debugging aid */
-STATIC void bm_end_info(drbd_dev *mdev, const char *where)
+void bm_end_info(struct drbd_conf *mdev, const char *where)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	size_t w = (b->bm_bits-1) >> LN2_BPL;
@@ -168,7 +168,7 @@
 
 /*
  * actually most functions herein should take a struct drbd_bitmap*, not a
- * drbd_dev*, but for the debug macros I like to have the mdev around
+ * struct drbd_conf*, but for the debug macros I like to have the mdev around
  * to be able to report device specific.
  */
 
@@ -182,7 +182,7 @@
  * called on driver init only. TODO call when a device is created.
  * allocates the drbd_bitmap, and stores it in mdev->bitmap.
  */
-int drbd_bm_init(drbd_dev *mdev)
+int drbd_bm_init(struct drbd_conf *mdev)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	WARN_ON(b);
@@ -198,7 +198,7 @@
 	return 0;
 }
 
-sector_t drbd_bm_capacity(drbd_dev *mdev)
+sector_t drbd_bm_capacity(struct drbd_conf *mdev)
 {
 	ERR_IF(!mdev->bitmap) return 0;
 	return mdev->bitmap->bm_dev_capacity;
@@ -206,7 +206,7 @@
 
 /* called on driver unload. TODO: call when a device is destroyed.
  */
-void drbd_bm_cleanup(drbd_dev *mdev)
+void drbd_bm_cleanup(struct drbd_conf *mdev)
 {
 	ERR_IF (!mdev->bitmap) return;
 	/* FIXME I think we should explicitly change the device size to zero
@@ -224,7 +224,7 @@
  * this masks out the remaining bits.
  * Rerturns the number of bits cleared.
  */
-STATIC int bm_clear_surplus(struct drbd_bitmap *b)
+int bm_clear_surplus(struct drbd_bitmap *b)
 {
 	const unsigned long mask = (1UL << (b->bm_bits & (BITS_PER_LONG-1))) -1;
 	size_t w = b->bm_bits >> LN2_BPL;
@@ -243,7 +243,7 @@
 	return cleared;
 }
 
-STATIC void bm_set_surplus(struct drbd_bitmap *b)
+void bm_set_surplus(struct drbd_bitmap *b)
 {
 	const unsigned long mask = (1UL << (b->bm_bits & (BITS_PER_LONG-1))) -1;
 	size_t w = b->bm_bits >> LN2_BPL;
@@ -255,7 +255,7 @@
 		b->bm[w++] = ~(0UL);
 }
 
-STATIC unsigned long bm_count_bits(struct drbd_bitmap *b, int just_read)
+unsigned long bm_count_bits(struct drbd_bitmap *b, int just_read)
 {
 	unsigned long *bm = b->bm;
 	unsigned long *ep = b->bm + b->bm_words;
@@ -272,7 +272,7 @@
 	return bits;
 }
 
-void _drbd_bm_recount_bits(drbd_dev *mdev, char *file, int line)
+void _drbd_bm_recount_bits(struct drbd_conf *mdev, char *file, int line)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long flags, bits;
@@ -299,7 +299,7 @@
  * In case this is actually a resize, we copy the old bitmap into the new one.
  * Otherwise, the bitmap is initiallized to all bits set.
  */
-int drbd_bm_resize(drbd_dev *mdev, sector_t capacity)
+int drbd_bm_resize(struct drbd_conf *mdev, sector_t capacity)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long bits, bytes, words, *nbm, *obm = 0;
@@ -406,7 +406,7 @@
  *
  * maybe bm_set should be atomic_t ?
  */
-unsigned long drbd_bm_total_weight(drbd_dev *mdev)
+unsigned long drbd_bm_total_weight(struct drbd_conf *mdev)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long s;
@@ -421,7 +421,7 @@
 	return s;
 }
 
-size_t drbd_bm_words(drbd_dev *mdev)
+size_t drbd_bm_words(struct drbd_conf *mdev)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	ERR_IF(!b) return 0;
@@ -431,7 +431,7 @@
 /* merge number words from buffer into the bitmap starting at offset.
  * buffer[i] is expected to be little endian unsigned long.
  */
-void drbd_bm_merge_lel( drbd_dev *mdev, size_t offset, size_t number,
+void drbd_bm_merge_lel( struct drbd_conf *mdev, size_t offset, size_t number,
 			unsigned long *buffer )
 {
 	struct drbd_bitmap *b = mdev->bitmap;
@@ -469,8 +469,8 @@
 /* copy number words from buffer into the bitmap starting at offset.
  * buffer[i] is expected to be little endian unsigned long.
  */
-void drbd_bm_set_lel( drbd_dev *mdev, size_t offset, size_t number,
-		      unsigned long *buffer )
+void drbd_bm_set_lel(struct drbd_conf *mdev, size_t offset, size_t number,
+		     unsigned long *buffer)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long *bm;
@@ -507,8 +507,8 @@
 /* copy number words from the bitmap starting at offset into the buffer.
  * buffer[i] will be little endian unsigned long.
  */
-void drbd_bm_get_lel( drbd_dev *mdev, size_t offset, size_t number,
-		      unsigned long *buffer )
+void drbd_bm_get_lel(struct drbd_conf *mdev, size_t offset, size_t number,
+		     unsigned long *buffer )
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long *bm;
@@ -535,7 +535,7 @@
 }
 
 /* set all bits in the bitmap */
-void drbd_bm_set_all(drbd_dev *mdev)
+void drbd_bm_set_all(struct drbd_conf *mdev)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	ERR_IF(!b) return;
@@ -578,7 +578,7 @@
 	return 0;
 }
 
-STATIC void drbd_bm_page_io_async(drbd_dev *mdev, struct drbd_bitmap *b, int page_nr, int rw)
+void drbd_bm_page_io_async(struct drbd_conf *mdev, struct drbd_bitmap *b, int page_nr, int rw)
 {
 	/* we are process context. we always get a bio */
 	/* THINK: do we need GFP_NOIO here? */
@@ -613,7 +613,7 @@
  * @enr is _sector_ offset from start of on disk bitmap (aka bm-extent nr).
  * returns 0 on success, -EIO on failure
  */
-int drbd_bm_read_sect(drbd_dev *mdev, unsigned long enr)
+int drbd_bm_read_sect(struct drbd_conf *mdev, unsigned long enr)
 {
 	sector_t on_disk_sector = mdev->bc->md.md_offset + mdev->bc->md.bm_offset + enr;
 	int bm_words, num_words, offset, err  = 0;
@@ -680,7 +680,7 @@
 /* lel_to_cpu == cpu_to_lel */
 # define bm_lel_to_cpu(x) bm_cpu_to_lel(x)
 
-STATIC int drbd_bm_rw(struct Drbd_Conf *mdev, int rw)
+int drbd_bm_rw(struct drbd_conf *mdev, int rw)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	/* sector_t sector; */
@@ -745,7 +745,7 @@
 	return err;
 }
 
-int drbd_bm_read(struct Drbd_Conf *mdev)
+int drbd_bm_read(struct drbd_conf *mdev)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	int err = 0;
@@ -768,7 +768,7 @@
  * @enr: The _sector_ offset from the start of the bitmap.
  *
  */
-int drbd_bm_write_sect(struct Drbd_Conf *mdev, unsigned long enr)
+int drbd_bm_write_sect(struct drbd_conf *mdev, unsigned long enr)
 {
 	sector_t on_disk_sector = enr + mdev->bc->md.md_offset + mdev->bc->md.bm_offset;
 	int bm_words, num_words, offset, err  = 0;
@@ -804,7 +804,7 @@
 /**
  * drbd_bm_write: Write the whole bitmap to its on disk location.
  */
-int drbd_bm_write(struct Drbd_Conf *mdev)
+int drbd_bm_write(struct drbd_conf *mdev)
 {
 	int err = drbd_bm_rw(mdev, WRITE);
 
@@ -815,7 +815,7 @@
 }
 
 /* clear all bits in the bitmap */
-void drbd_bm_clear_all(drbd_dev *mdev)
+void drbd_bm_clear_all(struct drbd_conf *mdev)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 
@@ -828,7 +828,7 @@
 	spin_unlock_irq(&b->bm_lock);
 }
 
-void drbd_bm_reset_find(drbd_dev *mdev)
+void drbd_bm_reset_find(struct drbd_conf *mdev)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 
@@ -845,7 +845,7 @@
  * should not make much difference anyways, but ...
  * this returns a bit number, NOT a sector!
  */
-unsigned long drbd_bm_find_next(drbd_dev *mdev)
+unsigned long drbd_bm_find_next(struct drbd_conf *mdev)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long i = -1UL;
@@ -869,7 +869,7 @@
 	return i;
 }
 
-void drbd_bm_set_find(drbd_dev *mdev, unsigned long i)
+void drbd_bm_set_find(struct drbd_conf *mdev, unsigned long i)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 
@@ -881,7 +881,7 @@
 }
 
 
-int drbd_bm_rs_done(drbd_dev *mdev)
+int drbd_bm_rs_done(struct drbd_conf *mdev)
 {
 	return mdev->bitmap->bm_fo == 0;
 }
@@ -893,7 +893,7 @@
 /* returns previous bit state
  * wants bitnr, NOT sector.
  */
-int drbd_bm_set_bit(drbd_dev *mdev, const unsigned long bitnr)
+int drbd_bm_set_bit(struct drbd_conf *mdev, const unsigned long bitnr)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	int i;
@@ -925,7 +925,7 @@
 
 /* returns number of bits actually changed (0->1)
  * wants bitnr, not sector */
-int drbd_bm_set_bits_in_irq(drbd_dev *mdev, const unsigned long s, const unsigned long e)
+int drbd_bm_set_bits_in_irq(struct drbd_conf *mdev, const unsigned long s, const unsigned long e)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long bitnr;
@@ -949,7 +949,7 @@
 /* returns previous bit state
  * wants bitnr, NOT sector.
  */
-int drbd_bm_clear_bit(drbd_dev *mdev, const unsigned long bitnr)
+int drbd_bm_clear_bit(struct drbd_conf *mdev, const unsigned long bitnr)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long flags;
@@ -985,7 +985,7 @@
  *  0 ... bit not set
  * -1 ... first out of bounds access, stop testing for bits!
  */
-int drbd_bm_test_bit(drbd_dev *mdev, const unsigned long bitnr)
+int drbd_bm_test_bit(struct drbd_conf *mdev, const unsigned long bitnr)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	int i;
@@ -1020,7 +1020,7 @@
  * reference count of some bitmap extent element from some lru instead...
  *
  */
-int drbd_bm_e_weight(drbd_dev *mdev, unsigned long enr)
+int drbd_bm_e_weight(struct drbd_conf *mdev, unsigned long enr)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	int count, s, e;
@@ -1048,7 +1048,7 @@
 }
 
 /* set all bits covered by the AL-extent al_enr */
-unsigned long drbd_bm_ALe_set_all(drbd_dev *mdev, unsigned long al_enr)
+unsigned long drbd_bm_ALe_set_all(struct drbd_conf *mdev, unsigned long al_enr)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long weight;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 14:15:33 UTC (rev 2996)
@@ -94,14 +94,9 @@
 #define ID_VACANT 0
 #define is_syncer_block_id(id) ((id) == ID_SYNCER)
 
-struct Drbd_Conf;
-typedef struct Drbd_Conf drbd_dev;
+struct drbd_conf;
 
-#ifdef DBG_ALL_SYMBOLS
-# define STATIC
-#else
-# define STATIC static
-#endif
+#define STATIC
 
 #ifdef PARANOIA
 # define PARANOIA_BUG_ON(x) BUG_ON(x)
@@ -181,7 +176,7 @@
 
 
 #ifdef DBG_ASSERTS
-extern void drbd_assert_breakpoint(drbd_dev *, char *, char *, int );
+extern void drbd_assert_breakpoint(struct drbd_conf *, char *, char *, int );
 # define D_ASSERT(exp)	if (!(exp)) \
 	 drbd_assert_breakpoint(mdev, #exp, __FILE__, __LINE__)
 #else
@@ -208,9 +203,9 @@
 };
 
 #ifdef DRBD_ENABLE_FAULTS
-extern unsigned int _drbd_insert_fault(drbd_dev *mdev, unsigned int type);
+extern unsigned int _drbd_insert_fault(struct drbd_conf *mdev, unsigned int type);
 static inline int
-drbd_insert_fault(drbd_dev *mdev, unsigned int type) {
+drbd_insert_fault(struct drbd_conf *mdev, unsigned int type) {
     return (fault_rate &&
 	    (enable_faults & (1<<type)) &&
 	    _drbd_insert_fault(mdev, type));
@@ -253,23 +248,23 @@
  *************************/
 
 #define SET_MDEV_MAGIC(x) \
-	({ typecheck(struct Drbd_Conf*, x); \
+	({ typecheck(struct drbd_conf*, x); \
 	  (x)->magic = (long)(x) ^ DRBD_MAGIC; })
 #define IS_VALID_MDEV(x)  \
-	( typecheck(struct Drbd_Conf*, x) && \
+	( typecheck(struct drbd_conf*, x) && \
 	  ((x) ? (((x)->magic ^ DRBD_MAGIC) == (long)(x)):0))
 
 /* drbd_meta-data.c (still in drbd_main.c) */
 /* 4th incarnation of the disk layout. */
 #define DRBD_MD_MAGIC (DRBD_MAGIC+4)
 
-extern struct Drbd_Conf **minor_table;
+extern struct drbd_conf **minor_table;
 
 /***
  * on the wire
  *********************************************************************/
 
-typedef enum {
+enum Drbd_Packet_Cmd {
 	Data,
 	DataReply,     /* Response to DataRequest */
 	RSDataReply,   /* Response to RSDataRequest */
@@ -314,9 +309,9 @@
 	HandShakeS = 0xfff2, /* First Packet on the Socket */
 
 	HandShake  = 0xfffe  /* FIXED for the next century! */
-} Drbd_Packet_Cmd;
+};
 
-static inline const char *cmdname(Drbd_Packet_Cmd cmd)
+static inline const char *cmdname(enum Drbd_Packet_Cmd cmd)
 {
 	/* THINK may need to become several global tables
 	 * when we want to support more than
@@ -384,12 +379,12 @@
  * NOTE that the payload starts at a long aligned offset,
  * regardless of 32 or 64 bit arch!
  */
-typedef struct {
+struct Drbd_Header {
 	u32	  magic;
 	u16	  command;
 	u16	  length;	/* bytes of data after this header */
 	char	  payload[0];
-} __attribute((packed)) Drbd_Header;
+} __attribute((packed));
 /* 8 bytes. packet FIXED for the next century! */
 
 /*
@@ -411,13 +406,13 @@
 #define DP_RW_SYNC	      2
 #define DP_MAY_SET_IN_SYNC    4
 
-typedef struct {
-	Drbd_Header head;
+struct Drbd_Data_Packet {
+	struct Drbd_Header head;
 	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;
+} __attribute((packed));
 
 /*
  * commands which share a struct:
@@ -427,22 +422,22 @@
  *  Drbd_BlockRequest_Packet:
  *   DataRequest, RSDataRequest
  */
-typedef struct {
-	Drbd_Header head;
+struct Drbd_BlockAck_Packet {
+	struct Drbd_Header head;
 	u64	    sector;
 	u64	    block_id;
 	u32	    blksize;
 	u32	    seq_num;
-} __attribute((packed)) Drbd_BlockAck_Packet;
+} __attribute((packed));
 
 
-typedef struct {
-	Drbd_Header head;
-	u64	    sector;
-	u64	    block_id;
-	u32	    blksize;
-	u32	    pad;	/* to multiple of 8 Byte */
-} __attribute((packed)) Drbd_BlockRequest_Packet;
+struct Drbd_BlockRequest_Packet {
+	struct Drbd_Header head;
+	u64 sector;
+	u64 block_id;
+	u32 blksize;
+	u32 pad;	/* to multiple of 8 Byte */
+} __attribute((packed));
 
 /*
  * commands with their own struct for additional fields:
@@ -453,82 +448,82 @@
  *   ReportParams
  */
 
-typedef struct {
-	Drbd_Header head;		/* 8 bytes */
-	u32	    protocol_version;
-	u32	    feature_flags;
+struct Drbd_HandShake_Packet {
+	struct Drbd_Header head;	/* 8 bytes */
+	u32 protocol_version;
+	u32 feature_flags;
 
 	/* should be more than enough for future enhancements
 	 * for now, feature_flags and the reserverd array shall be zero.
 	 */
 
-	u64	    reserverd[8];
-} __attribute((packed)) Drbd_HandShake_Packet;
+	u64 reserverd[8];
+} __attribute((packed));
 /* 80 bytes, FIXED for the next century */
 
-typedef struct {
-	Drbd_Header head;
-	u32	    barrier;	/* barrier number _handle_ only */
-	u32	    pad;	/* to multiple of 8 Byte */
-} __attribute((packed)) Drbd_Barrier_Packet;
+struct Drbd_Barrier_Packet {
+	struct Drbd_Header head;
+	u32 barrier;	/* barrier number _handle_ only */
+	u32 pad;	/* to multiple of 8 Byte */
+} __attribute((packed));
 
-typedef struct {
-	Drbd_Header head;
-	u32	    barrier;
-	u32	    set_size;
-} __attribute((packed)) Drbd_BarrierAck_Packet;
+struct Drbd_BarrierAck_Packet {
+	struct Drbd_Header head;
+	u32 barrier;
+	u32 set_size;
+} __attribute((packed));
 
-typedef struct {
-	Drbd_Header head;
-	u32	    rate;
-} __attribute((packed)) Drbd_SyncParam_Packet;
+struct Drbd_SyncParam_Packet {
+	struct Drbd_Header head;
+	u32 rate;
+} __attribute((packed));
 
-typedef struct {
-	Drbd_Header head;
-	u32	    protocol;
-	u32	    after_sb_0p;
-	u32	    after_sb_1p;
-	u32	    after_sb_2p;
-	u32	    want_lose;
-	u32	    two_primaries;
-} __attribute((packed)) Drbd_Protocol_Packet;
+struct Drbd_Protocol_Packet {
+	struct Drbd_Header head;
+	u32 protocol;
+	u32 after_sb_0p;
+	u32 after_sb_1p;
+	u32 after_sb_2p;
+	u32 want_lose;
+	u32 two_primaries;
+} __attribute((packed));
 
-typedef struct {
-	Drbd_Header head;
-	u64	    uuid[EXT_UUID_SIZE];
-} __attribute((packed)) Drbd_GenCnt_Packet;
+struct Drbd_GenCnt_Packet {
+	struct Drbd_Header head;
+	u64 uuid[EXT_UUID_SIZE];
+} __attribute((packed));
 
-typedef struct {
-	Drbd_Header head;
+struct Drbd_SyncUUID_Packet {
+	struct Drbd_Header head;
 	u64	    uuid;
-} __attribute((packed)) Drbd_SyncUUID_Packet;
+} __attribute((packed));
 
-typedef struct {
-	Drbd_Header head;
+struct Drbd_Sizes_Packet {
+	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 */
 	u32	    queue_order_type;
-} __attribute((packed)) Drbd_Sizes_Packet;
+} __attribute((packed));
 
-typedef struct {
-	Drbd_Header head;
+struct Drbd_State_Packet {
+	struct Drbd_Header head;
 	u32	    state;
-} __attribute((packed)) Drbd_State_Packet;
+} __attribute((packed));
 
-typedef struct {
-	Drbd_Header head;
+struct Drbd_Req_State_Packet {
+	struct Drbd_Header head;
 	u32	    mask;
 	u32	    val;
-} __attribute((packed)) Drbd_Req_State_Packet;
+} __attribute((packed));
 
-typedef struct {
-	Drbd_Header head;
+struct Drbd_RqS_Reply_Packet {
+	struct Drbd_Header head;
 	u32	    retcode;
-} __attribute((packed)) Drbd_RqS_Reply_Packet;
+} __attribute((packed));
 
-typedef struct {
+struct Drbd06_Parameter_P {
 	u64	  size;
 	u32	  state;
 	u32	  blksize;
@@ -536,51 +531,51 @@
 	u32	  version;
 	u32	  gen_cnt[5];
 	u32	  bit_map_gen[5];
-} __attribute((packed)) Drbd06_Parameter_P;
+} __attribute((packed));
 
-typedef struct {
-	Drbd_Header head;
+struct Drbd_Discard_Packet {
+	struct Drbd_Header head;
 	u64	    block_id;
 	u32	    seq_num;
 	u32	    pad;
-} __attribute((packed)) Drbd_Discard_Packet;
+} __attribute((packed));
 
-typedef union {
-	Drbd_Header		 head;
-	Drbd_HandShake_Packet	 HandShake;
-	Drbd_Data_Packet	 Data;
-	Drbd_BlockAck_Packet	 BlockAck;
-	Drbd_Barrier_Packet	 Barrier;
-	Drbd_BarrierAck_Packet	 BarrierAck;
-	Drbd_SyncParam_Packet	 SyncParam;
-	Drbd_Protocol_Packet	 Protocol;
-	Drbd_Sizes_Packet	 Sizes;
-	Drbd_GenCnt_Packet	 GenCnt;
-	Drbd_State_Packet	 State;
-	Drbd_Req_State_Packet	 ReqState;
-	Drbd_RqS_Reply_Packet	 RqSReply;
-	Drbd_BlockRequest_Packet BlockRequest;
-} __attribute((packed)) Drbd_Polymorph_Packet;
+union Drbd_Polymorph_Packet {
+	struct Drbd_Header		head;
+	struct Drbd_HandShake_Packet	HandShake;
+	struct Drbd_Data_Packet		Data;
+	struct Drbd_BlockAck_Packet	BlockAck;
+	struct Drbd_Barrier_Packet	Barrier;
+	struct Drbd_BarrierAck_Packet	BarrierAck;
+	struct Drbd_SyncParam_Packet	SyncParam;
+	struct Drbd_Protocol_Packet	Protocol;
+	struct Drbd_Sizes_Packet	Sizes;
+	struct Drbd_GenCnt_Packet	GenCnt;
+	struct Drbd_State_Packet	State;
+	struct Drbd_Req_State_Packet	ReqState;
+	struct Drbd_RqS_Reply_Packet	RqSReply;
+	struct Drbd_BlockRequest_Packet	BlockRequest;
+} __attribute((packed));
 
 /**********************************************************************/
 
-typedef enum {
+enum Drbd_thread_state {
 	None,
 	Running,
 	Exiting,
 	Restarting
-} Drbd_thread_state;
+};
 
 struct Drbd_thread {
 	spinlock_t t_lock;
 	struct task_struct *task;
 	struct completion startstop;
-	Drbd_thread_state t_state;
+	enum Drbd_thread_state t_state;
 	int (*function) (struct Drbd_thread *);
-	drbd_dev *mdev;
+	struct drbd_conf *mdev;
 };
 
-static inline Drbd_thread_state get_t_state(struct Drbd_thread *thi)
+static inline enum Drbd_thread_state get_t_state(struct Drbd_thread *thi)
 {
 	/* THINK testing the t_state seems to be uncritical in all cases
 	 * (but thread_{start,stop}), so we can read it *without* the lock.
@@ -598,7 +593,7 @@
  * drbd_request and Tl_epoch_entry are descendants of drbd_work.
  */
 struct drbd_work;
-typedef int (*drbd_work_cb)(drbd_dev *, struct drbd_work *, int cancel);
+typedef int (*drbd_work_cb)(struct drbd_conf *, struct drbd_work *, int cancel);
 struct drbd_work {
 	struct list_head list;
 	drbd_work_cb cb;
@@ -607,7 +602,7 @@
 struct drbd_barrier;
 struct drbd_request {
 	struct drbd_work w;
-	drbd_dev *mdev;
+	struct drbd_conf *mdev;
 	struct bio *private_bio;
 	struct hlist_node colision;
 	sector_t sector;
@@ -636,7 +631,7 @@
 	int n_req;	/* number of requests attached before this barrier */
 };
 
-typedef struct drbd_request drbd_request_t;
+struct drbd_request;
 
 /* These Tl_epoch_entries may be in one of 6 lists:
    active_ee .. data packet being written
@@ -647,7 +642,7 @@
 
 struct Tl_epoch_entry {
 	struct drbd_work    w;
-	drbd_dev *mdev;
+	struct drbd_conf *mdev;
 	struct bio *private_bio;
 	struct hlist_node colision;
 	sector_t sector;
@@ -700,7 +695,7 @@
 	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 */
@@ -729,8 +724,8 @@
 	struct socket	 *socket;
 	/* this way we get our
 	 * send/receive buffers off the stack */
-	Drbd_Polymorph_Packet sbuf;
-	Drbd_Polymorph_Packet rbuf;
+	union Drbd_Polymorph_Packet sbuf;
+	union Drbd_Polymorph_Packet rbuf;
 };
 
 struct drbd_md {
@@ -768,7 +763,7 @@
 	struct disk_conf dc; /* The user provided config... */
 };
 
-struct Drbd_Conf {
+struct drbd_conf {
 #ifdef PARANOIA
 	long magic;
 #endif
@@ -795,8 +790,8 @@
 	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 state;
+	union drbd_state_t new_state_tmp; /* Used after attach while negotiating new disk state. */
+	union drbd_state_t state;
 	wait_queue_head_t misc_wait;
 	wait_queue_head_t state_wait;  /* upon each state change. */
 	unsigned int send_cnt;
@@ -882,16 +877,16 @@
 	unsigned long comm_bm_set; /* communicated number of set bits. */
 };
 
-static inline drbd_dev *minor_to_mdev(int minor)
+static inline struct drbd_conf *minor_to_mdev(int minor)
 {
-	drbd_dev *mdev;
+	struct drbd_conf *mdev;
 
 	mdev = minor < minor_count ? minor_table[minor] : NULL;
 
 	return mdev;
 }
 
-static inline int mdev_to_minor(drbd_dev *mdev)
+static inline int mdev_to_minor(struct drbd_conf *mdev)
 {
 	return mdev->minor;
 }
@@ -904,7 +899,7 @@
  *	CODE();
  * drbd_put_data_sock(mdev);
  */
-static inline int drbd_get_data_sock(drbd_dev *mdev)
+static inline int drbd_get_data_sock(struct drbd_conf *mdev)
 {
 	down(&mdev->data.mutex);
 	/* drbd_disconnect() could have called drbd_free_sock()
@@ -916,7 +911,7 @@
 	return 1;
 }
 
-static inline void drbd_put_data_sock(drbd_dev *mdev)
+static inline void drbd_put_data_sock(struct drbd_conf *mdev)
 {
 	up(&mdev->data.mutex);
 }
@@ -934,76 +929,76 @@
 	ScheduleAfter	= 4,
 };
 
-extern int drbd_change_state(drbd_dev *mdev, enum chg_state_flags f,
-			     drbd_state_t mask, drbd_state_t val);
-extern void drbd_force_state(drbd_dev *, drbd_state_t, drbd_state_t);
-extern int _drbd_request_state(drbd_dev *, drbd_state_t, drbd_state_t,
+extern int drbd_change_state(struct drbd_conf *mdev, enum chg_state_flags f,
+			     union drbd_state_t mask, union drbd_state_t val);
+extern void drbd_force_state(struct drbd_conf *, union drbd_state_t, union drbd_state_t);
+extern int _drbd_request_state(struct drbd_conf *, union drbd_state_t, union drbd_state_t,
 			       enum chg_state_flags);
-extern int _drbd_set_state(drbd_dev *, drbd_state_t, enum chg_state_flags );
-extern void print_st_err(drbd_dev *, drbd_state_t, drbd_state_t, int );
-extern void after_state_ch(drbd_dev *mdev, drbd_state_t os, drbd_state_t ns,
+extern int _drbd_set_state(struct drbd_conf *, union drbd_state_t, enum chg_state_flags );
+extern void print_st_err(struct drbd_conf *, union drbd_state_t, union drbd_state_t, int );
+extern void after_state_ch(struct drbd_conf *mdev, union drbd_state_t os, union drbd_state_t ns,
 			   enum chg_state_flags);
 extern int  drbd_thread_start(struct Drbd_thread *thi);
 extern void _drbd_thread_stop(struct Drbd_thread *thi, int restart, int wait);
 extern void drbd_thread_signal(struct Drbd_thread *thi);
-extern void drbd_free_resources(drbd_dev *mdev);
-extern void tl_release(drbd_dev *mdev, unsigned int barrier_nr,
+extern void drbd_free_resources(struct drbd_conf *mdev);
+extern void tl_release(struct drbd_conf *mdev, unsigned int barrier_nr,
 		       unsigned int set_size);
-extern void tl_clear(drbd_dev *mdev);
-extern struct drbd_barrier *_tl_add_barrier(drbd_dev *, struct drbd_barrier *);
-extern void drbd_free_sock(drbd_dev *mdev);
-extern int drbd_send(drbd_dev *mdev, struct socket *sock,
+extern void tl_clear(struct drbd_conf *mdev);
+extern struct drbd_barrier *_tl_add_barrier(struct drbd_conf *, struct drbd_barrier *);
+extern void drbd_free_sock(struct drbd_conf *mdev);
+extern int drbd_send(struct drbd_conf *mdev, struct socket *sock,
 		     void *buf, size_t size, unsigned msg_flags);
-extern int drbd_send_protocol(drbd_dev *mdev);
-extern int drbd_send_uuids(drbd_dev *mdev);
-extern int drbd_send_sync_uuid(drbd_dev *mdev, u64 val);
-extern int drbd_send_sizes(drbd_dev *mdev);
-extern int drbd_send_state(drbd_dev *mdev);
-extern int _drbd_send_cmd(drbd_dev *mdev, struct socket *sock,
-			  Drbd_Packet_Cmd cmd, Drbd_Header *h,
+extern int drbd_send_protocol(struct drbd_conf *mdev);
+extern int drbd_send_uuids(struct drbd_conf *mdev);
+extern int drbd_send_sync_uuid(struct drbd_conf *mdev, u64 val);
+extern int drbd_send_sizes(struct drbd_conf *mdev);
+extern int drbd_send_state(struct drbd_conf *mdev);
+extern int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock,
+			  enum Drbd_Packet_Cmd cmd, struct Drbd_Header *h,
 			  size_t size, unsigned msg_flags);
 #define USE_DATA_SOCKET 1
 #define USE_META_SOCKET 0
-extern int drbd_send_cmd(drbd_dev *mdev, int use_data_socket,
-			  Drbd_Packet_Cmd cmd, Drbd_Header *h, size_t size);
-extern int drbd_send_cmd2(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
+extern int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket,
+			  enum Drbd_Packet_Cmd cmd, struct Drbd_Header *h, size_t size);
+extern int drbd_send_cmd2(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
 			  char *data, size_t size);
-extern int drbd_send_sync_param(drbd_dev *mdev, struct syncer_conf *sc);
-extern int drbd_send_b_ack(drbd_dev *mdev, u32 barrier_nr,
+extern int drbd_send_sync_param(struct drbd_conf *mdev, struct syncer_conf *sc);
+extern int drbd_send_b_ack(struct drbd_conf *mdev, u32 barrier_nr,
 			   u32 set_size);
-extern int drbd_send_ack(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
+extern int drbd_send_ack(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
 			 struct Tl_epoch_entry *e);
-extern int drbd_send_ack_rp(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
-			    Drbd_BlockRequest_Packet *rp);
-extern int drbd_send_ack_dp(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
-			    Drbd_Data_Packet *dp);
-extern int _drbd_send_page(drbd_dev *mdev, struct page *page,
+extern int drbd_send_ack_rp(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
+			    struct Drbd_BlockRequest_Packet *rp);
+extern int drbd_send_ack_dp(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
+			    struct Drbd_Data_Packet *dp);
+extern int _drbd_send_page(struct drbd_conf *mdev, struct page *page,
 			   int offset, size_t size);
-extern int drbd_send_block(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
+extern int drbd_send_block(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
 			   struct Tl_epoch_entry *e);
-extern int drbd_send_dblock(drbd_dev *mdev, drbd_request_t *req);
-extern int _drbd_send_barrier(drbd_dev *mdev, struct drbd_barrier *barrier);
-extern int drbd_send_drequest(drbd_dev *mdev, int cmd,
+extern int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req);
+extern int _drbd_send_barrier(struct drbd_conf *mdev, struct drbd_barrier *barrier);
+extern int drbd_send_drequest(struct drbd_conf *mdev, int cmd,
 			      sector_t sector, int size, u64 block_id);
-extern int drbd_send_bitmap(drbd_dev *mdev);
-extern int _drbd_send_bitmap(drbd_dev *mdev);
-extern int drbd_send_sr_reply(drbd_dev *mdev, int retcode);
+extern int drbd_send_bitmap(struct drbd_conf *mdev);
+extern int _drbd_send_bitmap(struct drbd_conf *mdev);
+extern int drbd_send_sr_reply(struct drbd_conf *mdev, int retcode);
 extern void drbd_free_bc(struct drbd_backing_dev *bc);
-extern int drbd_io_error(drbd_dev *mdev, int forcedetach);
-extern void drbd_mdev_cleanup(drbd_dev *mdev);
+extern int drbd_io_error(struct drbd_conf *mdev, int forcedetach);
+extern void drbd_mdev_cleanup(struct drbd_conf *mdev);
 
 /* 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);
+extern void drbd_md_sync(struct drbd_conf *mdev);
+extern int  drbd_md_read(struct drbd_conf *mdev, struct drbd_backing_dev *bdev);
 /* 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);
-extern void drbd_uuid_set_bm(drbd_dev *mdev, u64 val);
-extern void drbd_md_set_flag(drbd_dev *mdev, int flags);
-extern void drbd_md_clear_flag(drbd_dev *mdev, int flags);
+extern void drbd_uuid_set(struct drbd_conf *mdev, int idx, u64 val);
+extern void _drbd_uuid_set(struct drbd_conf *mdev, int idx, u64 val);
+extern void drbd_uuid_new_current(struct drbd_conf *mdev);
+extern void drbd_uuid_set_bm(struct drbd_conf *mdev, u64 val);
+extern void drbd_md_set_flag(struct drbd_conf *mdev, int flags);
+extern void drbd_md_clear_flag(struct drbd_conf *mdev, int flags);
 extern int drbd_md_test_flag(struct drbd_backing_dev *, int);
-extern void drbd_md_mark_dirty(drbd_dev *mdev);
+extern void drbd_md_mark_dirty(struct drbd_conf *mdev);
 
 /* Meta data layout
    We reserve a 128MB Block (4k aligned)
@@ -1095,7 +1090,7 @@
  * including offset and compression scheme and whatnot
  * Do not use PAGE_SIZE here! Use a architecture agnostic constant!
  */
-#define BM_PACKET_WORDS     ((4096-sizeof(Drbd_Header))/sizeof(long))
+#define BM_PACKET_WORDS ((4096-sizeof(struct Drbd_Header))/sizeof(long))
 
 /* the extent in "PER_EXTENT" below is an activity log extent
  * we need that many (long words/bytes) to store the bitmap
@@ -1135,46 +1130,46 @@
 /* Number of elements in the app_reads_hash */
 #define APP_R_HSIZE 15
 
-extern int  drbd_bm_init(drbd_dev *mdev);
-extern int  drbd_bm_resize(drbd_dev *mdev, sector_t sectors);
-extern void drbd_bm_cleanup(drbd_dev *mdev);
-extern void drbd_bm_set_all(drbd_dev *mdev);
-extern void drbd_bm_clear_all(drbd_dev *mdev);
-extern void drbd_bm_reset_find(drbd_dev *mdev);
-extern int  drbd_bm_set_bit(drbd_dev *mdev, unsigned long bitnr);
+extern int  drbd_bm_init(struct drbd_conf *mdev);
+extern int  drbd_bm_resize(struct drbd_conf *mdev, sector_t sectors);
+extern void drbd_bm_cleanup(struct drbd_conf *mdev);
+extern void drbd_bm_set_all(struct drbd_conf *mdev);
+extern void drbd_bm_clear_all(struct drbd_conf *mdev);
+extern void drbd_bm_reset_find(struct drbd_conf *mdev);
+extern int  drbd_bm_set_bit(struct drbd_conf *mdev, unsigned long bitnr);
 extern int  drbd_bm_set_bits_in_irq(
-		drbd_dev *mdev, unsigned long s, unsigned long e);
-extern int  drbd_bm_test_bit(drbd_dev *mdev, unsigned long bitnr);
-extern int  drbd_bm_clear_bit(drbd_dev *mdev, unsigned long bitnr);
-extern int  drbd_bm_e_weight(drbd_dev *mdev, unsigned long enr);
-extern int  drbd_bm_read_sect(drbd_dev *mdev, unsigned long enr);
-extern int  drbd_bm_write_sect(drbd_dev *mdev, unsigned long enr);
-extern int  drbd_bm_read(drbd_dev *mdev);
-extern int  drbd_bm_write(drbd_dev *mdev);
-extern unsigned long drbd_bm_ALe_set_all(drbd_dev *mdev, unsigned long al_enr);
-extern size_t	     drbd_bm_words(drbd_dev *mdev);
-extern sector_t      drbd_bm_capacity(drbd_dev *mdev);
-extern unsigned long drbd_bm_find_next(drbd_dev *mdev);
-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);
+		struct drbd_conf *mdev, unsigned long s, unsigned long e);
+extern int  drbd_bm_test_bit(struct drbd_conf *mdev, unsigned long bitnr);
+extern int  drbd_bm_clear_bit(struct drbd_conf *mdev, unsigned long bitnr);
+extern int  drbd_bm_e_weight(struct drbd_conf *mdev, unsigned long enr);
+extern int  drbd_bm_read_sect(struct drbd_conf *mdev, unsigned long enr);
+extern int  drbd_bm_write_sect(struct drbd_conf *mdev, unsigned long enr);
+extern int  drbd_bm_read(struct drbd_conf *mdev);
+extern int  drbd_bm_write(struct drbd_conf *mdev);
+extern unsigned long drbd_bm_ALe_set_all(struct drbd_conf *mdev, unsigned long al_enr);
+extern size_t	     drbd_bm_words(struct drbd_conf *mdev);
+extern sector_t      drbd_bm_capacity(struct drbd_conf *mdev);
+extern unsigned long drbd_bm_find_next(struct drbd_conf *mdev);
+extern void drbd_bm_set_find(struct drbd_conf *mdev, unsigned long i);
+extern unsigned long drbd_bm_total_weight(struct drbd_conf *mdev);
+extern int drbd_bm_rs_done(struct drbd_conf *mdev);
 /* for receive_bitmap */
-extern void drbd_bm_merge_lel(drbd_dev *mdev, size_t offset, size_t number,
+extern void drbd_bm_merge_lel(struct drbd_conf *mdev, size_t offset, size_t number,
 				unsigned long *buffer);
 /* for _drbd_send_bitmap and drbd_bm_write_sect */
-extern void drbd_bm_get_lel(drbd_dev *mdev, size_t offset, size_t number,
+extern void drbd_bm_get_lel(struct drbd_conf *mdev, size_t offset, size_t number,
 				unsigned long *buffer);
 /*
  * only used by drbd_bm_read_sect
-extern void drbd_bm_set_lel(drbd_dev *mdev, size_t offset, size_t number,
+extern void drbd_bm_set_lel(struct drbd_conf *mdev, size_t offset, size_t number,
 				unsigned long* buffer);
 */
 
-extern void __drbd_bm_lock(drbd_dev *mdev, char *file, int line);
-extern void drbd_bm_unlock(drbd_dev *mdev);
+extern void __drbd_bm_lock(struct drbd_conf *mdev, char *file, int line);
+extern void drbd_bm_unlock(struct drbd_conf *mdev);
 #define drbd_bm_lock(mdev)    __drbd_bm_lock(mdev, __FILE__, __LINE__ )
 
-extern void _drbd_bm_recount_bits(drbd_dev *mdev, char *file, int line);
+extern void _drbd_bm_recount_bits(struct drbd_conf *mdev, char *file, int line);
 #define drbd_bm_recount_bits(mdev) _drbd_bm_recount_bits(mdev,	__FILE__, __LINE__ )
 /* drbd_main.c */
 
@@ -1193,7 +1188,7 @@
 extern int	    drbd_pp_vacant;
 extern wait_queue_head_t drbd_pp_wait;
 
-extern drbd_dev *drbd_new_device(int minor);
+extern struct drbd_conf *drbd_new_device(int minor);
 
 /* Dynamic tracing framework */
 #ifdef ENABLE_DYNAMIC_TRACE
@@ -1226,7 +1221,7 @@
 	return ((trace_level >= level) && (type & trace_type));
 }
 static inline int
-is_mdev_trace(drbd_dev *mdev, unsigned int type, unsigned int level) {
+is_mdev_trace(struct drbd_conf *mdev, unsigned int type, unsigned int level) {
 	return (is_trace(type, level) &&
 		( ( 1 << mdev_to_minor(mdev)) & trace_devs));
 }
@@ -1246,25 +1241,25 @@
 } while (0)
 
 /* Buffer printing support
- * DbgPrintFlags: used for Flags arg to DbgPrintBuffer
+ * dbg_print_flags: used for Flags arg to drbd_print_buffer
  * - 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 {
+enum dbg_print_flags {
     DBGPRINT_BUFFADDR = 0x0001,
-}  DbgPrintFlags;
+};
 
-extern void drbd_print_uuid(drbd_dev *mdev, unsigned int idx);
+extern void drbd_print_uuid(struct drbd_conf *mdev, unsigned int idx);
 
 extern void drbd_print_buffer(const char *prefix, unsigned int flags, int size,
 			      const void *buffer, const void *buffer_va,
 			      unsigned int length);
 
 /* Bio printing support */
-extern void _dump_bio(drbd_dev *mdev, struct bio *bio, int complete);
+extern void _dump_bio(struct drbd_conf *mdev, struct bio *bio, int complete);
 
-static inline void dump_bio(drbd_dev *mdev, struct bio *bio, int complete)
+static inline void dump_bio(struct drbd_conf *mdev, struct bio *bio, int complete)
 {
 	MTRACE(TraceTypeRq, TraceLvlSummary,
 	       _dump_bio(mdev, bio, complete);
@@ -1272,12 +1267,12 @@
 }
 
 /* Packet dumping support */
-extern void _dump_packet(drbd_dev *mdev, struct socket *sock,
-			 int recv, Drbd_Polymorph_Packet *p, char *file, int line);
+extern void _dump_packet(struct drbd_conf *mdev, struct socket *sock,
+			 int recv, union Drbd_Polymorph_Packet *p, char *file, int line);
 
 static inline void
-dump_packet(drbd_dev *mdev, struct socket *sock,
-	    int recv, Drbd_Polymorph_Packet *p, char *file, int line)
+dump_packet(struct drbd_conf *mdev, struct socket *sock,
+	    int recv, union Drbd_Polymorph_Packet *p, char *file, int line)
 {
 	MTRACE(TraceTypePacket, TraceLvlSummary,
 	       _dump_packet(mdev, sock, recv, p, file, line);
@@ -1295,62 +1290,62 @@
 
 /* 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_read_remote(struct drbd_conf *mdev, struct drbd_request *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);
+extern int is_valid_ar_handle(struct drbd_request *, sector_t);
 
 
 /* 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 *);
-extern void drbd_setup_queue_param(drbd_dev *mdev, unsigned int);
-extern int drbd_set_role(drbd_dev *mdev, drbd_role_t new_role, int force);
+extern sector_t drbd_new_dev_size(struct drbd_conf *, struct drbd_backing_dev *);
+extern int drbd_determin_dev_size(struct drbd_conf *);
+extern void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int);
+extern int drbd_set_role(struct drbd_conf *mdev, enum drbd_role new_role, int force);
 extern int drbd_ioctl(struct inode *inode, struct file *file,
 		      unsigned int cmd, unsigned long arg);
-drbd_disks_t drbd_try_outdate_peer(drbd_dev *mdev);
+enum drbd_disk_state drbd_try_outdate_peer(struct drbd_conf *mdev);
 extern long drbd_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg);
-extern int drbd_khelper(drbd_dev *mdev, char *cmd);
+extern int drbd_khelper(struct drbd_conf *mdev, char *cmd);
 
 /* 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);
+extern void drbd_alter_sa(struct drbd_conf *mdev, int na);
+extern void drbd_start_resync(struct drbd_conf *mdev, enum drbd_conns side);
+extern void resume_next_sg(struct drbd_conf *mdev);
+extern void suspend_other_sg(struct drbd_conf *mdev);
+extern int drbd_resync_finished(struct drbd_conf *mdev);
 /* maybe rather drbd_main.c ? */
-extern int drbd_md_sync_page_io(drbd_dev *mdev, struct drbd_backing_dev *bdev,
+extern int drbd_md_sync_page_io(struct drbd_conf *mdev, struct drbd_backing_dev *bdev,
 				sector_t sector, int rw);
 /* 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);
-extern int w_e_end_rsdata_req(drbd_dev *, struct drbd_work *, int);
-extern int w_resync_inactive(drbd_dev *, struct drbd_work *, int);
-extern int w_resume_next_sg(drbd_dev *, struct drbd_work *, int);
-extern int w_io_error(drbd_dev *, struct drbd_work *, int);
-extern int w_send_write_hint(drbd_dev *, struct drbd_work *, int);
-extern int w_make_resync_request(drbd_dev *, struct drbd_work *, int);
-extern int w_send_dblock(drbd_dev *, struct drbd_work *, int);
-extern int w_send_barrier(drbd_dev *, struct drbd_work *, int);
-extern int w_send_read_req(drbd_dev *, struct drbd_work *, int);
-extern int w_prev_work_done(drbd_dev *, struct drbd_work *, int);
+extern int w_req_cancel_conflict(struct drbd_conf *, struct drbd_work *, int);
+extern int w_read_retry_remote(struct drbd_conf *, struct drbd_work *, int);
+extern int w_e_end_data_req(struct drbd_conf *, struct drbd_work *, int);
+extern int w_e_end_rsdata_req(struct drbd_conf *, struct drbd_work *, int);
+extern int w_resync_inactive(struct drbd_conf *, struct drbd_work *, int);
+extern int w_resume_next_sg(struct drbd_conf *, struct drbd_work *, int);
+extern int w_io_error(struct drbd_conf *, struct drbd_work *, int);
+extern int w_send_write_hint(struct drbd_conf *, struct drbd_work *, int);
+extern int w_make_resync_request(struct drbd_conf *, struct drbd_work *, int);
+extern int w_send_dblock(struct drbd_conf *, struct drbd_work *, int);
+extern int w_send_barrier(struct drbd_conf *, struct drbd_work *, int);
+extern int w_send_read_req(struct drbd_conf *, struct drbd_work *, int);
+extern int w_prev_work_done(struct drbd_conf *, struct drbd_work *, int);
 
 extern void resync_timer_fn(unsigned long data);
 
 /* 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,
+extern int drbd_release_ee(struct drbd_conf *mdev, struct list_head *list);
+extern struct Tl_epoch_entry *drbd_alloc_ee(struct drbd_conf *mdev,
 					    u64 id,
 					    sector_t sector,
 					    unsigned int data_size,
 					    unsigned int gfp_mask);
-extern void drbd_free_ee(drbd_dev *mdev, struct Tl_epoch_entry *e);
-extern void drbd_wait_ee_list_empty(drbd_dev *mdev, struct list_head *head);
-extern void _drbd_wait_ee_list_empty(drbd_dev *mdev, struct list_head *head);
-extern void drbd_set_recv_tcq(drbd_dev *mdev, int tcq_enabled);
-extern void _drbd_clear_done_ee(drbd_dev *mdev);
+extern void drbd_free_ee(struct drbd_conf *mdev, struct Tl_epoch_entry *e);
+extern void drbd_wait_ee_list_empty(struct drbd_conf *mdev, struct list_head *head);
+extern void _drbd_wait_ee_list_empty(struct drbd_conf *mdev, struct list_head *head);
+extern void drbd_set_recv_tcq(struct drbd_conf *mdev, int tcq_enabled);
+extern void _drbd_clear_done_ee(struct drbd_conf *mdev);
 
 static inline void drbd_tcp_cork(struct socket *sock)
 {
@@ -1384,36 +1379,36 @@
 /* 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);
+extern const char *conns_to_name(enum drbd_conns s);
+extern const char *roles_to_name(enum drbd_role s);
 
 /* 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);
-extern int drbd_rs_begin_io(struct Drbd_Conf *mdev, sector_t sector);
-extern int drbd_try_rs_begin_io(struct Drbd_Conf *mdev, sector_t sector);
-extern void drbd_rs_cancel_all(drbd_dev *mdev);
-extern int drbd_rs_del_all(drbd_dev *mdev);
-extern void drbd_rs_failed_io(drbd_dev *mdev, sector_t sector, int size);
-extern int drbd_al_read_log(struct Drbd_Conf *mdev, struct drbd_backing_dev *);
-extern void __drbd_set_in_sync(drbd_dev *mdev, sector_t sector, int size, const char *file, const unsigned int line);
+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);
+extern int drbd_rs_begin_io(struct drbd_conf *mdev, sector_t sector);
+extern int drbd_try_rs_begin_io(struct drbd_conf *mdev, sector_t sector);
+extern void drbd_rs_cancel_all(struct drbd_conf *mdev);
+extern int drbd_rs_del_all(struct drbd_conf *mdev);
+extern void drbd_rs_failed_io(struct drbd_conf *mdev, sector_t sector, int size);
+extern int drbd_al_read_log(struct drbd_conf *mdev, struct drbd_backing_dev *);
+extern void __drbd_set_in_sync(struct drbd_conf *mdev, sector_t sector, int size, const char *file, const unsigned int line);
 #define drbd_set_in_sync(mdev, sector, size) \
 	__drbd_set_in_sync(mdev, sector, size, __FILE__, __LINE__ )
-extern void __drbd_set_out_of_sync(drbd_dev *mdev, sector_t sector, int size, const char *file, const unsigned int line);
+extern void __drbd_set_out_of_sync(struct drbd_conf *mdev, sector_t sector, int size, const char *file, const unsigned int line);
 #define drbd_set_out_of_sync(mdev, sector, size) \
 	__drbd_set_out_of_sync(mdev, sector, size, __FILE__, __LINE__ )
-extern void drbd_al_apply_to_bm(struct Drbd_Conf *mdev);
-extern void drbd_al_to_on_disk_bm(struct Drbd_Conf *mdev);
-extern void drbd_al_shrink(struct Drbd_Conf *mdev);
+extern void drbd_al_apply_to_bm(struct drbd_conf *mdev);
+extern void drbd_al_to_on_disk_bm(struct drbd_conf *mdev);
+extern void drbd_al_shrink(struct drbd_conf *mdev);
 
 
 /* drbd_nl.c */
 
 void drbd_nl_cleanup(void);
 int __init drbd_nl_init(void);
-void drbd_bcast_state(drbd_dev *mdev);
-void drbd_bcast_sync_progress(drbd_dev *mdev);
+void drbd_bcast_state(struct drbd_conf *mdev);
+void drbd_bcast_sync_progress(struct drbd_conf *mdev);
 
 /*
  * inline helper functions
@@ -1425,41 +1420,42 @@
 #define user_isp_mask 1
 #define aftr_isp_mask 1
 
-#define NS(T, S) ({drbd_state_t mask; mask.i = 0; mask.T = T##_mask; mask; }), \
-		({drbd_state_t val; val.i = 0; val.T = (S); val; })
+#define NS(T, S) ({ union drbd_state_t mask; mask.i = 0; mask.T = T##_mask; mask; }), \
+		({ union drbd_state_t val; val.i = 0; val.T = (S); val; })
 #define NS2(T1, S1, T2, S2) \
-		({drbd_state_t mask; mask.i = 0; mask.T1 = T1##_mask; \
+		({ union drbd_state_t mask; mask.i = 0; mask.T1 = T1##_mask; \
 		  mask.T2 = T2##_mask; mask; }), \
-		({drbd_state_t val; val.i = 0; val.T1 = (S1); \
+		({ union drbd_state_t val; val.i = 0; val.T1 = (S1); \
 		  val.T2 = (S2); val; })
 #define NS3(T1, S1, T2, S2, T3, S3) \
-		({drbd_state_t mask; mask.i = 0; mask.T1 = T1##_mask; \
+		({ union drbd_state_t mask; mask.i = 0; mask.T1 = T1##_mask; \
 		  mask.T2 = T2##_mask; mask.T3 = T3##_mask; mask; }), \
-		({drbd_state_t val; val.i = 0; val.T1 = (S1); \
+		({ union drbd_state_t val; val.i = 0; val.T1 = (S1); \
 		  val.T2 = (S2); val.T3 = (S3); val; })
 
-#define _NS(D, T, S) D, ({drbd_state_t ns; ns.i = D->state.i; ns.T = (S); ns; })
+#define _NS(D, T, S) D, ({ union drbd_state_t ns; ns.i = D->state.i; ns.T = (S); ns; })
 #define _NS2(D, T1, S1, T2, S2) \
-		D, ({drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
+		D, ({ union drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
 		ns.T2 = (S2); ns; })
 #define _NS3(D, T1, S1, T2, S2, T3, S3) \
-		D, ({drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
+		D, ({ union drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
 		ns.T2 = (S2); ns.T3 = (S3); ns; })
 
-static inline void drbd_state_lock(drbd_dev *mdev)
+static inline void drbd_state_lock(struct drbd_conf *mdev)
 {
 	wait_event(mdev->misc_wait,
 		   !test_and_set_bit(CLUSTER_ST_CHANGE, &mdev->flags));
 }
 
-static inline void drbd_state_unlock(drbd_dev *mdev)
+static inline void drbd_state_unlock(struct drbd_conf *mdev)
 {
 	clear_bit(CLUSTER_ST_CHANGE, &mdev->flags);
 	wake_up(&mdev->misc_wait);
 }
 
-static inline int drbd_request_state(drbd_dev *mdev, drbd_state_t mask,
-				     drbd_state_t val)
+static inline int drbd_request_state(struct drbd_conf *mdev,
+				     union drbd_state_t mask,
+				     union drbd_state_t val)
 {
 	return _drbd_request_state(mdev, mask, val, ChgStateVerbose);
 }
@@ -1468,7 +1464,7 @@
  * drbd_chk_io_error: Handles the on_io_error setting, should be called from
  * all io completion handlers. See also drbd_io_error().
  */
-static inline void __drbd_chk_io_error(drbd_dev *mdev, int forcedetach)
+static inline void __drbd_chk_io_error(struct drbd_conf *mdev, int forcedetach)
 {
 	switch (mdev->bc->dc.on_io_error) {
 	case PassOn: /* FIXME would this be better named "Ignore"? */
@@ -1489,7 +1485,7 @@
 	}
 }
 
-static inline void drbd_chk_io_error(drbd_dev *mdev, int error, int forcedetach)
+static inline void drbd_chk_io_error(struct drbd_conf *mdev, int error, int forcedetach)
 {
 	if (error) {
 		unsigned long flags;
@@ -1554,7 +1550,7 @@
 }
 
 /* returns the sector number of our meta data 'super' block */
-static inline sector_t drbd_md_ss__(drbd_dev *mdev,
+static inline sector_t drbd_md_ss__(struct drbd_conf *mdev,
 				    struct drbd_backing_dev *bdev)
 {
 	switch (bdev->dc.meta_dev_idx) {
@@ -1608,33 +1604,33 @@
 	spin_unlock_irqrestore(&q->q_lock, flags);
 }
 
-static inline void wake_asender(drbd_dev *mdev)
+static inline void wake_asender(struct drbd_conf *mdev)
 {
 	if (test_bit(SIGNAL_ASENDER, &mdev->flags))
 		force_sig(DRBD_SIG, mdev->asender.task);
 }
 
-static inline void request_ping(drbd_dev *mdev)
+static inline void request_ping(struct drbd_conf *mdev)
 {
 	set_bit(SEND_PING, &mdev->flags);
 	wake_asender(mdev);
 }
 
-static inline int drbd_send_short_cmd(drbd_dev *mdev, Drbd_Packet_Cmd cmd)
+static inline int drbd_send_short_cmd(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd)
 {
-	Drbd_Header h;
+	struct Drbd_Header h;
 	return drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, &h, sizeof(h));
 }
 
-static inline int drbd_send_ping(drbd_dev *mdev)
+static inline int drbd_send_ping(struct drbd_conf *mdev)
 {
-	Drbd_Header h;
+	struct Drbd_Header h;
 	return drbd_send_cmd(mdev, USE_META_SOCKET, Ping, &h, sizeof(h));
 }
 
-static inline int drbd_send_ping_ack(drbd_dev *mdev)
+static inline int drbd_send_ping_ack(struct drbd_conf *mdev)
 {
-	Drbd_Header h;
+	struct Drbd_Header h;
 	return drbd_send_cmd(mdev, USE_META_SOCKET, PingAck, &h, sizeof(h));
 }
 
@@ -1676,7 +1672,7 @@
  *  _req_mod(req, connection_lost_while_pending)
  *     [from tl_clear_barrier]
  */
-static inline void inc_ap_pending(drbd_dev *mdev)
+static inline void inc_ap_pending(struct drbd_conf *mdev)
 {
 	atomic_inc(&mdev->ap_pending_cnt);
 }
@@ -1688,7 +1684,7 @@
 		    atomic_read(&mdev->which))
 
 #define dec_ap_pending(mdev)	do {				\
-	typecheck(drbd_dev *, mdev);				\
+	typecheck(struct drbd_conf *, mdev);				\
 	if (atomic_dec_and_test(&mdev->ap_pending_cnt))		\
 		wake_up(&mdev->misc_wait);			\
 	ERR_IF_CNT_IS_NEGATIVE(ap_pending_cnt); } while (0)
@@ -1699,13 +1695,13 @@
  * SyncSource sends RSDataReply   (and expects WriteAck whith ID_SYNCER)
  *					   (or NegAck with ID_SYNCER)
  */
-static inline void inc_rs_pending(drbd_dev *mdev)
+static inline void inc_rs_pending(struct drbd_conf *mdev)
 {
 	atomic_inc(&mdev->rs_pending_cnt);
 }
 
 #define dec_rs_pending(mdev)	do {				\
-	typecheck(drbd_dev *, mdev);				\
+	typecheck(struct drbd_conf *, mdev);				\
 	atomic_dec(&mdev->rs_pending_cnt);			\
 	ERR_IF_CNT_IS_NEGATIVE(rs_pending_cnt); } while (0)
 
@@ -1718,23 +1714,23 @@
  *  receive_DataRequest (receive_RSDataRequest) we need to send back Data
  *  receive_Barrier_*	we need to send a BarrierAck
  */
-static inline void inc_unacked(drbd_dev *mdev)
+static inline void inc_unacked(struct drbd_conf *mdev)
 {
 	atomic_inc(&mdev->unacked_cnt);
 }
 
 #define dec_unacked(mdev)	do {				\
-	typecheck(drbd_dev *, mdev);				\
+	typecheck(struct drbd_conf *, mdev);				\
 	atomic_dec(&mdev->unacked_cnt);				\
 	ERR_IF_CNT_IS_NEGATIVE(unacked_cnt); } while (0)
 
 #define sub_unacked(mdev, n)	do {				\
-	typecheck(drbd_dev *, mdev);				\
+	typecheck(struct drbd_conf *, mdev);				\
 	atomic_sub(n, &mdev->unacked_cnt);			\
 	ERR_IF_CNT_IS_NEGATIVE(unacked_cnt); } while (0)
 
 
-static inline void dec_net(drbd_dev *mdev)
+static inline void dec_net(struct drbd_conf *mdev)
 {
 	if (atomic_dec_and_test(&mdev->net_cnt))
 		wake_up(&mdev->misc_wait);
@@ -1744,7 +1740,7 @@
  * inc_net: Returns TRUE when it is ok to access mdev->net_conf. You
  * should call dec_net() when finished looking at mdev->net_conf.
  */
-static inline int inc_net(drbd_dev *mdev)
+static inline int inc_net(struct drbd_conf *mdev)
 {
 	int have_net_conf;
 
@@ -1760,7 +1756,7 @@
  * this is mood...
  */
 
-static inline void dec_local(drbd_dev *mdev)
+static inline void dec_local(struct drbd_conf *mdev)
 {
 	if (atomic_dec_and_test(&mdev->local_cnt))
 		wake_up(&mdev->misc_wait);
@@ -1770,7 +1766,7 @@
  * inc_local: Returns TRUE when local IO is possible. If it returns
  * TRUE you should call dec_local() after IO is completed.
  */
-static inline int inc_local_if_state(drbd_dev *mdev, drbd_disks_t mins)
+static inline int inc_local_if_state(struct drbd_conf *mdev, enum drbd_disk_state mins)
 {
 	int io_allowed;
 
@@ -1780,7 +1776,7 @@
 		dec_local(mdev);
 	return io_allowed;
 }
-static inline int inc_local(drbd_dev *mdev)
+static inline int inc_local(struct drbd_conf *mdev)
 {
 	return inc_local_if_state(mdev, Inconsistent);
 }
@@ -1788,7 +1784,7 @@
 /* this throttles on-the-fly application requests
  * according to max_buffers settings;
  * maybe re-implement using semaphores? */
-static inline int drbd_get_max_buffers(drbd_dev *mdev)
+static inline int drbd_get_max_buffers(struct drbd_conf *mdev)
 {
 	int mxb = 1000000; /* arbitrary limit on open requests */
 	if (inc_net(mdev)) {
@@ -1798,7 +1794,7 @@
 	return mxb;
 }
 
-static inline int __inc_ap_bio_cond(drbd_dev *mdev)
+static inline int __inc_ap_bio_cond(struct drbd_conf *mdev)
 {
 	int mxb = drbd_get_max_buffers(mdev);
 	if (mdev->state.susp) return 0;
@@ -1814,7 +1810,7 @@
 /* I'd like to use wait_event_lock_irq,
  * but I'm not sure when it got introduced,
  * and not sure when it has 3 or 4 arguments */
-static inline void inc_ap_bio(drbd_dev *mdev)
+static inline void inc_ap_bio(struct drbd_conf *mdev)
 {
 	/* compare with after_state_ch,
 	 * os.conn != WFBitMapS && ns.conn == WFBitMapS */
@@ -1839,7 +1835,7 @@
 	spin_unlock_irq(&mdev->req_lock);
 }
 
-static inline void dec_ap_bio(drbd_dev *mdev)
+static inline void dec_ap_bio(struct drbd_conf *mdev)
 {
 	int mxb = drbd_get_max_buffers(mdev);
 	int ap_bio = atomic_dec_return(&mdev->ap_bio_cnt);
@@ -1864,7 +1860,7 @@
 /* CAUTION: please no side effects in arguments! */
 #define seq_max(a, b) ((u32)(seq_gt((a), (b)) ? (a) : (b)))
 
-static inline void update_peer_seq(drbd_dev *mdev, unsigned int new_seq)
+static inline void update_peer_seq(struct drbd_conf *mdev, unsigned int new_seq)
 {
 	unsigned int m;
 	spin_lock(&mdev->peer_seq_lock);
@@ -1874,7 +1870,7 @@
 	if (m == new_seq) wake_up(&mdev->seq_wait);
 }
 
-static inline int drbd_queue_order_type(drbd_dev *mdev)
+static inline int drbd_queue_order_type(struct drbd_conf *mdev)
 {
 	/* sorry, we currently have no working implementation
 	 * of distributed TCQ stuff */
@@ -1904,7 +1900,7 @@
 		q->unplug_fn(q);
 }
 
-static inline void drbd_kick_lo(drbd_dev *mdev)
+static inline void drbd_kick_lo(struct drbd_conf *mdev)
 {
 	if (!mdev->bc->backing_bdev) {
 		if (DRBD_ratelimit(5*HZ, 5)) {

Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 14:15:33 UTC (rev 2996)
@@ -58,8 +58,8 @@
 
 struct after_state_chg_work {
 	struct drbd_work w;
-	drbd_state_t os;
-	drbd_state_t ns;
+	union drbd_state_t os;
+	union drbd_state_t ns;
 	enum chg_state_flags flags;
 };
 
@@ -68,11 +68,11 @@
 int drbd_asender(struct Drbd_thread *);
 
 int drbd_init(void);
-STATIC int drbd_open(struct inode *inode, struct file *file);
-STATIC int drbd_close(struct inode *inode, struct file *file);
-STATIC int w_after_state_ch(drbd_dev *mdev, struct drbd_work *w, int unused);
-STATIC int w_md_sync(drbd_dev *mdev, struct drbd_work *w, int unused);
-STATIC void md_sync_timer_fn(unsigned long data);
+int drbd_open(struct inode *inode, struct file *file);
+int drbd_close(struct inode *inode, struct file *file);
+int w_after_state_ch(struct drbd_conf *mdev, struct drbd_work *w, int unused);
+int w_md_sync(struct drbd_conf *mdev, struct drbd_work *w, int unused);
+void md_sync_timer_fn(unsigned long data);
 
 MODULE_AUTHOR("Philipp Reisner <phil@linbit.com>, Lars Ellenberg <lars@linbit.com>");
 MODULE_DESCRIPTION("drbd - Distributed Replicated Block Device v" REL_VERSION);
@@ -125,7 +125,7 @@
 /* in 2.6.x, our device mapping and config info contains our virtual gendisks
  * as member "struct gendisk *vdisk;"
  */
-struct Drbd_Conf **minor_table;
+struct drbd_conf **minor_table;
 
 struct kmem_cache *drbd_request_cache;
 struct kmem_cache *drbd_ee_cache;
@@ -143,7 +143,7 @@
 int          drbd_pp_vacant;
 wait_queue_head_t drbd_pp_wait;
 
-STATIC struct block_device_operations drbd_ops = {
+struct block_device_operations drbd_ops = {
 	.owner =   THIS_MODULE,
 	.open =    drbd_open,
 	.release = drbd_close,
@@ -152,7 +152,7 @@
 #define ARRY_SIZE(A) (sizeof(A)/sizeof(A[0]))
 
 /************************* The transfer log start */
-STATIC int tl_init(drbd_dev *mdev)
+int tl_init(struct drbd_conf *mdev)
 {
 	struct drbd_barrier *b;
 
@@ -173,7 +173,7 @@
 	return 1;
 }
 
-STATIC void tl_cleanup(drbd_dev *mdev)
+void tl_cleanup(struct drbd_conf *mdev)
 {
 	D_ASSERT(mdev->oldest_barrier == mdev->newest_barrier);
 	kfree(mdev->oldest_barrier);
@@ -188,7 +188,7 @@
  * It returns the previously newest barrier
  * (not the just created barrier) to the caller.
  */
-struct drbd_barrier *_tl_add_barrier(drbd_dev *mdev, struct drbd_barrier *new)
+struct drbd_barrier *_tl_add_barrier(struct drbd_conf *mdev, struct drbd_barrier *new)
 {
 	struct drbd_barrier *newest_before;
 
@@ -208,7 +208,7 @@
 }
 
 /* when we receive a barrier ack */
-void tl_release(drbd_dev *mdev, unsigned int barrier_nr,
+void tl_release(struct drbd_conf *mdev, unsigned int barrier_nr,
 		       unsigned int set_size)
 {
 	struct drbd_barrier *b;
@@ -255,7 +255,7 @@
 
 /* called by drbd_disconnect (exiting receiver thread)
  * or from some after_state_ch */
-void tl_clear(drbd_dev *mdev)
+void tl_clear(struct drbd_conf *mdev)
 {
 	struct drbd_barrier *b, *tmp;
 
@@ -310,7 +310,7 @@
  *	 anyways.  This is to make sure that you get a resynchronisation of
  *	 the full device the next time you connect.
  */
-int drbd_io_error(drbd_dev *mdev, int forcedetach)
+int drbd_io_error(struct drbd_conf *mdev, int forcedetach)
 {
 	enum io_error_handler eh;
 	unsigned long flags;
@@ -360,7 +360,7 @@
  * Returns TRUE if this state change should be preformed as a cluster wide
  * transaction. Of course it returns 0 as soon as the connection is lost.
  */
-STATIC int cl_wide_st_chg(drbd_dev *mdev, drbd_state_t os, drbd_state_t ns)
+int cl_wide_st_chg(struct drbd_conf *mdev, union drbd_state_t os, union drbd_state_t ns)
 {
 	return ( os.conn >= Connected && ns.conn >= Connected &&
 		 ( ( os.role != Primary && ns.role == Primary ) ||
@@ -370,11 +370,11 @@
 		(os.conn >= Connected && ns.conn == Disconnecting);
 }
 
-int drbd_change_state(drbd_dev *mdev, enum chg_state_flags f,
-		      drbd_state_t mask, drbd_state_t val)
+int drbd_change_state(struct drbd_conf *mdev, enum chg_state_flags f,
+		      union drbd_state_t mask, union drbd_state_t val)
 {
 	unsigned long flags;
-	drbd_state_t os, ns;
+	union drbd_state_t os, ns;
 	int rv;
 
 	spin_lock_irqsave(&mdev->req_lock, flags);
@@ -388,18 +388,18 @@
 	return rv;
 }
 
-void drbd_force_state(drbd_dev *mdev, drbd_state_t mask, drbd_state_t val)
+void drbd_force_state(struct drbd_conf *mdev, union drbd_state_t mask, union drbd_state_t val)
 {
 	drbd_change_state(mdev, ChgStateHard, mask, val);
 }
 
-STATIC int is_valid_state(drbd_dev *mdev, drbd_state_t ns);
-STATIC int is_valid_state_transition(drbd_dev *, drbd_state_t, drbd_state_t);
-STATIC int drbd_send_state_req(drbd_dev *, drbd_state_t, drbd_state_t);
+int is_valid_state(struct drbd_conf *mdev, union drbd_state_t ns);
+int is_valid_state_transition(struct drbd_conf *, union drbd_state_t, union drbd_state_t);
+int drbd_send_state_req(struct drbd_conf *, union drbd_state_t, union drbd_state_t);
 
-set_st_err_t _req_st_cond(drbd_dev *mdev, drbd_state_t mask, drbd_state_t val)
+enum set_st_err _req_st_cond(struct drbd_conf *mdev, union drbd_state_t mask, union drbd_state_t val)
 {
-	drbd_state_t os, ns;
+	union drbd_state_t os, ns;
 	unsigned long flags;
 	int rv;
 
@@ -432,11 +432,11 @@
  * transition this function even does a cluster wide transaction.
  * It has a cousin named drbd_request_state(), which is always verbose.
  */
-int _drbd_request_state(drbd_dev *mdev, drbd_state_t mask, drbd_state_t val,
+int _drbd_request_state(struct drbd_conf *mdev, union drbd_state_t mask, union drbd_state_t val,
 		       enum chg_state_flags f)
 {
 	unsigned long flags;
-	drbd_state_t os, ns;
+	union drbd_state_t os, ns;
 	int rv;
 
 	spin_lock_irqsave(&mdev->req_lock, flags);
@@ -486,7 +486,7 @@
 }
 
 
-STATIC void print_st(drbd_dev *mdev, char *name, drbd_state_t ns)
+void print_st(struct drbd_conf *mdev, char *name, union drbd_state_t ns)
 {
 	ERR(" %s = { cs:%s st:%s/%s ds:%s/%s %c%c%c%c }\n",
 	    name,
@@ -502,7 +502,7 @@
 	    );
 }
 
-void print_st_err(drbd_dev *mdev, drbd_state_t os, drbd_state_t ns, int err)
+void print_st_err(struct drbd_conf *mdev, union drbd_state_t os, union drbd_state_t ns, int err)
 {
 	ERR("State change failed: %s\n", set_st_err_name(err));
 	print_st(mdev, " state", os);
@@ -525,7 +525,7 @@
 			      A##s_to_name(ns.A)); \
 	} })
 
-STATIC int is_valid_state(drbd_dev *mdev, drbd_state_t ns)
+int is_valid_state(struct drbd_conf *mdev, union drbd_state_t ns)
 {
 	/* See drbd_state_sw_errors in drbd_strings.c */
 
@@ -576,7 +576,7 @@
 	return rv;
 }
 
-STATIC int is_valid_state_transition(drbd_dev *mdev, drbd_state_t ns, drbd_state_t os)
+int is_valid_state_transition(struct drbd_conf *mdev, union drbd_state_t ns, union drbd_state_t os)
 {
 	int rv = SS_Success;
 
@@ -592,9 +592,9 @@
 	return rv;
 }
 
-int _drbd_set_state(drbd_dev *mdev, drbd_state_t ns, enum chg_state_flags flags)
+int _drbd_set_state(struct drbd_conf *mdev, union drbd_state_t ns, enum chg_state_flags flags)
 {
-	drbd_state_t os;
+	union drbd_state_t os;
 	int rv = SS_Success, warn_sync_abort = 0;
 	enum fencing_policy fp;
 
@@ -809,7 +809,7 @@
 	return rv;
 }
 
-STATIC int w_after_state_ch(drbd_dev *mdev, struct drbd_work *w, int unused)
+int w_after_state_ch(struct drbd_conf *mdev, struct drbd_work *w, int unused)
 {
 	struct after_state_chg_work *ascw;
 
@@ -820,7 +820,7 @@
 	return 1;
 }
 
-void after_state_ch(drbd_dev *mdev, drbd_state_t os, drbd_state_t ns,
+void after_state_ch(struct drbd_conf *mdev, union drbd_state_t os, union drbd_state_t ns,
 		    enum chg_state_flags flags)
 {
 	enum fencing_policy fp;
@@ -1039,10 +1039,10 @@
 }
 
 
-STATIC int drbd_thread_setup(void *arg)
+int drbd_thread_setup(void *arg)
 {
 	struct Drbd_thread *thi = (struct Drbd_thread *) arg;
-	drbd_dev *mdev = thi->mdev;
+	struct drbd_conf *mdev = thi->mdev;
 	int retval;
 
 	daemonize("drbd_thread");
@@ -1072,7 +1072,7 @@
 	return retval;
 }
 
-STATIC void drbd_thread_init(drbd_dev *mdev, struct Drbd_thread *thi,
+void drbd_thread_init(struct drbd_conf *mdev, struct Drbd_thread *thi,
 		      int (*func) (struct Drbd_thread *))
 {
 	spin_lock_init(&thi->t_lock);
@@ -1085,7 +1085,7 @@
 int drbd_thread_start(struct Drbd_thread *thi)
 {
 	int pid;
-	drbd_dev *mdev = thi->mdev;
+	struct drbd_conf *mdev = thi->mdev;
 
 	spin_lock(&thi->t_lock);
 
@@ -1122,8 +1122,8 @@
 
 void _drbd_thread_stop(struct Drbd_thread *thi, int restart, int wait)
 {
-	drbd_dev *mdev = thi->mdev;
-	Drbd_thread_state ns = restart ? Restarting : Exiting;
+	struct drbd_conf *mdev = thi->mdev;
+	enum Drbd_thread_state ns = restart ? Restarting : Exiting;
 
 	spin_lock(&thi->t_lock);
 
@@ -1179,8 +1179,8 @@
 }
 
 /* the appropriate socket mutex must be held already */
-int _drbd_send_cmd(drbd_dev *mdev, struct socket *sock,
-			  Drbd_Packet_Cmd cmd, Drbd_Header *h,
+int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock,
+			  enum Drbd_Packet_Cmd cmd, struct Drbd_Header *h,
 			  size_t size, unsigned msg_flags)
 {
 	int sent, ok;
@@ -1190,7 +1190,7 @@
 
 	h->magic   = BE_DRBD_MAGIC;
 	h->command = cpu_to_be16(cmd);
-	h->length  = cpu_to_be16(size-sizeof(Drbd_Header));
+	h->length  = cpu_to_be16(size-sizeof(struct Drbd_Header));
 
 	dump_packet(mdev, sock, 0, (void *)h, __FILE__, __LINE__);
 	sent = drbd_send(mdev, sock, h, size, msg_flags);
@@ -1205,8 +1205,8 @@
 /* don't pass the socket. we may only look at it
  * when we hold the appropriate socket mutex.
  */
-int drbd_send_cmd(drbd_dev *mdev, int use_data_socket,
-		  Drbd_Packet_Cmd cmd, Drbd_Header *h, size_t size)
+int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket,
+		  enum Drbd_Packet_Cmd cmd, struct Drbd_Header *h, size_t size)
 {
 	int ok = 0;
 	struct socket *sock;
@@ -1231,10 +1231,10 @@
 	return ok;
 }
 
-int drbd_send_cmd2(drbd_dev *mdev, Drbd_Packet_Cmd cmd, char *data,
+int drbd_send_cmd2(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd, char *data,
 		   size_t size)
 {
-	Drbd_Header h;
+	struct Drbd_Header h;
 	int ok;
 
 	h.magic   = BE_DRBD_MAGIC;
@@ -1254,18 +1254,18 @@
 	return ok;
 }
 
-int drbd_send_sync_param(drbd_dev *mdev, struct syncer_conf *sc)
+int drbd_send_sync_param(struct drbd_conf *mdev, struct syncer_conf *sc)
 {
-	Drbd_SyncParam_Packet p;
+	struct Drbd_SyncParam_Packet p;
 
 	p.rate      = cpu_to_be32(sc->rate);
 
-	return drbd_send_cmd(mdev, USE_DATA_SOCKET, SyncParam, (Drbd_Header *)&p, sizeof(p));
+	return drbd_send_cmd(mdev, USE_DATA_SOCKET, SyncParam, (struct Drbd_Header *)&p, sizeof(p));
 }
 
-int drbd_send_protocol(drbd_dev *mdev)
+int drbd_send_protocol(struct drbd_conf *mdev)
 {
-	Drbd_Protocol_Packet p;
+	struct Drbd_Protocol_Packet p;
 
 	p.protocol      = cpu_to_be32(mdev->net_conf->wire_protocol);
 	p.after_sb_0p   = cpu_to_be32(mdev->net_conf->after_sb_0p);
@@ -1275,12 +1275,12 @@
 	p.two_primaries = cpu_to_be32(mdev->net_conf->two_primaries);
 
 	return drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportProtocol,
-			     (Drbd_Header *)&p, sizeof(p));
+			     (struct Drbd_Header *)&p, sizeof(p));
 }
 
-int drbd_send_uuids(drbd_dev *mdev)
+int drbd_send_uuids(struct drbd_conf *mdev)
 {
-	Drbd_GenCnt_Packet p;
+	struct Drbd_GenCnt_Packet p;
 	int i;
 	u64 uuid_flags = 0;
 
@@ -1299,22 +1299,22 @@
 	dec_local(mdev);
 
 	return drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportUUIDs,
-			     (Drbd_Header *)&p, sizeof(p));
+			     (struct Drbd_Header *)&p, sizeof(p));
 }
 
-int drbd_send_sync_uuid(drbd_dev *mdev, u64 val)
+int drbd_send_sync_uuid(struct drbd_conf *mdev, u64 val)
 {
-	Drbd_SyncUUID_Packet p;
+	struct Drbd_SyncUUID_Packet p;
 
 	p.uuid = cpu_to_be64(val);
 
 	return drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportSyncUUID,
-			     (Drbd_Header *)&p, sizeof(p));
+			     (struct Drbd_Header *)&p, sizeof(p));
 }
 
-int drbd_send_sizes(drbd_dev *mdev)
+int drbd_send_sizes(struct drbd_conf *mdev)
 {
-	Drbd_Sizes_Packet p;
+	struct Drbd_Sizes_Packet p;
 	sector_t d_size, u_size;
 	int q_order_type;
 	int ok;
@@ -1339,50 +1339,50 @@
 	p.queue_order_type = cpu_to_be32(q_order_type);
 
 	ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportSizes,
-			   (Drbd_Header *)&p, sizeof(p));
+			   (struct Drbd_Header *)&p, sizeof(p));
 	return ok;
 }
 
-int drbd_send_state(drbd_dev *mdev)
+int drbd_send_state(struct drbd_conf *mdev)
 {
-	Drbd_State_Packet p;
+	struct Drbd_State_Packet p;
 
 	p.state    = cpu_to_be32(mdev->state.i);
 
 	return drbd_send_cmd(mdev, USE_DATA_SOCKET, ReportState,
-			     (Drbd_Header *)&p, sizeof(p));
+			     (struct Drbd_Header *)&p, sizeof(p));
 }
 
-STATIC int drbd_send_state_req(drbd_dev *mdev, drbd_state_t mask, drbd_state_t val)
+int drbd_send_state_req(struct drbd_conf *mdev, union drbd_state_t mask, union drbd_state_t val)
 {
-	Drbd_Req_State_Packet p;
+	struct Drbd_Req_State_Packet p;
 
 	p.mask    = cpu_to_be32(mask.i);
 	p.val     = cpu_to_be32(val.i);
 
 	return drbd_send_cmd(mdev, USE_DATA_SOCKET, StateChgRequest,
-			     (Drbd_Header *)&p, sizeof(p));
+			     (struct Drbd_Header *)&p, sizeof(p));
 }
 
-int drbd_send_sr_reply(drbd_dev *mdev, int retcode)
+int drbd_send_sr_reply(struct drbd_conf *mdev, int retcode)
 {
-	Drbd_RqS_Reply_Packet p;
+	struct Drbd_RqS_Reply_Packet p;
 
 	p.retcode    = cpu_to_be32(retcode);
 
 	return drbd_send_cmd(mdev, USE_META_SOCKET, StateChgReply,
-			     (Drbd_Header *)&p, sizeof(p));
+			     (struct Drbd_Header *)&p, sizeof(p));
 }
 
 
 /* See the comment at receive_bitmap() */
-int _drbd_send_bitmap(drbd_dev *mdev)
+int _drbd_send_bitmap(struct drbd_conf *mdev)
 {
 	int want;
 	int ok = TRUE, bm_i = 0;
 	size_t bm_words, num_words;
 	unsigned long *buffer;
-	Drbd_Header *p;
+	struct Drbd_Header *p;
 
 	ERR_IF(!mdev->bitmap) return FALSE;
 
@@ -1422,7 +1422,7 @@
 	return ok;
 }
 
-int drbd_send_bitmap(drbd_dev *mdev)
+int drbd_send_bitmap(struct drbd_conf *mdev)
 {
 	int ok;
 
@@ -1433,15 +1433,15 @@
 	return ok;
 }
 
-int drbd_send_b_ack(drbd_dev *mdev, u32 barrier_nr, u32 set_size)
+int drbd_send_b_ack(struct drbd_conf *mdev, u32 barrier_nr, u32 set_size)
 {
 	int ok;
-	Drbd_BarrierAck_Packet p;
+	struct Drbd_BarrierAck_Packet p;
 
 	p.barrier  = barrier_nr;
 	p.set_size = cpu_to_be32(set_size);
 
-	ok = drbd_send_cmd(mdev, USE_META_SOCKET, BarrierAck, (Drbd_Header *)&p, sizeof(p));
+	ok = drbd_send_cmd(mdev, USE_META_SOCKET, BarrierAck, (struct Drbd_Header *)&p, sizeof(p));
 	return ok;
 }
 
@@ -1450,13 +1450,13 @@
  * This helper function expects the sector and block_id parameter already
  * in big endian!
  */
-STATIC int _drbd_send_ack(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
+int _drbd_send_ack(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
 			  u64 sector,
 			  u32 blksize,
 			  u64 block_id)
 {
 	int ok;
-	Drbd_BlockAck_Packet p;
+	struct Drbd_BlockAck_Packet p;
 
 	p.sector   = sector;
 	p.block_id = block_id;
@@ -1464,27 +1464,27 @@
 	p.seq_num  = cpu_to_be32(atomic_add_return(1, &mdev->packet_seq));
 
 	if (!mdev->meta.socket || mdev->state.conn < Connected) return FALSE;
-	ok = drbd_send_cmd(mdev, USE_META_SOCKET, cmd, (Drbd_Header *)&p, sizeof(p));
+	ok = drbd_send_cmd(mdev, USE_META_SOCKET, cmd, (struct Drbd_Header *)&p, sizeof(p));
 	return ok;
 }
 
-int drbd_send_ack_dp(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
-		     Drbd_Data_Packet *dp)
+int drbd_send_ack_dp(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
+		     struct Drbd_Data_Packet *dp)
 {
-	const int header_size = sizeof(Drbd_Data_Packet) - sizeof(Drbd_Header);
-	int data_size  = ((Drbd_Header *)dp)->length - header_size;
+	const int header_size = sizeof(struct Drbd_Data_Packet) - sizeof(struct Drbd_Header);
+	int data_size  = ((struct Drbd_Header *)dp)->length - header_size;
 
 	return _drbd_send_ack(mdev, cmd, dp->sector, cpu_to_be32(data_size),
 			      dp->block_id);
 }
 
-int drbd_send_ack_rp(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
-		     Drbd_BlockRequest_Packet *rp)
+int drbd_send_ack_rp(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
+		     struct Drbd_BlockRequest_Packet *rp)
 {
 	return _drbd_send_ack(mdev, cmd, rp->sector, rp->blksize, rp->block_id);
 }
 
-int drbd_send_ack(drbd_dev *mdev, Drbd_Packet_Cmd cmd, struct Tl_epoch_entry *e)
+int drbd_send_ack(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd, struct Tl_epoch_entry *e)
 {
 	return _drbd_send_ack(mdev, cmd,
 			      cpu_to_be64(e->sector),
@@ -1492,11 +1492,11 @@
 			      e->block_id);
 }
 
-int drbd_send_drequest(drbd_dev *mdev, int cmd,
+int drbd_send_drequest(struct drbd_conf *mdev, int cmd,
 		       sector_t sector, int size, u64 block_id)
 {
 	int ok;
-	Drbd_BlockRequest_Packet p;
+	struct Drbd_BlockRequest_Packet p;
 
 	p.sector   = cpu_to_be64(sector);
 	p.block_id = block_id;
@@ -1504,7 +1504,7 @@
 
 	/* FIXME BIO_RW_SYNC ? */
 
-	ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, (Drbd_Header *)&p, sizeof(p));
+	ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, (struct Drbd_Header *)&p, sizeof(p));
 	return ok;
 }
 
@@ -1512,7 +1512,7 @@
  * returns FALSE if we should retry,
  * TRUE if we think connection is dead
  */
-STATIC int we_should_drop_the_connection(drbd_dev *mdev, struct socket *sock)
+int we_should_drop_the_connection(struct drbd_conf *mdev, struct socket *sock)
 {
 	int drop_it;
 	/* long elapsed = (long)(jiffies - mdev->last_received); */
@@ -1556,7 +1556,7 @@
    XFS seems to have problems, still, it submits pages with page_count == 0!
    As a workaround, we disable sendpage on pages with page_count == 0 or PageSlab.
 */
-int _drbd_no_send_page(drbd_dev *mdev, struct page *page,
+int _drbd_no_send_page(struct drbd_conf *mdev, struct page *page,
 		   int offset, size_t size)
 {
        int ret;
@@ -1565,7 +1565,7 @@
        return ret;
 }
 
-int _drbd_send_page(drbd_dev *mdev, struct page *page,
+int _drbd_send_page(struct drbd_conf *mdev, struct page *page,
 		    int offset, size_t size)
 {
 	mm_segment_t oldfs = get_fs();
@@ -1637,7 +1637,7 @@
 	return ok;
 }
 
-STATIC int _drbd_send_zc_bio(drbd_dev *mdev, struct bio *bio)
+int _drbd_send_zc_bio(struct drbd_conf *mdev, struct bio *bio)
 {
 	struct bio_vec *bvec;
 	int i;
@@ -1653,10 +1653,10 @@
 /* Used to send write requests
  * Primary -> Peer	(Data)
  */
-int drbd_send_dblock(drbd_dev *mdev, drbd_request_t *req)
+int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req)
 {
 	int ok = 1;
-	Drbd_Data_Packet p;
+	struct Drbd_Data_Packet p;
 	unsigned int dp_flags = 0;
 
 	if (!drbd_get_data_sock(mdev))
@@ -1664,7 +1664,7 @@
 
 	p.head.magic   = BE_DRBD_MAGIC;
 	p.head.command = cpu_to_be16(Data);
-	p.head.length  = cpu_to_be16(sizeof(p)-sizeof(Drbd_Header)+req->size);
+	p.head.length  = cpu_to_be16(sizeof(p)-sizeof(struct Drbd_Header)+req->size);
 
 	p.sector   = cpu_to_be64(req->sector);
 	p.block_id = (unsigned long)req;
@@ -1698,15 +1698,15 @@
  *  Peer       -> (diskless) Primary   (DataReply)
  *  SyncSource -> SyncTarget         (RSDataReply)
  */
-int drbd_send_block(drbd_dev *mdev, Drbd_Packet_Cmd cmd,
+int drbd_send_block(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
 		    struct Tl_epoch_entry *e)
 {
 	int ok;
-	Drbd_Data_Packet p;
+	struct Drbd_Data_Packet p;
 
 	p.head.magic   = BE_DRBD_MAGIC;
 	p.head.command = cpu_to_be16(cmd);
-	p.head.length  = cpu_to_be16( sizeof(p)-sizeof(Drbd_Header) + e->size);
+	p.head.length  = cpu_to_be16( sizeof(p)-sizeof(struct Drbd_Header) + e->size);
 
 	p.sector   = cpu_to_be64(e->sector);
 	p.block_id = e->block_id;
@@ -1744,7 +1744,7 @@
 /*
  * you must have down()ed the appropriate [m]sock_mutex elsewhere!
  */
-int drbd_send(drbd_dev *mdev, struct socket *sock,
+int drbd_send(struct drbd_conf *mdev, struct socket *sock,
 	      void *buf, size_t size, unsigned msg_flags)
 {
 #if !HAVE_KERNEL_SENDMSG
@@ -1840,9 +1840,9 @@
 	return sent;
 }
 
-STATIC int drbd_open(struct inode *inode, struct file *file)
+int drbd_open(struct inode *inode, struct file *file)
 {
-	drbd_dev *mdev;
+	struct drbd_conf *mdev;
 	unsigned long flags;
 	int rv = 0;
 
@@ -1865,10 +1865,10 @@
 	return rv;
 }
 
-STATIC int drbd_close(struct inode *inode, struct file *file)
+int drbd_close(struct inode *inode, struct file *file)
 {
 	/* do not use *file (May be NULL, in case of a unmount :-) */
-	drbd_dev *mdev;
+	struct drbd_conf *mdev;
 
 	mdev = minor_to_mdev(MINOR(inode->i_rdev));
 	if (!mdev) return -ENODEV;
@@ -1884,9 +1884,9 @@
 	return 0;
 }
 
-STATIC void drbd_unplug_fn(request_queue_t *q)
+void drbd_unplug_fn(request_queue_t *q)
 {
-	drbd_dev *mdev = q->queuedata;
+	struct drbd_conf *mdev = q->queuedata;
 
 	MTRACE(TraceTypeUnplug, TraceLvlSummary,
 	       INFO("got unplugged ap_bio_count=%d\n",
@@ -1916,16 +1916,16 @@
 	if (mdev->state.disk >= Inconsistent) drbd_kick_lo(mdev);
 }
 
-void drbd_set_defaults(drbd_dev *mdev)
+void drbd_set_defaults(struct drbd_conf *mdev)
 {
 	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->state = (drbd_state_t) {
+	mdev->state = (union drbd_state_t) {
 		{ Secondary, Unknown, StandAlone, Diskless, DUnknown, 0 } };
 }
 
-void drbd_init_set_defaults(drbd_dev *mdev)
+void drbd_init_set_defaults(struct drbd_conf *mdev)
 {
 	/* the memset(,0,) did most of this.
 	 * note: only assignments, no allocation in here */
@@ -1994,7 +1994,7 @@
 #endif
 }
 
-void drbd_mdev_cleanup(drbd_dev *mdev)
+void drbd_mdev_cleanup(struct drbd_conf *mdev)
 {
 	/* I'd like to cleanup completely, and memset(,0,) it.
 	 * but I'd have to reinit it.
@@ -2118,7 +2118,7 @@
 
 	/* caches */
 	drbd_request_cache = drbd_kmem_cache_create(
-		"drbd_req_cache", sizeof(drbd_request_t),
+		"drbd_req_cache", sizeof(struct drbd_request),
 		0, 0, NULL);
 	if (drbd_request_cache == NULL)
 		goto Enomem;
@@ -2158,7 +2158,7 @@
 	return -ENOMEM;
 }
 
-STATIC int drbd_notify_sys(struct notifier_block *this, unsigned long code,
+int drbd_notify_sys(struct notifier_block *this, unsigned long code,
 	void *unused)
 {
 	/* just so we have it.  you never know what interessting things we
@@ -2168,12 +2168,12 @@
 	return NOTIFY_DONE;
 }
 
-STATIC struct notifier_block drbd_notifier = {
+struct notifier_block drbd_notifier = {
 	.notifier_call = drbd_notify_sys,
 };
 
 
-STATIC void __exit drbd_cleanup(void)
+void __exit drbd_cleanup(void)
 {
 	int i, rr;
 
@@ -2186,7 +2186,7 @@
 			remove_proc_entry("drbd", &proc_root);
 		i = minor_count;
 		while (i--) {
-			drbd_dev        *mdev  = minor_to_mdev(i);
+			struct drbd_conf        *mdev  = minor_to_mdev(i);
 			struct gendisk  **disk = &mdev->vdisk;
 			request_queue_t **q    = &mdev->rq_queue;
 
@@ -2268,13 +2268,13 @@
 	printk(KERN_INFO DEVICE_NAME": module cleanup done.\n");
 }
 
-drbd_dev *drbd_new_device(int minor)
+struct drbd_conf *drbd_new_device(int minor)
 {
-	drbd_dev *mdev = NULL;
+	struct drbd_conf *mdev = NULL;
 	struct gendisk *disk;
 	request_queue_t *q;
 
-	mdev = kzalloc(sizeof(drbd_dev), GFP_KERNEL);
+	mdev = kzalloc(sizeof(struct drbd_conf), GFP_KERNEL);
 	if (!mdev) goto Enomem;
 
 	mdev->minor = minor;
@@ -2341,7 +2341,7 @@
 	       THIS_MODULE, THIS_MODULE->module_core);
 #endif
 
-	if (sizeof(Drbd_HandShake_Packet) != 80) {
+	if (sizeof(struct Drbd_HandShake_Packet) != 80) {
 		printk(KERN_ERR DEVICE_NAME
 		       ": never change the size or layout of the HandShake packet.\n");
 		return -EINVAL;
@@ -2378,7 +2378,7 @@
 	init_waitqueue_head(&drbd_pp_wait);
 
 	drbd_proc = NULL; /* play safe for drbd_cleanup */
-	minor_table = kzalloc(sizeof(drbd_dev *)*minor_count, GFP_KERNEL);
+	minor_table = kzalloc(sizeof(struct drbd_conf *)*minor_count, GFP_KERNEL);
 	if (!minor_table) goto Enomem;
 
 	err = drbd_create_mempools();
@@ -2433,7 +2433,7 @@
 	kfree(bc);
 }
 
-void drbd_free_sock(drbd_dev *mdev)
+void drbd_free_sock(struct drbd_conf *mdev)
 {
 	if (mdev->data.socket) {
 		sock_release(mdev->data.socket);
@@ -2446,7 +2446,7 @@
 }
 
 
-void drbd_free_resources(drbd_dev *mdev)
+void drbd_free_resources(struct drbd_conf *mdev)
 {
 	if (mdev->cram_hmac_tfm) {
 		crypto_free_hash(mdev->cram_hmac_tfm);
@@ -2481,7 +2481,7 @@
  * drbd_md_sync:
  * Writes the meta data super block if the MD_DIRTY flag bit is set.
  */
-void drbd_md_sync(drbd_dev *mdev)
+void drbd_md_sync(struct drbd_conf *mdev)
 {
 	struct meta_data_on_disk *buffer;
 	sector_t sector;
@@ -2551,7 +2551,7 @@
  * enum ret_codes in case something goes wrong.
  * Currently only: MDIOError, MDInvalid.
  */
-int drbd_md_read(drbd_dev *mdev, struct drbd_backing_dev *bdev)
+int drbd_md_read(struct drbd_conf *mdev, struct drbd_backing_dev *bdev)
 {
 	struct meta_data_on_disk *buffer;
 	int i, rv = NoError;
@@ -2626,14 +2626,14 @@
  * the meta-data super block. This function sets MD_DIRTY, and starts a
  * timer that ensures that within five seconds you have to call drbd_md_sync().
  */
-void drbd_md_mark_dirty(drbd_dev *mdev)
+void drbd_md_mark_dirty(struct drbd_conf *mdev)
 {
 	set_bit(MD_DIRTY, &mdev->flags);
 	mod_timer(&mdev->md_sync_timer, jiffies + 5*HZ );
 }
 
 
-STATIC void drbd_uuid_move_history(drbd_dev *mdev)
+void drbd_uuid_move_history(struct drbd_conf *mdev)
 {
 	int i;
 
@@ -2646,7 +2646,7 @@
 	}
 }
 
-void _drbd_uuid_set(drbd_dev *mdev, int idx, u64 val)
+void _drbd_uuid_set(struct drbd_conf *mdev, int idx, u64 val)
 {
 	if (idx == Current) {
 		if (mdev->state.role == Primary)
@@ -2665,7 +2665,7 @@
 }
 
 
-void drbd_uuid_set(drbd_dev *mdev, int idx, u64 val)
+void drbd_uuid_set(struct drbd_conf *mdev, int idx, u64 val)
 {
 	if (mdev->bc->md.uuid[idx]) {
 		drbd_uuid_move_history(mdev);
@@ -2677,7 +2677,7 @@
 	_drbd_uuid_set(mdev, idx, val);
 }
 
-void drbd_uuid_new_current(drbd_dev *mdev)
+void drbd_uuid_new_current(struct drbd_conf *mdev)
 {
 	INFO("Creating new current UUID\n");
 	D_ASSERT(mdev->bc->md.uuid[Bitmap] == 0);
@@ -2699,7 +2699,7 @@
 	drbd_md_mark_dirty(mdev);
 }
 
-void drbd_uuid_set_bm(drbd_dev *mdev, u64 val)
+void drbd_uuid_set_bm(struct drbd_conf *mdev, u64 val)
 {
 	if (mdev->bc->md.uuid[Bitmap] == 0 && val == 0) return;
 
@@ -2726,7 +2726,7 @@
 }
 
 
-void drbd_md_set_flag(drbd_dev *mdev, int flag)
+void drbd_md_set_flag(struct drbd_conf *mdev, int flag)
 {
 	MUST_HOLD(mdev->req_lock);
 	if ( (mdev->bc->md.flags & flag) != flag) {
@@ -2734,7 +2734,7 @@
 		mdev->bc->md.flags |= flag;
 	}
 }
-void drbd_md_clear_flag(drbd_dev *mdev, int flag)
+void drbd_md_clear_flag(struct drbd_conf *mdev, int flag)
 {
 	MUST_HOLD(mdev->req_lock);
 	if ( (mdev->bc->md.flags & flag) != 0 ) {
@@ -2747,14 +2747,14 @@
 	return ((bdev->md.flags & flag) != 0);
 }
 
-STATIC void md_sync_timer_fn(unsigned long data)
+void md_sync_timer_fn(unsigned long data)
 {
-	drbd_dev *mdev = (drbd_dev *) data;
+	struct drbd_conf *mdev = (struct drbd_conf *) data;
 
 	drbd_queue_work_front(&mdev->data.work, &mdev->md_sync_work);
 }
 
-STATIC int w_md_sync(drbd_dev *mdev, struct drbd_work *w, int unused)
+int w_md_sync(struct drbd_conf *mdev, struct drbd_work *w, int unused)
 {
 	WARN("BUG! md_sync_timer expired! Worker calls drbd_md_sync().\n");
 	drbd_md_sync(mdev);
@@ -2778,7 +2778,7 @@
  * Crude but fast random-number generator.  Uses a linear congruential
  * generator, with occasional help from get_random_bytes().
  */
-STATIC unsigned long
+unsigned long
 _drbd_fault_random(struct fault_random_state *rsp)
 {
 	long refresh;
@@ -2792,7 +2792,7 @@
 	return swahw32(rsp->state);
 }
 
-STATIC char *
+char *
 _drbd_fault_str(unsigned int type) {
 	static char *_faults[] = {
 		"Meta-data write",
@@ -2808,7 +2808,7 @@
 }
 
 unsigned int
-_drbd_insert_fault(drbd_dev *mdev, unsigned int type)
+_drbd_insert_fault(struct drbd_conf *mdev, unsigned int type)
 {
 	static struct fault_random_state rrs = {0, 0};
 
@@ -2829,7 +2829,7 @@
 
 #ifdef ENABLE_DYNAMIC_TRACE
 
-STATIC char *_drbd_uuid_str(unsigned int idx)
+char *_drbd_uuid_str(unsigned int idx)
 {
 	static char *uuid_str[] = {
 		"Current",
@@ -2845,7 +2845,7 @@
 
 /* Pretty print a UUID value */
 void
-drbd_print_uuid(drbd_dev *mdev, unsigned int idx) {
+drbd_print_uuid(struct drbd_conf *mdev, unsigned int idx) {
 	INFO(" uuid[%s] now %016llX\n", _drbd_uuid_str(idx), mdev->bc->md.uuid[idx]);
 }
 
@@ -2998,7 +2998,7 @@
 	} \
 } while (0)
 
-STATIC char *dump_st(char *p, int len, drbd_state_t mask, drbd_state_t val)
+char *dump_st(char *p, int len, union drbd_state_t mask, union drbd_state_t val)
 {
 	char *op = p;
 	*p = '\0';
@@ -3037,13 +3037,13 @@
 }
 
 void
-_dump_packet(drbd_dev *mdev, struct socket *sock,
-	    int recv, Drbd_Polymorph_Packet *p, char *file, int line)
+_dump_packet(struct drbd_conf *mdev, struct socket *sock,
+	    int recv, union Drbd_Polymorph_Packet *p, char *file, int line)
 {
 	char *sockname = sock == mdev->meta.socket ? "meta" : "data";
 	int cmd = (recv == 2) ? p->head.command : be16_to_cpu(p->head.command);
 	char tmp[300];
-	drbd_state_t m, v;
+	union drbd_state_t m, v;
 
 	switch (cmd) {
 	case HandShake:
@@ -3150,7 +3150,7 @@
 
 /* Debug routine to dump info about bio */
 
-void _dump_bio(drbd_dev *mdev, struct bio *bio, int complete)
+void _dump_bio(struct drbd_conf *mdev, struct bio *bio, int complete)
 {
 #ifdef CONFIG_LBD
 #define SECTOR_FORMAT "%Lx"

Modified: branches/drbd-8.0-for-linus/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 14:15:33 UTC (rev 2996)
@@ -47,7 +47,7 @@
 
 /* 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) \
+int name ## _from_tags (struct drbd_conf *mdev, unsigned short *tags, struct name *arg) \
 { \
 	int tag; \
 	int dlen; \
@@ -88,7 +88,7 @@
 /* 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) \
+name ## _to_tags (struct drbd_conf *mdev, struct name *arg, unsigned short *tags) \
 { \
 	fields \
 	return tags; \
@@ -116,8 +116,8 @@
 	tags = (unsigned short *)((char *)tags + arg->member ## _len);
 #include "linux/drbd_nl.h"
 
-extern void drbd_init_set_defaults(drbd_dev *mdev);
-void drbd_bcast_ev_helper(drbd_dev *mdev, char *helper_name);
+extern void drbd_init_set_defaults(struct drbd_conf *mdev);
+void drbd_bcast_ev_helper(struct drbd_conf *mdev, char *helper_name);
 void drbd_nl_send_reply(struct cn_msg *, int);
 
 char *nl_packet_name(int packet_type)
@@ -165,7 +165,7 @@
 	       req->seq, req->ack, req->len);
 }
 
-int drbd_khelper(drbd_dev *mdev, char *cmd)
+int drbd_khelper(struct drbd_conf *mdev, char *cmd)
 {
 	char mb[12];
 	char *argv[] = {usermode_helper, cmd, mb, NULL };
@@ -182,10 +182,10 @@
 	return call_usermodehelper(usermode_helper, argv, envp, 1);
 }
 
-drbd_disks_t drbd_try_outdate_peer(drbd_dev *mdev)
+enum drbd_disk_state drbd_try_outdate_peer(struct drbd_conf *mdev)
 {
 	int r;
-	drbd_disks_t nps;
+	enum drbd_disk_state nps;
 	enum fencing_policy fp;
 
 	D_ASSERT(mdev->state.pdsk == DUnknown);
@@ -236,11 +236,11 @@
 }
 
 
-int drbd_set_role(drbd_dev *mdev, drbd_role_t new_role, int force)
+int drbd_set_role(struct drbd_conf *mdev, enum drbd_role new_role, int force)
 {
 	int r = 0, forced = 0, try = 0;
-	drbd_state_t mask, val;
-	drbd_disks_t nps;
+	union drbd_state_t mask, val;
+	enum drbd_disk_state nps;
 
 	if (new_role == Primary)
 		request_ping(mdev); /* Detect a dead peer ASAP */
@@ -363,7 +363,7 @@
 }
 
 
-STATIC int drbd_nl_primary(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_primary(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			   struct drbd_nl_cfg_reply *reply)
 {
 	struct primary primary_args;
@@ -379,7 +379,7 @@
 	return 0;
 }
 
-STATIC int drbd_nl_secondary(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_secondary(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			     struct drbd_nl_cfg_reply *reply)
 {
 	reply->ret_code = drbd_set_role(mdev, Secondary, 0);
@@ -389,7 +389,7 @@
 
 /* initializes the md.*_offset members, so we are able to find
  * the on disk meta data */
-STATIC void drbd_md_set_sector_offsets(drbd_dev *mdev,
+void drbd_md_set_sector_offsets(struct drbd_conf *mdev,
 				       struct drbd_backing_dev *bdev)
 {
 	sector_t md_size_sect = 0;
@@ -447,7 +447,7 @@
 
 /* You should call drbd_md_sync() after calling this.
  */
-int drbd_determin_dev_size(struct Drbd_Conf *mdev)
+int drbd_determin_dev_size(struct drbd_conf *mdev)
 {
 	sector_t prev_first_sect, prev_size; /* previous meta location */
 	sector_t la_size;
@@ -522,7 +522,7 @@
 }
 
 sector_t
-drbd_new_dev_size(struct Drbd_Conf *mdev, struct drbd_backing_dev *bdev)
+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. */
@@ -566,7 +566,7 @@
  * -ENOMEM when allocation failed, and 0 on success. You should call
  * drbd_md_sync() after you called this function.
  */
-STATIC int drbd_check_al_size(drbd_dev *mdev)
+int drbd_check_al_size(struct drbd_conf *mdev)
 {
 	struct lru_cache *n, *t;
 	struct lc_element *e;
@@ -613,7 +613,7 @@
 	return 0;
 }
 
-void drbd_setup_queue_param(drbd_dev *mdev, unsigned int max_seg_s)
+void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int max_seg_s)
 {
 	request_queue_t * const q = mdev->rq_queue;
 	request_queue_t * const b = mdev->bc->backing_bdev->bd_disk->queue;
@@ -672,14 +672,14 @@
 
 /* does always return 0;
  * interesting return code is in reply->ret_code */
-STATIC int drbd_nl_disk_conf(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_disk_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			     struct drbd_nl_cfg_reply *reply)
 {
 	enum ret_codes retcode;
 	struct drbd_backing_dev *nbc = NULL; /* new_backing_conf */
 	struct inode *inode, *inode2;
 	struct lru_cache *resync_lru = NULL;
-	drbd_state_t ns, os;
+	union drbd_state_t ns, os;
 	int rv, ntries = 0;
 
 	/* if you want to reconfigure, please tear down first */
@@ -992,7 +992,7 @@
 	return 0;
 }
 
-STATIC int drbd_nl_detach(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_detach(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			  struct drbd_nl_cfg_reply *reply)
 {
 	fsync_bdev(mdev->this_bdev);
@@ -1003,7 +1003,7 @@
 
 #define HMAC_NAME_L 20
 
-STATIC int drbd_nl_net_conf(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_net_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			    struct drbd_nl_cfg_reply *reply)
 {
 	int i, ns;
@@ -1012,7 +1012,7 @@
 	struct crypto_hash *tfm = NULL;
 	struct hlist_head *new_tl_hash = NULL;
 	struct hlist_head *new_ee_hash = NULL;
-	drbd_dev *odev;
+	struct drbd_conf *odev;
 	char hmac_name[HMAC_NAME_L];
 
 	if (mdev->state.conn > StandAlone) {
@@ -1187,7 +1187,7 @@
 	return 0;
 }
 
-STATIC int drbd_nl_disconnect(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_disconnect(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			      struct drbd_nl_cfg_reply *reply)
 {
 	int retcode;
@@ -1228,7 +1228,7 @@
 	return 0;
 }
 
-STATIC int drbd_nl_resize(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_resize(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			  struct drbd_nl_cfg_reply *reply)
 {
 	struct resize rs;
@@ -1272,12 +1272,12 @@
 	return 0;
 }
 
-STATIC int drbd_nl_syncer_conf(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_syncer_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			       struct drbd_nl_cfg_reply *reply)
 {
 	int retcode = NoError;
 	struct syncer_conf sc;
-	drbd_dev *odev;
+	struct drbd_conf *odev;
 	int err;
 
 	memcpy(&sc, &mdev->sync_conf, sizeof(struct syncer_conf));
@@ -1341,7 +1341,7 @@
 	return 0;
 }
 
-STATIC int drbd_nl_invalidate(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_invalidate(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			      struct drbd_nl_cfg_reply *reply)
 {
 	reply->ret_code = drbd_request_state(mdev, NS2(conn, StartingSyncT,
@@ -1349,7 +1349,7 @@
 	return 0;
 }
 
-STATIC int drbd_nl_invalidate_peer(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_invalidate_peer(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 				   struct drbd_nl_cfg_reply *reply)
 {
 
@@ -1359,7 +1359,7 @@
 	return 0;
 }
 
-STATIC int drbd_nl_pause_sync(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_pause_sync(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			      struct drbd_nl_cfg_reply *reply)
 {
 	int retcode = NoError;
@@ -1371,7 +1371,7 @@
 	return 0;
 }
 
-STATIC int drbd_nl_resume_sync(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_resume_sync(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			       struct drbd_nl_cfg_reply *reply)
 {
 	int retcode = NoError;
@@ -1383,7 +1383,7 @@
 	return 0;
 }
 
-STATIC int drbd_nl_suspend_io(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_suspend_io(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			      struct drbd_nl_cfg_reply *reply)
 {
 	reply->ret_code = drbd_request_state(mdev, NS(susp, 1));
@@ -1391,18 +1391,18 @@
 	return 0;
 }
 
-STATIC int drbd_nl_resume_io(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_resume_io(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			     struct drbd_nl_cfg_reply *reply)
 {
 	reply->ret_code = drbd_request_state(mdev, NS(susp, 0));
 	return 0;
 }
 
-STATIC int drbd_nl_outdate(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_outdate(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			   struct drbd_nl_cfg_reply *reply)
 {
 	int retcode;
-	drbd_state_t os, ns;
+	union drbd_state_t os, ns;
 
 	spin_lock_irq(&mdev->req_lock);
 	os = mdev->state;
@@ -1427,7 +1427,7 @@
 	return 0;
 }
 
-STATIC int drbd_nl_get_config(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_get_config(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			   struct drbd_nl_cfg_reply *reply)
 {
 	unsigned short *tl;
@@ -1450,7 +1450,7 @@
 	return (int)((char *)tl - (char *)reply->tag_list);
 }
 
-STATIC int drbd_nl_get_state(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_get_state(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			     struct drbd_nl_cfg_reply *reply)
 {
 	unsigned short *tl;
@@ -1463,7 +1463,7 @@
 	return (int)((char *)tl - (char *)reply->tag_list);
 }
 
-STATIC int drbd_nl_get_uuids(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_get_uuids(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 			     struct drbd_nl_cfg_reply *reply)
 {
 	unsigned short *tl;
@@ -1488,7 +1488,7 @@
 }
 
 
-STATIC int drbd_nl_get_timeout_flag(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
+int drbd_nl_get_timeout_flag(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
 				    struct drbd_nl_cfg_reply *reply)
 {
 	unsigned short *tl;
@@ -1505,9 +1505,9 @@
 	return (int)((char *)tl - (char *)reply->tag_list);
 }
 
-STATIC drbd_dev *ensure_mdev(struct drbd_nl_cfg_req *nlp)
+struct drbd_conf *ensure_mdev(struct drbd_nl_cfg_req *nlp)
 {
-	drbd_dev *mdev;
+	struct drbd_conf *mdev;
 
 	mdev = minor_to_mdev(nlp->drbd_minor);
 
@@ -1535,7 +1535,7 @@
 }
 
 struct cn_handler_struct {
-	int (*function)(drbd_dev *,
+	int (*function)(struct drbd_conf *,
 			 struct drbd_nl_cfg_req *,
 			 struct drbd_nl_cfg_reply* );
 	int reply_body_size;
@@ -1577,7 +1577,7 @@
 	struct cn_handler_struct *cm;
 	struct cn_msg *cn_reply;
 	struct drbd_nl_cfg_reply *reply;
-	drbd_dev *mdev;
+	struct drbd_conf *mdev;
 	int retcode, rr;
 	int reply_size = sizeof(struct cn_msg)
 		+ sizeof(struct drbd_nl_cfg_reply)
@@ -1640,7 +1640,7 @@
 
 atomic_t drbd_nl_seq = ATOMIC_INIT(2); /* two. */
 
-void drbd_bcast_state(drbd_dev *mdev)
+void drbd_bcast_state(struct drbd_conf *mdev)
 {
 	char buffer[sizeof(struct cn_msg)+
 		    sizeof(struct drbd_nl_cfg_reply)+
@@ -1673,7 +1673,7 @@
 	cn_netlink_send(cn_reply, CN_IDX_DRBD, GFP_KERNEL);
 }
 
-void drbd_bcast_ev_helper(drbd_dev *mdev, char *helper_name)
+void drbd_bcast_ev_helper(struct drbd_conf *mdev, char *helper_name)
 {
 	char buffer[sizeof(struct cn_msg)+
 		    sizeof(struct drbd_nl_cfg_reply)+
@@ -1711,7 +1711,7 @@
 	cn_netlink_send(cn_reply, CN_IDX_DRBD, GFP_KERNEL);
 }
 
-void drbd_bcast_sync_progress(drbd_dev *mdev)
+void drbd_bcast_sync_progress(struct drbd_conf *mdev)
 {
 	char buffer[sizeof(struct cn_msg)+
 		    sizeof(struct drbd_nl_cfg_reply)+

Modified: branches/drbd-8.0-for-linus/drbd/drbd_proc.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_proc.c	2007-07-24 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/drbd_proc.c	2007-07-24 14:15:33 UTC (rev 2996)
@@ -38,7 +38,7 @@
 #include "drbd_int.h"
 #include "lru_cache.h" /* for lc_sprintf_stats */
 
-STATIC int drbd_proc_open(struct inode *inode, struct file *file);
+int drbd_proc_open(struct inode *inode, struct file *file);
 
 
 struct proc_dir_entry *drbd_proc;
@@ -56,7 +56,7 @@
  *	[=====>..............] 33.5% (23456/123456)
  *	finish: 2:20:20 speed: 6,345 (6,456) K/sec
  */
-STATIC void drbd_syncer_progress(struct Drbd_Conf *mdev, struct seq_file *seq)
+void drbd_syncer_progress(struct drbd_conf *mdev, struct seq_file *seq)
 {
 	unsigned long res , db, dt, dbdt, rt, rs_left;
 
@@ -158,7 +158,7 @@
 }
 
 #if 0
-STATIC void resync_dump_detail(struct seq_file *seq, struct lc_element *e)
+void resync_dump_detail(struct seq_file *seq, struct lc_element *e)
 {
 	struct bm_extent *bme = (struct bm_extent *)e;
 
@@ -169,11 +169,11 @@
 }
 #endif
 
-STATIC int drbd_seq_show(struct seq_file *seq, void *v)
+int drbd_seq_show(struct seq_file *seq, void *v)
 {
 	int i, hole = 0;
 	const char *sn;
-	drbd_dev *mdev;
+	struct drbd_conf *mdev;
 
 	seq_printf(seq, "version: " REL_VERSION " (api:%d/proto:%d)\n%s\n",
 		    API_VERSION, PRO_VERSION, drbd_buildtag());
@@ -258,7 +258,7 @@
 	return 0;
 }
 
-STATIC int drbd_proc_open(struct inode *inode, struct file *file)
+int drbd_proc_open(struct inode *inode, struct file *file)
 {
 	return single_open(file, drbd_seq_show, PDE(inode)->data);
 }

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 14:15:33 UTC (rev 2996)
@@ -57,7 +57,7 @@
 #endif
 
 #ifdef DBG_ASSERTS
-void drbd_assert_breakpoint(drbd_dev *mdev, char *exp,
+void drbd_assert_breakpoint(struct drbd_conf *mdev, char *exp,
 			    char *file, int line)
 {
 	ERR("ASSERT( %s ) in %s:%d\n", exp, file, line);
@@ -67,7 +67,7 @@
 
 #if 0
 #define CHECK_LIST_LIMIT 1000
-void check_list(drbd_dev *mdev, struct list_head *list, char *t)
+void check_list(struct drbd_conf *mdev, struct list_head *list, char *t)
 {
 	struct list_head *le, *la;
 	int forward = 0, backward = 0;
@@ -120,7 +120,7 @@
 /**
  * drbd_bp_alloc: Returns a page. Fails only if a signal comes in.
  */
-STATIC struct page *drbd_pp_alloc(drbd_dev *mdev, unsigned int gfp_mask)
+struct page *drbd_pp_alloc(struct drbd_conf *mdev, unsigned int gfp_mask)
 {
 	unsigned long flags = 0;
 	struct page *page;
@@ -192,7 +192,7 @@
 	return page;
 }
 
-STATIC void drbd_pp_free(drbd_dev *mdev, struct page *page)
+void drbd_pp_free(struct drbd_conf *mdev, struct page *page)
 {
 	unsigned long flags = 0;
 	int free_it;
@@ -235,7 +235,7 @@
  drbd_wait_ee_list_empty()
 */
 
-struct Tl_epoch_entry *drbd_alloc_ee(drbd_dev *mdev,
+struct Tl_epoch_entry *drbd_alloc_ee(struct drbd_conf *mdev,
 				     u64 id,
 				     sector_t sector,
 				     unsigned int data_size,
@@ -328,7 +328,7 @@
 	return NULL;
 }
 
-void drbd_free_ee(drbd_dev *mdev, struct Tl_epoch_entry *e)
+void drbd_free_ee(struct drbd_conf *mdev, struct Tl_epoch_entry *e)
 {
 	struct bio *bio = e->private_bio;
 	struct bio_vec *bvec;
@@ -351,7 +351,7 @@
 }
 
 /* currently on module unload only */
-int drbd_release_ee(drbd_dev *mdev, struct list_head *list)
+int drbd_release_ee(struct drbd_conf *mdev, struct list_head *list)
 {
 	int count = 0;
 	struct Tl_epoch_entry *e;
@@ -371,7 +371,7 @@
 }
 
 
-STATIC void reclaim_net_ee(drbd_dev *mdev)
+void reclaim_net_ee(struct drbd_conf *mdev)
 {
 	struct Tl_epoch_entry *e;
 	struct list_head *le, *tle;
@@ -399,7 +399,7 @@
  * Grab done_ee, call all callbacks, free the entries.
  * The callbacks typically send out ACKs.
  */
-STATIC int drbd_process_done_ee(drbd_dev *mdev)
+int drbd_process_done_ee(struct drbd_conf *mdev)
 {
 	LIST_HEAD(work_list);
 	struct Tl_epoch_entry *e, *t;
@@ -434,7 +434,7 @@
 
 
 /* clean-up helper for drbd_disconnect */
-void _drbd_clear_done_ee(drbd_dev *mdev)
+void _drbd_clear_done_ee(struct drbd_conf *mdev)
 {
 	struct list_head *le;
 	struct Tl_epoch_entry *e;
@@ -459,7 +459,7 @@
 	sub_unacked(mdev, n);
 }
 
-void _drbd_wait_ee_list_empty(drbd_dev *mdev, struct list_head *head)
+void _drbd_wait_ee_list_empty(struct drbd_conf *mdev, struct list_head *head)
 {
 	DEFINE_WAIT(wait);
 	MUST_HOLD(&mdev->req_lock);
@@ -475,14 +475,14 @@
 	}
 }
 
-void drbd_wait_ee_list_empty(drbd_dev *mdev, struct list_head *head)
+void drbd_wait_ee_list_empty(struct drbd_conf *mdev, struct list_head *head)
 {
 	spin_lock_irq(&mdev->req_lock);
 	_drbd_wait_ee_list_empty(mdev, head);
 	spin_unlock_irq(&mdev->req_lock);
 }
 
-STATIC struct socket *drbd_accept(drbd_dev *mdev, struct socket *sock)
+struct socket *drbd_accept(struct drbd_conf *mdev, struct socket *sock)
 {
 	struct socket *newsock;
 	int err = 0;
@@ -511,7 +511,7 @@
 	return 0;
 }
 
-STATIC int drbd_recv_short(drbd_dev *mdev, struct socket *sock,
+int drbd_recv_short(struct drbd_conf *mdev, struct socket *sock,
 			   void *buf, size_t size)
 {
 	mm_segment_t oldfs;
@@ -539,7 +539,7 @@
 	return rv;
 }
 
-int drbd_recv(drbd_dev *mdev, void *buf, size_t size)
+int drbd_recv(struct drbd_conf *mdev, void *buf, size_t size)
 {
 	mm_segment_t oldfs;
 	struct iovec iov;
@@ -593,7 +593,7 @@
 	return rv;
 }
 
-STATIC struct socket *drbd_try_connect(drbd_dev *mdev)
+struct socket *drbd_try_connect(struct drbd_conf *mdev)
 {
 	int err;
 	struct socket *sock;
@@ -644,7 +644,7 @@
 	return sock;
 }
 
-STATIC struct socket *drbd_wait_for_connect(drbd_dev *mdev)
+struct socket *drbd_wait_for_connect(struct drbd_conf *mdev)
 {
 	int err;
 	struct socket *sock, *sock2;
@@ -679,19 +679,19 @@
 	return sock;
 }
 
-STATIC int drbd_do_handshake(drbd_dev *mdev);
-STATIC int drbd_do_auth(drbd_dev *mdev);
+int drbd_do_handshake(struct drbd_conf *mdev);
+int drbd_do_auth(struct drbd_conf *mdev);
 
-STATIC int drbd_send_fp(drbd_dev *mdev, struct socket *sock, Drbd_Packet_Cmd cmd)
+int drbd_send_fp(struct drbd_conf *mdev, struct socket *sock, enum Drbd_Packet_Cmd cmd)
 {
-	Drbd_Header *h = (Drbd_Header *) &mdev->data.sbuf.head;
+	struct Drbd_Header *h = (struct Drbd_Header *) &mdev->data.sbuf.head;
 
 	return _drbd_send_cmd(mdev, sock, cmd, h, sizeof(*h), 0);
 }
 
-STATIC Drbd_Packet_Cmd drbd_recv_fp(drbd_dev *mdev, struct socket *sock)
+enum Drbd_Packet_Cmd drbd_recv_fp(struct drbd_conf *mdev, struct socket *sock)
 {
-	Drbd_Header *h = (Drbd_Header *) &mdev->data.sbuf.head;
+	struct Drbd_Header *h = (struct Drbd_Header *) &mdev->data.sbuf.head;
 	int rr;
 
 	rr = drbd_recv_short(mdev, sock, h, sizeof(*h));
@@ -709,7 +709,7 @@
  *  -1 peer talks different language,
  *     no point in trying again, please go standalone.
  */
-int drbd_connect(drbd_dev *mdev)
+int drbd_connect(struct drbd_conf *mdev)
 {
 	struct socket *s, *sock, *msock;
 	int try, h;
@@ -844,7 +844,7 @@
 	return 1;
 }
 
-STATIC int drbd_recv_header(drbd_dev *mdev, Drbd_Header *h)
+int drbd_recv_header(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
 	int r;
 
@@ -867,11 +867,11 @@
 	return TRUE;
 }
 
-STATIC int receive_Barrier_no_tcq(drbd_dev *mdev, Drbd_Header *h)
+int receive_Barrier_no_tcq(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
 	int rv;
 	int epoch_size;
-	Drbd_Barrier_Packet *p = (Drbd_Barrier_Packet *)h;
+	struct Drbd_Barrier_Packet *p = (struct Drbd_Barrier_Packet *)h;
 
 	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
 
@@ -909,8 +909,8 @@
 
 /* used from receive_RSDataReply (recv_resync_read)
  * and from receive_Data */
-STATIC struct Tl_epoch_entry *
-read_in_block(drbd_dev *mdev, u64 id, sector_t sector, int data_size)
+struct Tl_epoch_entry *
+read_in_block(struct drbd_conf *mdev, u64 id, sector_t sector, int data_size)
 {
 	struct Tl_epoch_entry *e;
 	struct bio_vec *bvec;
@@ -942,8 +942,8 @@
 /* drbd_drain_block() just takes a data block out of the socket input
  * buffer and discards ist.
  */
-STATIC int
-drbd_drain_block(drbd_dev *mdev, int data_size)
+int
+drbd_drain_block(struct drbd_conf *mdev, int data_size)
 {
 	struct page *page;
 	int rr, rv = 1;
@@ -972,14 +972,14 @@
 /* kick lower level device, if we have more than (arbitrary number)
  * reference counts on it, which typically are locally submitted io
  * requests.  don't use unacked_cnt, so we speed up proto A and B, too. */
-static void maybe_kick_lo(drbd_dev *mdev)
+static void maybe_kick_lo(struct drbd_conf *mdev)
 {
 	/* 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,
+int recv_dless_read(struct drbd_conf *mdev, struct drbd_request *req,
 			   sector_t sector, int data_size)
 {
 	struct bio_vec *bvec;
@@ -1010,7 +1010,7 @@
 
 /* e_end_resync_block() is called via
  * drbd_process_done_ee() by asender only */
-STATIC int e_end_resync_block(drbd_dev *mdev, struct drbd_work *w, int unused)
+int e_end_resync_block(struct drbd_conf *mdev, struct drbd_work *w, int unused)
 {
 	struct Tl_epoch_entry *e = (struct Tl_epoch_entry *)w;
 	sector_t sector = e->sector;
@@ -1033,7 +1033,7 @@
 	return ok;
 }
 
-STATIC int recv_resync_read(drbd_dev *mdev, sector_t sector, int data_size)
+int recv_resync_read(struct drbd_conf *mdev, sector_t sector, int data_size)
 {
 	struct Tl_epoch_entry *e;
 
@@ -1064,13 +1064,13 @@
 	return TRUE;
 }
 
-STATIC int receive_DataReply(drbd_dev *mdev, Drbd_Header *h)
+int receive_DataReply(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
-	drbd_request_t *req;
+	struct drbd_request *req;
 	sector_t sector;
 	unsigned int header_size, data_size;
 	int ok;
-	Drbd_Data_Packet *p = (Drbd_Data_Packet *)h;
+	struct Drbd_Data_Packet *p = (struct Drbd_Data_Packet *)h;
 
 	header_size = sizeof(*p) - sizeof(*h);
 	data_size   = h->length  - header_size;
@@ -1108,12 +1108,12 @@
 	return ok;
 }
 
-STATIC int receive_RSDataReply(drbd_dev *mdev, Drbd_Header *h)
+int receive_RSDataReply(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
 	sector_t sector;
 	unsigned int header_size, data_size;
 	int ok;
-	Drbd_Data_Packet *p = (Drbd_Data_Packet *)h;
+	struct Drbd_Data_Packet *p = (struct Drbd_Data_Packet *)h;
 
 	header_size = sizeof(*p) - sizeof(*h);
 	data_size   = h->length  - header_size;
@@ -1160,7 +1160,7 @@
  * for a broken example implementation of the TCQ barrier version of
  * e_end_block see older revisions...
  */
-STATIC int e_end_block(drbd_dev *mdev, struct drbd_work *w, int unused)
+int e_end_block(struct drbd_conf *mdev, struct drbd_work *w, int unused)
 {
 	struct Tl_epoch_entry *e = (struct Tl_epoch_entry *)w;
 	sector_t sector = e->sector;
@@ -1207,7 +1207,7 @@
 	return ok;
 }
 
-STATIC int e_send_discard_ack(drbd_dev *mdev, struct drbd_work *w, int unused)
+int e_send_discard_ack(struct drbd_conf *mdev, struct drbd_work *w, int unused)
 {
 	struct Tl_epoch_entry *e = (struct Tl_epoch_entry *)w;
 	int ok = 1;
@@ -1248,7 +1248,7 @@
  *
  * returns 0 if we may process the packet,
  * -ERESTARTSYS if we were interrupted (by disconnect signal). */
-static int drbd_wait_peer_seq(drbd_dev *mdev, const u32 packet_seq)
+static int drbd_wait_peer_seq(struct drbd_conf *mdev, const u32 packet_seq)
 {
 	DEFINE_WAIT(wait);
 	int ret = 0;
@@ -1273,11 +1273,11 @@
 }
 
 /* mirrored write */
-STATIC int receive_Data(drbd_dev *mdev, Drbd_Header *h)
+int receive_Data(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
 	sector_t sector;
 	struct Tl_epoch_entry *e;
-	Drbd_Data_Packet *p = (Drbd_Data_Packet *)h;
+	struct Drbd_Data_Packet *p = (struct Drbd_Data_Packet *)h;
 	int header_size, data_size;
 	unsigned int barrier_nr = 0;
 	unsigned int epoch_size = 0;
@@ -1340,7 +1340,7 @@
 		const int size = e->size;
 		const int discard = test_bit(DISCARD_CONCURRENT, &mdev->flags);
 		DEFINE_WAIT(wait);
-		drbd_request_t *i;
+		struct drbd_request *i;
 		struct hlist_node *n;
 		struct hlist_head *slot;
 		int first;
@@ -1569,14 +1569,14 @@
 	return FALSE;
 }
 
-STATIC int receive_DataRequest(drbd_dev *mdev, Drbd_Header *h)
+int receive_DataRequest(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
 	sector_t sector;
 	const sector_t capacity = drbd_get_capacity(mdev->this_bdev);
 	struct Tl_epoch_entry *e;
 	int size;
 	unsigned int fault_type;
-	Drbd_BlockRequest_Packet *p = (Drbd_BlockRequest_Packet *)h;
+	struct Drbd_BlockRequest_Packet *p = (struct Drbd_BlockRequest_Packet *)h;
 
 	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
 
@@ -1656,7 +1656,7 @@
 	return TRUE;
 }
 
-STATIC int drbd_asb_recover_0p(drbd_dev *mdev)
+int drbd_asb_recover_0p(struct drbd_conf *mdev)
 {
 	int self, peer, rv = -100;
 	unsigned long ch_self, ch_peer;
@@ -1712,7 +1712,7 @@
 	return rv;
 }
 
-STATIC int drbd_asb_recover_1p(drbd_dev *mdev)
+int drbd_asb_recover_1p(struct drbd_conf *mdev)
 {
 	int self, peer, hg, rv = -100;
 
@@ -1756,7 +1756,7 @@
 	return rv;
 }
 
-STATIC int drbd_asb_recover_2p(drbd_dev *mdev)
+int drbd_asb_recover_2p(struct drbd_conf *mdev)
 {
 	int self, peer, hg, rv = -100;
 
@@ -1795,7 +1795,7 @@
 	return rv;
 }
 
-STATIC void drbd_uuid_dump(drbd_dev *mdev, char *text, u64 *uuid)
+void drbd_uuid_dump(struct drbd_conf *mdev, char *text, u64 *uuid)
 {
 	INFO("%s %016llX:%016llX:%016llX:%016llX\n",
 	     text,
@@ -1815,7 +1815,7 @@
  -100	after split brain, disconnect
 -1000	unrelated data
  */
-STATIC int drbd_uuid_compare(drbd_dev *mdev, int *rule_nr)
+int drbd_uuid_compare(struct drbd_conf *mdev, int *rule_nr)
 {
 	u64 self, peer;
 	int i, j;
@@ -1898,12 +1898,12 @@
 /* drbd_sync_handshake() returns the new conn state on success, or
    conn_mask (-1) on failure.
  */
-STATIC drbd_conns_t drbd_sync_handshake(drbd_dev *mdev, drbd_role_t peer_role,
-					drbd_disks_t peer_disk)
+enum drbd_conns drbd_sync_handshake(struct drbd_conf *mdev, enum drbd_role peer_role,
+					enum drbd_disk_state peer_disk)
 {
 	int hg, rule_nr;
-	drbd_conns_t rv = conn_mask;
-	drbd_disks_t mydisk;
+	enum drbd_conns rv = conn_mask;
+	enum drbd_disk_state mydisk;
 
 	mydisk = mdev->state.disk;
 	if (mydisk == Negotiating) mydisk = mdev->new_state_tmp.disk;
@@ -2032,7 +2032,7 @@
 }
 
 /* returns 1 if invalid */
-STATIC int cmp_after_sb(enum after_sb_handler peer, enum after_sb_handler self)
+int cmp_after_sb(enum after_sb_handler peer, enum after_sb_handler self)
 {
 	/* DiscardRemote - DiscardLocal is valid */
 	if ( (peer == DiscardRemote && self == DiscardLocal) ||
@@ -2049,9 +2049,9 @@
 	return 1;
 }
 
-STATIC int receive_protocol(drbd_dev *mdev, Drbd_Header *h)
+int receive_protocol(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
-	Drbd_Protocol_Packet *p = (Drbd_Protocol_Packet *)h;
+	struct Drbd_Protocol_Packet *p = (struct Drbd_Protocol_Packet *)h;
 
 	int p_proto, p_after_sb_0p, p_after_sb_1p, p_after_sb_2p;
 	int p_want_lose, p_two_primaries;
@@ -2104,10 +2104,10 @@
 	return FALSE;
 }
 
-STATIC int receive_SyncParam(drbd_dev *mdev, Drbd_Header *h)
+int receive_SyncParam(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
 	int ok = TRUE;
-	Drbd_SyncParam_Packet *p = (Drbd_SyncParam_Packet *)h;
+	struct Drbd_SyncParam_Packet *p = (struct Drbd_SyncParam_Packet *)h;
 
 	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
 	if (drbd_recv(mdev, h->payload, h->length) != h->length)
@@ -2119,14 +2119,14 @@
 	return ok;
 }
 
-STATIC void drbd_setup_order_type(drbd_dev *mdev, int peer)
+void drbd_setup_order_type(struct drbd_conf *mdev, int peer)
 {
 	/* sorry, we currently have no working implementation
 	 * of distributed TCQ */
 }
 
 /* warn if the arguments differ by more than 12.5% */
-static void warn_if_differ_considerably(drbd_dev *mdev, const char *s, sector_t a, sector_t b)
+static void warn_if_differ_considerably(struct drbd_conf *mdev, const char *s, sector_t a, sector_t b)
 {
 	sector_t d;
 	if (a == 0 || b == 0) return;
@@ -2136,12 +2136,12 @@
 		     (unsigned long long)a, (unsigned long long)b);
 }
 
-STATIC int receive_sizes(drbd_dev *mdev, Drbd_Header *h)
+int receive_sizes(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
-	Drbd_Sizes_Packet *p = (Drbd_Sizes_Packet *)h;
+	struct Drbd_Sizes_Packet *p = (struct Drbd_Sizes_Packet *)h;
 	unsigned int max_seg_s;
 	sector_t p_size, p_usize, my_usize;
-	drbd_conns_t nconn;
+	enum drbd_conns nconn;
 
 	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
 	if (drbd_recv(mdev, h->payload, h->length) != h->length)
@@ -2241,9 +2241,9 @@
 	return TRUE;
 }
 
-STATIC int receive_uuids(drbd_dev *mdev, Drbd_Header *h)
+int receive_uuids(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
-	Drbd_GenCnt_Packet *p = (Drbd_GenCnt_Packet *)h;
+	struct Drbd_GenCnt_Packet *p = (struct Drbd_GenCnt_Packet *)h;
 	u64 *p_uuid;
 	int i;
 
@@ -2266,11 +2266,11 @@
  * convert_state:
  * Switches the view of the state.
  */
-STATIC drbd_state_t convert_state(drbd_state_t ps)
+union drbd_state_t convert_state(union drbd_state_t ps)
 {
-	drbd_state_t ms;
+	union drbd_state_t ms;
 
-	static drbd_conns_t c_tab[] = {
+	static enum drbd_conns c_tab[] = {
 		[Connected] = Connected,
 
 		[StartingSyncS] = StartingSyncT,
@@ -2292,10 +2292,10 @@
 	return ms;
 }
 
-STATIC int receive_req_state(drbd_dev *mdev, Drbd_Header *h)
+int receive_req_state(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
-	Drbd_Req_State_Packet *p = (Drbd_Req_State_Packet *)h;
-	drbd_state_t mask, val;
+	struct Drbd_Req_State_Packet *p = (struct Drbd_Req_State_Packet *)h;
+	union drbd_state_t mask, val;
 	int rv;
 
 	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
@@ -2320,11 +2320,11 @@
 	return TRUE;
 }
 
-STATIC int receive_state(drbd_dev *mdev, Drbd_Header *h)
+int receive_state(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
-	Drbd_State_Packet *p = (Drbd_State_Packet *)h;
-	drbd_conns_t nconn, oconn;
-	drbd_state_t os, ns, peer_state;
+	struct Drbd_State_Packet *p = (struct Drbd_State_Packet *)h;
+	enum drbd_conns nconn, oconn;
+	union drbd_state_t os, ns, peer_state;
 	int rv;
 
 	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
@@ -2391,9 +2391,9 @@
 	return TRUE;
 }
 
-STATIC int receive_sync_uuid(drbd_dev *mdev, Drbd_Header *h)
+int receive_sync_uuid(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
-	Drbd_SyncUUID_Packet *p = (Drbd_SyncUUID_Packet *)h;
+	struct Drbd_SyncUUID_Packet *p = (struct Drbd_SyncUUID_Packet *)h;
 
 	wait_event( mdev->misc_wait,
 		    mdev->state.conn < Connected || mdev->state.conn == WFSyncUUID);
@@ -2422,7 +2422,7 @@
    in order to be agnostic to the 32 vs 64 bits issue.
 
    returns 0 on failure, 1 if we suceessfully received it. */
-STATIC int receive_bitmap(drbd_dev *mdev, Drbd_Header *h)
+int receive_bitmap(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
 	size_t bm_words, bm_i, want, num_words;
 	unsigned long *buffer;
@@ -2469,7 +2469,7 @@
 	return ok;
 }
 
-STATIC int receive_skip(drbd_dev *mdev, Drbd_Header *h)
+int receive_skip(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
 	/* TODO zero copy sink :) */
 	static char sink[128];
@@ -2488,13 +2488,13 @@
 	return (size == 0);
 }
 
-STATIC int receive_UnplugRemote(drbd_dev *mdev, Drbd_Header *h)
+int receive_UnplugRemote(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
 	if (mdev->state.disk >= Inconsistent) drbd_kick_lo(mdev);
 	return TRUE; /* cannot fail. */
 }
 
-typedef int (*drbd_cmd_handler_f)(drbd_dev *, Drbd_Header *);
+typedef int (*drbd_cmd_handler_f)(struct drbd_conf *, struct Drbd_Header *);
 
 static drbd_cmd_handler_f drbd_default_handler[] = {
 	[Data]		   = receive_Data,
@@ -2522,10 +2522,10 @@
 static drbd_cmd_handler_f *drbd_cmd_handler = drbd_default_handler;
 static drbd_cmd_handler_f *drbd_opt_cmd_handler;
 
-STATIC void drbdd(drbd_dev *mdev)
+void drbdd(struct drbd_conf *mdev)
 {
 	drbd_cmd_handler_f handler;
-	Drbd_Header *header = &mdev->data.rbuf.head;
+	struct Drbd_Header *header = &mdev->data.rbuf.head;
 
 	while (get_t_state(&mdev->receiver) == Running) {
 		if (!drbd_recv_header(mdev, header))
@@ -2558,11 +2558,11 @@
 }
 
 /* FIXME how should freeze-io be handled? */
-STATIC void drbd_fail_pending_reads(drbd_dev *mdev)
+void drbd_fail_pending_reads(struct drbd_conf *mdev)
 {
 	struct hlist_head *slot;
 	struct hlist_node *n;
-	drbd_request_t *req;
+	struct drbd_request *req;
 	struct list_head *le;
 	LIST_HEAD(workset);
 	int i;
@@ -2581,7 +2581,7 @@
 
 	while (!list_empty(&workset)) {
 		le = workset.next;
-		req = list_entry(le, drbd_request_t, w.list);
+		req = list_entry(le, struct drbd_request, w.list);
 		list_del(le);
 
 		_req_mod(req, connection_lost_while_pending, 0);
@@ -2589,11 +2589,11 @@
 	spin_unlock_irq(&mdev->req_lock);
 }
 
-STATIC void drbd_disconnect(drbd_dev *mdev)
+void drbd_disconnect(struct drbd_conf *mdev)
 {
 	struct drbd_work prev_work_done;
 	enum fencing_policy fp;
-	drbd_state_t os, ns;
+	union drbd_state_t os, ns;
 	int rv = SS_UnknownError;
 
 	D_ASSERT(mdev->state.conn < Connected);
@@ -2674,7 +2674,7 @@
 	if (mdev->state.role == Primary) {
 		if ( fp >= Resource &&
 		    mdev->state.pdsk >= DUnknown ) {
-			drbd_disks_t nps = drbd_try_outdate_peer(mdev);
+			enum drbd_disk_state nps = drbd_try_outdate_peer(mdev);
 			drbd_request_state(mdev, NS(pdsk, nps));
 		}
 	}
@@ -2737,10 +2737,10 @@
  *
  * for now, they are expected to be zero, but ignored.
  */
-int drbd_send_handshake(drbd_dev *mdev)
+int drbd_send_handshake(struct drbd_conf *mdev)
 {
 	/* ASSERT current == mdev->receiver ... */
-	Drbd_HandShake_Packet *p = &mdev->data.sbuf.HandShake;
+	struct Drbd_HandShake_Packet *p = &mdev->data.sbuf.HandShake;
 	int ok;
 
 	if (down_interruptible(&mdev->data.mutex)) {
@@ -2756,7 +2756,7 @@
 	memset(p, 0, sizeof(*p));
 	p->protocol_version = cpu_to_be32(PRO_VERSION);
 	ok = _drbd_send_cmd( mdev, mdev->data.socket, HandShake,
-			     (Drbd_Header *)p, sizeof(*p), 0 );
+			     (struct Drbd_Header *)p, sizeof(*p), 0 );
 	up(&mdev->data.mutex);
 	return ok;
 }
@@ -2768,11 +2768,11 @@
  *  -1 peer talks different language,
  *     no point in trying again, please go standalone.
  */
-STATIC int drbd_do_handshake(drbd_dev *mdev)
+int drbd_do_handshake(struct drbd_conf *mdev)
 {
 	/* ASSERT current == mdev->receiver ... */
-	Drbd_HandShake_Packet *p = &mdev->data.rbuf.HandShake;
-	const int expect = sizeof(Drbd_HandShake_Packet)-sizeof(Drbd_Header);
+	struct Drbd_HandShake_Packet *p = &mdev->data.rbuf.HandShake;
+	const int expect = sizeof(struct Drbd_HandShake_Packet)-sizeof(struct Drbd_Header);
 	int rv;
 
 	rv = drbd_send_handshake(mdev);
@@ -2846,7 +2846,7 @@
 }
 
 #if !defined(CONFIG_CRYPTO_HMAC) && !defined(CONFIG_CRYPTO_HMAC_MODULE)
-STATIC int drbd_do_auth(drbd_dev *mdev)
+int drbd_do_auth(struct drbd_conf *mdev)
 {
 	ERR( "This kernel was build without CONFIG_CRYPTO_HMAC.\n");
 	ERR( "You need to disable 'cram-hmac-alg' in drbd.conf.\n");
@@ -2854,14 +2854,14 @@
 }
 #else
 #define CHALLENGE_LEN 64
-STATIC int drbd_do_auth(drbd_dev *mdev)
+int drbd_do_auth(struct drbd_conf *mdev)
 {
 	char my_challenge[CHALLENGE_LEN];  /* 64 Bytes... */
 	struct scatterlist sg;
 	char *response = NULL;
 	char *right_response = NULL;
 	char *peers_ch = NULL;
-	Drbd_Header p;
+	struct Drbd_Header p;
 	unsigned int key_len = strlen(mdev->net_conf->shared_secret);
 	unsigned int resp_size;
 	struct hash_desc desc;
@@ -2995,7 +2995,7 @@
 
 int drbdd_init(struct Drbd_thread *thi)
 {
-	drbd_dev *mdev = thi->mdev;
+	struct drbd_conf *mdev = thi->mdev;
 	int minor = mdev_to_minor(mdev);
 	int h;
 
@@ -3039,9 +3039,9 @@
 
 /* ********* acknowledge sender ******** */
 
-STATIC int got_RqSReply(drbd_dev *mdev, Drbd_Header *h)
+int got_RqSReply(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
-	Drbd_RqS_Reply_Packet *p = (Drbd_RqS_Reply_Packet *)h;
+	struct Drbd_RqS_Reply_Packet *p = (struct Drbd_RqS_Reply_Packet *)h;
 
 	int retcode = be32_to_cpu(p->retcode);
 
@@ -3057,13 +3057,13 @@
 	return TRUE;
 }
 
-STATIC int got_Ping(drbd_dev *mdev, Drbd_Header *h)
+int got_Ping(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
 	return drbd_send_ping_ack(mdev);
 
 }
 
-STATIC int got_PingAck(drbd_dev *mdev, Drbd_Header *h)
+int got_PingAck(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
 	/* restore idle timeout */
 	mdev->meta.socket->sk->sk_rcvtimeo = mdev->net_conf->ping_int*HZ;
@@ -3071,10 +3071,10 @@
 	return TRUE;
 }
 
-STATIC int got_BlockAck(drbd_dev *mdev, Drbd_Header *h)
+int got_BlockAck(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
-	drbd_request_t *req;
-	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet *)h;
+	struct drbd_request *req;
+	struct Drbd_BlockAck_Packet *p = (struct Drbd_BlockAck_Packet *)h;
 	sector_t sector = be64_to_cpu(p->sector);
 	int blksize = be32_to_cpu(p->blksize);
 
@@ -3123,11 +3123,11 @@
 	return TRUE;
 }
 
-STATIC int got_NegAck(drbd_dev *mdev, Drbd_Header *h)
+int got_NegAck(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
-	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet *)h;
+	struct Drbd_BlockAck_Packet *p = (struct Drbd_BlockAck_Packet *)h;
 	sector_t sector = be64_to_cpu(p->sector);
-	drbd_request_t *req;
+	struct drbd_request *req;
 
 	if (DRBD_ratelimit(5*HZ, 5))
 		WARN("Got NegAck packet. Peer is in troubles?\n");
@@ -3156,10 +3156,10 @@
 	return TRUE;
 }
 
-STATIC int got_NegDReply(drbd_dev *mdev, Drbd_Header *h)
+int got_NegDReply(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
-	drbd_request_t *req;
-	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet *)h;
+	struct drbd_request *req;
+	struct Drbd_BlockAck_Packet *p = (struct Drbd_BlockAck_Packet *)h;
 	sector_t sector = be64_to_cpu(p->sector);
 
 	spin_lock_irq(&mdev->req_lock);
@@ -3184,11 +3184,11 @@
 	return TRUE;
 }
 
-STATIC int got_NegRSDReply(drbd_dev *mdev, Drbd_Header *h)
+int got_NegRSDReply(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
 	sector_t sector;
 	int size;
-	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet *)h;
+	struct Drbd_BlockAck_Packet *p = (struct Drbd_BlockAck_Packet *)h;
 
 	sector = be64_to_cpu(p->sector);
 	size = be32_to_cpu(p->blksize);
@@ -3205,9 +3205,9 @@
 	return TRUE;
 }
 
-STATIC int got_BarrierAck(drbd_dev *mdev, Drbd_Header *h)
+int got_BarrierAck(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
-	Drbd_BarrierAck_Packet *p = (Drbd_BarrierAck_Packet *)h;
+	struct Drbd_BarrierAck_Packet *p = (struct Drbd_BarrierAck_Packet *)h;
 
 	tl_release(mdev, p->barrier, be32_to_cpu(p->set_size));
 	dec_ap_pending(mdev);
@@ -3217,33 +3217,33 @@
 
 struct asender_cmd {
 	size_t pkt_size;
-	int (*process)(drbd_dev *mdev, Drbd_Header *h);
+	int (*process)(struct drbd_conf *mdev, struct Drbd_Header *h);
 };
 
 int drbd_asender(struct Drbd_thread *thi)
 {
-	drbd_dev *mdev = thi->mdev;
-	Drbd_Header *h = &mdev->meta.rbuf.head;
+	struct drbd_conf *mdev = thi->mdev;
+	struct Drbd_Header *h = &mdev->meta.rbuf.head;
 
 	int rv, len;
 	void *buf    = h;
 	int received = 0;
-	int expect   = sizeof(Drbd_Header);
+	int expect   = sizeof(struct Drbd_Header);
 	int cmd      = -1;
 	int empty;
 
 	static struct asender_cmd asender_tbl[] = {
-	[Ping]		= { sizeof(Drbd_Header),	    got_Ping },
-	[PingAck]	= { sizeof(Drbd_Header),	    got_PingAck },
-	[RecvAck]	= { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
-	[WriteAck]	= { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
-	[RSWriteAck]	= { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
-	[DiscardAck]	= { sizeof(Drbd_BlockAck_Packet),   got_BlockAck },
-	[NegAck]	= { sizeof(Drbd_BlockAck_Packet),   got_NegAck },
-	[NegDReply]	= { sizeof(Drbd_BlockAck_Packet),   got_NegDReply },
-	[NegRSDReply]	= { sizeof(Drbd_BlockAck_Packet),   got_NegRSDReply},
-	[BarrierAck]	= { sizeof(Drbd_BarrierAck_Packet), got_BarrierAck },
-	[StateChgReply] = { sizeof(Drbd_RqS_Reply_Packet),  got_RqSReply },
+	[Ping]		= { sizeof(struct Drbd_Header),	    got_Ping },
+	[PingAck]	= { sizeof(struct Drbd_Header),	    got_PingAck },
+	[RecvAck]	= { sizeof(struct Drbd_BlockAck_Packet),   got_BlockAck },
+	[WriteAck]	= { sizeof(struct Drbd_BlockAck_Packet),   got_BlockAck },
+	[RSWriteAck]	= { sizeof(struct Drbd_BlockAck_Packet),   got_BlockAck },
+	[DiscardAck]	= { sizeof(struct Drbd_BlockAck_Packet),   got_BlockAck },
+	[NegAck]	= { sizeof(struct Drbd_BlockAck_Packet),   got_NegAck },
+	[NegDReply]	= { sizeof(struct Drbd_BlockAck_Packet),   got_NegDReply },
+	[NegRSDReply]	= { sizeof(struct Drbd_BlockAck_Packet),   got_NegRSDReply},
+	[BarrierAck]	= { sizeof(struct Drbd_BarrierAck_Packet), got_BarrierAck },
+	[StateChgReply] = { sizeof(struct Drbd_RqS_Reply_Packet),  got_RqSReply },
 	};
 
 	sprintf(current->comm, "drbd%d_asender", mdev_to_minor(mdev));
@@ -3322,7 +3322,7 @@
 				goto err;
 			}
 			expect = asender_tbl[cmd].pkt_size;
-			ERR_IF(len != expect-sizeof(Drbd_Header)) {
+			ERR_IF(len != expect-sizeof(struct Drbd_Header)) {
 				dump_packet(mdev, mdev->meta.socket, 1, (void *)h, __FILE__, __LINE__);
 				DUMPI(expect);
 			}
@@ -3334,7 +3334,7 @@
 
 			buf	 = h;
 			received = 0;
-			expect	 = sizeof(Drbd_Header);
+			expect	 = sizeof(struct Drbd_Header);
 			cmd	 = -1;
 		}
 	}

Modified: branches/drbd-8.0-for-linus/drbd/drbd_req.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 14:15:33 UTC (rev 2996)
@@ -35,10 +35,10 @@
 
 /* outside of the ifdef
  * because of the _print_rq_state(,FIXME) in barrier_acked */
-void _print_rq_state(drbd_request_t *req, const char *txt)
+void _print_rq_state(struct drbd_request *req, const char *txt)
 {
 	const unsigned long s = req->rq_state;
-	drbd_dev *mdev = req->mdev;
+	struct drbd_conf *mdev = req->mdev;
 	const int rw = (req->master_bio == NULL ||
 			bio_data_dir(req->master_bio) == WRITE) ?
 		'W' : 'R';
@@ -61,9 +61,9 @@
 
 /* #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)
+void _print_req_mod(struct drbd_request *req, enum drbd_req_event what)
 {
-	drbd_dev *mdev = req->mdev;
+	struct drbd_conf *mdev = req->mdev;
 	const int rw = (req->master_bio == NULL ||
 			bio_data_dir(req->master_bio) == WRITE) ?
 		'W' : 'R';
@@ -105,7 +105,7 @@
 #define print_req_mod(T, W)
 #endif
 
-static void _req_is_done(drbd_dev *mdev, drbd_request_t *req, const int rw)
+static void _req_is_done(struct drbd_conf *mdev, struct drbd_request *req, const int rw)
 {
 	const unsigned long s = req->rq_state;
 	/* if it was a write, we may have to set the corresponding
@@ -179,10 +179,10 @@
 	}
 }
 
-static void _about_to_complete_local_write(drbd_dev *mdev, drbd_request_t *req)
+static void _about_to_complete_local_write(struct drbd_conf *mdev, struct drbd_request *req)
 {
 	const unsigned long s = req->rq_state;
-			drbd_request_t *i;
+			struct drbd_request *i;
 			struct Tl_epoch_entry *e;
 			struct hlist_node *n;
 			struct hlist_head *slot;
@@ -237,7 +237,7 @@
 #undef OVERLAPS
 }
 
-static void _complete_master_bio(drbd_dev *mdev, drbd_request_t *req, int error)
+static void _complete_master_bio(struct drbd_conf *mdev, struct drbd_request *req, int error)
 {
 	dump_bio(mdev, req->master_bio, 1);
 	bio_endio(req->master_bio, req->master_bio->bi_size, error);
@@ -245,10 +245,10 @@
 	dec_ap_bio(mdev);
 }
 
-void _req_may_be_done(drbd_request_t *req, int error)
+void _req_may_be_done(struct drbd_request *req, int error)
 {
 	const unsigned long s = req->rq_state;
-	drbd_dev *mdev = req->mdev;
+	struct drbd_conf *mdev = req->mdev;
 	int rw;
 
 	print_rq_state(req, "_req_may_be_done");
@@ -350,12 +350,12 @@
  * second hlist_for_each_entry becomes a noop. This is even simpler than to
  * grab a reference on the net_conf, and check for the two_primaries flag...
  */
-STATIC int _req_conflicts(drbd_request_t *req)
+int _req_conflicts(struct drbd_request *req)
 {
-	drbd_dev *mdev = req->mdev;
+	struct drbd_conf *mdev = req->mdev;
 	const sector_t sector = req->sector;
 	const int size = req->size;
-	drbd_request_t *i;
+	struct drbd_request *i;
 	struct Tl_epoch_entry *e;
 	struct hlist_node *n;
 	struct hlist_head *slot;
@@ -431,9 +431,9 @@
  * Though I think it is likely that we break this again into many
  * static inline void _req_mod_ ## what (req) ...
  */
-void _req_mod(drbd_request_t *req, drbd_req_event_t what, int error)
+void _req_mod(struct drbd_request *req, enum drbd_req_event what, int error)
 {
-	drbd_dev *mdev = req->mdev;
+	struct drbd_conf *mdev = req->mdev;
 	MUST_HOLD(&mdev->req_lock);
 
 	if (error && (bio_rw(req->master_bio) != READA))
@@ -716,7 +716,7 @@
  *   since size may be bigger than BM_BLOCK_SIZE,
  *   we may need to check several bits.
  */
-STATIC int drbd_may_do_local_read(drbd_dev *mdev, sector_t sector, int size)
+int drbd_may_do_local_read(struct drbd_conf *mdev, sector_t sector, int size)
 {
 	unsigned long sbnr, ebnr, bnr;
 	sector_t esector, nr_sectors;
@@ -758,12 +758,12 @@
  * anyways, and then see that it does not work there and then.
  */
 
-STATIC int
-drbd_make_request_common(drbd_dev *mdev, int rw, int size,
+int
+drbd_make_request_common(struct drbd_conf *mdev, int rw, int size,
 			 sector_t sector, struct bio *bio)
 {
 	struct drbd_barrier *b = NULL;
-	drbd_request_t *req;
+	struct drbd_request *req;
 	int local, remote;
 	int err = -EIO;
 
@@ -1020,7 +1020,7 @@
  * return 1
  * otherwise return 0
  */
-static int drbd_fail_request_early(drbd_dev *mdev, int is_write)
+static int drbd_fail_request_early(struct drbd_conf *mdev, int is_write)
 {
 	/* Unconfigured */
 	if (mdev->state.conn == Disconnecting &&
@@ -1061,7 +1061,7 @@
 int drbd_make_request_26(request_queue_t *q, struct bio *bio)
 {
 	unsigned int s_enr, e_enr;
-	struct Drbd_Conf *mdev = (drbd_dev *) q->queuedata;
+	struct drbd_conf *mdev = (struct drbd_conf *) q->queuedata;
 
 	if (drbd_fail_request_early(mdev, bio_data_dir(bio) & WRITE)) {
 		bio_endio(bio, bio->bi_size, -EPERM);
@@ -1137,7 +1137,7 @@
  * we should use DRBD_MAX_SEGMENT_SIZE instead of AL_EXTENT_SIZE */
 int drbd_merge_bvec(request_queue_t *q, struct bio *bio, struct bio_vec *bvec)
 {
-	struct Drbd_Conf *mdev = (drbd_dev *) q->queuedata;
+	struct drbd_conf *mdev = (struct drbd_conf *) q->queuedata;
 	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 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.h	2007-07-24 14:15:33 UTC (rev 2996)
@@ -39,7 +39,7 @@
    Try to get the locking right :) */
 
 /*
- * Objects of type drbd_request_t do only exist on a Primary node, and are
+ * Objects of type struct drbd_request do only exist on a Primary node, and are
  * associated with IO requests originating from the block layer above us.
  *
  * There are quite a few things that may happen to a drbd request
@@ -84,7 +84,7 @@
  *  (dot -Tps2 documentation/drbd-request-state-overview.dot | display -)
  */
 
-typedef enum {
+enum drbd_req_event {
 	created,
 	to_be_send,
 	to_be_submitted,
@@ -110,7 +110,7 @@
 	read_completed_with_error,
 	write_completed_with_error,
 	completed_ok,
-} drbd_req_event_t;
+};
 
 /* encoding of request states for now.  we don't actually need that many bits.
  * we don't need to do atomic bit operations either, since most of the time we
@@ -207,14 +207,14 @@
 #define RQ_NET_MASK        (((1UL << __RQ_NET_MAX)-1) & ~RQ_LOCAL_MASK) /* 0x1f8 */
 
 /* epoch entries */
-static inline struct hlist_head *ee_hash_slot(drbd_dev *mdev, sector_t sector)
+static inline struct hlist_head *ee_hash_slot(struct drbd_conf *mdev, sector_t sector)
 {
 	BUG_ON(mdev->ee_hash_s == 0);
 	return mdev->ee_hash + ((unsigned int)(sector>>HT_SHIFT) % mdev->ee_hash_s);
 }
 
 /* transfer log (drbd_request objects) */
-static inline struct hlist_head *tl_hash_slot(drbd_dev *mdev, sector_t sector)
+static inline struct hlist_head *tl_hash_slot(struct drbd_conf *mdev, sector_t sector)
 {
 	BUG_ON(mdev->tl_hash_s == 0);
 	return mdev->tl_hash +
@@ -223,11 +223,11 @@
 
 /* when we receive the answer for a read request,
  * verify that we actually know about it */
-static inline drbd_request_t *_ack_id_to_req(drbd_dev *mdev, u64 id, sector_t sector)
+static inline struct drbd_request *_ack_id_to_req(struct drbd_conf *mdev, u64 id, sector_t sector)
 {
 	struct hlist_head *slot = tl_hash_slot(mdev, sector);
 	struct hlist_node *n;
-	drbd_request_t *req;
+	struct drbd_request *req;
 
 	hlist_for_each_entry(req, n, slot, colision) {
 		if ((unsigned long)req == (unsigned long)id) {
@@ -247,7 +247,7 @@
 }
 
 /* application reads (drbd_request objects) */
-static struct hlist_head *ar_hash_slot(drbd_dev *mdev, sector_t sector)
+static struct hlist_head *ar_hash_slot(struct drbd_conf *mdev, sector_t sector)
 {
 	return mdev->app_reads_hash
 		+ ((unsigned int)(sector) % APP_R_HSIZE);
@@ -255,11 +255,11 @@
 
 /* when we receive the answer for a read request,
  * verify that we actually know about it */
-static inline drbd_request_t *_ar_id_to_req(drbd_dev *mdev, u64 id, sector_t sector)
+static inline struct drbd_request *_ar_id_to_req(struct drbd_conf *mdev, u64 id, sector_t sector)
 {
 	struct hlist_head *slot = ar_hash_slot(mdev, sector);
 	struct hlist_node *n;
-	drbd_request_t *req;
+	struct drbd_request *req;
 
 	hlist_for_each_entry(req, n, slot, colision) {
 		if ((unsigned long)req == (unsigned long)id) {
@@ -270,10 +270,10 @@
 	return NULL;
 }
 
-static inline drbd_request_t *drbd_req_new(drbd_dev *mdev, struct bio *bio_src)
+static inline struct drbd_request *drbd_req_new(struct drbd_conf *mdev, struct bio *bio_src)
 {
 	struct bio *bio;
-	drbd_request_t *req = mempool_alloc(drbd_request_mempool, GFP_NOIO);
+	struct drbd_request *req = mempool_alloc(drbd_request_mempool, GFP_NOIO);
 	if (likely(req)) {
 		bio = bio_clone(bio_src, GFP_NOIO); /* XXX cannot fail?? */
 
@@ -294,7 +294,7 @@
 	return req;
 }
 
-static inline void drbd_req_free(drbd_request_t *req)
+static inline void drbd_req_free(struct drbd_request *req)
 {
 	mempool_free(req, drbd_request_mempool);
 }
@@ -306,13 +306,13 @@
 
 /* aparently too large to be inlined...
  * moved to drbd_req.c */
-extern void _req_may_be_done(drbd_request_t *req, int error);
-extern void _req_mod(drbd_request_t *req, drbd_req_event_t what, int error);
+extern void _req_may_be_done(struct drbd_request *req, int error);
+extern void _req_mod(struct drbd_request *req, enum drbd_req_event what, int error);
 
 /* If you need it irqsave, do it your self! */
-static inline void req_mod(drbd_request_t *req, drbd_req_event_t what, int error)
+static inline void req_mod(struct drbd_request *req, enum drbd_req_event what, int error)
 {
-	drbd_dev *mdev = req->mdev;
+	struct drbd_conf *mdev = req->mdev;
 	spin_lock_irq(&mdev->req_lock);
 	_req_mod(req, what, error);
 	spin_unlock_irq(&mdev->req_lock);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_strings.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_strings.c	2007-07-24 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/drbd_strings.c	2007-07-24 14:15:33 UTC (rev 2996)
@@ -83,23 +83,23 @@
 	[-SS_DeviceInUse] = "Device is held open by someone"
 };
 
-const char *conns_to_name(drbd_conns_t s)
+const char *conns_to_name(enum drbd_conns s)
 {
 	/* enums are unsigned... */
 	return s > PausedSyncT ? "TOO_LARGE" : drbd_conn_s_names[s];
 }
 
-const char *roles_to_name(drbd_role_t s)
+const char *roles_to_name(enum drbd_role s)
 {
 	return s > Secondary   ? "TOO_LARGE" : drbd_role_s_names[s];
 }
 
-const char *disks_to_name(drbd_disks_t s)
+const char *disks_to_name(enum drbd_disk_state s)
 {
 	return s > UpToDate    ? "TOO_LARGE" : drbd_disk_s_names[s];
 }
 
-const char *set_st_err_name(set_st_err_t err)
+const char *set_st_err_name(enum set_st_err err)
 {
 	return err < SS_DeviceInUse ? "TOO_SMALL" :
 	       err > SS_TwoPrimaries ? "TOO_LARGE"

Modified: branches/drbd-8.0-for-linus/drbd/drbd_worker.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 14:15:33 UTC (rev 2996)
@@ -79,7 +79,7 @@
 {
 	unsigned long flags = 0;
 	struct Tl_epoch_entry *e = NULL;
-	struct Drbd_Conf *mdev;
+	struct drbd_conf *mdev;
 	int uptodate = bio_flagged(bio, BIO_UPTODATE);
 
 	e = bio->bi_private;
@@ -123,7 +123,7 @@
 {
 	unsigned long flags = 0;
 	struct Tl_epoch_entry *e = NULL;
-	drbd_dev *mdev;
+	struct drbd_conf *mdev;
 	sector_t e_sector;
 	int do_wake;
 	int is_syncer_req;
@@ -195,9 +195,9 @@
 int drbd_endio_pri(struct bio *bio, unsigned int bytes_done, int error)
 {
 	unsigned long flags;
-	drbd_request_t *req = bio->bi_private;
-	drbd_dev *mdev = req->mdev;
-	drbd_req_event_t what;
+	struct drbd_request *req = bio->bi_private;
+	struct drbd_conf *mdev = req->mdev;
+	enum drbd_req_event what;
 	int uptodate = bio_flagged(bio, BIO_UPTODATE);
 
 	/* see above */
@@ -222,9 +222,9 @@
 	return 0;
 }
 
-int w_io_error(drbd_dev *mdev, struct drbd_work *w, int cancel)
+int w_io_error(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
-	drbd_request_t *req = (drbd_request_t *)w;
+	struct drbd_request *req = (struct drbd_request *)w;
 	int ok;
 
 	/* FIXME send a "set_out_of_sync" packet to the peer
@@ -247,9 +247,9 @@
 	return ok;
 }
 
-int w_read_retry_remote(drbd_dev *mdev, struct drbd_work *w, int cancel)
+int w_read_retry_remote(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
-	drbd_request_t *req = (drbd_request_t *)w;
+	struct drbd_request *req = (struct drbd_request *)w;
 
 	spin_lock_irq(&mdev->req_lock);
 	if ( cancel ||
@@ -270,7 +270,7 @@
 	return w_send_read_req(mdev, w, 0);
 }
 
-int w_resync_inactive(drbd_dev *mdev, struct drbd_work *w, int cancel)
+int w_resync_inactive(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
 	ERR_IF(cancel) return 1;
 	ERR("resync inactive, but callback triggered??\n");
@@ -280,7 +280,7 @@
 void resync_timer_fn(unsigned long data)
 {
 	unsigned long flags;
-	drbd_dev *mdev = (drbd_dev *) data;
+	struct drbd_conf *mdev = (struct drbd_conf *) data;
 	int queue;
 
 	spin_lock_irqsave(&mdev->req_lock, flags);
@@ -302,7 +302,7 @@
 
 #define SLEEP_TIME (HZ/10)
 
-int w_make_resync_request(drbd_dev *mdev, struct drbd_work *w, int cancel)
+int w_make_resync_request(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
 	unsigned long bit;
 	sector_t sector;
@@ -441,7 +441,7 @@
 	return 1;
 }
 
-int w_resync_finished(drbd_dev *mdev, struct drbd_work *w, int cancel)
+int w_resync_finished(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
 	kfree(w);
 
@@ -452,7 +452,7 @@
 	return 1;
 }
 
-int drbd_resync_finished(drbd_dev *mdev)
+int drbd_resync_finished(struct drbd_conf *mdev)
 {
 	unsigned long db, dt, dbdt;
 	int dstate, pdstate;
@@ -550,7 +550,7 @@
 /**
  * w_e_end_data_req: Send the answer (DataReply) in response to a DataRequest.
  */
-int w_e_end_data_req(drbd_dev *mdev, struct drbd_work *w, int cancel)
+int w_e_end_data_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
 	struct Tl_epoch_entry *e = (struct Tl_epoch_entry *)w;
 	int ok;
@@ -594,7 +594,7 @@
 /**
  * w_e_end_rsdata_req: Send the answer (RSDataReply) to a RSDataRequest.
  */
-int w_e_end_rsdata_req(drbd_dev *mdev, struct drbd_work *w, int cancel)
+int w_e_end_rsdata_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
 	struct Tl_epoch_entry *e = (struct Tl_epoch_entry *)w;
 	int ok;
@@ -647,17 +647,17 @@
 	return ok;
 }
 
-int w_prev_work_done(drbd_dev *mdev, struct drbd_work *w, int cancel)
+int w_prev_work_done(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
 	clear_bit(WORK_PENDING, &mdev->flags);
 	wake_up(&mdev->misc_wait);
 	return 1;
 }
 
-int w_send_barrier(drbd_dev *mdev, struct drbd_work *w, int cancel)
+int w_send_barrier(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
 	struct drbd_barrier *b = (struct drbd_barrier *)w;
-	Drbd_Barrier_Packet *p = &mdev->data.sbuf.Barrier;
+	struct Drbd_Barrier_Packet *p = &mdev->data.sbuf.Barrier;
 	int ok = 1;
 
 	/* really avoid racing with tl_clear.  w.cb may have been referenced
@@ -678,13 +678,13 @@
 	/* inc_ap_pending was done where this was queued.
 	 * dec_ap_pending will be done in got_BarrierAck
 	 * or (on connection loss) in w_clear_epoch.  */
-	ok = _drbd_send_cmd(mdev, mdev->data.socket, Barrier, (Drbd_Header *)p, sizeof(*p), 0);
+	ok = _drbd_send_cmd(mdev, mdev->data.socket, Barrier, (struct Drbd_Header *)p, sizeof(*p), 0);
 	drbd_put_data_sock(mdev);
 
 	return ok;
 }
 
-int w_send_write_hint(drbd_dev *mdev, struct drbd_work *w, int cancel)
+int w_send_write_hint(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
 	if (cancel) return 1;
 	return drbd_send_short_cmd(mdev, UnplugRemote);
@@ -693,9 +693,9 @@
 /**
  * w_send_dblock: Send a mirrored write request.
  */
-int w_send_dblock(drbd_dev *mdev, struct drbd_work *w, int cancel)
+int w_send_dblock(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
-	drbd_request_t *req = (drbd_request_t *)w;
+	struct drbd_request *req = (struct drbd_request *)w;
 	int ok;
 
 	if (unlikely(cancel)) {
@@ -712,9 +712,9 @@
 /**
  * w_send_read_req: Send a read requests.
  */
-int w_send_read_req(drbd_dev *mdev, struct drbd_work *w, int cancel)
+int w_send_read_req(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
-	drbd_request_t *req = (drbd_request_t *)w;
+	struct drbd_request *req = (struct drbd_request *)w;
 	int ok;
 
 	if (unlikely(cancel)) {
@@ -740,9 +740,9 @@
 	return ok;
 }
 
-STATIC void drbd_global_lock(void)
+void drbd_global_lock(void)
 {
-	drbd_dev *mdev;
+	struct drbd_conf *mdev;
 	int i;
 
 	local_irq_disable();
@@ -754,9 +754,9 @@
 	}
 }
 
-STATIC void drbd_global_unlock(void)
+void drbd_global_unlock(void)
 {
-	drbd_dev *mdev;
+	struct drbd_conf *mdev;
 	int i;
 
 	for (i = 0; i < minor_count; i++) {
@@ -768,9 +768,9 @@
 	local_irq_enable();
 }
 
-STATIC int _drbd_may_sync_now(drbd_dev *mdev)
+int _drbd_may_sync_now(struct drbd_conf *mdev)
 {
-	drbd_dev *odev = mdev;
+	struct drbd_conf *odev = mdev;
 
 	while (1) {
 		if (odev->sync_conf.after == -1) return 1;
@@ -789,9 +789,9 @@
  * pause their resynchronisation.
  * Called from process context only ( ioctl and after_state_ch ).
  */
-STATIC int _drbd_pause_after(drbd_dev *mdev)
+int _drbd_pause_after(struct drbd_conf *mdev)
 {
-	drbd_dev *odev;
+	struct drbd_conf *odev;
 	int i, rv = 0;
 
 	for (i = 0; i < minor_count; i++) {
@@ -812,9 +812,9 @@
  * process, and causes them to resume.
  * Called from process context only ( ioctl and worker ).
  */
-STATIC int _drbd_resume_next(drbd_dev *mdev)
+int _drbd_resume_next(struct drbd_conf *mdev)
 {
-	drbd_dev *odev;
+	struct drbd_conf *odev;
 	int i, rv = 0;
 
 	for (i = 0; i < minor_count; i++) {
@@ -831,21 +831,21 @@
 	return rv;
 }
 
-void resume_next_sg(drbd_dev *mdev)
+void resume_next_sg(struct drbd_conf *mdev)
 {
 	drbd_global_lock();
 	_drbd_resume_next(mdev);
 	drbd_global_unlock();
 }
 
-void suspend_other_sg(drbd_dev *mdev)
+void suspend_other_sg(struct drbd_conf *mdev)
 {
 	drbd_global_lock();
 	_drbd_pause_after(mdev);
 	drbd_global_unlock();
 }
 
-void drbd_alter_sa(drbd_dev *mdev, int na)
+void drbd_alter_sa(struct drbd_conf *mdev, int na)
 {
 	int changes;
 
@@ -868,9 +868,9 @@
  * Note, this function might bring you directly into one of the
  * PausedSync* states.
  */
-void drbd_start_resync(drbd_dev *mdev, drbd_conns_t side)
+void drbd_start_resync(struct drbd_conf *mdev, enum drbd_conns side)
 {
-	drbd_state_t os, ns;
+	union drbd_state_t os, ns;
 	int r = 0;
 
 	MTRACE(TraceTypeResync, TraceLvlSummary,
@@ -945,7 +945,7 @@
 
 int drbd_worker(struct Drbd_thread *thi)
 {
-	drbd_dev *mdev = thi->mdev;
+	struct drbd_conf *mdev = thi->mdev;
 	struct drbd_work *w = 0;
 	LIST_HEAD(work_list);
 	int intr = 0, i;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-24 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-24 14:15:33 UTC (rev 2996)
@@ -36,7 +36,7 @@
 }
 
 /* sets the number of 512 byte sectors of our virtual device */
-static inline void drbd_set_my_capacity(drbd_dev *mdev,
+static inline void drbd_set_my_capacity(struct drbd_conf *mdev,
 					sector_t size)
 {
 	/* set_capacity(mdev->this_bdev->bd_disk, size); */
@@ -108,7 +108,7 @@
 /*
  * used to submit our private bio
  */
-static inline void drbd_generic_make_request(drbd_dev *mdev, int rw, int fault_type, struct bio *bio)
+static inline void drbd_generic_make_request(struct drbd_conf *mdev, int rw, int fault_type, struct bio *bio)
 {
 	bio->bi_rw = rw; /* on the receiver side, e->..rw was not yet defined. */
 
@@ -126,7 +126,7 @@
 		generic_make_request(bio);
 }
 
-static inline void drbd_plug_device(drbd_dev *mdev)
+static inline void drbd_plug_device(struct drbd_conf *mdev)
 {
 	request_queue_t *q;
 	q = bdev_get_queue(mdev->this_bdev);
@@ -144,7 +144,7 @@
 	spin_unlock_irq(q->queue_lock);
 }
 
-static inline int _drbd_send_bio(drbd_dev *mdev, struct bio *bio)
+static inline int _drbd_send_bio(struct drbd_conf *mdev, struct bio *bio)
 {
 	struct bio_vec *bvec = bio_iovec(bio);
 	struct page *page = bvec->bv_page;

Modified: branches/drbd-8.0-for-linus/drbd/linux/drbd.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/linux/drbd.h	2007-07-24 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd.h	2007-07-24 14:15:33 UTC (rev 2996)
@@ -121,12 +121,12 @@
 #define DRBD_PROT_B   2
 #define DRBD_PROT_C   3
 
-typedef enum {
+enum drbd_role {
 	Unknown = 0,
 	Primary = 1,     /* role */
 	Secondary = 2,   /* role */
 	role_mask = 3,
-} drbd_role_t;
+};
 
 /* The order of these constants is important.
  * The lower ones (<WFReportParams) indicate
@@ -137,7 +137,7 @@
  * Skipped should be < Connected,
  * so writes on a Primary after Skipped sync are not mirrored either ?
  */
-typedef enum {
+enum drbd_conns {
 	StandAlone,
 	Disconnecting,  /* Temporal state on the way to StandAlone. */
 	Unconnected,    /* >= Unconnected -> inc_net() succeeds */
@@ -170,9 +170,9 @@
 	PausedSyncS,
 	PausedSyncT,
 	conn_mask = 31
-} drbd_conns_t;
+};
 
-typedef enum {
+enum drbd_disk_state {
 	Diskless,
 	Attaching,      /* In the process of reading the meta-data */
 	Failed,         /* Becomes Diskless as soon as we told it the peer */
@@ -184,9 +184,9 @@
 	Consistent,     /* Might be Outdated, might be UpToDate ... */
 	UpToDate,       /* Only this disk state allows applications' IO ! */
 	disk_mask = 15
-} drbd_disks_t;
+};
 
-typedef union {
+union drbd_state_t {
 	struct {
 		unsigned role : 2 ;   /* 3/4      primary/secondary/unknown */
 		unsigned peer : 2 ;   /* 3/4      primary/secondary/unknown */
@@ -200,9 +200,9 @@
 		unsigned _pad : 11;   /* 0        unused */
 	};
 	unsigned int i;
-} drbd_state_t;
+};
 
-typedef enum {
+enum set_st_err {
 	SS_CW_NoNeed = 4,
 	SS_CW_Success = 3,
 	SS_NothingToDo = 2,
@@ -219,13 +219,13 @@
 	SS_CW_FailedByPeer = -10,
 	SS_IsDiskLess = -11,
 	SS_DeviceInUse = -12
-} set_st_err_t;
+};
 
 /* from drbd_strings.c */
-extern const char *conns_to_name(drbd_conns_t);
-extern const char *roles_to_name(drbd_role_t);
-extern const char *disks_to_name(drbd_disks_t);
-extern const char *set_st_err_name(set_st_err_t);
+extern const char *conns_to_name(enum drbd_conns);
+extern const char *roles_to_name(enum drbd_role);
+extern const char *disks_to_name(enum drbd_disk_state);
+extern const char *set_st_err_name(enum set_st_err);
 
 #ifndef BDEVNAME_SIZE
 # define BDEVNAME_SIZE 32

Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 13:38:35 UTC (rev 2995)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 14:15:33 UTC (rev 2996)
@@ -125,7 +125,7 @@
 	return NULL;
 }
 
-STATIC struct lc_element *lc_evict(struct lru_cache *lc)
+struct lc_element *lc_evict(struct lru_cache *lc)
 {
 	struct list_head  *n;
 	struct lc_element *e;
@@ -160,7 +160,7 @@
 	RETURN();
 }
 
-STATIC struct lc_element *lc_get_unused_element(struct lru_cache *lc)
+struct lc_element *lc_get_unused_element(struct lru_cache *lc)
 {
 	struct list_head *n;
 
@@ -171,7 +171,7 @@
 	return list_entry(n, struct lc_element, list);
 }
 
-STATIC int lc_unused_element_available(struct lru_cache *lc)
+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 */

From drbd-cvs at lists.linbit.com  Tue Jul 24 16:19:09 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 16:19:11 2007
Subject: [DRBD-cvs] svn commit by lars - r2997 -
	branches/drbd-8.0-for-linus/drbd -
	2a1752739664f9dee865ad696cd87e0d26d19486 got rid of vol
Message-ID: <20070724141909.6141940095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 16:19:07 +0200 (Tue, 24 Jul 2007)
New Revision: 2997

Modified:
   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
Log:
2a1752739664f9dee865ad696cd87e0d26d19486 got rid of volatile; got rid of extern in .c file


Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 14:15:33 UTC (rev 2996)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 14:19:07 UTC (rev 2997)
@@ -582,7 +582,7 @@
 	 *	--lge */
 
 	smp_rmb();
-	return (volatile int)thi->t_state;
+	return thi->t_state;
 }
 
 
@@ -782,8 +782,8 @@
 
 	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;
+	unsigned long last_received; /* in jiffies, either socket */
+	unsigned int ko_count;
 	struct drbd_work  resync_work,
 			  unplug_work,
 			  md_sync_work;
@@ -929,6 +929,7 @@
 	ScheduleAfter	= 4,
 };
 
+extern void drbd_init_set_defaults(struct drbd_conf *mdev);
 extern int drbd_change_state(struct drbd_conf *mdev, enum chg_state_flags f,
 			     union drbd_state_t mask, union drbd_state_t val);
 extern void drbd_force_state(struct drbd_conf *, union drbd_state_t, union drbd_state_t);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 14:15:33 UTC (rev 2996)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 14:19:07 UTC (rev 2997)
@@ -119,9 +119,6 @@
 
 module_param_string(usermode_helper, usermode_helper, sizeof(usermode_helper), 0644);
 
-/* global panic flag */
-volatile int drbd_did_panic = 0;
-
 /* in 2.6.x, our device mapping and config info contains our virtual gendisks
  * as member "struct gendisk *vdisk;"
  */
@@ -1521,7 +1518,7 @@
 	drop_it =   mdev->meta.socket == sock
 		|| !mdev->asender.task
 		|| get_t_state(&mdev->asender) != Running
-		|| (volatile int)mdev->state.conn < Connected;
+		|| mdev->state.conn < Connected;
 
 	if (drop_it)
 		return TRUE;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 14:15:33 UTC (rev 2996)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 14:19:07 UTC (rev 2997)
@@ -116,7 +116,6 @@
 	tags = (unsigned short *)((char *)tags + arg->member ## _len);
 #include "linux/drbd_nl.h"
 
-extern void drbd_init_set_defaults(struct drbd_conf *mdev);
 void drbd_bcast_ev_helper(struct drbd_conf *mdev, char *helper_name);
 void drbd_nl_send_reply(struct cn_msg *, int);
 

From drbd-cvs at lists.linbit.com  Tue Jul 24 16:57:12 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 16:57:14 2007
Subject: [DRBD-cvs] svn commit by lars - r2998 -
	branches/drbd-8.0-for-linus/drbd -
	402d48f63eb57eaf7e802de1d35b502f93ab38a9 got rid of unn
Message-ID: <20070724145712.505B640095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 16:57:11 +0200 (Tue, 24 Jul 2007)
New Revision: 2998

Modified:
   branches/drbd-8.0-for-linus/drbd/drbd_main.c
   branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
Log:
402d48f63eb57eaf7e802de1d35b502f93ab38a9 got rid of unneccessary 'if (p != NULL) kfree(p);'


Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 14:19:07 UTC (rev 2997)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 14:57:11 UTC (rev 2998)
@@ -174,10 +174,8 @@
 {
 	D_ASSERT(mdev->oldest_barrier == mdev->newest_barrier);
 	kfree(mdev->oldest_barrier);
-	if (mdev->tl_hash) {
-		kfree(mdev->tl_hash);
-		mdev->tl_hash_s = 0;
-	}
+	kfree(mdev->tl_hash);
+	mdev->tl_hash_s = 0;
 }
 
 /**
@@ -888,10 +886,8 @@
 	/* Lost contact to peer's copy of the data */
 	if ( (os.pdsk >= Inconsistent && os.pdsk != DUnknown && os.pdsk != Outdated) &&
 	     (ns.pdsk < Inconsistent || ns.pdsk == DUnknown || ns.pdsk == Outdated) ) {
-		if (mdev->p_uuid) {
-			kfree(mdev->p_uuid);
-			mdev->p_uuid = NULL;
-		}
+		kfree(mdev->p_uuid);
+		mdev->p_uuid = NULL;
 		if (inc_local(mdev)) {
 			if (ns.role == Primary && mdev->bc->md.uuid[Bitmap] == 0) {
 				/* Only do it if we have not yet done it... */
@@ -2233,26 +2229,22 @@
 			if (mdev->md_io_tmpp)
 				__free_page(mdev->md_io_tmpp);
 
-			if (mdev->act_log) lc_free(mdev->act_log);
+			if (mdev->act_log)
+				lc_free(mdev->act_log);
 
-			if (mdev->ee_hash) {
-				kfree(mdev->ee_hash);
-				mdev->ee_hash_s = 0;
-				mdev->ee_hash = NULL;
-			}
-			if (mdev->tl_hash) {
-				kfree(mdev->tl_hash);
-				mdev->tl_hash_s = 0;
-				mdev->tl_hash = NULL;
-			}
-			if (mdev->app_reads_hash) {
-				kfree(mdev->app_reads_hash);
-				mdev->app_reads_hash = NULL;
-			}
-			if (mdev->p_uuid) {
-				kfree(mdev->p_uuid);
-				mdev->p_uuid = NULL;
-			}
+			kfree(mdev->ee_hash);
+			mdev->ee_hash_s = 0;
+			mdev->ee_hash = NULL;
+
+			kfree(mdev->tl_hash);
+			mdev->tl_hash_s = 0;
+			mdev->tl_hash = NULL;
+
+			kfree(mdev->app_reads_hash);
+			mdev->app_reads_hash = NULL;
+
+			kfree(mdev->p_uuid);
+			mdev->p_uuid = NULL;
 		}
 		drbd_destroy_mempools();
 	}

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 14:19:07 UTC (rev 2997)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 14:57:11 UTC (rev 2998)
@@ -2657,10 +2657,8 @@
 	drbd_queue_work(&mdev->data.work, &prev_work_done);
 	wait_event(mdev->misc_wait, !test_bit(WORK_PENDING, &mdev->flags));
 
-	if (mdev->p_uuid) {
-		kfree(mdev->p_uuid);
-		mdev->p_uuid = NULL;
-	}
+	kfree(mdev->p_uuid);
+	mdev->p_uuid = NULL;
 
 	/* queue cleanup for the worker.
 	 * FIXME this should go into after_state_ch  */
@@ -2693,21 +2691,18 @@
 
 	if (os.conn == Disconnecting) {
 		wait_event( mdev->misc_wait, atomic_read(&mdev->net_cnt) == 0 );
-		if (mdev->ee_hash) {
-			kfree(mdev->ee_hash);
-			mdev->ee_hash = NULL;
-			mdev->ee_hash_s = 0;
-		}
 
-		if (mdev->tl_hash) {
-			kfree(mdev->tl_hash);
-			mdev->tl_hash = NULL;
-			mdev->tl_hash_s = 0;
-		}
-		if (mdev->cram_hmac_tfm) {
-			crypto_free_hash(mdev->cram_hmac_tfm);
-			mdev->cram_hmac_tfm = NULL;
-		}
+		kfree(mdev->ee_hash);
+		mdev->ee_hash = NULL;
+		mdev->ee_hash_s = 0;
+
+		kfree(mdev->tl_hash);
+		mdev->tl_hash = NULL;
+		mdev->tl_hash_s = 0;
+
+		crypto_free_hash(mdev->cram_hmac_tfm);
+		mdev->cram_hmac_tfm = NULL;
+
 		kfree(mdev->net_conf);
 		mdev->net_conf = NULL;
 		drbd_request_state(mdev, NS(conn, StandAlone));

From drbd-cvs at lists.linbit.com  Tue Jul 24 19:02:32 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Tue Jul 24 19:02:36 2007
Subject: [DRBD-cvs] svn commit by lars - r2999 - in
	branches/drbd-8.0-for-linus/drbd: . linux -
	3aa0336d147a3c7ead5c2f71509ebdb5fb774020 got rid of war
Message-ID: <20070724170232.5489C40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-24 19:02:29 +0200 (Tue, 24 Jul 2007)
New Revision: 2999

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_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/lru_cache.c
   branches/drbd-8.0-for-linus/drbd/lru_cache.h
Log:
3aa0336d147a3c7ead5c2f71509ebdb5fb774020 got rid of warnings for some '#if 0'ed code
476323d033c1fc06cff0968faf65bf0b560d598d wrapped many long lines; a few are left, unfortunately
dad50ae97f11ab4ee3aa037545065021c82ca637 cleanup some of "declaring multiple variables together should be avoided"
cd9230bb862e29dd5568a4649a8717ae55a8d0cd unindent labels


Modified: branches/drbd-8.0-for-linus/drbd/drbd_actlog.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/drbd_actlog.c	2007-07-24 17:02:29 UTC (rev 2999)
@@ -41,6 +41,8 @@
 {
 	struct bio *bio = bio_alloc(GFP_NOIO, 1);
 	struct completion event;
+	const int do_fail = FAULT_ACTIVE(mdev,
+		(rw & WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD);
 	int ok;
 
 	bio->bi_bdev = bdev->md_bdev;
@@ -51,7 +53,7 @@
 	bio->bi_private = &event;
 	bio->bi_end_io = drbd_md_io_complete;
 
-	if (FAULT_ACTIVE(mdev, (rw & WRITE)? DRBD_FAULT_MD_WR:DRBD_FAULT_MD_RD)) {
+	if (do_fail) {
 		bio->bi_rw |= rw;
 		bio_endio(bio, bio->bi_size, -EIO);
 	} else {
@@ -72,7 +74,8 @@
 int drbd_md_sync_page_io(struct drbd_conf *mdev, struct drbd_backing_dev *bdev,
 			 sector_t sector, int rw)
 {
-	int hardsect, mask, ok, offset = 0;
+	int hardsect, mask, ok;
+	int offset = 0;
 	struct page *iop = mdev->md_io_page;
 
 	D_ASSERT(semaphore_is_locked(&mdev->md_io_mutex));
@@ -116,7 +119,8 @@
 						   sector, READ, hardsect);
 
 			if (unlikely(!ok)) {
-				ERR("drbd_md_sync_page_io(,%llus,READ [hardsect!=512]) failed!\n",
+				ERR("drbd_md_sync_page_io(,%llus,"
+				    "READ [hardsect!=512]) failed!\n",
 				    (unsigned long long)sector);
 				return 0;
 			}
@@ -190,7 +194,8 @@
 	unsigned long     al_flags = 0;
 
 	spin_lock_irq(&mdev->al_lock);
-	bm_ext = (struct bm_extent *) lc_find(mdev->resync, enr/AL_EXT_PER_BM_SECT);
+	bm_ext = (struct bm_extent *)
+		lc_find(mdev->resync, enr/AL_EXT_PER_BM_SECT);
 	if (unlikely(bm_ext != NULL)) {
 		if (test_bit(BME_NO_WRITES, &bm_ext->flags)) {
 			spin_unlock_irq(&mdev->al_lock);
@@ -317,10 +322,6 @@
 	buffer->updates[0].pos = cpu_to_be32(n);
 	buffer->updates[0].extent = cpu_to_be32(new_enr);
 
-#if 0	/* Use this printf with the test_al.pl program */
-	ERR("T%03d S%03d=E%06d\n", mdev->al_tr_number, n, new_enr);
-#endif
-
 	xor_sum ^= new_enr;
 
 	mx = min_t(int, AL_EXTENTS_PT,
@@ -338,18 +339,21 @@
 		xor_sum ^= LC_FREE;
 	}
 	mdev->al_tr_cycle += AL_EXTENTS_PT;
-	if (mdev->al_tr_cycle >= mdev->act_log->nr_elements) mdev->al_tr_cycle = 0;
+	if (mdev->al_tr_cycle >= mdev->act_log->nr_elements)
+		mdev->al_tr_cycle = 0;
 
 	buffer->xor_sum = cpu_to_be32(xor_sum);
 
-	sector = mdev->bc->md.md_offset + mdev->bc->md.al_offset + mdev->al_tr_pos;
+	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)) {
 		drbd_chk_io_error(mdev, 1, TRUE);
 		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);
@@ -401,11 +405,17 @@
 int drbd_al_read_log(struct drbd_conf *mdev, struct drbd_backing_dev *bdev)
 {
 	struct al_transaction *buffer;
-	int from = -1, to = -1, i, cnr, overflow = 0, rv;
-	u32 from_tnr = -1, to_tnr = 0;
+	int i;
+	int rv;
+	int mx;
+	int cnr;
 	int active_extents = 0;
 	int transactions = 0;
-	int mx;
+	int overflow = 0;
+	int from = -1;
+	int to = -1;
+	u32 from_tnr = -1;
+	u32 to_tnr = 0;
 
 	mx = div_ceil(mdev->act_log->nr_elements, AL_EXTENTS_PT);
 
@@ -481,7 +491,7 @@
 
 		transactions++;
 
-	cancel:
+cancel:
 		if (i == to) break;
 		i++;
 		if (i > mx) i = 0;
@@ -489,7 +499,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 */
@@ -549,11 +560,13 @@
 			     unsigned int enr,
 			     struct drbd_atodb_wait *wc)
 {
-	int i = 0, allocated_page = 0;
 	struct bio *bio;
 	struct page *np;
-	sector_t on_disk_sector = enr + mdev->bc->md.md_offset + mdev->bc->md.bm_offset;
+	sector_t on_disk_sector = enr + mdev->bc->md.md_offset
+				      + mdev->bc->md.bm_offset;
 	int offset;
+	int i = 0;
+	int allocated_page = 0;
 
 	/* check if that enr is already covered by an already created bio. */
 	while ( (bio = bios[i]) ) {
@@ -770,7 +783,8 @@
 
 	if ( !inc_local_if_state(mdev, Attaching) ) {
 		if (DRBD_ratelimit(5*HZ, 5))
-			WARN("Can not update on disk bitmap, local IO disabled.\n");
+			WARN("Can not update on disk bitmap, "
+			     "local IO disabled.\n");
 		return 1;
 	}
 
@@ -779,12 +793,15 @@
 
 	kfree(udw);
 
-	if (drbd_bm_total_weight(mdev) <= mdev->rs_failed &&
-	   ( mdev->state.conn == SyncSource || mdev->state.conn == SyncTarget ||
-	     mdev->state.conn == PausedSyncS || mdev->state.conn == PausedSyncT ) ) {
-		drbd_bm_lock(mdev);
-		drbd_resync_finished(mdev);
-		drbd_bm_unlock(mdev);
+	if (drbd_bm_total_weight(mdev) <= mdev->rs_failed) {
+		switch (mdev->state.conn) {
+		case SyncSource:  case SyncTarget:
+		case PausedSyncS: case PausedSyncT:
+			drbd_bm_lock(mdev);
+			drbd_resync_finished(mdev);
+			drbd_bm_unlock(mdev);
+		default: /* nothing to do */;
+		}
 	}
 	drbd_bcast_sync_progress(mdev);
 
@@ -821,9 +838,11 @@
 			else
 				ext->rs_failed += count;
 			if (ext->rs_left < ext->rs_failed) {
-				ERR("BAD! sector=%llus enr=%u rs_left=%d rs_failed=%d count=%d\n",
+				ERR("BAD! sector=%llus enr=%u rs_left=%d "
+				    "rs_failed=%d count=%d\n",
 				     (unsigned long long)sector,
-				     ext->lce.lc_number, ext->rs_left, ext->rs_failed, count);
+				     ext->lce.lc_number, ext->rs_left,
+				     ext->rs_failed, count);
 				dump_stack();
 				/* FIXME brrrgs. should never happen! */
 				drbd_force_state(mdev, NS(conn, Disconnecting));
@@ -885,7 +904,8 @@
  * called by worker on SyncTarget and receiver on SyncSource.
  *
  */
-void __drbd_set_in_sync(struct drbd_conf *mdev, sector_t sector, int size, const char *file, const unsigned int line)
+void __drbd_set_in_sync(struct drbd_conf *mdev, sector_t sector, int size,
+		       const char *file, const unsigned int line)
 {
 	/* Is called from worker and receiver context _only_ */
 	unsigned long sbnr, ebnr, lbnr, bnr;
@@ -936,7 +956,8 @@
 	if (count) {
 		/* 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. */
+			/* should be roling marks,
+			 * but we estimate only anyways. */
 			if ( mdev->rs_mark_left != drbd_bm_total_weight(mdev) &&
 			    mdev->state.conn != PausedSyncT &&
 			    mdev->state.conn != PausedSyncS ) {
@@ -948,8 +969,8 @@
 			drbd_try_clear_on_disk_bm(mdev, sector, count, TRUE);
 			dec_local(mdev);
 		}
-		/* just wake_up unconditional now,
-		 * various lc_chaged(), lc_put() in drbd_try_clear_on_disk_bm(). */
+		/* just wake_up unconditional now, various lc_chaged(),
+		 * lc_put() in drbd_try_clear_on_disk_bm(). */
 		wake_up = 1;
 	}
 	spin_unlock_irqrestore(&mdev->al_lock, flags);
@@ -958,12 +979,14 @@
 
 /*
  * this is intended to set one request worth of data out of sync.
- * affects at least 1 bit, and at most 1+DRBD_MAX_SEGMENT_SIZE/BM_BLOCK_SIZE bits.
+ * affects at least 1 bit,
+ * and at most 1+DRBD_MAX_SEGMENT_SIZE/BM_BLOCK_SIZE bits.
  *
  * called by tl_clear and drbd_send_dblock (==drbd_make_request).
  * so this can be _any_ process.
  */
-void __drbd_set_out_of_sync(struct drbd_conf *mdev, sector_t sector, int size, const char *file, const unsigned int line)
+void __drbd_set_out_of_sync(struct drbd_conf *mdev, sector_t sector, int size,
+			    const char *file, const unsigned int line)
 {
 	unsigned long sbnr, ebnr, lbnr;
 	sector_t esector, nr_sectors;
@@ -987,7 +1010,8 @@
 	*/
 
 	if (size <= 0 || (size & 0x1ff) != 0 || size > DRBD_MAX_SEGMENT_SIZE) {
-		ERR("sector: %llus, size: %d\n", (unsigned long long)sector, size);
+		ERR("sector: %llus, size: %d\n",
+			(unsigned long long)sector, size);
 		return;
 	}
 
@@ -1005,7 +1029,8 @@
 	ebnr = BM_SECT_TO_BIT(esector);
 
 	MTRACE(TraceTypeResync, TraceLvlMetrics,
-	       INFO("drbd_set_out_of_sync: sector=%llus size=%u sbnr=%lu ebnr=%lu\n",
+	       INFO("drbd_set_out_of_sync: sector=%llus size=%u "
+		    "sbnr=%lu ebnr=%lu\n",
 		    (unsigned long long)sector, size, sbnr, ebnr);
 	    );
 
@@ -1162,7 +1187,8 @@
 			INFO("dropping %u, aparently got 'synced' "
 			     "by application io\n", mdev->resync_wenr);
 		);
-		bm_ext = (struct bm_extent *)lc_find(mdev->resync, mdev->resync_wenr);
+		bm_ext = (struct bm_extent *)
+			lc_find(mdev->resync, mdev->resync_wenr);
 		if (bm_ext) {
 			D_ASSERT(!test_bit(BME_LOCKED, &bm_ext->flags));
 			D_ASSERT(test_bit(BME_NO_WRITES, &bm_ext->flags));
@@ -1216,7 +1242,7 @@
 		mdev->resync_locked++;
 		goto check_al;
 	}
-  check_al:
+check_al:
 	MTRACE(TraceTypeResync, TraceLvlAll,
 		INFO("checking al for %u\n", enr);
 	);
@@ -1227,12 +1253,12 @@
 			goto try_again;
 	}
 	set_bit(BME_LOCKED, &bm_ext->flags);
-  proceed:
+proceed:
 	mdev->resync_wenr = LC_FREE;
 	spin_unlock_irq(&mdev->al_lock);
 	return 0;
 
-  try_again:
+try_again:
 	MTRACE(TraceTypeResync, TraceLvlAll,
 		INFO("need to try again for %u\n", enr);
 	);
@@ -1262,7 +1288,8 @@
 
 	if (bm_ext->lce.refcnt == 0) {
 		spin_unlock_irqrestore(&mdev->al_lock, flags);
-		ERR("drbd_rs_complete_io(,%llu [=%u]) called, but refcnt is 0!?\n",
+		ERR("drbd_rs_complete_io(,%llu [=%u]) called, "
+		    "but refcnt is 0!?\n",
 		    (unsigned long long)sector, enr);
 		return;
 	}
@@ -1335,8 +1362,8 @@
 			bm_ext = (struct bm_extent *) lc_entry(mdev->resync, i);
 			if (bm_ext->lce.lc_number == LC_FREE) continue;
 			if (bm_ext->lce.lc_number == mdev->resync_wenr) {
-				INFO("dropping %u in drbd_rs_del_all, "
-				     "aparently got 'synced' by application io\n",
+				INFO("dropping %u in drbd_rs_del_all, aparently"
+				     " got 'synced' by application io\n",
 				     mdev->resync_wenr);
 				D_ASSERT(!test_bit(BME_LOCKED, &bm_ext->flags));
 				D_ASSERT(test_bit(BME_NO_WRITES, &bm_ext->flags));
@@ -1424,8 +1451,8 @@
 			dec_local(mdev);
 		}
 
-		/* just wake_up unconditional now,
-		 * various lc_chaged(), lc_put() in drbd_try_clear_on_disk_bm(). */
+		/* just wake_up unconditional now, various lc_chaged(),
+		 * lc_put() in drbd_try_clear_on_disk_bm(). */
 		wake_up = 1;
 	}
 	spin_unlock_irq(&mdev->al_lock);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/drbd_bitmap.c	2007-07-24 17:02:29 UTC (rev 2999)
@@ -302,8 +302,10 @@
 int drbd_bm_resize(struct drbd_conf *mdev, sector_t capacity)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
-	unsigned long bits, bytes, words, *nbm, *obm = 0;
-	int err = 0, growing;
+	unsigned long *nbm, *obm = NULL;
+	unsigned long bits, bytes, words;
+	int err = 0;
+	int growing;
 
 	ERR_IF(!b) return -ENOMEM;
 
@@ -338,7 +340,8 @@
 		*/
 		words = ALIGN(bits, 64) >> LN2_BPL;
 
-		D_ASSERT((u64)bits <= (((u64)mdev->bc->md.md_size_sect-MD_BM_OFFSET) << 12));
+		D_ASSERT((u64)bits <=
+			(((u64)mdev->bc->md.md_size_sect-MD_BM_OFFSET) << 12));
 
 		if (words == b->bm_words) {
 			/* optimize: capacity has changed,
@@ -357,7 +360,8 @@
 			bytes = (words+1)*sizeof(long);
 			nbm = vmalloc(bytes);
 			if (!nbm) {
-				ERR("bitmap: failed to vmalloc %lu bytes\n", bytes);
+				ERR("bitmap: failed to vmalloc %lu bytes\n",
+					bytes);
 				err = -ENOMEM;
 				goto out;
 			}
@@ -369,7 +373,8 @@
 		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));
+			memcpy(nbm, obm, min_t(size_t, b->bm_words, words)
+								*sizeof(long));
 		}
 		growing = words > b->bm_words;
 		if (growing) {
@@ -548,7 +553,8 @@
 	spin_unlock_irq(&b->bm_lock);
 }
 
-int drbd_bm_async_io_complete(struct bio *bio, unsigned int bytes_done, int error)
+int drbd_bm_async_io_complete(struct bio *bio,
+	unsigned int bytes_done, int error)
 {
 	struct drbd_bitmap *b = bio->bi_private;
 	int uptodate = bio_flagged(bio, BIO_UPTODATE);
@@ -578,17 +584,21 @@
 	return 0;
 }
 
-void drbd_bm_page_io_async(struct drbd_conf *mdev, struct drbd_bitmap *b, int page_nr, int rw)
+void drbd_bm_page_io_async(struct drbd_conf *mdev, struct drbd_bitmap *b,
+			   int page_nr, int rw)
 {
 	/* we are process context. we always get a bio */
 	/* THINK: do we need GFP_NOIO here? */
 	struct bio *bio = bio_alloc(GFP_KERNEL, 1);
-	struct page *page = vmalloc_to_page((char *)(b->bm) + (PAGE_SIZE*page_nr));
+	struct page *page = vmalloc_to_page((char *)(b->bm)
+						+ (PAGE_SIZE*page_nr));
 	unsigned int len;
-	sector_t on_disk_sector = mdev->bc->md.md_offset + mdev->bc->md.bm_offset;
+	sector_t on_disk_sector =
+		mdev->bc->md.md_offset + mdev->bc->md.bm_offset;
 	on_disk_sector += ((sector_t)page_nr) << (PAGE_SHIFT-9);
 
-	/* this might happen with very small flexible external meta data device */
+	/* this might happen with very small
+	 * flexible external meta data device */
 	len = min_t(unsigned int, PAGE_SIZE,
 		(drbd_md_last_sector(mdev->bc) - on_disk_sector + 1)<<9);
 
@@ -615,8 +625,10 @@
  */
 int drbd_bm_read_sect(struct drbd_conf *mdev, unsigned long enr)
 {
-	sector_t on_disk_sector = mdev->bc->md.md_offset + mdev->bc->md.bm_offset + enr;
-	int bm_words, num_words, offset, err  = 0;
+	sector_t on_disk_sector = mdev->bc->md.md_offset
+				+ mdev->bc->md.bm_offset + enr;
+	int bm_words, num_words, offset;
+	int err = 0;
 
 	down(&mdev->md_io_mutex);
 	if (drbd_md_sync_page_io(mdev, mdev->bc, on_disk_sector, READ)) {
@@ -770,8 +782,10 @@
  */
 int drbd_bm_write_sect(struct drbd_conf *mdev, unsigned long enr)
 {
-	sector_t on_disk_sector = enr + mdev->bc->md.md_offset + mdev->bc->md.bm_offset;
-	int bm_words, num_words, offset, err  = 0;
+	sector_t on_disk_sector = enr + mdev->bc->md.md_offset
+				      + mdev->bc->md.bm_offset;
+	int bm_words, num_words, offset;
+	int err = 0;
 
 	down(&mdev->md_io_mutex);
 	bm_words  = drbd_bm_words(mdev);
@@ -925,7 +939,8 @@
 
 /* returns number of bits actually changed (0->1)
  * wants bitnr, not sector */
-int drbd_bm_set_bits_in_irq(struct drbd_conf *mdev, const unsigned long s, const unsigned long e)
+int drbd_bm_set_bits_in_irq(struct drbd_conf *mdev,
+	const unsigned long s, const unsigned long e)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long bitnr;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/drbd_int.h	2007-07-24 17:02:29 UTC (rev 2999)
@@ -185,7 +185,8 @@
 #endif
 #define ERR_IF(exp) if (({ \
 	int _b = (exp) != 0; \
-	if (_b) ERR("%s: (" #exp ") in %s:%d\n", __func__, __FILE__, __LINE__); \
+	if (_b) ERR("%s: (" #exp ") in %s:%d\n", \
+		__func__, __FILE__, __LINE__); \
 	 _b; \
 	}))
 
@@ -203,7 +204,8 @@
 };
 
 #ifdef DRBD_ENABLE_FAULTS
-extern unsigned int _drbd_insert_fault(struct drbd_conf *mdev, unsigned int type);
+extern unsigned int
+_drbd_insert_fault(struct drbd_conf *mdev, unsigned int type);
 static inline int
 drbd_insert_fault(struct drbd_conf *mdev, unsigned int type) {
     return (fault_rate &&
@@ -682,10 +684,10 @@
 	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 */
+	UNPLUG_REMOTE,		/* sending a "UnplugRemote" could help */
+	MD_DIRTY,		/* current uuids 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. */
+	USE_DEGR_WFC_T,		/* degr-wfc-timeout instead of wfc-timeout. */
 	CLUSTER_ST_CHANGE,	/* Cluster wide state change going on... */
 	CL_ST_CHG_SUCCESS,
 	CL_ST_CHG_FAIL,
@@ -751,7 +753,8 @@
 #define INTEGER(pn, pr, member) int member;
 #define INT64(pn, pr, member) __u64 member;
 #define BIT(pn, pr, member) unsigned member : 1;
-#define STRING(pn, pr, member, len) unsigned char member[len]; int member ## _len;
+#define STRING(pn, pr, member, len) \
+	unsigned char member[len]; int member ## _len;
 #include "linux/drbd_nl.h"
 
 struct drbd_backing_dev {
@@ -790,7 +793,9 @@
 	struct timer_list resync_timer;
 	struct timer_list md_sync_timer;
 
-	union drbd_state_t new_state_tmp; /* Used after attach while negotiating new disk state. */
+	/* Used after attach while negotiating new disk state. */
+	union drbd_state_t new_state_tmp;
+
 	union drbd_state_t state;
 	wait_queue_head_t misc_wait;
 	wait_queue_head_t state_wait;  /* upon each state change. */
@@ -804,7 +809,7 @@
 	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 local_cnt;	 /* Waiting for local completion */
 	atomic_t net_cnt;	 /* Users of net_conf */
 	spinlock_t req_lock;
 	struct drbd_barrier *unused_spare_barrier; /* for pre-allocation */
@@ -931,14 +936,17 @@
 
 extern void drbd_init_set_defaults(struct drbd_conf *mdev);
 extern int drbd_change_state(struct drbd_conf *mdev, enum chg_state_flags f,
-			     union drbd_state_t mask, union drbd_state_t val);
-extern void drbd_force_state(struct drbd_conf *, union drbd_state_t, union drbd_state_t);
-extern int _drbd_request_state(struct drbd_conf *, union drbd_state_t, union drbd_state_t,
-			       enum chg_state_flags);
-extern int _drbd_set_state(struct drbd_conf *, union drbd_state_t, enum chg_state_flags );
-extern void print_st_err(struct drbd_conf *, union drbd_state_t, union drbd_state_t, int );
-extern void after_state_ch(struct drbd_conf *mdev, union drbd_state_t os, union drbd_state_t ns,
-			   enum chg_state_flags);
+			union drbd_state_t mask, union drbd_state_t val);
+extern void drbd_force_state(struct drbd_conf *, union drbd_state_t,
+			union drbd_state_t);
+extern int _drbd_request_state(struct drbd_conf *, union drbd_state_t,
+			union drbd_state_t, enum chg_state_flags);
+extern int _drbd_set_state(struct drbd_conf *, union drbd_state_t,
+			enum chg_state_flags );
+extern void print_st_err(struct drbd_conf *, union drbd_state_t,
+			union drbd_state_t, int );
+extern void after_state_ch(struct drbd_conf *mdev, union drbd_state_t os,
+			union drbd_state_t ns, enum chg_state_flags);
 extern int  drbd_thread_start(struct Drbd_thread *thi);
 extern void _drbd_thread_stop(struct Drbd_thread *thi, int restart, int wait);
 extern void drbd_thread_signal(struct Drbd_thread *thi);
@@ -946,39 +954,42 @@
 extern void tl_release(struct drbd_conf *mdev, unsigned int barrier_nr,
 		       unsigned int set_size);
 extern void tl_clear(struct drbd_conf *mdev);
-extern struct drbd_barrier *_tl_add_barrier(struct drbd_conf *, struct drbd_barrier *);
+extern struct drbd_barrier *_tl_add_barrier(struct drbd_conf *,
+			struct drbd_barrier *);
 extern void drbd_free_sock(struct drbd_conf *mdev);
 extern int drbd_send(struct drbd_conf *mdev, struct socket *sock,
-		     void *buf, size_t size, unsigned msg_flags);
+			void *buf, size_t size, unsigned msg_flags);
 extern int drbd_send_protocol(struct drbd_conf *mdev);
 extern int drbd_send_uuids(struct drbd_conf *mdev);
 extern int drbd_send_sync_uuid(struct drbd_conf *mdev, u64 val);
 extern int drbd_send_sizes(struct drbd_conf *mdev);
 extern int drbd_send_state(struct drbd_conf *mdev);
 extern int _drbd_send_cmd(struct drbd_conf *mdev, struct socket *sock,
-			  enum Drbd_Packet_Cmd cmd, struct Drbd_Header *h,
-			  size_t size, unsigned msg_flags);
+			enum Drbd_Packet_Cmd cmd, struct Drbd_Header *h,
+			size_t size, unsigned msg_flags);
 #define USE_DATA_SOCKET 1
 #define USE_META_SOCKET 0
 extern int drbd_send_cmd(struct drbd_conf *mdev, int use_data_socket,
-			  enum Drbd_Packet_Cmd cmd, struct Drbd_Header *h, size_t size);
+			enum Drbd_Packet_Cmd cmd, struct Drbd_Header *h,
+			size_t size);
 extern int drbd_send_cmd2(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
-			  char *data, size_t size);
+			char *data, size_t size);
 extern int drbd_send_sync_param(struct drbd_conf *mdev, struct syncer_conf *sc);
 extern int drbd_send_b_ack(struct drbd_conf *mdev, u32 barrier_nr,
-			   u32 set_size);
+			u32 set_size);
 extern int drbd_send_ack(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
-			 struct Tl_epoch_entry *e);
+			struct Tl_epoch_entry *e);
 extern int drbd_send_ack_rp(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
-			    struct Drbd_BlockRequest_Packet *rp);
+			struct Drbd_BlockRequest_Packet *rp);
 extern int drbd_send_ack_dp(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
-			    struct Drbd_Data_Packet *dp);
+			struct Drbd_Data_Packet *dp);
 extern int _drbd_send_page(struct drbd_conf *mdev, struct page *page,
-			   int offset, size_t size);
+			int offset, size_t size);
 extern int drbd_send_block(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
 			   struct Tl_epoch_entry *e);
 extern int drbd_send_dblock(struct drbd_conf *mdev, struct drbd_request *req);
-extern int _drbd_send_barrier(struct drbd_conf *mdev, struct drbd_barrier *barrier);
+extern int _drbd_send_barrier(struct drbd_conf *mdev,
+			struct drbd_barrier *barrier);
 extern int drbd_send_drequest(struct drbd_conf *mdev, int cmd,
 			      sector_t sector, int size, u64 block_id);
 extern int drbd_send_bitmap(struct drbd_conf *mdev);
@@ -1010,14 +1021,16 @@
 /* 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 */
+/* Allows up to about 3.8TB */
+#define MD_BM_OFFSET (MD_AL_OFFSET + MD_AL_MAX_SIZE)
 
-#define MD_HARDSECT_B	 9     /* Since the smalles IO unit is usually 512 byte */
+/* Since the smalles IO unit is usually 512 byte */
+#define MD_HARDSECT_B	 9
 #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 */
+#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
@@ -1147,7 +1160,8 @@
 extern int  drbd_bm_write_sect(struct drbd_conf *mdev, unsigned long enr);
 extern int  drbd_bm_read(struct drbd_conf *mdev);
 extern int  drbd_bm_write(struct drbd_conf *mdev);
-extern unsigned long drbd_bm_ALe_set_all(struct drbd_conf *mdev, unsigned long al_enr);
+extern unsigned long drbd_bm_ALe_set_all(struct drbd_conf *mdev,
+		unsigned long al_enr);
 extern size_t	     drbd_bm_words(struct drbd_conf *mdev);
 extern sector_t      drbd_bm_capacity(struct drbd_conf *mdev);
 extern unsigned long drbd_bm_find_next(struct drbd_conf *mdev);
@@ -1155,23 +1169,19 @@
 extern unsigned long drbd_bm_total_weight(struct drbd_conf *mdev);
 extern int drbd_bm_rs_done(struct drbd_conf *mdev);
 /* for receive_bitmap */
-extern void drbd_bm_merge_lel(struct drbd_conf *mdev, size_t offset, size_t number,
-				unsigned long *buffer);
+extern void drbd_bm_merge_lel(struct drbd_conf *mdev, size_t offset,
+		size_t number, unsigned long *buffer);
 /* for _drbd_send_bitmap and drbd_bm_write_sect */
-extern void drbd_bm_get_lel(struct drbd_conf *mdev, size_t offset, size_t number,
-				unsigned long *buffer);
-/*
- * only used by drbd_bm_read_sect
-extern void drbd_bm_set_lel(struct drbd_conf *mdev, size_t offset, size_t number,
-				unsigned long* buffer);
-*/
+extern void drbd_bm_get_lel(struct drbd_conf *mdev, size_t offset,
+		size_t number, unsigned long *buffer);
 
 extern void __drbd_bm_lock(struct drbd_conf *mdev, char *file, int line);
 extern void drbd_bm_unlock(struct drbd_conf *mdev);
 #define drbd_bm_lock(mdev)    __drbd_bm_lock(mdev, __FILE__, __LINE__ )
 
 extern void _drbd_bm_recount_bits(struct drbd_conf *mdev, char *file, int line);
-#define drbd_bm_recount_bits(mdev) _drbd_bm_recount_bits(mdev,	__FILE__, __LINE__ )
+#define drbd_bm_recount_bits(mdev) \
+	_drbd_bm_recount_bits(mdev, __FILE__, __LINE__ )
 /* drbd_main.c */
 
 /* needs to be included here,
@@ -1260,7 +1270,8 @@
 /* Bio printing support */
 extern void _dump_bio(struct drbd_conf *mdev, struct bio *bio, int complete);
 
-static inline void dump_bio(struct drbd_conf *mdev, struct bio *bio, int complete)
+static inline void dump_bio(struct drbd_conf *mdev,
+		struct bio *bio, int complete)
 {
 	MTRACE(TraceTypeRq, TraceLvlSummary,
 	       _dump_bio(mdev, bio, complete);
@@ -1269,7 +1280,8 @@
 
 /* Packet dumping support */
 extern void _dump_packet(struct drbd_conf *mdev, struct socket *sock,
-			 int recv, union Drbd_Polymorph_Packet *p, char *file, int line);
+			 int recv, union Drbd_Polymorph_Packet *p,
+			 char *file, int line);
 
 static inline void
 dump_packet(struct drbd_conf *mdev, struct socket *sock,
@@ -1298,10 +1310,12 @@
 
 /* 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 sector_t drbd_new_dev_size(struct drbd_conf *,
+		struct drbd_backing_dev *);
 extern int drbd_determin_dev_size(struct drbd_conf *);
 extern void drbd_setup_queue_param(struct drbd_conf *mdev, unsigned int);
-extern int drbd_set_role(struct drbd_conf *mdev, enum drbd_role new_role, int force);
+extern int drbd_set_role(struct drbd_conf *mdev, enum drbd_role new_role,
+		int force);
 extern int drbd_ioctl(struct inode *inode, struct file *file,
 		      unsigned int cmd, unsigned long arg);
 enum drbd_disk_state drbd_try_outdate_peer(struct drbd_conf *mdev);
@@ -1316,8 +1330,8 @@
 extern void suspend_other_sg(struct drbd_conf *mdev);
 extern int drbd_resync_finished(struct drbd_conf *mdev);
 /* maybe rather drbd_main.c ? */
-extern int drbd_md_sync_page_io(struct drbd_conf *mdev, struct drbd_backing_dev *bdev,
-				sector_t sector, int rw);
+extern int drbd_md_sync_page_io(struct drbd_conf *mdev,
+		struct drbd_backing_dev *bdev, sector_t sector, int rw);
 /* worker callbacks */
 extern int w_req_cancel_conflict(struct drbd_conf *, struct drbd_work *, int);
 extern int w_read_retry_remote(struct drbd_conf *, struct drbd_work *, int);
@@ -1343,8 +1357,10 @@
 					    unsigned int data_size,
 					    unsigned int gfp_mask);
 extern void drbd_free_ee(struct drbd_conf *mdev, struct Tl_epoch_entry *e);
-extern void drbd_wait_ee_list_empty(struct drbd_conf *mdev, struct list_head *head);
-extern void _drbd_wait_ee_list_empty(struct drbd_conf *mdev, struct list_head *head);
+extern void drbd_wait_ee_list_empty(struct drbd_conf *mdev,
+		struct list_head *head);
+extern void _drbd_wait_ee_list_empty(struct drbd_conf *mdev,
+		struct list_head *head);
 extern void drbd_set_recv_tcq(struct drbd_conf *mdev, int tcq_enabled);
 extern void _drbd_clear_done_ee(struct drbd_conf *mdev);
 
@@ -1391,12 +1407,15 @@
 extern int drbd_try_rs_begin_io(struct drbd_conf *mdev, sector_t sector);
 extern void drbd_rs_cancel_all(struct drbd_conf *mdev);
 extern int drbd_rs_del_all(struct drbd_conf *mdev);
-extern void drbd_rs_failed_io(struct drbd_conf *mdev, sector_t sector, int size);
+extern void drbd_rs_failed_io(struct drbd_conf *mdev,
+		sector_t sector, int size);
 extern int drbd_al_read_log(struct drbd_conf *mdev, struct drbd_backing_dev *);
-extern void __drbd_set_in_sync(struct drbd_conf *mdev, sector_t sector, int size, const char *file, const unsigned int line);
+extern void __drbd_set_in_sync(struct drbd_conf *mdev, sector_t sector,
+		int size, const char *file, const unsigned int line);
 #define drbd_set_in_sync(mdev, sector, size) \
 	__drbd_set_in_sync(mdev, sector, size, __FILE__, __LINE__ )
-extern void __drbd_set_out_of_sync(struct drbd_conf *mdev, sector_t sector, int size, const char *file, const unsigned int line);
+extern void __drbd_set_out_of_sync(struct drbd_conf *mdev, sector_t sector,
+		int size, const char *file, const unsigned int line);
 #define drbd_set_out_of_sync(mdev, sector, size) \
 	__drbd_set_out_of_sync(mdev, sector, size, __FILE__, __LINE__ )
 extern void drbd_al_apply_to_bm(struct drbd_conf *mdev);
@@ -1421,26 +1440,28 @@
 #define user_isp_mask 1
 #define aftr_isp_mask 1
 
-#define NS(T, S) ({ union drbd_state_t mask; mask.i = 0; mask.T = T##_mask; mask; }), \
-		({ union drbd_state_t val; val.i = 0; val.T = (S); val; })
+#define NS(T, S) \
+	({ union drbd_state_t mask; mask.i = 0; mask.T = T##_mask; mask; }), \
+	({ union drbd_state_t val; val.i = 0; val.T = (S); val; })
 #define NS2(T1, S1, T2, S2) \
-		({ union drbd_state_t mask; mask.i = 0; mask.T1 = T1##_mask; \
-		  mask.T2 = T2##_mask; mask; }), \
-		({ union drbd_state_t val; val.i = 0; val.T1 = (S1); \
-		  val.T2 = (S2); val; })
+	({ union drbd_state_t mask; mask.i = 0; mask.T1 = T1##_mask; \
+	  mask.T2 = T2##_mask; mask; }), \
+	({ union drbd_state_t val; val.i = 0; val.T1 = (S1); \
+	  val.T2 = (S2); val; })
 #define NS3(T1, S1, T2, S2, T3, S3) \
-		({ union drbd_state_t mask; mask.i = 0; mask.T1 = T1##_mask; \
-		  mask.T2 = T2##_mask; mask.T3 = T3##_mask; mask; }), \
-		({ union drbd_state_t val; val.i = 0; val.T1 = (S1); \
-		  val.T2 = (S2); val.T3 = (S3); val; })
+	({ union drbd_state_t mask; mask.i = 0; mask.T1 = T1##_mask; \
+	  mask.T2 = T2##_mask; mask.T3 = T3##_mask; mask; }), \
+	({ union drbd_state_t val; val.i = 0; val.T1 = (S1); \
+	  val.T2 = (S2); val.T3 = (S3); val; })
 
-#define _NS(D, T, S) D, ({ union drbd_state_t ns; ns.i = D->state.i; ns.T = (S); ns; })
+#define _NS(D, T, S) \
+	D, ({ union drbd_state_t ns; ns.i = D->state.i; ns.T = (S); ns; })
 #define _NS2(D, T1, S1, T2, S2) \
-		D, ({ union drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
-		ns.T2 = (S2); ns; })
+	D, ({ union drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
+	ns.T2 = (S2); ns; })
 #define _NS3(D, T1, S1, T2, S2, T3, S3) \
-		D, ({ union drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
-		ns.T2 = (S2); ns.T3 = (S3); ns; })
+	D, ({ union drbd_state_t ns; ns.i = D->state.i; ns.T1 = (S1); \
+	ns.T2 = (S2); ns.T3 = (S3); ns; })
 
 static inline void drbd_state_lock(struct drbd_conf *mdev)
 {
@@ -1486,7 +1507,8 @@
 	}
 }
 
-static inline void drbd_chk_io_error(struct drbd_conf *mdev, int error, int forcedetach)
+static inline void drbd_chk_io_error(struct drbd_conf *mdev,
+	int error, int forcedetach)
 {
 	if (error) {
 		unsigned long flags;
@@ -1617,7 +1639,8 @@
 	wake_asender(mdev);
 }
 
-static inline int drbd_send_short_cmd(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd)
+static inline int drbd_send_short_cmd(struct drbd_conf *mdev,
+	enum Drbd_Packet_Cmd cmd)
 {
 	struct Drbd_Header h;
 	return drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, &h, sizeof(h));
@@ -1767,7 +1790,8 @@
  * inc_local: Returns TRUE when local IO is possible. If it returns
  * TRUE you should call dec_local() after IO is completed.
  */
-static inline int inc_local_if_state(struct drbd_conf *mdev, enum drbd_disk_state mins)
+static inline int inc_local_if_state(struct drbd_conf *mdev,
+	enum drbd_disk_state mins)
 {
 	int io_allowed;
 
@@ -1819,8 +1843,8 @@
 
 	/* we wait here
 	 *    as long as the device is suspended
-	 *    until the bitmap is no longer on the fly during connection handshake
-	 *    as long as we would exeed the max_buffer limit.
+	 *    until the bitmap is no longer on the fly during connection
+	 *    handshake as long as we would exeed the max_buffer limit.
 	 *
 	 * to avoid races with the reconnect code,
 	 * we need to atomic_inc within the spinlock. */
@@ -1905,7 +1929,9 @@
 {
 	if (!mdev->bc->backing_bdev) {
 		if (DRBD_ratelimit(5*HZ, 5)) {
-			ERR("backing_bdev==NULL in drbd_kick_lo! The following call trace is for debuggin purposes only. Don't worry.\n");
+			ERR("backing_bdev==NULL in drbd_kick_lo! "
+			    "The following call trace is for "
+			    "debuggin purposes only. Don't worry.\n");
 			dump_stack();
 		}
 	} else {

Modified: branches/drbd-8.0-for-linus/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/drbd_main.c	2007-07-24 17:02:29 UTC (rev 2999)
@@ -74,7 +74,8 @@
 int w_md_sync(struct drbd_conf *mdev, struct drbd_work *w, int unused);
 void md_sync_timer_fn(unsigned long data);
 
-MODULE_AUTHOR("Philipp Reisner <phil@linbit.com>, Lars Ellenberg <lars@linbit.com>");
+MODULE_AUTHOR("Philipp Reisner <phil@linbit.com>, "
+	      "Lars Ellenberg <lars@linbit.com>");
 MODULE_DESCRIPTION("drbd - Distributed Replicated Block Device v" REL_VERSION);
 MODULE_LICENSE("GPL");
 MODULE_PARM_DESC(minor_count, "Maximum number of drbd devices (1-255)");
@@ -93,10 +94,14 @@
 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 */
+/* bitmap of enabled faults */
+module_param(enable_faults, int, 0664);
+/* fault rate % value - applies to all enabled faults */
+module_param(fault_rate, int, 0664);
+/* count of faults inserted */
+module_param(fault_count, int, 0664);
+/* bitmap of devices to insert faults on */
+module_param(fault_devs, int, 0644);
 #endif
 
 /* module parameter, defined */
@@ -117,7 +122,8 @@
  * to run. Default is /sbin/drbdadm */
 char usermode_helper[80] = "/sbin/drbdadm";
 
-module_param_string(usermode_helper, usermode_helper, sizeof(usermode_helper), 0644);
+module_param_string(usermode_helper, usermode_helper,
+	sizeof(usermode_helper), 0644);
 
 /* in 2.6.x, our device mapping and config info contains our virtual gendisks
  * as member "struct gendisk *vdisk;"
@@ -183,7 +189,8 @@
  * It returns the previously newest barrier
  * (not the just created barrier) to the caller.
  */
-struct drbd_barrier *_tl_add_barrier(struct drbd_conf *mdev, struct drbd_barrier *new)
+struct drbd_barrier *_tl_add_barrier(struct drbd_conf *mdev,
+	struct drbd_barrier *new)
 {
 	struct drbd_barrier *newest_before;
 
@@ -309,7 +316,8 @@
 {
 	enum io_error_handler eh;
 	unsigned long flags;
-	int send, ok = 1;
+	int send;
+	int ok = 1;
 
 	eh = PassOn;
 	if (inc_local_if_state(mdev, Failed)) {
@@ -355,7 +363,8 @@
  * Returns TRUE if this state change should be preformed as a cluster wide
  * transaction. Of course it returns 0 as soon as the connection is lost.
  */
-int cl_wide_st_chg(struct drbd_conf *mdev, union drbd_state_t os, union drbd_state_t ns)
+int cl_wide_st_chg(struct drbd_conf *mdev,
+	union drbd_state_t os, union drbd_state_t ns)
 {
 	return ( os.conn >= Connected && ns.conn >= Connected &&
 		 ( ( os.role != Primary && ns.role == Primary ) ||
@@ -378,21 +387,26 @@
 	rv = _drbd_set_state(mdev, ns, f);
 	ns = mdev->state;
 	spin_unlock_irqrestore(&mdev->req_lock, flags);
-	if (rv == SS_Success && !(f&ScheduleAfter)) after_state_ch(mdev, os, ns, f);
+	if (rv == SS_Success && !(f&ScheduleAfter))
+		after_state_ch(mdev, os, ns, f);
 
 	return rv;
 }
 
-void drbd_force_state(struct drbd_conf *mdev, union drbd_state_t mask, union drbd_state_t val)
+void drbd_force_state(struct drbd_conf *mdev,
+	union drbd_state_t mask, union drbd_state_t val)
 {
 	drbd_change_state(mdev, ChgStateHard, mask, val);
 }
 
 int is_valid_state(struct drbd_conf *mdev, union drbd_state_t ns);
-int is_valid_state_transition(struct drbd_conf *, union drbd_state_t, union drbd_state_t);
-int drbd_send_state_req(struct drbd_conf *, union drbd_state_t, union drbd_state_t);
+int is_valid_state_transition(struct drbd_conf *,
+	union drbd_state_t, union drbd_state_t);
+int drbd_send_state_req(struct drbd_conf *,
+	union drbd_state_t, union drbd_state_t);
 
-enum set_st_err _req_st_cond(struct drbd_conf *mdev, union drbd_state_t mask, union drbd_state_t val)
+enum set_st_err _req_st_cond(struct drbd_conf *mdev,
+	union drbd_state_t mask, union drbd_state_t val)
 {
 	union drbd_state_t os, ns;
 	unsigned long flags;
@@ -413,7 +427,8 @@
 		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);
@@ -427,7 +442,8 @@
  * transition this function even does a cluster wide transaction.
  * It has a cousin named drbd_request_state(), which is always verbose.
  */
-int _drbd_request_state(struct drbd_conf *mdev, union drbd_state_t mask, union drbd_state_t val,
+int _drbd_request_state(struct drbd_conf *mdev,
+	union drbd_state_t mask, union drbd_state_t val,
 		       enum chg_state_flags f)
 {
 	unsigned long flags;
@@ -457,7 +473,8 @@
 			return rv;
 		}
 
-		wait_event(mdev->state_wait, (rv = _req_st_cond(mdev, mask, val)));
+		wait_event(mdev->state_wait,
+			(rv = _req_st_cond(mdev, mask, val)));
 
 		if (rv < SS_Success) {
 			/* nearly dead code. */
@@ -475,7 +492,8 @@
 	ns = mdev->state;
 	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
-	if (rv == SS_Success && !(f&ScheduleAfter)) after_state_ch(mdev, os, ns, f);
+	if (rv == SS_Success && !(f&ScheduleAfter))
+		after_state_ch(mdev, os, ns, f);
 
 	return rv;
 }
@@ -497,7 +515,8 @@
 	    );
 }
 
-void print_st_err(struct drbd_conf *mdev, union drbd_state_t os, union drbd_state_t ns, int err)
+void print_st_err(struct drbd_conf *mdev,
+	union drbd_state_t os, union drbd_state_t ns, int err)
 {
 	ERR("State change failed: %s\n", set_st_err_name(err));
 	print_st(mdev, " state", os);
@@ -571,7 +590,8 @@
 	return rv;
 }
 
-int is_valid_state_transition(struct drbd_conf *mdev, union drbd_state_t ns, union drbd_state_t os)
+int is_valid_state_transition(struct drbd_conf *mdev,
+	union drbd_state_t ns, union drbd_state_t os)
 {
 	int rv = SS_Success;
 
@@ -587,10 +607,12 @@
 	return rv;
 }
 
-int _drbd_set_state(struct drbd_conf *mdev, union drbd_state_t ns, enum chg_state_flags flags)
+int _drbd_set_state(struct drbd_conf *mdev,
+	union drbd_state_t ns, enum chg_state_flags flags)
 {
 	union drbd_state_t os;
-	int rv = SS_Success, warn_sync_abort = 0;
+	int rv = SS_Success;
+	int warn_sync_abort = 0;
 	enum fencing_policy fp;
 
 	MUST_HOLD(&mdev->req_lock);
@@ -815,8 +837,8 @@
 	return 1;
 }
 
-void after_state_ch(struct drbd_conf *mdev, union drbd_state_t os, union drbd_state_t ns,
-		    enum chg_state_flags flags)
+void after_state_ch(struct drbd_conf *mdev, union drbd_state_t os,
+	union drbd_state_t ns, enum chg_state_flags flags)
 {
 	enum fencing_policy fp;
 	u32 mdf;
@@ -884,22 +906,27 @@
 	}
 
 	/* Lost contact to peer's copy of the data */
-	if ( (os.pdsk >= Inconsistent && os.pdsk != DUnknown && os.pdsk != Outdated) &&
-	     (ns.pdsk < Inconsistent || ns.pdsk == DUnknown || ns.pdsk == Outdated) ) {
+	if ( (os.pdsk >= Inconsistent &&
+	      os.pdsk != DUnknown &&
+	      os.pdsk != Outdated)
+	&&   (ns.pdsk < Inconsistent ||
+	      ns.pdsk == DUnknown ||
+	      ns.pdsk == Outdated) ) {
 		kfree(mdev->p_uuid);
 		mdev->p_uuid = NULL;
 		if (inc_local(mdev)) {
-			if (ns.role == Primary && mdev->bc->md.uuid[Bitmap] == 0) {
-				/* Only do it if we have not yet done it... */
+			/* generate new uuid, unless we did already */
+			if (ns.role == Primary &&
+			    mdev->bc->md.uuid[Bitmap] == 0)
 				drbd_uuid_new_current(mdev);
-			}
+
+			/* Note: The condition ns.peer == Primary implies
+			 * that we are connected. Otherwise it would
+			 * be ns.peer == Unknown.
+			 * So this means our peer lost its disk.
+			 * No rotation into BitMap-UUID! A FullSync is
+			 * required after a primary detached from its disk! */
 			if (ns.peer == Primary) {
-				/* Note: The condition ns.peer == Primary implies
-				   that we are connected. Otherwise it would
-				   be ns.peer == Unknown. */
-				/* Our peer lost its disk.
-				   Not rotation into BitMap-UUID! A FullSync is
-				   required after a primary detached from it disk! */
 				u64 uuid;
 				INFO("Creating new current UUID [no BitMap]\n");
 				get_random_bytes(&uuid, sizeof(u64));
@@ -1102,7 +1129,8 @@
 			ERR("Couldn't start thread (%d)\n", pid);
 			return FALSE;
 		}
-		wait_for_completion(&thi->startstop); /* waits until thi->task is set */
+		/* waits until thi->task is set */
+		wait_for_completion(&thi->startstop);
 		D_ASSERT(thi->task);
 		D_ASSERT(get_t_state(thi) == Running);
 	} else {
@@ -1239,8 +1267,10 @@
 
 	dump_packet(mdev, mdev->data.socket, 0, (void *)&h, __FILE__, __LINE__);
 
-	ok = ( sizeof(h) == drbd_send(mdev, mdev->data.socket, &h, sizeof(h), 0) );
-	ok = ok && ( size == drbd_send(mdev, mdev->data.socket, data, size, 0) );
+	ok = ( sizeof(h) ==
+		drbd_send(mdev, mdev->data.socket, &h, sizeof(h), 0) );
+	ok = ok && ( size ==
+		drbd_send(mdev, mdev->data.socket, data, size, 0) );
 
 	drbd_put_data_sock(mdev);
 
@@ -1253,7 +1283,8 @@
 
 	p.rate      = cpu_to_be32(sc->rate);
 
-	return drbd_send_cmd(mdev, USE_DATA_SOCKET, SyncParam, (struct Drbd_Header *)&p, sizeof(p));
+	return drbd_send_cmd(mdev, USE_DATA_SOCKET, SyncParam,
+				(struct Drbd_Header *)&p, sizeof(p));
 }
 
 int drbd_send_protocol(struct drbd_conf *mdev)
@@ -1346,7 +1377,8 @@
 			     (struct Drbd_Header *)&p, sizeof(p));
 }
 
-int drbd_send_state_req(struct drbd_conf *mdev, union drbd_state_t mask, union drbd_state_t val)
+int drbd_send_state_req(struct drbd_conf *mdev,
+	union drbd_state_t mask, union drbd_state_t val)
 {
 	struct Drbd_Req_State_Packet p;
 
@@ -1372,7 +1404,8 @@
 int _drbd_send_bitmap(struct drbd_conf *mdev)
 {
 	int want;
-	int ok = TRUE, bm_i = 0;
+	int ok = TRUE;
+	int bm_i = 0;
 	size_t bm_words, num_words;
 	unsigned long *buffer;
 	struct Drbd_Header *p;
@@ -1386,10 +1419,11 @@
 	if (drbd_md_test_flag(mdev->bc, MDF_FullSync)) {
 		drbd_bm_set_all(mdev);
 		drbd_bm_write(mdev);
-		if (unlikely(mdev->state.disk <= Failed )) {
-			/* write_bm did fail! Leave full sync flag set in Meta Data
-			 * but otherwise process as per normal - need to tell other
-			 * side that a full resync is required! */
+
+		/* if write_bm did fail, Leave full sync flag set in Meta Data
+		 * but otherwise process as per normal - need to tell other
+		 * side that a full resync is required! */
+		if (unlikely(mdev->state.disk <= Failed)) {
 			ERR("Failed to write bitmap to disk!\n");
 		} else {
 			drbd_md_clear_flag(mdev, MDF_FullSync);
@@ -1434,7 +1468,8 @@
 	p.barrier  = barrier_nr;
 	p.set_size = cpu_to_be32(set_size);
 
-	ok = drbd_send_cmd(mdev, USE_META_SOCKET, BarrierAck, (struct Drbd_Header *)&p, sizeof(p));
+	ok = drbd_send_cmd(mdev, USE_META_SOCKET, BarrierAck,
+			(struct Drbd_Header *)&p, sizeof(p));
 	return ok;
 }
 
@@ -1457,14 +1492,16 @@
 	p.seq_num  = cpu_to_be32(atomic_add_return(1, &mdev->packet_seq));
 
 	if (!mdev->meta.socket || mdev->state.conn < Connected) return FALSE;
-	ok = drbd_send_cmd(mdev, USE_META_SOCKET, cmd, (struct Drbd_Header *)&p, sizeof(p));
+	ok = drbd_send_cmd(mdev, USE_META_SOCKET, cmd,
+				(struct Drbd_Header *)&p, sizeof(p));
 	return ok;
 }
 
 int drbd_send_ack_dp(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd,
 		     struct Drbd_Data_Packet *dp)
 {
-	const int header_size = sizeof(struct Drbd_Data_Packet) - sizeof(struct Drbd_Header);
+	const int header_size = sizeof(struct Drbd_Data_Packet)
+			      - sizeof(struct Drbd_Header);
 	int data_size  = ((struct Drbd_Header *)dp)->length - header_size;
 
 	return _drbd_send_ack(mdev, cmd, dp->sector, cpu_to_be32(data_size),
@@ -1477,7 +1514,8 @@
 	return _drbd_send_ack(mdev, cmd, rp->sector, rp->blksize, rp->block_id);
 }
 
-int drbd_send_ack(struct drbd_conf *mdev, enum Drbd_Packet_Cmd cmd, struct Tl_epoch_entry *e)
+int drbd_send_ack(struct drbd_conf *mdev,
+	enum Drbd_Packet_Cmd cmd, struct Tl_epoch_entry *e)
 {
 	return _drbd_send_ack(mdev, cmd,
 			      cpu_to_be64(e->sector),
@@ -1497,7 +1535,8 @@
 
 	/* FIXME BIO_RW_SYNC ? */
 
-	ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd, (struct Drbd_Header *)&p, sizeof(p));
+	ok = drbd_send_cmd(mdev, USE_DATA_SOCKET, cmd,
+				(struct Drbd_Header *)&p, sizeof(p));
 	return ok;
 }
 
@@ -1530,25 +1569,26 @@
 }
 
 /* The idea of sendpage seems to be to put some kind of reference
-   to the page into the skb, and to hand it over to the NIC. In
-   this process get_page() gets called.
-
-   As soon as the page was really sent over the network put_page()
-   gets called by some part of the network layer. [ NIC driver? ]
-
-   [ get_page() / put_page() increment/decrement the count. If count
-     reaches 0 the page will be freed. ]
-
-   This works nicely with pages from FSs.
-   But this means that in protocol A we might signal IO completion too early !
-
-   In order not to corrupt data during a resync we must make sure
-   that we do not reuse our own buffer pages (EEs) to early, therefore
-   we have the net_ee list.
-
-   XFS seems to have problems, still, it submits pages with page_count == 0!
-   As a workaround, we disable sendpage on pages with page_count == 0 or PageSlab.
-*/
+ * to the page into the skb, and to hand it over to the NIC. In
+ * this process get_page() gets called.
+ *
+ * As soon as the page was really sent over the network put_page()
+ * gets called by some part of the network layer. [ NIC driver? ]
+ *
+ * [ get_page() / put_page() increment/decrement the count. If count
+ *   reaches 0 the page will be freed. ]
+ *
+ * This works nicely with pages from FSs.
+ * But this means that in protocol A we might signal IO completion too early!
+ *
+ * In order not to corrupt data during a resync we must make sure
+ * that we do not reuse our own buffer pages (EEs) to early, therefore
+ * we have the net_ee list.
+ *
+ * XFS seems to have problems, still, it submits pages with page_count == 0!
+ * As a workaround, we disable sendpage on pages
+ * with page_count == 0 or PageSlab.
+ */
 int _drbd_no_send_page(struct drbd_conf *mdev, struct page *page,
 		   int offset, size_t size)
 {
@@ -1563,7 +1603,7 @@
 {
 	mm_segment_t oldfs = get_fs();
 	int sent, ok;
-	int len   = size;
+	int len = size;
 
 #ifdef SHOW_SENDPAGE_USAGE
 	unsigned long now = jiffies;
@@ -1623,7 +1663,7 @@
 	} while (len > 0 /* THINK && mdev->cstate >= Connected*/);
 	set_fs(oldfs);
 
-  out:
+out:
 	ok = (len == 0);
 	if (likely(ok))
 		mdev->send_cnt += size>>9;
@@ -1657,7 +1697,8 @@
 
 	p.head.magic   = BE_DRBD_MAGIC;
 	p.head.command = cpu_to_be16(Data);
-	p.head.length  = cpu_to_be16(sizeof(p)-sizeof(struct Drbd_Header)+req->size);
+	p.head.length  = cpu_to_be16(sizeof(p)
+			-sizeof(struct Drbd_Header)+req->size);
 
 	p.sector   = cpu_to_be64(req->sector);
 	p.block_id = (unsigned long)req;
@@ -1675,7 +1716,8 @@
 	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);
+	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)
 			ok = _drbd_send_bio(mdev, req->master_bio);
@@ -1699,7 +1741,8 @@
 
 	p.head.magic   = BE_DRBD_MAGIC;
 	p.head.command = cpu_to_be16(cmd);
-	p.head.length  = cpu_to_be16( sizeof(p)-sizeof(struct Drbd_Header) + e->size);
+	p.head.length  = cpu_to_be16( sizeof(p)
+			-sizeof(struct Drbd_Header) + e->size);
 
 	p.sector   = cpu_to_be64(e->sector);
 	p.block_id = e->block_id;
@@ -1713,7 +1756,8 @@
 		return 0;
 
 	dump_packet(mdev, mdev->data.socket, 0, (void *)&p, __FILE__, __LINE__);
-	ok = sizeof(p) == drbd_send(mdev, mdev->data.socket, &p, sizeof(p), MSG_MORE);
+	ok = sizeof(p) == drbd_send(mdev, mdev->data.socket, &p,
+					sizeof(p), MSG_MORE);
 	if (ok)
 		ok = _drbd_send_zc_bio(mdev, e->private_bio);
 
@@ -1843,7 +1887,8 @@
 	if (!mdev) return -ENODEV;
 
 	spin_lock_irqsave(&mdev->req_lock, flags);
-	/* to have a stable mdev->state.role and no race with updating open_cnt */
+	/* 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)
@@ -1901,7 +1946,8 @@
 			 * XXX this might be a good addition to drbd_queue_work
 			 * anyways, to detect "double queuing" ... */
 			if (list_empty(&mdev->unplug_work.list))
-				drbd_queue_work(&mdev->data.work, &mdev->unplug_work);
+				drbd_queue_work(&mdev->data.work,
+						&mdev->unplug_work);
 		}
 	}
 	spin_unlock_irq(&mdev->req_lock);
@@ -1913,7 +1959,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;
 	mdev->state = (union drbd_state_t) {
 		{ Secondary, Unknown, StandAlone, Diskless, DUnknown, 0 } };
 }
@@ -2146,7 +2192,7 @@
 
 	return 0;
 
-  Enomem:
+Enomem:
 	drbd_destroy_mempools(); /* in case we allocated some */
 	return -ENOMEM;
 }
@@ -2330,9 +2376,11 @@
 	       THIS_MODULE, THIS_MODULE->module_core);
 #endif
 
+	/* FIXME should be a compile time assert */
 	if (sizeof(struct Drbd_HandShake_Packet) != 80) {
 		printk(KERN_ERR DEVICE_NAME
-		       ": never change the size or layout of the HandShake packet.\n");
+		       ": never change the size or layout "
+		       "of the HandShake packet.\n");
 		return -EINVAL;
 	}
 
@@ -2367,7 +2415,8 @@
 	init_waitqueue_head(&drbd_pp_wait);
 
 	drbd_proc = NULL; /* play safe for drbd_cleanup */
-	minor_table = kzalloc(sizeof(struct drbd_conf *)*minor_count, GFP_KERNEL);
+	minor_table = kzalloc(sizeof(struct drbd_conf *)*minor_count,
+				GFP_KERNEL);
 	if (!minor_table) goto Enomem;
 
 	err = drbd_create_mempools();
@@ -2395,12 +2444,13 @@
 	       "Version: " REL_VERSION " (api:%d/proto:%d)\n",
 	       API_VERSION, PRO_VERSION);
 	printk(KERN_INFO DEVICE_NAME ": %s\n", drbd_buildtag());
-	printk(KERN_INFO DEVICE_NAME": registered as block device major %d\n", DRBD_MAJOR);
+	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! */
 
-  Enomem:
+Enomem:
 	drbd_cleanup();
 	if (err == -ENOMEM) /* currently always the case */
 		printk(KERN_ERR DEVICE_NAME ": ran out of memory\n");
@@ -2506,15 +2556,6 @@
 	D_ASSERT(drbd_md_ss__(mdev, mdev->bc) == mdev->bc->md.md_offset);
 	sector = mdev->bc->md.md_offset;
 
-#if 0
-	/* FIXME sooner or later I'd like to use the MD_DIRTY flag everywhere,
-	 * so we can avoid unneccessary md writes.
-	 */
-	ERR_IF (!test_bit(MD_DIRTY, &mdev->flags)) {
-		dump_stack();
-	}
-#endif
-
 	if (drbd_md_sync_page_io(mdev, mdev->bc, sector, WRITE)) {
 		clear_bit(MD_DIRTY, &mdev->flags);
 	} else {
@@ -2802,14 +2843,16 @@
 	static struct fault_random_state rrs = {0, 0};
 
 	unsigned int ret = (
-		(fault_devs == 0 || ((1 << mdev_to_minor(mdev)) & fault_devs) != 0) &&
+		(fault_devs == 0 ||
+			((1 << mdev_to_minor(mdev)) & fault_devs) != 0) &&
 		(((_drbd_fault_random(&rrs) % 100) + 1) <= fault_rate));
 
 	if (ret) {
 		fault_count++;
 
 		if (printk_ratelimit())
-			WARN("***Simulating %s failure\n", _drbd_fault_str(type));
+			WARN("***Simulating %s failure\n",
+				_drbd_fault_str(type));
 	}
 
 	return ret;
@@ -2835,7 +2878,8 @@
 /* Pretty print a UUID value */
 void
 drbd_print_uuid(struct drbd_conf *mdev, unsigned int idx) {
-	INFO(" uuid[%s] now %016llX\n", _drbd_uuid_str(idx), mdev->bc->md.uuid[idx]);
+	INFO(" uuid[%s] now %016llX\n",
+		_drbd_uuid_str(idx), mdev->bc->md.uuid[idx]);
 }
 
 
@@ -2886,8 +2930,11 @@
 	int count;
 
 	/* 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);
+	if (size != sizeof(char) &&
+	    size != sizeof(short) &&
+	    size != sizeof(int)) {
+		printk(KERN_DEBUG "drbd_print_buffer: "
+			"ERROR invalid size %d\n", size);
 		return;
 	}
 
@@ -2896,7 +2943,8 @@
 
 	/* 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);
+	pend   = (const unsigned char *)
+		(((long)buffer + length + sizemask) & ~sizemask);
 
 	if (flags & DBGPRINT_BUFFADDR) {
 		/* Move start back to nearest multiple of line size,
@@ -2908,7 +2956,8 @@
 	}
 
 	/* Set value of start VA to print if addresses asked for */
-	pstart_va = (const unsigned char *)buffer_va - ((const unsigned char *)buffer-pstart);
+	pstart_va = (const unsigned char *)buffer_va
+		 - ((const unsigned char *)buffer-pstart);
 
 	/* Calculate end position to nicely align right hand side */
 	pend_str = pstart + (((pend-pstart) + LINE_SIZE-1) & ~(LINE_SIZE-1));
@@ -3036,7 +3085,8 @@
 
 	switch (cmd) {
 	case HandShake:
-		INFOP("%s (protocol %u)\n", cmdname(cmd), be32_to_cpu(p->HandShake.protocol_version));
+		INFOP("%s (protocol %u)\n", cmdname(cmd),
+			be32_to_cpu(p->HandShake.protocol_version));
 		break;
 
 	case ReportBitMap: /* don't report this */
@@ -3065,7 +3115,8 @@
 	case DiscardAck:
 	case NegAck:
 	case NegRSDReply:
-		INFOP("%s (sector %llus, size %u, id %s, seq %u)\n", cmdname(cmd),
+		INFOP("%s (sector %llus, size %u, id %s, seq %u)\n",
+			cmdname(cmd),
 		      (long long)be64_to_cpu(p->BlockAck.sector),
 		      be32_to_cpu(p->BlockAck.blksize),
 		      _dump_block_id(p->BlockAck.block_id, tmp),
@@ -3088,7 +3139,9 @@
 		break;
 
 	case ReportUUIDs:
-		INFOP("%s Curr:%016llX, Bitmap:%016llX, HisSt:%016llX, HisEnd:%016llX\n", cmdname(cmd),
+		INFOP("%s Curr:%016llX, Bitmap:%016llX, "
+		      "HisSt:%016llX, HisEnd:%016llX\n",
+		      cmdname(cmd),
 		      be64_to_cpu(p->GenCnt.uuid[Current]),
 		      be64_to_cpu(p->GenCnt.uuid[Bitmap]),
 		      be64_to_cpu(p->GenCnt.uuid[History_start]),
@@ -3096,7 +3149,9 @@
 		break;
 
 	case ReportSizes:
-		INFOP("%s (d %lluMiB, u %lluMiB, c %lldMiB, max bio %x, q order %x)\n", cmdname(cmd),
+		INFOP("%s (d %lluMiB, u %lluMiB, c %lldMiB, "
+		      "max bio %x, q order %x)\n",
+		      cmdname(cmd),
 		      (long long)(be64_to_cpu(p->Sizes.d_size)>>(20-9)),
 		      (long long)(be64_to_cpu(p->Sizes.u_size)>>(20-9)),
 		      (long long)(be64_to_cpu(p->Sizes.c_size)>>(20-9)),
@@ -3176,7 +3231,8 @@
 				drbd_print_buffer("    ", DBGPRINT_BUFFADDR, 1,
 						  bvec_buf,
 						  faddr,
-						  (bvec->bv_len <= 0x80)? bvec->bv_len : 0x80);
+						  (bvec->bv_len <= 0x80)
+						  ? bvec->bv_len : 0x80);
 
 				bvec_kunmap_irq(bvec_buf, &flags);
 

Modified: branches/drbd-8.0-for-linus/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/drbd_nl.c	2007-07-24 17:02:29 UTC (rev 2999)
@@ -47,7 +47,8 @@
 
 /* Generate the tag_list to struct functions */
 #define PACKET(name, number, fields) \
-int name ## _from_tags (struct drbd_conf *mdev, unsigned short *tags, struct name *arg) \
+int name ## _from_tags (struct drbd_conf *mdev, \
+	unsigned short *tags, struct name *arg) \
 { \
 	int tag; \
 	int dlen; \
@@ -88,7 +89,8 @@
 /* Generate the struct to tag_list functions */
 #define PACKET(name, number, fields) \
 unsigned short* \
-name ## _to_tags (struct drbd_conf *mdev, struct name *arg, unsigned short *tags) \
+name ## _to_tags (struct drbd_conf *mdev, \
+	struct name *arg, unsigned short *tags) \
 { \
 	fields \
 	return tags; \
@@ -208,8 +210,8 @@
 	case 4: /* peer is outdated */
 		nps = Outdated;
 		break;
-	case 5: /* peer was down, we will(have) create(d) a new UUID anyways... */
-		/* If we would be more strict, we would return DUnknown here. */
+	case 5: /* peer was down, we will(have) create(d) a new UUID anyways.
+		 * If we would be more strict, we would return DUnknown here. */
 		nps = Outdated;
 		break;
 	case 6: /* Peer is primary, voluntarily outdate myself */
@@ -292,11 +294,12 @@
 			/* 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);
 			if (r < SS_Success) goto fail;
 		}
 		break;
@@ -373,7 +376,8 @@
 		return 0;
 	}
 
-	reply->ret_code = drbd_set_role(mdev, Primary, primary_args.overwrite_peer);
+	reply->ret_code =
+		drbd_set_role(mdev, Primary, primary_args.overwrite_peer);
 
 	return 0;
 }
@@ -475,7 +479,9 @@
 			/* currently there is only one error: ENOMEM! */
 			size = drbd_bm_capacity(mdev)>>1;
 			if (size == 0) {
-				ERR("OUT OF MEMORY! Could not allocate bitmap! Set device size => 0\n");
+				ERR("OUT OF MEMORY! "
+				    "Could not allocate bitmap! "
+				    "Set device size => 0\n");
 			} else {
 				/* FIXME this is problematic,
 				 * if we in fact are smaller now! */
@@ -514,7 +520,7 @@
 			dec_local(mdev);
 		}
 	}
-  out:
+out:
 	lc_unlock(mdev->act_log);
 
 	return rv;
@@ -608,7 +614,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;
 }
 
@@ -861,7 +867,8 @@
 	drbd_setup_queue_param(mdev, DRBD_MAX_SEGMENT_SIZE);
 	/*
 	 * FIXME currently broken.
-	 * drbd_set_recv_tcq(mdev,drbd_queue_order_type(mdev)==QUEUE_ORDERED_TAG);
+	 * drbd_set_recv_tcq(mdev,
+	 *	drbd_queue_order_type(mdev)==QUEUE_ORDERED_TAG);
 	 */
 
 	/* If I am currently not Primary,
@@ -888,7 +895,8 @@
 	drbd_determin_dev_size(mdev);
 
 	if (drbd_md_test_flag(mdev->bc, MDF_FullSync)) {
-		INFO("Assuming that all blocks are out of sync (aka FullSync)\n");
+		INFO("Assuming that all blocks are out of sync "
+		     "(aka FullSync)\n");
 		drbd_bm_set_all(mdev);
 		if (unlikely(drbd_bm_write(mdev) < 0)) {
 			retcode = MDIOError;
@@ -1053,7 +1061,8 @@
 		goto fail;
 	}
 
-	if (new_conf->two_primaries && (new_conf->wire_protocol != DRBD_PROT_C)) {
+	if (new_conf->two_primaries
+	&& (new_conf->wire_protocol != DRBD_PROT_C)) {
 		retcode = ProtocolCRequired;
 		goto fail;
 	};
@@ -1090,7 +1099,8 @@
 #undef O_PORT
 
 	if (new_conf->cram_hmac_alg[0] != 0) {
-		snprintf(hmac_name, HMAC_NAME_L, "hmac(%s)", new_conf->cram_hmac_alg);
+		snprintf(hmac_name, HMAC_NAME_L, "hmac(%s)",
+			new_conf->cram_hmac_alg);
 		tfm = crypto_alloc_hash(hmac_name, 0, CRYPTO_ALG_ASYNC);
 		if (IS_ERR(tfm)) {
 			tfm = NULL;
@@ -1098,7 +1108,8 @@
 			goto fail;
 		}
 
-		if (crypto_tfm_alg_type(crypto_hash_tfm(tfm)) != CRYPTO_ALG_TYPE_HASH ) {
+		if (crypto_tfm_alg_type(crypto_hash_tfm(tfm))
+						!= CRYPTO_ALG_TYPE_HASH) {
 			retcode = CRAMAlgNotDigest;
 			goto fail;
 		}
@@ -1176,7 +1187,7 @@
 	reply->ret_code = retcode;
 	return 0;
 
-  fail:
+fail:
 	if (tfm) crypto_free_hash(tfm);
 	if (new_tl_hash) kfree(new_tl_hash);
 	if (new_ee_hash) kfree(new_ee_hash);
@@ -1191,7 +1202,8 @@
 {
 	int retcode;
 
-	retcode = _drbd_request_state(mdev, NS(conn, Disconnecting), 0);	/* silently. */
+	/* silently. */
+	retcode = _drbd_request_state(mdev, NS(conn, Disconnecting), 0);
 
 	if (retcode == SS_NothingToDo) goto done;
 	else if (retcode == SS_AlreadyStandAlone) goto done;
@@ -1208,7 +1220,8 @@
 		 * 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));
+			retcode = drbd_request_state(mdev,
+						NS(conn, StandAlone));
 	}
 
 	if (retcode < SS_Success) goto fail;
@@ -1408,11 +1421,13 @@
 	if (mdev->state.disk < Outdated)
 		retcode = -999;
 	else
-		retcode = _drbd_set_state(_NS(mdev, disk, Outdated), ChgStateVerbose);
+		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);
+	if (retcode == SS_Success)
+		after_state_ch(mdev, os, ns, ChgStateVerbose);
 
 	if (retcode == -999) {
 		retcode = DiskLowerThanOutdated;
@@ -1487,8 +1502,8 @@
 }
 
 
-int drbd_nl_get_timeout_flag(struct drbd_conf *mdev, struct drbd_nl_cfg_req *nlp,
-				    struct drbd_nl_cfg_reply *reply)
+int drbd_nl_get_timeout_flag(struct drbd_conf *mdev,
+	struct drbd_nl_cfg_req *nlp, struct drbd_nl_cfg_reply *reply)
 {
 	unsigned short *tl;
 
@@ -1564,8 +1579,9 @@
 				    sizeof(struct get_state_tag_len_struct) },
 	[ P_get_uuids ]		= { &drbd_nl_get_uuids,
 				    sizeof(struct get_uuids_tag_len_struct) },
-	[ P_get_timeout_flag ]	= { &drbd_nl_get_timeout_flag,
-				    sizeof(struct get_timeout_flag_tag_len_struct)},
+	[ P_get_timeout_flag ]	=
+		{ &drbd_nl_get_timeout_flag,
+		  sizeof(struct get_timeout_flag_tag_len_struct)},
 
 };
 
@@ -1610,7 +1626,8 @@
 	}
 	reply = (struct drbd_nl_cfg_reply *) cn_reply->data;
 
-	reply->packet_type = cm->reply_body_size ? nlp->packet_type : P_nl_after_last_packet;
+	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. */
@@ -1646,7 +1663,8 @@
 		    sizeof(struct get_state_tag_len_struct)+
 		    sizeof(short int)];
 	struct cn_msg *cn_reply = (struct cn_msg *) buffer;
-	struct drbd_nl_cfg_reply *reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
+	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"); */
@@ -1679,7 +1697,8 @@
 		    sizeof(struct call_helper_tag_len_struct)+
 		    sizeof(short int)];
 	struct cn_msg *cn_reply = (struct cn_msg *) buffer;
-	struct drbd_nl_cfg_reply *reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
+	struct drbd_nl_cfg_reply *reply =
+		(struct drbd_nl_cfg_reply *)cn_reply->data;
 	unsigned short *tl = reply->tag_list;
 	int str_len;
 
@@ -1717,7 +1736,8 @@
 		    sizeof(struct sync_progress_tag_len_struct)+
 		    sizeof(short int)];
 	struct cn_msg *cn_reply = (struct cn_msg *) buffer;
-	struct drbd_nl_cfg_reply *reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
+	struct drbd_nl_cfg_reply *reply =
+		(struct drbd_nl_cfg_reply *)cn_reply->data;
 	unsigned short *tl = reply->tag_list;
 	int res;
 	unsigned long rs_left;
@@ -1727,8 +1747,9 @@
 
 		rs_left = drbd_bm_total_weight(mdev) - mdev->rs_failed;
 		if (rs_left > mdev->rs_total) {
-			ERR("logic bug? rs_left=%lu > rs_total=%lu (rs_failed %lu)\n",
-					rs_left, mdev->rs_total, mdev->rs_failed);
+			ERR("logic bug? "
+			    "rs_left=%lu > rs_total=%lu (rs_failed %lu)\n",
+				rs_left, mdev->rs_total, mdev->rs_failed);
 			res = 1000;
 		} else {
 			res = (rs_left >> 10)*1000/((mdev->rs_total >> 10) + 1);
@@ -1801,7 +1822,8 @@
 {
 	char buffer[sizeof(struct cn_msg)+sizeof(struct drbd_nl_cfg_reply)];
 	struct cn_msg *cn_reply = (struct cn_msg *) buffer;
-	struct drbd_nl_cfg_reply *reply = (struct drbd_nl_cfg_reply *)cn_reply->data;
+	struct drbd_nl_cfg_reply *reply =
+		(struct drbd_nl_cfg_reply *)cn_reply->data;
 	int rr;
 
 	cn_reply->id = req->id;

Modified: branches/drbd-8.0-for-linus/drbd/drbd_proc.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_proc.c	2007-07-24 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/drbd_proc.c	2007-07-24 17:02:29 UTC (rev 2999)
@@ -157,7 +157,7 @@
 	seq_printf(seq, " K/sec\n");
 }
 
-#if 0
+#ifdef DRBD_DUMP_RESYNC_DETAIL
 void resync_dump_detail(struct seq_file *seq, struct lc_element *e)
 {
 	struct bm_extent *bme = (struct bm_extent *)e;
@@ -246,7 +246,7 @@
 		if (mdev->act_log)
 			lc_printf_stats(seq, mdev->act_log);
 
-#if 0
+#ifdef DRBD_DUMP_RESYNC_DETAIL
 		if (mdev->resync) {
 			lc_dump(mdev->resync, seq, "rs_left",
 				resync_dump_detail);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/drbd_receiver.c	2007-07-24 17:02:29 UTC (rev 2999)
@@ -64,57 +64,6 @@
 }
 #endif
 
-
-#if 0
-#define CHECK_LIST_LIMIT 1000
-void check_list(struct drbd_conf *mdev, struct list_head *list, char *t)
-{
-	struct list_head *le, *la;
-	int forward = 0, backward = 0;
-
-	le = list;
-	do {
-		la = le;
-		le = le->next;
-		if (le->prev != la) {
-			printk(KERN_ERR DEVICE_NAME
-			       "%d: %s list fucked.\n",
-			       mdev_to_minor(mdev), t);
-			break;
-		}
-		if (forward++ > CHECK_LIST_LIMIT) {
-			printk(KERN_ERR DEVICE_NAME
-			       "%d: %s forward > 1000\n",
-			       mdev_to_minor(mdev), t);
-			break;
-		}
-	} while (le != list);
-
-	le = list;
-	do {
-		la = le;
-		le = le->prev;
-		if (le->next != la) {
-			printk(KERN_ERR DEVICE_NAME
-			       "%d: %s list fucked.\n",
-			       mdev_to_minor(mdev), t);
-			break;
-		}
-		if (backward++ > CHECK_LIST_LIMIT) {
-			printk(KERN_ERR DEVICE_NAME
-			       "%d: %s backward > 1000\n",
-			       mdev_to_minor(mdev), t);
-			break;
-		}
-	} while (le != list);
-
-	if (forward != backward) {
-		printk(KERN_ERR DEVICE_NAME "%d: forward=%d, backward=%d\n",
-		       mdev_to_minor(mdev), forward, backward);
-	}
-}
-#endif
-
 #define GFP_TRY	( __GFP_HIGHMEM | __GFP_NOWARN )
 
 /**
@@ -165,7 +114,8 @@
 		/* hm. pool was empty. try to allocate from kernel.
 		 * don't wait, if none is available, though.
 		 */
-		if ( atomic_read(&mdev->pp_in_use) < mdev->net_conf->max_buffers ) {
+		if (atomic_read(&mdev->pp_in_use)
+					< mdev->net_conf->max_buffers) {
 			page = alloc_page(GFP_TRY);
 			if (page)
 				break;
@@ -464,7 +414,8 @@
 	DEFINE_WAIT(wait);
 	MUST_HOLD(&mdev->req_lock);
 
-	/* avoids spin_lock/unlock and calling prepare_to_wait in the fast path */
+	/* avoids spin_lock/unlock
+	 * and calling prepare_to_wait in the fast path */
 	while (!list_empty(head)) {
 		prepare_to_wait(&mdev->ee_wait, &wait, TASK_UNINTERRUPTIBLE);
 		spin_unlock_irq(&mdev->req_lock);
@@ -503,9 +454,9 @@
 
 	return newsock;
 
-      out_release:
+out_release:
 	sock_release(newsock);
-      out:
+out:
 	if (err != -EAGAIN && err != -EINTR)
 		ERR("accept failed! %d\n", err);
 	return 0;
@@ -682,7 +633,8 @@
 int drbd_do_handshake(struct drbd_conf *mdev);
 int drbd_do_auth(struct drbd_conf *mdev);
 
-int drbd_send_fp(struct drbd_conf *mdev, struct socket *sock, enum Drbd_Packet_Cmd cmd)
+int drbd_send_fp(struct drbd_conf *mdev,
+	struct socket *sock, enum Drbd_Packet_Cmd cmd)
 {
 	struct Drbd_Header *h = (struct Drbd_Header *) &mdev->data.sbuf.head;
 
@@ -717,14 +669,16 @@
 	D_ASSERT(mdev->state.conn >= Unconnected);
 	D_ASSERT(!mdev->data.socket);
 
-	if (drbd_request_state(mdev, NS(conn, WFConnection)) < SS_Success ) return 0;
+	if (drbd_request_state(mdev, NS(conn, WFConnection)) < SS_Success)
+		return 0;
 	clear_bit(DISCARD_CONCURRENT, &mdev->flags);
 
 	sock  = NULL;
 	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() */
@@ -813,7 +767,8 @@
 	mdev->meta.socket = msock;
 	mdev->last_received = jiffies;
 
-	if (drbd_request_state(mdev, NS(conn, WFReportParams)) < SS_Success) return 0;
+	if (drbd_request_state(mdev, NS(conn, WFReportParams)) < SS_Success)
+		return 0;
 	D_ASSERT(mdev->asender.task == NULL);
 
 	h = drbd_do_handshake(mdev);
@@ -996,7 +951,8 @@
 			     expect);
 		kunmap(bvec->bv_page);
 		if (rr != expect) {
-			WARN("short read receiving data reply: read %d expected %d\n",
+			WARN("short read receiving data reply: "
+			     "read %d expected %d\n",
 			     rr, expect);
 			return 0;
 		}
@@ -1057,7 +1013,8 @@
 	       INFO("submit EE (RS)WRITE sec=%llus size=%u ee=%p\n",
 		    (unsigned long long)e->sector, e->size, e);
 	       );
-	drbd_generic_make_request(mdev, WRITE, DRBD_FAULT_RS_WR, e->private_bio);
+	drbd_generic_make_request(mdev, WRITE, DRBD_FAULT_RS_WR,
+					e->private_bio);
 	/* accounting done in endio */
 
 	maybe_kick_lo(mdev);
@@ -1180,8 +1137,9 @@
 			/* FIXME I think we should send a NegAck regardless of
 			 * which protocol is in effect.
 			 * In which case we would need to make sure that any
-			 * NegAck is sent. basically that means that drbd_process_done_ee
-			 * may not list_del() the ee before this callback did run...
+			 * NegAck is sent. Basically that means that
+			 * drbd_process_done_ee may not list_del() the ee
+			 * before this callback did run...
 			 * maybe even move the list_del(e) in here... */
 			ok  = drbd_send_ack(mdev, NegAck, e);
 			ok &= drbd_io_error(mdev, FALSE);
@@ -1299,7 +1257,8 @@
 		 * corresponding dec_local done either below (on error),
 		 * or in drbd_endio_write_sec. */
 		if (DRBD_ratelimit(5*HZ, 5))
-			ERR("Can not write mirrored data block to local disk.\n");
+			ERR("Can not write mirrored data block "
+			    "to local disk.\n");
 		spin_lock(&mdev->peer_seq_lock);
 		if (mdev->peer_seq+1 == be32_to_cpu(p->seq_num))
 			mdev->peer_seq++;
@@ -1367,7 +1326,8 @@
 		 * if no conflicting request is found:
 		 *    submit.
 		 *
-		 * if any conflicting request is found that has not yet been acked,
+		 * if any conflicting request is found
+		 * that has not yet been acked,
 		 * AND I have the "discard concurrent writes" flag:
 		 *	 queue (via done_ee) the DiscardAck; OUT.
 		 *
@@ -1395,19 +1355,20 @@
 		for (;;) {
 			int have_unacked = 0;
 			int have_conflict = 0;
-			prepare_to_wait(&mdev->misc_wait, &wait, TASK_INTERRUPTIBLE);
+			prepare_to_wait(&mdev->misc_wait, &wait,
+				TASK_INTERRUPTIBLE);
 			hlist_for_each_entry(i, n, slot, colision) {
 				if (OVERLAPS) {
-					if (first) {
-						/* only ALERT on first iteration,
-						 * we may be woken up early... */
+					/* only ALERT on first iteration,
+					 * we may be woken up early... */
+					if (first)
 						ALERT("%s[%u] Concurrent local write detected!"
 						      "	new: %llus +%u; pending: %llus +%u\n",
 						      current->comm, current->pid,
 						      (unsigned long long)sector, size,
 						      (unsigned long long)i->sector, i->size);
-					}
-					if (i->rq_state & RQ_NET_PENDING) ++have_unacked;
+					if (i->rq_state & RQ_NET_PENDING)
+						++have_unacked;
 					++have_conflict;
 				}
 			}
@@ -1523,7 +1484,8 @@
 		 * maybe rather move it into the e_end_block callback,
 		 * where it would be sent as soon as possible).
 		 */
-		(void)drbd_send_b_ack(mdev, cpu_to_be32(barrier_nr), epoch_size);
+		(void)drbd_send_b_ack(mdev,
+					cpu_to_be32(barrier_nr), epoch_size);
 	}
 
 	switch (mdev->net_conf->wire_protocol) {
@@ -1554,13 +1516,14 @@
 		    (unsigned long long)e->sector, e->size, e);
 	       );
 	/* FIXME drbd_al_begin_io in case we have two primaries... */
-	drbd_generic_make_request(mdev, WRITE, DRBD_FAULT_DT_WR, e->private_bio);
+	drbd_generic_make_request(mdev, WRITE, DRBD_FAULT_DT_WR,
+					e->private_bio);
 	/* accounting done in endio */
 
 	maybe_kick_lo(mdev);
 	return TRUE;
 
-  out_interrupted:
+out_interrupted:
 	/* yes, the epoch_size now is imbalanced.
 	 * but we drop the connection anyways, so we don't have a chance to
 	 * receive a barrier... atomic_inc(&mdev->epoch_size); */
@@ -1576,7 +1539,8 @@
 	struct Tl_epoch_entry *e;
 	int size;
 	unsigned int fault_type;
-	struct Drbd_BlockRequest_Packet *p = (struct Drbd_BlockRequest_Packet *)h;
+	struct Drbd_BlockRequest_Packet *p =
+		(struct Drbd_BlockRequest_Packet *)h;
 
 	ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
 
@@ -1599,7 +1563,8 @@
 
 	if (!inc_local_if_state(mdev, UpToDate)) {
 		if (DRBD_ratelimit(5*HZ, 5))
-			ERR("Can not satisfy peer's read request, no local data.\n");
+			ERR("Can not satisfy peer's read request, "
+			    "no local data.\n");
 		drbd_send_ack_rp(mdev, h->command == DataRequest ? NegDReply :
 				 NegRSDReply , p);
 		return TRUE;
@@ -1687,7 +1652,8 @@
 		     "Using discard-least-changes instead\n");
 	case DiscardZeroChg:
 		if (ch_peer == 0 && ch_self == 0) {
-			rv = test_bit(DISCARD_CONCURRENT, &mdev->flags) ? -1 : 1;
+			rv = test_bit(DISCARD_CONCURRENT, &mdev->flags)
+				? -1 : 1;
 			break;
 		} else {
 			if (ch_peer == 0) { rv =  1; break; }
@@ -1699,7 +1665,8 @@
 		else if (ch_self > ch_peer) rv =  1;
 		else /* ( ch_self == ch_peer ) */ {
 			/* Well, then use something else. */
-			rv = test_bit(DISCARD_CONCURRENT, &mdev->flags) ? -1 : 1;
+			rv = test_bit(DISCARD_CONCURRENT, &mdev->flags)
+				? -1 : 1;
 		}
 		break;
 	case DiscardLocal:
@@ -1898,8 +1865,8 @@
 /* drbd_sync_handshake() returns the new conn state on success, or
    conn_mask (-1) on failure.
  */
-enum drbd_conns drbd_sync_handshake(struct drbd_conf *mdev, enum drbd_role peer_role,
-					enum drbd_disk_state peer_disk)
+enum drbd_conns drbd_sync_handshake(struct drbd_conf *mdev,
+	enum drbd_role peer_role, enum drbd_disk_state peer_disk)
 {
 	int hg, rule_nr;
 	enum drbd_conns rv = conn_mask;
@@ -1933,7 +1900,8 @@
 	}
 
 	if (hg == 100 || (hg == -100 && mdev->net_conf->always_asbp) ) {
-		int pcount = (mdev->state.role == Primary) + (peer_role == Primary);
+		int pcount = (mdev->state.role == Primary)
+			   + (peer_role == Primary);
 		int forced = (hg == -100);
 
 		switch (pcount) {
@@ -1948,7 +1916,8 @@
 			break;
 		}
 		if ( abs(hg) < 100 ) {
-			WARN("Split-Brain detected, %d primaries, automatically solved. Sync from %s node\n",
+			WARN("Split-Brain detected, %d primaries, "
+			     "automatically solved. Sync from %s node\n",
 			     pcount, (hg < 0) ? "peer":"this");
 			if (forced) {
 				WARN("Doing a full sync, since"
@@ -1967,7 +1936,8 @@
 			hg = 1;
 
 		if ( abs(hg) < 100 )
-			WARN("Split-Brain detected, manually solved. Sync from %s node\n",
+			WARN("Split-Brain detected, manually solved. "
+			     "Sync from %s node\n",
 			     (hg < 0) ? "peer":"this");
 	}
 
@@ -2126,7 +2096,8 @@
 }
 
 /* warn if the arguments differ by more than 12.5% */
-static void warn_if_differ_considerably(struct drbd_conf *mdev, const char *s, sector_t a, sector_t b)
+static void warn_if_differ_considerably(struct drbd_conf *mdev,
+	const char *s, sector_t a, sector_t b)
 {
 	sector_t d;
 	if (a == 0 || b == 0) return;
@@ -2195,9 +2166,9 @@
 	if (inc_local(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!
-		 * try to solve it thus:
+		 * you may get a flip-flop connection established/connection
+		 * loss, in case both really have different usize uppon first
+		 * connect!  try to solve it thus:
 		 ***/
 
 		drbd_determin_dev_size(mdev);
@@ -2209,7 +2180,8 @@
 	}
 
 	if (mdev->p_uuid && mdev->state.conn <= Connected && inc_local(mdev)) {
-		nconn = drbd_sync_handshake(mdev, mdev->state.peer, mdev->state.pdsk);
+		nconn = drbd_sync_handshake(mdev,
+				mdev->state.peer, mdev->state.pdsk);
 		dec_local(mdev);
 
 		if (nconn == conn_mask) return FALSE;
@@ -2343,7 +2315,8 @@
 	if (mdev->p_uuid && oconn <= Connected &&
 	    peer_state.disk >= Negotiating &&
 	    inc_local_if_state(mdev, Negotiating) ) {
-		nconn = drbd_sync_handshake(mdev, peer_state.role, peer_state.disk);
+		nconn = drbd_sync_handshake(mdev,
+				peer_state.role, peer_state.disk);
 		dec_local(mdev);
 
 		if (nconn == conn_mask) return FALSE;
@@ -2371,10 +2344,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) {
+		} else if (nconn == Connected &&
+					peer_state.disk == Negotiating) {
 			/* peer is waiting for us to respond... */
 			drbd_send_state(mdev);
 		}
@@ -2396,7 +2370,8 @@
 	struct Drbd_SyncUUID_Packet *p = (struct Drbd_SyncUUID_Packet *)h;
 
 	wait_event( mdev->misc_wait,
-		    mdev->state.conn < Connected || mdev->state.conn == WFSyncUUID);
+		    mdev->state.conn < Connected ||
+		    mdev->state.conn == WFSyncUUID);
 
 	/* D_ASSERT( mdev->state.conn == WFSyncUUID ); */
 
@@ -2533,7 +2508,8 @@
 
 		if (header->command < MAX_CMD)
 			handler = drbd_cmd_handler[header->command];
-		else if (MayIgnore < header->command && header->command < MAX_OPT_CMD)
+		else if (MayIgnore < header->command
+		     && header->command < MAX_OPT_CMD)
 			handler = drbd_opt_cmd_handler[header->command-MayIgnore];
 		else if (header->command > MAX_OPT_CMD)
 			handler = receive_skip;
@@ -2553,7 +2529,8 @@
 			break;
 		}
 
-		dump_packet(mdev, mdev->data.socket, 2, &mdev->data.rbuf, __FILE__, __LINE__);
+		dump_packet(mdev, mdev->data.socket, 2, &mdev->data.rbuf,
+				__FILE__, __LINE__);
 	}
 }
 
@@ -2767,7 +2744,8 @@
 {
 	/* ASSERT current == mdev->receiver ... */
 	struct Drbd_HandShake_Packet *p = &mdev->data.rbuf.HandShake;
-	const int expect = sizeof(struct Drbd_HandShake_Packet)-sizeof(struct Drbd_Header);
+	const int expect = sizeof(struct Drbd_HandShake_Packet)
+			  -sizeof(struct Drbd_Header);
 	int rv;
 
 	rv = drbd_send_handshake(mdev);
@@ -2795,7 +2773,8 @@
 		return 0;
 	}
 
-	dump_packet(mdev, mdev->data.socket, 2, &mdev->data.rbuf, __FILE__, __LINE__);
+	dump_packet(mdev, mdev->data.socket, 2, &mdev->data.rbuf,
+			__FILE__, __LINE__);
 
 	p->protocol_version = be32_to_cpu(p->protocol_version);
 
@@ -2806,8 +2785,8 @@
 			      "Peer wants protocol version: %u\n",
 			      p->protocol_version );
 		}
-		INFO( "Handshake successful: DRBD Network Protocol version %u\n",
-		      PRO_VERSION );
+		INFO("Handshake successful: "
+		     "DRBD Network Protocol version %u\n", PRO_VERSION);
 	} /* else if ( p->protocol_version == (PRO_VERSION-1) ) {
 		// not yet; but next time :)
 		INFO( "Handshake successful: DRBD Protocol version %u\n",
@@ -3228,17 +3207,21 @@
 	int empty;
 
 	static struct asender_cmd asender_tbl[] = {
-	[Ping]		= { sizeof(struct Drbd_Header),	    got_Ping },
-	[PingAck]	= { sizeof(struct Drbd_Header),	    got_PingAck },
-	[RecvAck]	= { sizeof(struct Drbd_BlockAck_Packet),   got_BlockAck },
-	[WriteAck]	= { sizeof(struct Drbd_BlockAck_Packet),   got_BlockAck },
-	[RSWriteAck]	= { sizeof(struct Drbd_BlockAck_Packet),   got_BlockAck },
-	[DiscardAck]	= { sizeof(struct Drbd_BlockAck_Packet),   got_BlockAck },
-	[NegAck]	= { sizeof(struct Drbd_BlockAck_Packet),   got_NegAck },
-	[NegDReply]	= { sizeof(struct Drbd_BlockAck_Packet),   got_NegDReply },
-	[NegRSDReply]	= { sizeof(struct Drbd_BlockAck_Packet),   got_NegRSDReply},
-	[BarrierAck]	= { sizeof(struct Drbd_BarrierAck_Packet), got_BarrierAck },
-	[StateChgReply] = { sizeof(struct Drbd_RqS_Reply_Packet),  got_RqSReply },
+	[Ping]		= { sizeof(struct Drbd_Header), got_Ping },
+	[PingAck]	= { sizeof(struct Drbd_Header),	got_PingAck },
+	[RecvAck]	= { sizeof(struct Drbd_BlockAck_Packet), got_BlockAck },
+	[WriteAck]	= { sizeof(struct Drbd_BlockAck_Packet), got_BlockAck },
+	[RSWriteAck]	= { sizeof(struct Drbd_BlockAck_Packet), got_BlockAck },
+	[DiscardAck]	= { sizeof(struct Drbd_BlockAck_Packet), got_BlockAck },
+	[NegAck]	= { sizeof(struct Drbd_BlockAck_Packet), got_NegAck },
+	[NegDReply]	=
+		{ sizeof(struct Drbd_BlockAck_Packet), got_NegDReply },
+	[NegRSDReply]	=
+		{ sizeof(struct Drbd_BlockAck_Packet), got_NegRSDReply},
+	[BarrierAck]	=
+		{ sizeof(struct Drbd_BarrierAck_Packet), got_BarrierAck },
+	[StateChgReply] =
+		{ sizeof(struct Drbd_RqS_Reply_Packet), got_RqSReply },
 	};
 
 	sprintf(current->comm, "drbd%d_asender", mdev_to_minor(mdev));
@@ -3318,13 +3301,15 @@
 			}
 			expect = asender_tbl[cmd].pkt_size;
 			ERR_IF(len != expect-sizeof(struct Drbd_Header)) {
-				dump_packet(mdev, mdev->meta.socket, 1, (void *)h, __FILE__, __LINE__);
+				dump_packet(mdev, mdev->meta.socket, 1,
+					(void *)h, __FILE__, __LINE__);
 				DUMPI(expect);
 			}
 		}
 		if (received == expect) {
 			D_ASSERT(cmd != -1);
-			dump_packet(mdev, mdev->meta.socket, 1, (void *)h, __FILE__, __LINE__);
+			dump_packet(mdev, mdev->meta.socket, 1, (void *)h,
+					__FILE__, __LINE__);
 			if (!asender_tbl[cmd].process(mdev, h)) goto err;
 
 			buf	 = h;
@@ -3335,7 +3320,7 @@
 	}
 
 	if (0) {
-	err:
+err:
 		clear_bit(SIGNAL_ASENDER, &mdev->flags);
 		if (mdev->state.conn >= Connected)
 			drbd_force_state(mdev, NS(conn, NetworkFailure));

Modified: branches/drbd-8.0-for-linus/drbd/drbd_req.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.c	2007-07-24 17:02:29 UTC (rev 2999)
@@ -77,7 +77,8 @@
 		[send_canceled] = "send_canceled",
 		[send_failed] = "send_failed",
 		[handed_over_to_network] = "handed_over_to_network",
-		[connection_lost_while_pending] = "connection_lost_while_pending",
+		[connection_lost_while_pending] =
+					"connection_lost_while_pending",
 		[recv_acked_by_peer] = "recv_acked_by_peer",
 		[write_acked_by_peer] = "write_acked_by_peer",
 		[neg_acked] = "neg_acked",
@@ -93,8 +94,10 @@
 }
 
 # ifdef ENABLE_DYNAMIC_TRACE
-#  define print_rq_state(R, T) MTRACE(TraceTypeRq, TraceLvlMetrics, _print_rq_state(R, T);)
-#  define print_req_mod(T, W)  MTRACE(TraceTypeRq, TraceLvlMetrics, _print_req_mod(T, W);)
+#  define print_rq_state(R, T) \
+	MTRACE(TraceTypeRq, TraceLvlMetrics, _print_rq_state(R, T);)
+#  define print_req_mod(T, W)  \
+	MTRACE(TraceTypeRq, TraceLvlMetrics, _print_req_mod(T, W);)
 # else
 #  define print_rq_state(R, T) _print_rq_state(R, T)
 #  define print_req_mod(T, W)  _print_req_mod(T, W)
@@ -105,7 +108,8 @@
 #define print_req_mod(T, W)
 #endif
 
-static void _req_is_done(struct drbd_conf *mdev, struct drbd_request *req, const int rw)
+static void _req_is_done(struct drbd_conf *mdev,
+	struct drbd_request *req, const int rw)
 {
 	const unsigned long s = req->rq_state;
 	/* if it was a write, we may have to set the corresponding
@@ -179,65 +183,68 @@
 	}
 }
 
-static void _about_to_complete_local_write(struct drbd_conf *mdev, struct drbd_request *req)
+static void _about_to_complete_local_write(struct drbd_conf *mdev,
+	struct drbd_request *req)
 {
 	const unsigned long s = req->rq_state;
-			struct drbd_request *i;
-			struct Tl_epoch_entry *e;
-			struct hlist_node *n;
-			struct hlist_head *slot;
+	struct drbd_request *i;
+	struct Tl_epoch_entry *e;
+	struct hlist_node *n;
+	struct hlist_head *slot;
 
-			/* before we can signal completion to the upper layers,
-			 * we may need to close the current epoch */
-			if (req->epoch == mdev->newest_barrier->br_number)
-				set_bit(ISSUE_BARRIER, &mdev->flags);
+	/* before we can signal completion to the upper layers,
+	 * we may need to close the current epoch */
+	if (req->epoch == mdev->newest_barrier->br_number)
+		set_bit(ISSUE_BARRIER, &mdev->flags);
 
-			/* we need to do the conflict detection stuff,
-			 * if we have the ee_hash (two_primaries) and
-			 * this has been on the network */
-			if ((s & RQ_NET_DONE) && mdev->ee_hash != NULL) {
-				const sector_t sector = req->sector;
-				const int size = req->size;
+	/* we need to do the conflict detection stuff,
+	 * if we have the ee_hash (two_primaries) and
+	 * this has been on the network */
+	if ((s & RQ_NET_DONE) && mdev->ee_hash != NULL) {
+		const sector_t sector = req->sector;
+		const int size = req->size;
 
-				/* ASSERT:
-				 * there must be no conflicting requests, since
-				 * they must have been failed on the spot */
+		/* ASSERT:
+		 * there must be no conflicting requests, since
+		 * they must have been failed on the spot */
 #define OVERLAPS overlaps(sector, size, i->sector, i->size)
-				slot = tl_hash_slot(mdev, sector);
-				hlist_for_each_entry(i, n, slot, colision) {
-					if (OVERLAPS) {
-						ALERT("LOGIC BUG: completed: %p %llus +%u; other: %p %llus +%u\n",
-						      req, (unsigned long long)sector, size,
-						      i,   (unsigned long long)i->sector, i->size);
-					}
-				}
+		slot = tl_hash_slot(mdev, sector);
+		hlist_for_each_entry(i, n, slot, colision) {
+			if (OVERLAPS) {
+				ALERT("LOGIC BUG: completed: %p %llus +%u; "
+				      "other: %p %llus +%u\n",
+				      req, (unsigned long long)sector, size,
+				      i, (unsigned long long)i->sector, i->size);
+			}
+		}
 
-				/* maybe "wake" those conflicting epoch entries
-				 * that wait for this request to finish.
-				 *
-				 * currently, there can be only _one_ such ee
-				 * (well, or some more, which would be pending
-				 * DiscardAck not yet sent by the asender...),
-				 * since we block the receiver thread upon the
-				 * first conflict detection, which will wait on
-				 * misc_wait.  maybe we want to assert that?
-				 *
-				 * anyways, if we found one,
-				 * we just have to do a wake_up.  */
+		/* maybe "wake" those conflicting epoch entries
+		 * that wait for this request to finish.
+		 *
+		 * currently, there can be only _one_ such ee
+		 * (well, or some more, which would be pending
+		 * DiscardAck not yet sent by the asender...),
+		 * since we block the receiver thread upon the
+		 * first conflict detection, which will wait on
+		 * misc_wait.  maybe we want to assert that?
+		 *
+		 * anyways, if we found one,
+		 * we just have to do a wake_up.  */
 #undef OVERLAPS
 #define OVERLAPS overlaps(sector, size, e->sector, e->size)
-				slot = ee_hash_slot(mdev, req->sector);
-				hlist_for_each_entry(e, n, slot, colision) {
-					if (OVERLAPS) {
-						wake_up(&mdev->misc_wait);
-						break;
-					}
-				}
+		slot = ee_hash_slot(mdev, req->sector);
+		hlist_for_each_entry(e, n, slot, colision) {
+			if (OVERLAPS) {
+				wake_up(&mdev->misc_wait);
+				break;
 			}
+		}
+	}
 #undef OVERLAPS
 }
 
-static void _complete_master_bio(struct drbd_conf *mdev, struct drbd_request *req, int error)
+static void _complete_master_bio(struct drbd_conf *mdev,
+	struct drbd_request *req, int error)
 {
 	dump_bio(mdev, req->master_bio, 1);
 	bio_endio(req->master_bio, req->master_bio->bi_size, error);
@@ -377,8 +384,9 @@
 	slot = tl_hash_slot(mdev, sector);
 	hlist_for_each_entry(i, n, slot, colision) {
 		if (OVERLAPS) {
-			ALERT("%s[%u] Concurrent local write detected!"
-			      " [DISCARD L] new: %llus +%u; pending: %llus +%u\n",
+			ALERT("%s[%u] Concurrent local write detected! "
+			      "[DISCARD L] new: %llus +%u; "
+			      "pending: %llus +%u\n",
 			      current->comm, current->pid,
 			      (unsigned long long)sector, size,
 			      (unsigned long long)i->sector, i->size);
@@ -395,7 +403,8 @@
 		hlist_for_each_entry(e, n, slot, colision) {
 			if (OVERLAPS) {
 				ALERT("%s[%u] Concurrent remote write detected!"
-				      " [DISCARD L] new: %llus +%u; pending: %llus +%u\n",
+				      " [DISCARD L] new: %llus +%u; "
+				      "pending: %llus +%u\n",
 				      current->comm, current->pid,
 				      (unsigned long long)sector, size,
 				      (unsigned long long)e->sector, e->size);
@@ -405,13 +414,13 @@
 	}
 #undef OVERLAPS
 
-  out_no_conflict:
+out_no_conflict:
 	/* this is like it should be, and what we expected.
 	 * our users do behave after all... */
 	dec_net(mdev);
 	return 0;
 
-  out_conflict:
+out_conflict:
 	dec_net(mdev);
 	return 1;
 }
@@ -578,11 +587,13 @@
 		 *
 		 * Add req to the (now) current epoch (barrier). */
 
-		/* see drbd_make_request_common just after it grabs the req_lock */
+		/* see drbd_make_request_common,
+		 * just after it grabs the req_lock */
 		D_ASSERT(test_bit(ISSUE_BARRIER, &mdev->flags) == 0);
 
 		req->epoch = mdev->newest_barrier->br_number;
-		list_add_tail(&req->tl_requests, &mdev->newest_barrier->requests);
+		list_add_tail(&req->tl_requests,
+				&mdev->newest_barrier->requests);
 
 		/* mark the current epoch as closed,
 		 * in case it outgrew the limit */
@@ -602,11 +613,11 @@
 	case send_canceled:
 		/* for the request, this is the same thing */
 	case send_failed:
-		/* real cleanup will be done from tl_clear.  just update flags so
-		 * it is no longer marked as on the worker queue */
+		/* real cleanup will be done from tl_clear.  just update flags
+		 * so it is no longer marked as on the worker queue */
 		req->rq_state &= ~RQ_NET_QUEUED;
-		/* if we did it right, tl_clear should be scheduled only after this,
-		 * so this should not be necessary! */
+		/* if we did it right, tl_clear should be scheduled only after
+		 * this, so this should not be necessary! */
 		_req_may_be_done(req, error);
 		break;
 
@@ -692,7 +703,8 @@
 			/* barrier came in before all requests have been acked.
 			 * this is bad, because if the connection is lost now,
 			 * we won't be able to clean them up... */
-			_print_rq_state(req, "FIXME (barrier_acked but pending)");
+			_print_rq_state(req,
+				"FIXME (barrier_acked but pending)");
 		}
 		D_ASSERT(req->rq_state & RQ_NET_SENT);
 		req->rq_state |= RQ_NET_DONE;
@@ -753,9 +765,9 @@
  * application request is on the fly, so once we are positive about a "bad"
  * state, we know it won't get better during the lifetime of this request.
  *
- * In case we think we are ok, but "asynchronously" some interrupt or other thread
- * marks some operation as impossible, we are still ok, since we would just try
- * anyways, and then see that it does not work there and then.
+ * In case we think we are ok, but "asynchronously" some interrupt or other
+ * thread marks some operation as impossible, we are still ok, since we would
+ * just try anyways, and then see that it does not work there and then.
  */
 
 int
@@ -836,11 +848,11 @@
 		goto fail_and_free_req;
 	}
 
-	/* For WRITES going to the local disk, grab a reference on the target extent.
-	 * This waits for any resync activity in the corresponding resync
-	 * extent to finish, and, if necessary, pulls in the target extent into
-	 * the activity log, which involves further disk io because of transactional
-	 * on-disk meta data updates. */
+	/* For WRITES going to the local disk, grab a reference on the target
+	 * extent.  This waits for any resync activity in the corresponding
+	 * resync extent to finish, and, if necessary, pulls in the target
+	 * extent into the activity log, which involves further disk io because
+	 * of transactional on-disk meta data updates. */
 	if (rw == WRITE && local)
 		drbd_al_begin_io(mdev, sector);
 
@@ -997,7 +1009,8 @@
 		if (FAULT_ACTIVE(mdev, rw == WRITE ? DRBD_FAULT_DT_WR :
 				       ( rw == READ ? DRBD_FAULT_DT_RD :
 						   DRBD_FAULT_DT_RA ) ))
-			bio_endio(req->private_bio, req->private_bio->bi_size, -EIO);
+			bio_endio(req->private_bio,
+					req->private_bio->bi_size, -EIO);
 		else
 			generic_make_request(req->private_bio);
 	}
@@ -1008,7 +1021,7 @@
 
 	return 0;
 
-  fail_and_free_req:
+fail_and_free_req:
 	if (b) kfree(b);
 	bio_endio(bio, bio->bi_size, err);
 	drbd_req_free(req);
@@ -1030,8 +1043,11 @@
 	if (mdev->state.role != Primary &&
 		( !allow_oos || is_write) ) {
 		if (DRBD_ratelimit(5*HZ, 5)) {
-			ERR("Process %s[%u] tried to %s; since we are not in Primary state, we cannot allow this\n",
-			    current->comm, current->pid, is_write ? "WRITE" : "READ");
+			ERR("Process %s[%u] tried to %s; "
+			    "since we are not in Primary state, "
+			    "we cannot allow this\n",
+			    current->comm, current->pid,
+			    is_write ? "WRITE" : "READ");
 		}
 		return 1;
 	}
@@ -1138,20 +1154,19 @@
 int drbd_merge_bvec(request_queue_t *q, struct bio *bio, struct bio_vec *bvec)
 {
 	struct drbd_conf *mdev = (struct drbd_conf *) 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;
 
-#if 1
-	limit = DRBD_MAX_SEGMENT_SIZE - ((bio_offset & (DRBD_MAX_SEGMENT_SIZE-1)) + bio_size);
-#else
-	limit = AL_EXTENT_SIZE - ((bio_offset & (AL_EXTENT_SIZE-1)) + bio_size);
-#endif
+	limit = DRBD_MAX_SEGMENT_SIZE
+	      - ((bio_offset & (DRBD_MAX_SEGMENT_SIZE-1)) + bio_size);
 	if (limit < 0) limit = 0;
 	if (bio_size == 0) {
 		if (limit <= bvec->bv_len) limit = bvec->bv_len;
 	} else if (limit && inc_local(mdev)) {
-		request_queue_t * const b = mdev->bc->backing_bdev->bd_disk->queue;
+		request_queue_t * const b =
+			mdev->bc->backing_bdev->bd_disk->queue;
 		if (b->merge_bvec_fn && mdev->bc->dc.use_bmbv) {
 			backing_limit = b->merge_bvec_fn(b, bio, bvec);
 			limit = min(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 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/drbd_req.h	2007-07-24 17:02:29 UTC (rev 2999)
@@ -204,17 +204,21 @@
 #define RQ_NET_OK          (1UL << __RQ_NET_OK)
 #define RQ_NET_SIS         (1UL << __RQ_NET_SIS)
 
-#define RQ_NET_MASK        (((1UL << __RQ_NET_MAX)-1) & ~RQ_LOCAL_MASK) /* 0x1f8 */
+/* 0x1f8 */
+#define RQ_NET_MASK        (((1UL << __RQ_NET_MAX)-1) & ~RQ_LOCAL_MASK)
 
 /* epoch entries */
-static inline struct hlist_head *ee_hash_slot(struct drbd_conf *mdev, sector_t sector)
+static inline
+struct hlist_head *ee_hash_slot(struct drbd_conf *mdev, sector_t sector)
 {
 	BUG_ON(mdev->ee_hash_s == 0);
-	return mdev->ee_hash + ((unsigned int)(sector>>HT_SHIFT) % mdev->ee_hash_s);
+	return mdev->ee_hash +
+		((unsigned int)(sector>>HT_SHIFT) % mdev->ee_hash_s);
 }
 
 /* transfer log (drbd_request objects) */
-static inline struct hlist_head *tl_hash_slot(struct drbd_conf *mdev, sector_t sector)
+static inline
+struct hlist_head *tl_hash_slot(struct drbd_conf *mdev, sector_t sector)
 {
 	BUG_ON(mdev->tl_hash_s == 0);
 	return mdev->tl_hash +
@@ -223,7 +227,8 @@
 
 /* when we receive the answer for a read request,
  * verify that we actually know about it */
-static inline struct drbd_request *_ack_id_to_req(struct drbd_conf *mdev, u64 id, sector_t sector)
+static inline struct drbd_request *_ack_id_to_req(struct drbd_conf *mdev,
+	u64 id, sector_t sector)
 {
 	struct hlist_head *slot = tl_hash_slot(mdev, sector);
 	struct hlist_node *n;
@@ -255,7 +260,8 @@
 
 /* when we receive the answer for a read request,
  * verify that we actually know about it */
-static inline struct drbd_request *_ar_id_to_req(struct drbd_conf *mdev, u64 id, sector_t sector)
+static inline struct drbd_request *_ar_id_to_req(struct drbd_conf *mdev,
+	u64 id, sector_t sector)
 {
 	struct hlist_head *slot = ar_hash_slot(mdev, sector);
 	struct hlist_node *n;
@@ -270,10 +276,12 @@
 	return NULL;
 }
 
-static inline struct drbd_request *drbd_req_new(struct drbd_conf *mdev, struct bio *bio_src)
+static inline struct drbd_request *drbd_req_new(struct drbd_conf *mdev,
+	struct bio *bio_src)
 {
 	struct bio *bio;
-	struct drbd_request *req = mempool_alloc(drbd_request_mempool, GFP_NOIO);
+	struct drbd_request *req =
+		mempool_alloc(drbd_request_mempool, GFP_NOIO);
 	if (likely(req)) {
 		bio = bio_clone(bio_src, GFP_NOIO); /* XXX cannot fail?? */
 
@@ -307,10 +315,12 @@
 /* aparently too large to be inlined...
  * moved to drbd_req.c */
 extern void _req_may_be_done(struct drbd_request *req, int error);
-extern void _req_mod(struct drbd_request *req, enum drbd_req_event what, int error);
+extern void _req_mod(struct drbd_request *req,
+		enum drbd_req_event what, int error);
 
 /* If you need it irqsave, do it your self! */
-static inline void req_mod(struct drbd_request *req, enum drbd_req_event what, int error)
+static inline void req_mod(struct drbd_request *req,
+		enum drbd_req_event what, int error)
 {
 	struct drbd_conf *mdev = req->mdev;
 	spin_lock_irq(&mdev->req_lock);

Modified: branches/drbd-8.0-for-linus/drbd/drbd_worker.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/drbd_worker.c	2007-07-24 17:02:29 UTC (rev 2999)
@@ -266,7 +266,8 @@
 	/* FIXME this is ugly. we should not detach for read io-error,
 	 * but try to WRITE the DataReply to the failed location,
 	 * to give the disk the chance to relocate that block */
-	drbd_io_error(mdev, FALSE); /* tries to schedule a detach and notifies peer */
+	/* try to schedule a detach and notifies peer: */
+	drbd_io_error(mdev, FALSE);
 	return w_send_read_req(mdev, w, 0);
 }
 
@@ -302,7 +303,8 @@
 
 #define SLEEP_TIME (HZ/10)
 
-int w_make_resync_request(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
+int w_make_resync_request(struct drbd_conf *mdev,
+		struct drbd_work *w, int cancel)
 {
 	unsigned long bit;
 	sector_t sector;
@@ -321,7 +323,8 @@
 	}
 
 	if (mdev->state.conn != SyncTarget)
-		ERR("%s in w_make_resync_request\n", conns_to_name(mdev->state.conn));
+		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);
 
@@ -340,8 +343,7 @@
 	}
 
 	for (i = 0; i < number; i++) {
-
-	next_sector:
+next_sector:
 		size = BM_BLOCK_SIZE;
 		/* as of now, we are the only user of drbd_bm_find_next */
 		bit  = drbd_bm_find_next(mdev);
@@ -616,7 +618,8 @@
 			ok = drbd_send_block(mdev, RSDataReply, e);
 		} else {
 			if (DRBD_ratelimit(5*HZ, 5))
-				ERR("Not sending RSDataReply, partner DISKLESS!\n");
+				ERR("Not sending RSDataReply, "
+				    "partner DISKLESS!\n");
 			ok = 1;
 		}
 	} else {
@@ -678,7 +681,8 @@
 	/* inc_ap_pending was done where this was queued.
 	 * dec_ap_pending will be done in got_BarrierAck
 	 * or (on connection loss) in w_clear_epoch.  */
-	ok = _drbd_send_cmd(mdev, mdev->data.socket, Barrier, (struct Drbd_Header *)p, sizeof(*p), 0);
+	ok = _drbd_send_cmd(mdev, mdev->data.socket, Barrier,
+				(struct Drbd_Header *)p, sizeof(*p), 0);
 	drbd_put_data_sock(mdev);
 
 	return ok;
@@ -823,9 +827,9 @@
 			continue;
 		if (odev->state.aftr_isp) {
 			if (_drbd_may_sync_now(odev))
-				rv |= ( _drbd_set_state(_NS(odev, aftr_isp, 0),
-							ChgStateHard|ScheduleAfter)
-					!= SS_NothingToDo ) ;
+				rv |= (_drbd_set_state(_NS(odev, aftr_isp, 0),
+						ChgStateHard|ScheduleAfter)
+					!= SS_NothingToDo) ;
 		}
 	}
 	return rv;
@@ -1003,7 +1007,8 @@
 		if (!w->cb(mdev, w, mdev->state.conn < Connected )) {
 			/* WARN("worker: a callback failed! \n"); */
 			if (mdev->state.conn >= Connected)
-				drbd_force_state(mdev, NS(conn, NetworkFailure));
+				drbd_force_state(mdev,
+						NS(conn, NetworkFailure));
 		}
 	}
 
@@ -1035,7 +1040,7 @@
 	 * from the times when the worker did not live as long as the
 	 * device.. */
 
-	D_ASSERT( mdev->state.disk == Diskless && mdev->state.conn == StandAlone );
+	D_ASSERT(mdev->state.disk == Diskless && mdev->state.conn == StandAlone);
 	drbd_mdev_cleanup(mdev);
 	module_put(THIS_MODULE);
 

Modified: branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-24 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/drbd_wrappers.h	2007-07-24 17:02:29 UTC (rev 2999)
@@ -17,10 +17,13 @@
 extern char *drbd_sec_holder;
 
 /* bi_end_io handlers */
-extern int drbd_md_io_complete(struct bio *bio, unsigned int bytes_done, int error);
+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);
-extern int drbd_endio_write_sec(struct bio *bio, unsigned int bytes_done, int error);
+extern int drbd_endio_read_sec(struct bio *bio,
+		unsigned int bytes_done, int error);
+extern int drbd_endio_write_sec(struct bio *bio,
+		unsigned int bytes_done, int error);
 extern int drbd_endio_pri(struct bio *bio, unsigned int bytes_done, int error);
 
 static inline sector_t drbd_get_hardsect(struct block_device *bdev)
@@ -108,12 +111,15 @@
 /*
  * used to submit our private bio
  */
-static inline void drbd_generic_make_request(struct drbd_conf *mdev, int rw, int fault_type, struct bio *bio)
+static inline void drbd_generic_make_request(struct drbd_conf *mdev, int rw,
+	int fault_type, struct bio *bio)
 {
-	bio->bi_rw = rw; /* on the receiver side, e->..rw was not yet defined. */
+	/* on the receiver side, e->..rw was not yet defined. */
+	bio->bi_rw = rw;
 
 	if (!bio->bi_bdev) {
-		printk(KERN_ERR DEVICE_NAME "%d: drbd_generic_make_request: bio->bi_bdev == NULL\n",
+		printk(KERN_ERR DEVICE_NAME
+		       "%d: drbd_generic_make_request: bio->bi_bdev == NULL\n",
 		       mdev_to_minor(mdev));
 		dump_stack();
 		bio_endio(bio, bio->bi_size, -ENODEV);

Modified: branches/drbd-8.0-for-linus/drbd/linux/drbd.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/linux/drbd.h	2007-07-24 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/linux/drbd.h	2007-07-24 17:02:29 UTC (rev 2999)
@@ -177,7 +177,7 @@
 	Attaching,      /* In the process of reading the meta-data */
 	Failed,         /* Becomes Diskless as soon as we told it the peer */
 			/* when >= Failed it is legal to access mdev->bc */
-	Negotiating,    /* Late attaching state, we need to talk to the peer... */
+	Negotiating,    /* Late attaching state, we need to talk to the peer */
 	Inconsistent,
 	Outdated,
 	DUnknown,       /* Only used for the peer, never for myself */
@@ -253,8 +253,8 @@
 	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. */
+	UUID_SIZE,      /* nl-packet: number of dirty bits */
+	UUID_FLAGS,     /* nl-packet: flags */
 	EXT_UUID_SIZE   /* Everything. */
 };
 

Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.c
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.c	2007-07-24 17:02:29 UTC (rev 2999)
@@ -90,9 +90,10 @@
 {
 	/* NOTE:
 	 * total calls to lc_get are
-	 * starving + hits + misses
-	 * misses include "dirty" count (update from an other thread in progress)
-	 * and "changed", when this in fact lead to an successful update of the cache.
+	 * (starving + hits + misses)
+	 * misses include "dirty" count (update from an other thread in
+	 * progress) and "changed", when this in fact lead to an successful
+	 * update of the cache.
 	 */
 	return seq_printf(seq, "\t%s: used:%u/%u "
 		"hits:%lu misses:%lu starving:%lu dirty:%lu changed:%lu\n",
@@ -293,7 +294,8 @@
 	++lc->changed;
 	e->lc_number = lc->new_number;
 	list_add(&e->list, &lc->in_use);
-	hlist_add_head( &e->colision, lc->slot + lc_hash_fn(lc, lc->new_number) );
+	hlist_add_head(&e->colision,
+		lc->slot + lc_hash_fn(lc, lc->new_number));
 	lc->changing_element = NULL;
 	lc->new_number = -1;
 	clear_bit(__LC_DIRTY, &lc->flags);
@@ -312,7 +314,8 @@
 	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. */
+		/* move it to the front of LRU. */
+		list_move(&e->list, &lc->lru);
 		lc->used--;
 		clear_bit(__LC_STARVING, &lc->flags);
 		smp_mb__after_clear_bit();
@@ -342,7 +345,7 @@
 	list_move(&e->list, e->refcnt ? &lc->in_use : &lc->lru);
 }
 
-#if 0
+#ifdef DRBD_DUMP_RESYNC_DETAIL
 /**
  * lc_dump: Dump a complete LRU cache to seq in textual form.
  */

Modified: branches/drbd-8.0-for-linus/drbd/lru_cache.h
===================================================================
--- branches/drbd-8.0-for-linus/drbd/lru_cache.h	2007-07-24 14:57:11 UTC (rev 2998)
+++ branches/drbd-8.0-for-linus/drbd/lru_cache.h	2007-07-24 17:02:29 UTC (rev 2999)
@@ -26,22 +26,23 @@
  */
 
 /*
-  The lru_cache describes a big set of objects that are addressed
-  by an index number (=lc_number). Only a small fraction of this set
-  is present in the cache.
-  (You set the size of the cache during lc_alloc)
-  Once created, the api consists of
-    lc_find(,nr) -- finds the object with the given number, if present
-    lc_get(,nr)  -- finds the object and increases the usage count
-		    if not present, actions are taken to make sure that
-		    the cache is updated, the user is notified of this by a callback.
-		    Return value is NULL in this case.
-		    As soon as the user informs the cache that it has been updated,
-		    the next lc_get on that very object number will be successfull.
-    lc_put(,lc_element*)
-		 -- decreases the usage count of this object, and returns the new value.
-
-    NOTE: It is the USERS responsibility to make sure that calls do not happen concurrently.
+ * The lru_cache describes a big set of objects that are addressed
+ * by an index number (=lc_number). Only a small fraction of this set
+ * is present in the cache.
+ * (You set the size of the cache during lc_alloc)
+ * Once created, the api consists of
+ *   lc_find(,nr) -- finds the object with the given number, if present
+ *   lc_get(,nr)  -- finds the object and increases the usage count
+ *	if not present, actions are taken to make sure that
+ *	the cache is updated, the user is notified of this by a callback.
+ *	Return value is NULL in this case.
+ *	As soon as the user informs the cache that it has been updated,
+ *	the next lc_get on that very object number will be successfull.
+ *   lc_put(,lc_element*)
+ *     -- decreases the usage count of this object, and returns the new value.
+ *
+ * NOTE: It is the USERS responsibility
+ * to make sure that calls do not happen concurrently.
  */
 
 #ifndef LRU_CACHE_H

From drbd-cvs at lists.linbit.com  Wed Jul 25 14:54:21 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Jul 25 14:54:24 2007
Subject: [DRBD-cvs] svn commit by lars - r3001 - branches - here we
	"backport" all changes necessary for kernel inc
Message-ID: <20070725125421.0B4C640095@garcon1.linbit.com>

Author: lars
Date: 2007-07-25 14:54:21 +0200 (Wed, 25 Jul 2007)
New Revision: 3001

Added:
   branches/drbd-8.1/
Removed:
   branches/drbd-8.0-for-linus/
Log:
here we "backport" all changes necessary for kernel inclusion.
aparently we need some major code changes.
I'm confident that these will be improvements.
but along the way this may temporarily destabilize the code,
which we cannot do in a "stable" branch.

so even without new features, but expecting major code restructuring,
this won't stay 8.0 any longer, but is going to be 8.1,


Copied: branches/drbd-8.1 (from rev 3000, branches/drbd-8.0-for-linus)

From drbd-cvs at lists.linbit.com  Fri Jul 27 13:35:57 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Fri Jul 27 13:36:00 2007
Subject: [DRBD-cvs] svn commit by lars - r3002 - in branches/drbd-8.1/drbd:
	. linux - c075badaf241dc52e2f085f95727f24434758a26 DRBD: split "i
Message-ID: <20070727113557.AD1FF40095@garcon1.linbit.com>

Author: lars
Date: 2007-07-27 13:35:53 +0200 (Fri, 27 Jul 2007)
New Revision: 3002

Modified:
   branches/drbd-8.1/drbd/drbd_actlog.c
   branches/drbd-8.1/drbd/drbd_bitmap.c
   branches/drbd-8.1/drbd/drbd_int.h
   branches/drbd-8.1/drbd/drbd_main.c
   branches/drbd-8.1/drbd/drbd_nl.c
   branches/drbd-8.1/drbd/drbd_proc.c
   branches/drbd-8.1/drbd/drbd_receiver.c
   branches/drbd-8.1/drbd/drbd_req.c
   branches/drbd-8.1/drbd/drbd_req.h
   branches/drbd-8.1/drbd/drbd_worker.c
   branches/drbd-8.1/drbd/linux/drbd_config.h
   branches/drbd-8.1/drbd/lru_cache.c
Log:
c075badaf241dc52e2f085f95727f24434758a26 DRBD: split "if (cond) stmt;" into two lines everywhere.
ee62de7319cf503c465d76cf53ed682eb5385ed6 DRBD: got rid of useless if in "if (p) kfree(p);"


Modified: branches/drbd-8.1/drbd/drbd_actlog.c
===================================================================
--- branches/drbd-8.1/drbd/drbd_actlog.c	2007-07-25 12:54:21 UTC (rev 3001)
+++ branches/drbd-8.1/drbd/drbd_actlog.c	2007-07-27 11:35:53 UTC (rev 3002)
@@ -48,7 +48,8 @@
 	bio->bi_bdev = bdev->md_bdev;
 	bio->bi_sector = sector;
 	ok = (bio_add_page(bio, page, size, 0) == size);
-	if (!ok) goto out;
+	if (!ok)
+		goto out;
 	init_completion(&event);
 	bio->bi_private = &event;
 	bio->bi_end_io = drbd_md_io_complete;
@@ -89,13 +90,15 @@
 	}
 
 	hardsect = drbd_get_hardsect(bdev->md_bdev);
-	if (hardsect == 0) hardsect = MD_HARDSECT;
+	if (hardsect == 0)
+		hardsect = MD_HARDSECT;
 
 	/* in case hardsect != 512 [ s390 only? ] */
 	if (hardsect != MD_HARDSECT) {
 		if (!mdev->md_io_tmpp) {
 			struct page *page = alloc_page(GFP_NOIO);
-			if (!page) return 0;
+			if (!page)
+				return 0;
 
 			WARN("Meta data's bdev hardsect = %d != %d\n",
 			     hardsect, MD_HARDSECT);
@@ -428,7 +431,8 @@
 	/* 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;
+		if (rv == 0)
+			continue;
 		if (rv == -1) {
 			up(&mdev->md_io_mutex);
 			return 0;
@@ -436,7 +440,8 @@
 		cnr = be32_to_cpu(buffer->tr_number);
 		/* INFO("index %d valid tnr=%d\n",i,cnr); */
 
-		if (cnr == -1) overflow = 1;
+		if (cnr == -1)
+			overflow = 1;
 
 		if (cnr < from_tnr && !overflow) {
 			from = i;
@@ -482,7 +487,8 @@
 			pos = be32_to_cpu(buffer->updates[j].pos);
 			extent_nr = be32_to_cpu(buffer->updates[j].extent);
 
-			if (extent_nr == LC_FREE) continue;
+			if (extent_nr == LC_FREE)
+				continue;
 
 			lc_set(mdev->act_log, extent_nr, pos);
 			active_extents++;
@@ -492,9 +498,11 @@
 		transactions++;
 
 cancel:
-		if (i == to) break;
+		if (i == to)
+			break;
 		i++;
-		if (i > mx) i = 0;
+		if (i > mx)
+			i = 0;
 	}
 
 	mdev->al_tr_number = to_tnr+1;
@@ -526,7 +534,8 @@
 	struct page *page;
 	int uptodate = bio_flagged(bio, BIO_UPTODATE);
 
-	if (bio->bi_size) return 1;
+	if (bio->bi_size)
+		return 1;
 
 	/* strange behaviour of some lower level drivers...
 	 * fail the request by clearing the uptodate flag,
@@ -536,13 +545,15 @@
 		error = -EIO;
 
 	drbd_chk_io_error(mdev, error, TRUE);
-	if (error && wc->error == 0) wc->error = error;
+	if (error && wc->error == 0)
+		wc->error = error;
 
 	if (atomic_dec_and_test(&wc->count))
 		complete(&wc->io_done);
 
 	page = bio->bi_io_vec[0].bv_page;
-	if (page) put_page(page);
+	if (page)
+		put_page(page);
 	bio_put(bio);
 	mdev->bm_writ_cnt++;
 	dec_local(mdev);
@@ -570,12 +581,14 @@
 
 	/* 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;
+		if (bio->bi_sector == on_disk_sector)
+			return 0;
 		i++;
 	}
 
 	bio = bio_alloc(GFP_KERNEL, 1);
-	if (bio == NULL) return -ENOMEM;
+	if (bio == NULL)
+		return -ENOMEM;
 
 	bio->bi_bdev = mdev->bc->md_bdev;
 	bio->bi_sector = on_disk_sector;
@@ -585,7 +598,8 @@
 	if (*page_offset == PAGE_SIZE) {
 		np = alloc_page(__GFP_HIGHMEM);
 		/* no memory leak, bio gets cleaned up by caller */
-		if (np == NULL) return -ENOMEM;
+		if (np == NULL)
+			return -ENOMEM;
 		*page = np;
 		*page_offset = 0;
 		allocated_page = 1;
@@ -601,7 +615,8 @@
 	if (bio_add_page(bio, *page, MD_HARDSECT, *page_offset) != MD_HARDSECT)
 		return -EINVAL;
 
-	if (!allocated_page) get_page(*page);
+	if (!allocated_page)
+		get_page(*page);
 
 	*page_offset += MD_HARDSECT;
 
@@ -641,7 +656,8 @@
 	nr_elements = mdev->act_log->nr_elements;
 
 	bios = kzalloc(sizeof(struct bio *) * nr_elements, GFP_KERNEL);
-	if (!bios) goto submit_one_by_one;
+	if (!bios)
+		goto submit_one_by_one;
 
 	atomic_set(&wc.count, 0);
 	init_completion(&wc.io_done);
@@ -650,7 +666,8 @@
 
 	for (i = 0; i < nr_elements; i++) {
 		enr = lc_entry(mdev->act_log, i)->lc_number;
-		if (enr == LC_FREE) continue;
+		if (enr == LC_FREE)
+			continue;
 		/* next statement also does atomic_inc wc.count */
 		if (atodb_prepare_unless_covered(mdev, bios, &page,
 						&page_offset,
@@ -665,7 +682,8 @@
 
 	/* all prepared, submit them */
 	for (i = 0; i < nr_elements; i++) {
-		if (bios[i] == NULL) break;
+		if (bios[i] == NULL)
+			break;
 		if (FAULT_ACTIVE( mdev, DRBD_FAULT_MD_WR )) {
 			bios[i]->bi_rw = WRITE;
 			bio_endio(bios[i], bios[i]->bi_size, -EIO);
@@ -687,14 +705,16 @@
 
 	dec_local(mdev);
 
-	if (wc.error) drbd_io_error(mdev, TRUE);
+	if (wc.error)
+		drbd_io_error(mdev, TRUE);
 	kfree(bios);
 	return;
 
  free_bios_submit_one_by_one:
 	/* free everything by calling the endio callback directly. */
 	for (i = 0; i < nr_elements; i++) {
-		if (bios[i] == NULL) break;
+		if (bios[i] == NULL)
+			break;
 		bios[i]->bi_size = 0;
 		atodb_endio(bios[i], MD_HARDSECT, 0);
 	}
@@ -705,7 +725,8 @@
 
 	for (i = 0; i < mdev->act_log->nr_elements; i++) {
 		enr = lc_entry(mdev->act_log, i)->lc_number;
-		if (enr == LC_FREE) continue;
+		if (enr == LC_FREE)
+			continue;
 		/* Really slow: if we have al-extents 16..19 active,
 		 * sector 4 will be written four times! Synchronous! */
 		drbd_bm_write_sect(mdev, enr/AL_EXT_PER_BM_SECT );
@@ -731,7 +752,8 @@
 
 	for (i = 0; i < mdev->act_log->nr_elements; i++) {
 		enr = lc_entry(mdev->act_log, i)->lc_number;
-		if (enr == LC_FREE) continue;
+		if (enr == LC_FREE)
+			continue;
 		add += drbd_bm_ALe_set_all(mdev, enr);
 	}
 
@@ -770,7 +792,8 @@
 
 	for (i = 0; i < mdev->act_log->nr_elements; i++) {
 		al_ext = lc_entry(mdev->act_log, i);
-		if (al_ext->lc_number == LC_FREE) continue;
+		if (al_ext->lc_number == LC_FREE)
+			continue;
 		wait_event(mdev->al_wait, _try_lc_del(mdev, al_ext));
 	}
 
@@ -943,7 +966,8 @@
 		    (unsigned long long)sector, size, sbnr, ebnr);
 	    );
 
-	if (sbnr > ebnr) return;
+	if (sbnr > ebnr)
+		return;
 
 	/*
 	 * ok, (capacity & 7) != 0 sometimes, but who cares...
@@ -974,7 +998,8 @@
 		wake_up = 1;
 	}
 	spin_unlock_irqrestore(&mdev->al_lock, flags);
-	if (wake_up) wake_up(&mdev->al_wait);
+	if (wake_up)
+		wake_up(&mdev->al_wait);
 }
 
 /*
@@ -1059,12 +1084,14 @@
 			lc_changed(mdev->resync, (struct lc_element *)bm_ext);
 			wakeup = 1;
 		}
-		if (bm_ext->lce.refcnt == 1) mdev->resync_locked++;
+		if (bm_ext->lce.refcnt == 1)
+			mdev->resync_locked++;
 		set_bit(BME_NO_WRITES, &bm_ext->flags);
 	}
 	rs_flags = mdev->resync->flags;
 	spin_unlock_irq(&mdev->al_lock);
-	if (wakeup) wake_up(&mdev->al_wait);
+	if (wakeup)
+		wake_up(&mdev->al_wait);
 
 	if (!bm_ext) {
 		if (rs_flags & LC_STARVING)
@@ -1086,7 +1113,8 @@
 	else {
 		al_ext = lc_find(mdev->act_log, enr);
 		if (al_ext) {
-			if (al_ext->refcnt) rv = 1;
+			if (al_ext->refcnt)
+				rv = 1;
 		}
 	}
 	spin_unlock_irq(&mdev->al_lock);
@@ -1122,7 +1150,8 @@
 
 	sig = wait_event_interruptible( mdev->al_wait,
 			(bm_ext = _bme_get(mdev, enr)) );
-	if (sig) return 0;
+	if (sig)
+		return 0;
 
 	if (test_bit(BME_LOCKED, &bm_ext->flags)) return 1;
 
@@ -1262,7 +1291,8 @@
 	MTRACE(TraceTypeResync, TraceLvlAll,
 		INFO("need to try again for %u\n", enr);
 	);
-	if (bm_ext) mdev->resync_wenr = enr;
+	if (bm_ext)
+		mdev->resync_wenr = enr;
 	spin_unlock_irq(&mdev->al_lock);
 	return -EAGAIN;
 }
@@ -1323,7 +1353,8 @@
 		/* 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;
+			if (bm_ext->lce.lc_number == LC_FREE)
+				continue;
 			bm_ext->lce.refcnt = 0; /* Rude but ok. */
 			bm_ext->rs_left = 0;
 			clear_bit(BME_LOCKED, &bm_ext->flags);
@@ -1360,7 +1391,8 @@
 		/* 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;
+			if (bm_ext->lce.lc_number == LC_FREE)
+				continue;
 			if (bm_ext->lce.lc_number == mdev->resync_wenr) {
 				INFO("dropping %u in drbd_rs_del_all, aparently"
 				     " got 'synced' by application io\n",
@@ -1433,7 +1465,8 @@
 		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;
+	if (sbnr > ebnr)
+		return;
 
 	/*
 	 * ok, (capacity & 7) != 0 sometimes, but who cares...
@@ -1456,5 +1489,6 @@
 		wake_up = 1;
 	}
 	spin_unlock_irq(&mdev->al_lock);
-	if (wake_up) wake_up(&mdev->al_wait);
+	if (wake_up)
+		wake_up(&mdev->al_wait);
 }

Modified: branches/drbd-8.1/drbd/drbd_bitmap.c
===================================================================
--- branches/drbd-8.1/drbd/drbd_bitmap.c	2007-07-25 12:54:21 UTC (rev 3001)
+++ branches/drbd-8.1/drbd/drbd_bitmap.c	2007-07-27 11:35:53 UTC (rev 3002)
@@ -444,7 +444,8 @@
 	unsigned long word, bits;
 	size_t n = number;
 
-	if (number == 0) return;
+	if (number == 0)
+		return;
 	ERR_IF(!b) return;
 	ERR_IF(!b->bm) return;
 	WARN_ON(offset        >= b->bm_words);
@@ -482,7 +483,8 @@
 	unsigned long word, bits;
 	size_t n = number;
 
-	if (number == 0) return;
+	if (number == 0)
+		return;
 	ERR_IF(!b) return;
 	ERR_IF(!b->bm) return;
 	WARN_ON(offset        >= b->bm_words);
@@ -518,7 +520,8 @@
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long *bm;
 
-	if (number == 0) return;
+	if (number == 0)
+		return;
 	ERR_IF(!b) return;
 	ERR_IF(!b->bm) return;
 	if ( (offset        >= b->bm_words) ||
@@ -712,7 +715,8 @@
 	 */
 	mdev->bitmap = NULL;
 
-	if (rw == WRITE)	bm_cpu_to_lel(b);
+	if (rw == WRITE)
+		bm_cpu_to_lel(b);
 
 	now = jiffies;
 	atomic_set(&b->bm_async_io, num_pages);

Modified: branches/drbd-8.1/drbd/drbd_int.h
===================================================================
--- branches/drbd-8.1/drbd/drbd_int.h	2007-07-25 12:54:21 UTC (rev 3001)
+++ branches/drbd-8.1/drbd/drbd_int.h	2007-07-27 11:35:53 UTC (rev 3002)
@@ -183,11 +183,12 @@
 # define D_ASSERT(exp)	if (!(exp)) \
 	 ERR("ASSERT( " #exp " ) in %s:%d\n", __FILE__, __LINE__)
 #endif
-#define ERR_IF(exp) if (({ \
-	int _b = (exp) != 0; \
-	if (_b) ERR("%s: (" #exp ") in %s:%d\n", \
-		__func__, __FILE__, __LINE__); \
-	 _b; \
+#define ERR_IF(exp) if (({				\
+	int _b = (exp) != 0;				\
+	if (_b)						\
+		ERR("%s: (" #exp ") in %s:%d\n",	\
+		__func__, __FILE__, __LINE__);		\
+	 _b;						\
 	}))
 
 /* Defines to control fault insertion */
@@ -1770,7 +1771,8 @@
 
 	atomic_inc(&mdev->net_cnt);
 	have_net_conf = mdev->state.conn >= Unconnected;
-	if (!have_net_conf) dec_net(mdev);
+	if (!have_net_conf)
+		dec_net(mdev);
 	return have_net_conf;
 }
 
@@ -1822,9 +1824,12 @@
 static inline int __inc_ap_bio_cond(struct drbd_conf *mdev)
 {
 	int mxb = drbd_get_max_buffers(mdev);
-	if (mdev->state.susp) return 0;
-	if (mdev->state.conn == WFBitMapS) return 0;
-	if (mdev->state.conn == WFBitMapT) return 0;
+	if (mdev->state.susp)
+		return 0;
+	if (mdev->state.conn == WFBitMapS)
+		return 0;
+	if (mdev->state.conn == WFBitMapT)
+		return 0;
 	/* since some older kernels don't have atomic_add_unless,
 	 * and we are within the spinlock anyways, we have this workaround.  */
 	if (atomic_read(&mdev->ap_bio_cnt) > mxb) return 0;
@@ -1866,7 +1871,8 @@
 	int ap_bio = atomic_dec_return(&mdev->ap_bio_cnt);
 
 	D_ASSERT(ap_bio >= 0);
-	if (ap_bio < mxb) wake_up(&mdev->misc_wait);
+	if (ap_bio < mxb)
+		wake_up(&mdev->misc_wait);
 }
 
 static inline int seq_cmp(u32 a, u32 b)
@@ -1892,7 +1898,8 @@
 	m = seq_max(mdev->peer_seq, new_seq);
 	mdev->peer_seq = m;
 	spin_unlock(&mdev->peer_seq_lock);
-	if (m == new_seq) wake_up(&mdev->seq_wait);
+	if (m == new_seq)
+		wake_up(&mdev->seq_wait);
 }
 
 static inline int drbd_queue_order_type(struct drbd_conf *mdev)

Modified: branches/drbd-8.1/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.1/drbd/drbd_main.c	2007-07-25 12:54:21 UTC (rev 3001)
+++ branches/drbd-8.1/drbd/drbd_main.c	2007-07-27 11:35:53 UTC (rev 3002)
@@ -160,7 +160,8 @@
 	struct drbd_barrier *b;
 
 	b = kmalloc(sizeof(struct drbd_barrier), GFP_KERNEL);
-	if (!b) return 0;
+	if (!b)
+		return 0;
 	INIT_LIST_HEAD(&b->requests);
 	INIT_LIST_HEAD(&b->w.list);
 	b->next = 0;
@@ -335,7 +336,8 @@
 				ChgStateHard|ScheduleAfter);
 	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
-	if (!send) return ok;
+	if (!send)
+		return ok;
 
 	ok = drbd_send_state(mdev);
 	if (ok)
@@ -461,7 +463,8 @@
 		spin_unlock_irqrestore(&mdev->req_lock, flags);
 
 		if (rv < SS_Success) {
-			if (f & ChgStateVerbose) print_st_err(mdev, os, ns, rv);
+			if (f & ChgStateVerbose)
+				print_st_err(mdev, os, ns, rv);
 			return rv;
 		}
 
@@ -469,7 +472,8 @@
 		if ( !drbd_send_state_req(mdev, mask, val) ) {
 			drbd_state_unlock(mdev);
 			rv = SS_CW_FailedByPeer;
-			if (f & ChgStateVerbose) print_st_err(mdev, os, ns, rv);
+			if (f & ChgStateVerbose)
+				print_st_err(mdev, os, ns, rv);
 			return rv;
 		}
 
@@ -479,7 +483,8 @@
 		if (rv < SS_Success) {
 			/* nearly dead code. */
 			drbd_state_unlock(mdev);
-			if (f & ChgStateVerbose) print_st_err(mdev, os, ns, rv);
+			if (f & ChgStateVerbose)
+				print_st_err(mdev, os, ns, rv);
 			return rv;
 		}
 		spin_lock_irqsave(&mdev->req_lock, flags);
@@ -559,7 +564,8 @@
 		dec_net(mdev);
 	}
 
-	if (rv <= 0) /* already found a reason to abort */;
+	if (rv <= 0)
+		/* already found a reason to abort */;
 	else if (ns.role == Secondary && mdev->open_cnt)
 		rv = SS_DeviceInUse;
 
@@ -716,14 +722,19 @@
 			ns.susp = 1;
 
 	if (ns.aftr_isp || ns.peer_isp || ns.user_isp) {
-		if (ns.conn == SyncSource) ns.conn = PausedSyncS;
-		if (ns.conn == SyncTarget) ns.conn = PausedSyncT;
+		if (ns.conn == SyncSource)
+			ns.conn = PausedSyncS;
+		if (ns.conn == SyncTarget)
+			ns.conn = PausedSyncT;
 	} else {
-		if (ns.conn == PausedSyncS) ns.conn = SyncSource;
-		if (ns.conn == PausedSyncT) ns.conn = SyncTarget;
+		if (ns.conn == PausedSyncS)
+			ns.conn = SyncSource;
+		if (ns.conn == PausedSyncT)
+			ns.conn = SyncTarget;
 	}
 
-	if (ns.i == os.i) return SS_NothingToDo;
+	if (ns.i == os.i)
+		return SS_NothingToDo;
 
 	if ( !(flags & ChgStateHard) ) {
 		/*  pre-state-change checks ; only look at ns  */
@@ -747,7 +758,8 @@
 	}
 
 	if (rv < SS_Success) {
-		if (flags & ChgStateVerbose) print_st_err(mdev, os, ns, rv);
+		if (flags & ChgStateVerbose)
+			print_st_err(mdev, os, ns, rv);
 		return rv;
 	}
 
@@ -859,13 +871,19 @@
 
 		if (test_bit(CRASHED_PRIMARY, &mdev->flags) ||
 		    mdev->state.role == Primary ||
-		    ( mdev->state.pdsk < Inconsistent &&
-		      mdev->state.peer == Primary ) )  mdf |= MDF_PrimaryInd;
-		if (mdev->state.conn > WFReportParams) mdf |= MDF_ConnectedInd;
-		if (mdev->state.disk > Inconsistent)   mdf |= MDF_Consistent;
-		if (mdev->state.disk > Outdated)       mdf |= MDF_WasUpToDate;
+		    (mdev->state.pdsk < Inconsistent &&
+		      mdev->state.peer == Primary))
+			mdf |= MDF_PrimaryInd;
+		if (mdev->state.conn > WFReportParams)
+			mdf |= MDF_ConnectedInd;
+		if (mdev->state.disk > Inconsistent)
+			mdf |= MDF_Consistent;
+		if (mdev->state.disk > Outdated)
+			mdf |= MDF_WasUpToDate;
 		if (mdev->state.pdsk <= Outdated &&
-		    mdev->state.pdsk >= Inconsistent)  mdf |= MDF_PeerOutDated;
+		    mdev->state.pdsk >= Inconsistent)
+			mdf |= MDF_PeerOutDated;
+
 		if (mdf != mdev->bc->md.flags) {
 			mdev->bc->md.flags = mdf;
 			drbd_md_mark_dirty(mdev);
@@ -1154,7 +1172,8 @@
 
 	if (thi->t_state == None) {
 		spin_unlock(&thi->t_lock);
-		if (restart) drbd_thread_start(thi);
+		if (restart)
+			drbd_thread_start(thi);
 		return;
 	}
 
@@ -1167,7 +1186,8 @@
 		thi->t_state = ns;
 		smp_mb();
 		if (thi->task != current) {
-			if (wait) init_completion(&thi->startstop);
+			if (wait)
+				init_completion(&thi->startstop);
 			force_sig(DRBD_SIGKILL, thi->task);
 		} else
 			D_ASSERT(!wait);
@@ -1491,7 +1511,8 @@
 	p.blksize  = blksize;
 	p.seq_num  = cpu_to_be32(atomic_add_return(1, &mdev->packet_seq));
 
-	if (!mdev->meta.socket || mdev->state.conn < Connected) return FALSE;
+	if (!mdev->meta.socket || mdev->state.conn < Connected)
+		return FALSE;
 	ok = drbd_send_cmd(mdev, USE_META_SOCKET, cmd,
 				(struct Drbd_Header *)&p, sizeof(p));
 	return ok;
@@ -1793,7 +1814,8 @@
 	struct msghdr msg;
 	int rv, sent = 0;
 
-	if (!sock) return -1000;
+	if (!sock)
+		return -1000;
 
 	/* THINK  if (signal_pending) return ... ? */
 
@@ -1854,7 +1876,8 @@
 			flush_signals(current);
 			rv = 0;
 		}
-		if (rv < 0) break;
+		if (rv < 0)
+			break;
 		sent += rv;
 		iov.iov_base += rv;
 		iov.iov_len  -= rv;
@@ -1884,7 +1907,8 @@
 	int rv = 0;
 
 	mdev = minor_to_mdev(MINOR(inode->i_rdev));
-	if (!mdev) return -ENODEV;
+	if (!mdev)
+		return -ENODEV;
 
 	spin_lock_irqsave(&mdev->req_lock, flags);
 	/* to have a stable mdev->state.role
@@ -1897,7 +1921,8 @@
 			rv = -EMEDIUMTYPE;
 	}
 
-	if (!rv) mdev->open_cnt++;
+	if (!rv)
+		mdev->open_cnt++;
 	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
 	return rv;
@@ -1909,7 +1934,8 @@
 	struct drbd_conf *mdev;
 
 	mdev = minor_to_mdev(MINOR(inode->i_rdev));
-	if (!mdev) return -ENODEV;
+	if (!mdev)
+		return -ENODEV;
 
 	/*
 	printk(KERN_ERR DEVICE_NAME ": close(inode=%p,file=%p)"
@@ -1952,7 +1978,8 @@
 	}
 	spin_unlock_irq(&mdev->req_lock);
 
-	if (mdev->state.disk >= Inconsistent) drbd_kick_lo(mdev);
+	if (mdev->state.disk >= Inconsistent)
+		drbd_kick_lo(mdev);
 }
 
 void drbd_set_defaults(struct drbd_conf *mdev)
@@ -2130,10 +2157,14 @@
 
 	/* D_ASSERT(atomic_read(&drbd_pp_vacant)==0); */
 
-	if (drbd_ee_mempool) mempool_destroy(drbd_ee_mempool);
-	if (drbd_request_mempool) mempool_destroy(drbd_request_mempool);
-	if (drbd_ee_cache) kmem_cache_destroy(drbd_ee_cache);
-	if (drbd_request_cache) kmem_cache_destroy(drbd_request_cache);
+	if (drbd_ee_mempool)
+		mempool_destroy(drbd_ee_mempool);
+	if (drbd_request_mempool)
+		mempool_destroy(drbd_request_mempool);
+	if (drbd_ee_cache)
+		kmem_cache_destroy(drbd_ee_cache);
+	if (drbd_request_cache)
+		kmem_cache_destroy(drbd_request_cache);
 
 	drbd_ee_mempool      = NULL;
 	drbd_request_mempool = NULL;
@@ -2184,7 +2215,8 @@
 
 	for (i = 0; i < number; i++) {
 		page = alloc_page(GFP_HIGHUSER);
-		if (!page) goto Enomem;
+		if (!page)
+			goto Enomem;
 		set_page_private(page, (unsigned long)drbd_pp_pool);
 		drbd_pp_pool = page;
 	}
@@ -2229,7 +2261,8 @@
 			struct gendisk  **disk = &mdev->vdisk;
 			request_queue_t **q    = &mdev->rq_queue;
 
-			if (!mdev) continue;
+			if (!mdev)
+				continue;
 			drbd_free_resources(mdev);
 
 			if (*disk) {
@@ -2237,30 +2270,39 @@
 				put_disk(*disk);
 				*disk = NULL;
 			}
-			if (*q) blk_put_queue(*q);
+			if (*q)
+				blk_put_queue(*q);
 			*q = NULL;
 
 			D_ASSERT(mdev->open_cnt == 0);
-			if (mdev->this_bdev) bdput(mdev->this_bdev);
+			if (mdev->this_bdev)
+				bdput(mdev->this_bdev);
 
 			tl_cleanup(mdev);
-			if (mdev->bitmap) drbd_bm_cleanup(mdev);
-			if (mdev->resync) lc_free(mdev->resync);
+			if (mdev->bitmap)
+				drbd_bm_cleanup(mdev);
+			if (mdev->resync)
+				lc_free(mdev->resync);
 
 			rr = drbd_release_ee(mdev, &mdev->active_ee);
-			if (rr) ERR("%d EEs in active list found!\n", rr);
+			if (rr)
+				ERR("%d EEs in active list found!\n", rr);
 
 			rr = drbd_release_ee(mdev, &mdev->sync_ee);
-			if (rr) ERR("%d EEs in sync list found!\n", rr);
+			if (rr)
+				ERR("%d EEs in sync list found!\n", rr);
 
 			rr = drbd_release_ee(mdev, &mdev->read_ee);
-			if (rr) ERR("%d EEs in read list found!\n", rr);
+			if (rr)
+				ERR("%d EEs in read list found!\n", rr);
 
 			rr = drbd_release_ee(mdev, &mdev->done_ee);
-			if (rr) ERR("%d EEs in done list found!\n", rr);
+			if (rr)
+				ERR("%d EEs in done list found!\n", rr);
 
 			rr = drbd_release_ee(mdev, &mdev->net_ee);
-			if (rr) ERR("%d EEs in net list found!\n", rr);
+			if (rr)
+				ERR("%d EEs in net list found!\n", rr);
 
 			ERR_IF (!list_empty(&mdev->data.work.q)) {
 				struct list_head *lp;
@@ -2310,20 +2352,23 @@
 	request_queue_t *q;
 
 	mdev = kzalloc(sizeof(struct drbd_conf), GFP_KERNEL);
-	if (!mdev) goto Enomem;
+	if (!mdev)
+		goto Enomem;
 
 	mdev->minor = minor;
 
 	drbd_init_set_defaults(mdev);
 
 	q = blk_alloc_queue(GFP_KERNEL);
-	if (!q) goto Enomem;
+	if (!q)
+		goto Enomem;
 	mdev->rq_queue = q;
 	q->queuedata   = mdev;
 	q->max_segment_size = DRBD_MAX_SEGMENT_SIZE;
 
 	disk = alloc_disk(1);
-	if (!disk) goto Enomem;
+	if (!disk)
+		goto Enomem;
 	mdev->vdisk = disk;
 
 	set_disk_ro( disk, TRUE );
@@ -2347,21 +2392,24 @@
 	q->unplug_fn = drbd_unplug_fn;
 
 	mdev->md_io_page = alloc_page(GFP_KERNEL);
-	if (!mdev->md_io_page) goto Enomem;
+	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. */
 	if (!tl_init(mdev)) goto Enomem;
 
 	mdev->app_reads_hash = kzalloc(APP_R_HSIZE*sizeof(void *), GFP_KERNEL);
-	if (!mdev->app_reads_hash) goto Enomem;
+	if (!mdev->app_reads_hash)
+		goto Enomem;
 
 	return mdev;
 
  Enomem:
 	if (mdev) {
-		if (mdev->app_reads_hash) kfree(mdev->app_reads_hash);
-		if (mdev->md_io_page) __free_page(mdev->md_io_page);
+		kfree(mdev->app_reads_hash);
+		if (mdev->md_io_page)
+			__free_page(mdev->md_io_page);
 		kfree(mdev);
 	}
 	return NULL;
@@ -2395,7 +2443,8 @@
 	}
 
 	err = drbd_nl_init();
-	if (err) return err;
+	if (err)
+		return err;
 
 	err = register_blkdev(DRBD_MAJOR, DEVICE_NAME);
 	if (err) {
@@ -2417,7 +2466,8 @@
 	drbd_proc = NULL; /* play safe for drbd_cleanup */
 	minor_table = kzalloc(sizeof(struct drbd_conf *)*minor_count,
 				GFP_KERNEL);
-	if (!minor_table) goto Enomem;
+	if (!minor_table)
+		goto Enomem;
 
 	err = drbd_create_mempools();
 	if (err)
@@ -2452,7 +2502,8 @@
 
 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");
@@ -2461,7 +2512,8 @@
 
 void drbd_free_bc(struct drbd_backing_dev *bc)
 {
-	if (bc == NULL) return;
+	if (bc == NULL)
+		return;
 
 	bd_release(bc->backing_bdev);
 	bd_release(bc->md_bdev);
@@ -2731,7 +2783,8 @@
 
 void drbd_uuid_set_bm(struct drbd_conf *mdev, u64 val)
 {
-	if (mdev->bc->md.uuid[Bitmap] == 0 && val == 0) return;
+	if (mdev->bc->md.uuid[Bitmap] == 0 && val == 0)
+		return;
 
 	if (val == 0) {
 		drbd_uuid_move_history(mdev);
@@ -2743,7 +2796,8 @@
 		       drbd_print_uuid(mdev, Bitmap);
 			);
 	} else {
-		if (mdev->bc->md.uuid[Bitmap]) WARN("bm UUID already set");
+		if (mdev->bc->md.uuid[Bitmap])
+			WARN("bm UUID already set");
 
 		mdev->bc->md.uuid[Bitmap] = val;
 		mdev->bc->md.uuid[Bitmap] &= ~((u64)1);
@@ -3025,15 +3079,16 @@
 	}
 }
 
-#define PSM(A) \
-do { \
-	if (mask.A) { \
-		int i = snprintf(p, len, " " #A "( %s )", \
-				A##s_to_name(val.A)); \
-		if (i >= len) return op; \
-		p += i; \
-		len -= i; \
-	} \
+#define PSM(A)							\
+do {								\
+	if (mask.A) {						\
+		int i = snprintf(p, len, " " #A "( %s )",	\
+				A##s_to_name(val.A));		\
+		if (i >= len)					\
+			return op;				\
+		p += i;						\
+		len -= i;					\
+	}							\
 } while (0)
 
 char *dump_st(char *p, int len, union drbd_state_t mask, union drbd_state_t val)

Modified: branches/drbd-8.1/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.1/drbd/drbd_nl.c	2007-07-25 12:54:21 UTC (rev 3001)
+++ branches/drbd-8.1/drbd/drbd_nl.c	2007-07-27 11:35:53 UTC (rev 3002)
@@ -199,7 +199,8 @@
 
 	D_ASSERT( fp > DontCare );
 
-	if (fp == Stonith) drbd_request_state(mdev, NS(susp, 1));
+	if (fp == Stonith)
+		drbd_request_state(mdev, NS(susp, 1));
 
 	r = drbd_khelper(mdev, "outdate-peer");
 
@@ -276,7 +277,8 @@
 			continue;
 		}
 
-		if (r == SS_NothingToDo) goto fail;
+		if (r == SS_NothingToDo)
+			goto fail;
 		if (r == SS_PrimaryNOP) {
 			nps = drbd_try_outdate_peer(mdev);
 
@@ -300,12 +302,14 @@
 		}
 		if (r < SS_Success) {
 			r = drbd_request_state(mdev, mask, val);
-			if (r < SS_Success) goto fail;
+			if (r < SS_Success)
+				goto fail;
 		}
 		break;
 	}
 
-	if (forced) WARN("Forced to conisder local data as UpToDate!\n");
+	if (forced)
+		WARN("Forced to conisder local data as UpToDate!\n");
 
 	fsync_bdev(mdev->this_bdev);
 
@@ -345,14 +349,16 @@
 		}
 	}
 
-	if ((new_role == Secondary) && inc_local(mdev) ) {
+	if ((new_role == Secondary) && inc_local(mdev) )
+	{
 		drbd_al_to_on_disk_bm(mdev);
 		dec_local(mdev);
 	}
 
 	if (mdev->state.conn >= WFReportParams) {
 		/* if this was forced, we should consider sync */
-		if (forced) drbd_send_uuids(mdev);
+		if (forced)
+			drbd_send_uuids(mdev);
 		drbd_send_state(mdev);
 	}
 
@@ -497,7 +503,8 @@
 		INFO("size = %s (%llu KB)\n", ppsize(ppb, size>>1),
 		     (unsigned long long)size>>1);
 	}
-	if (rv < 0) goto out;
+	if (rv < 0)
+		goto out;
 
 	la_size_changed = (la_size != mdev->bc->md.la_size_sect);
 
@@ -542,11 +549,15 @@
 	} else {
 		if (la_size) {
 			size = la_size;
-			if (m_size && m_size < size) size = m_size;
-			if (p_size && p_size < size) size = p_size;
+			if (m_size && m_size < size)
+				size = m_size;
+			if (p_size && p_size < size)
+				size = p_size;
 		} else {
-			if (m_size) size = m_size;
-			if (p_size) size = p_size;
+			if (m_size)
+				size = m_size;
+			if (p_size)
+				size = p_size;
 		}
 	}
 
@@ -612,7 +623,8 @@
 		lc_free(n);
 		return -EBUSY;
 	} else {
-		if (t) lc_free(t);
+		if (t)
+			lc_free(t);
 	}
 	drbd_md_mark_dirty(mdev); /* we changed mdev->act_log->nr_elemens */
 	return 0;
@@ -651,7 +663,8 @@
 	 * should be
 	 * t->max_segment_size = min_not_zero(...,...)
 	 * workaround here: */
-	if (q->max_segment_size == 0) q->max_segment_size = max_seg_s;
+	if (q->max_segment_size == 0)
+		q->max_segment_size = max_seg_s;
 
 	MTRACE(TraceTypeRq, TraceLvlSummary,
 	       DUMPI(q->max_sectors);
@@ -958,7 +971,8 @@
 	rv = _drbd_set_state(mdev, ns, ChgStateVerbose);
 	ns = mdev->state;
 	spin_unlock_irq(&mdev->req_lock);
-	if (rv == SS_Success) after_state_ch(mdev, os, ns, ChgStateVerbose);
+	if (rv == SS_Success)
+		after_state_ch(mdev, os, ns, ChgStateVerbose);
 
 	if (rv < SS_Success)
 		goto unlock_bm;
@@ -984,16 +998,21 @@
 	drbd_force_state(mdev, NS(disk, Diskless));
 	drbd_md_sync(mdev);
  release_bdev2_fail:
-	if (nbc) bd_release(nbc->md_bdev);
+	if (nbc)
+		bd_release(nbc->md_bdev);
  release_bdev_fail:
-	if (nbc) bd_release(nbc->backing_bdev);
+	if (nbc)
+		bd_release(nbc->backing_bdev);
  fail:
 	if (nbc) {
-		if (nbc->lo_file) fput(nbc->lo_file);
-		if (nbc->md_file) fput(nbc->md_file);
+		if (nbc->lo_file)
+			fput(nbc->lo_file);
+		if (nbc->md_file)
+			fput(nbc->md_file);
 		kfree(nbc);
 	}
-	if (resync_lru) lc_free(resync_lru);
+	if (resync_lru)
+		lc_free(resync_lru);
 
 	reply->ret_code = retcode;
 	return 0;
@@ -1079,7 +1098,8 @@
 	retcode = NoError;
 	for (i = 0; i < minor_count; i++) {
 		odev = minor_to_mdev(i);
-		if (!odev || odev == mdev) continue;
+		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) )
@@ -1090,7 +1110,8 @@
 				retcode = OAAlreadyInUse;
 
 			dec_net(odev);
-			if (retcode != NoError) goto fail;
+			if (retcode != NoError)
+				goto fail;
 		}
 	}
 #undef M_ADDR
@@ -1167,13 +1188,13 @@
 	mdev->recv_cnt = 0;
 
 	if (new_tl_hash) {
-		if (mdev->tl_hash) kfree(mdev->tl_hash);
+		kfree(mdev->tl_hash);
 		mdev->tl_hash_s = mdev->net_conf->max_epoch_size/8;
 		mdev->tl_hash = new_tl_hash;
 	}
 
 	if (new_ee_hash) {
-		if (mdev->ee_hash) kfree(mdev->ee_hash);
+		kfree(mdev->ee_hash);
 		mdev->ee_hash_s = mdev->net_conf->max_buffers/8;
 		mdev->ee_hash = new_ee_hash;
 	}
@@ -1188,10 +1209,10 @@
 	return 0;
 
 fail:
-	if (tfm) crypto_free_hash(tfm);
-	if (new_tl_hash) kfree(new_tl_hash);
-	if (new_ee_hash) kfree(new_ee_hash);
-	if (new_conf) kfree(new_conf);
+	crypto_free_hash(tfm);
+	kfree(new_tl_hash);
+	kfree(new_ee_hash);
+	kfree(new_conf);
 
 	reply->ret_code = retcode;
 	return 0;
@@ -1205,8 +1226,10 @@
 	/* silently. */
 	retcode = _drbd_request_state(mdev, NS(conn, Disconnecting), 0);
 
-	if (retcode == SS_NothingToDo) goto done;
-	else if (retcode == SS_AlreadyStandAlone) goto done;
+	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. */
 		retcode = drbd_request_state(mdev, NS2(conn, Disconnecting,
@@ -1224,7 +1247,8 @@
 						NS(conn, StandAlone));
 	}
 
-	if (retcode < SS_Success) goto fail;
+	if (retcode < SS_Success)
+		goto fail;
 
 	if ( wait_event_interruptible( mdev->misc_wait,
 				      mdev->state.conn == StandAlone) ) {
@@ -1316,7 +1340,8 @@
 				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);
 		}
 	}
@@ -1536,8 +1561,9 @@
 		spin_unlock_irq(&drbd_pp_lock);
 
 		if (mdev) {
-			if (mdev->app_reads_hash) kfree(mdev->app_reads_hash);
-			if (mdev->md_io_page) __free_page(mdev->md_io_page);
+			kfree(mdev->app_reads_hash);
+			if (mdev->md_io_page)
+				__free_page(mdev->md_io_page);
 			kfree(mdev);
 			mdev = NULL;
 		}

Modified: branches/drbd-8.1/drbd/drbd_proc.c
===================================================================
--- branches/drbd-8.1/drbd/drbd_proc.c	2007-07-25 12:54:21 UTC (rev 3001)
+++ branches/drbd-8.1/drbd/drbd_proc.c	2007-07-27 11:35:53 UTC (rev 3002)
@@ -127,7 +127,8 @@
 		return;
 	}
 
-	if (!dt) dt++;
+	if (!dt)
+		dt++;
 	db = mdev->rs_mark_left - rs_left;
 	rt = (dt * (rs_left / (db/100+1)))/100; /* seconds */
 
@@ -145,7 +146,8 @@
 	/* mean speed since syncer started
 	 * we do account for PausedSync periods */
 	dt = (jiffies - mdev->rs_start - mdev->rs_paused) / HZ;
-	if (dt <= 0) dt = 1;
+	if (dt <= 0)
+		dt = 1;
 	db = mdev->rs_total - rs_left;
 	dbdt = Bit2KB(db/dt);
 	if (dbdt > 1000)

Modified: branches/drbd-8.1/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-8.1/drbd/drbd_receiver.c	2007-07-25 12:54:21 UTC (rev 3001)
+++ branches/drbd-8.1/drbd/drbd_receiver.c	2007-07-27 11:35:53 UTC (rev 3002)
@@ -109,7 +109,8 @@
 		}
 		spin_unlock_irqrestore(&drbd_pp_lock, flags);
 
-		if (page) break;
+		if (page)
+			break;
 
 		/* hm. pool was empty. try to allocate from kernel.
 		 * don't wait, if none is available, though.
@@ -160,7 +161,8 @@
 
 	atomic_dec(&mdev->pp_in_use);
 
-	if (free_it) __free_page(page);
+	if (free_it)
+		__free_page(page);
 
 	/*
 	 * FIXME
@@ -512,7 +514,8 @@
 
 	for (;;) {
 		rv = sock_recvmsg(mdev->data.socket, &msg, size, msg.msg_flags);
-		if (rv == size) break;
+		if (rv == size)
+			break;
 
 		/* Note:
 		 * ECONNRESET	other side closed the connection
@@ -539,7 +542,8 @@
 
 	set_fs(oldfs);
 
-	if (rv != size) drbd_force_state(mdev, NS(conn, BrokenPipe));
+	if (rv != size)
+		drbd_force_state(mdev, NS(conn, BrokenPipe));
 
 	return rv;
 }
@@ -680,7 +684,8 @@
 		for (try = 0;;) {
 			/* 3 tries, this should take less than a second! */
 			s = drbd_try_connect(mdev);
-			if (s || ++try >= 3) break;
+			if (s || ++try >= 3)
+				break;
 			/* give the other side time to call bind() & listen() */
 			set_current_state(TASK_INTERRUPTIBLE);
 			schedule_timeout(HZ / 10);
@@ -707,17 +712,20 @@
 			}
 		}
 
-		if (sock && msock) break;
+		if (sock && msock)
+			break;
 
 		s = drbd_wait_for_connect(mdev);
 		if (s) {
 			switch (drbd_recv_fp(mdev, s)) {
 			case HandShakeS:
-				if (sock) sock_release(sock);
+				if (sock)
+					sock_release(sock);
 				sock = s;
 				break;
 			case HandShakeM:
-				if (msock) sock_release(msock);
+				if (msock)
+					sock_release(msock);
 				msock = s;
 				set_bit(DISCARD_CONCURRENT, &mdev->flags);
 				break;
@@ -727,13 +735,16 @@
 			}
 		}
 
-		if (mdev->state.conn <= Disconnecting) return -1;
+		if (mdev->state.conn <= Disconnecting)
+			return -1;
 		if (signal_pending(current)) {
 			flush_signals(current);
 			smp_rmb();
 			if (get_t_state(&mdev->receiver) == Exiting) {
-				if (sock) sock_release(sock);
-				if (msock) sock_release(msock);
+				if (sock)
+					sock_release(sock);
+				if (msock)
+					sock_release(msock);
 				return -1;
 			}
 		}
@@ -772,7 +783,8 @@
 	D_ASSERT(mdev->asender.task == NULL);
 
 	h = drbd_do_handshake(mdev);
-	if (h <= 0) return h;
+	if (h <= 0)
+		return h;
 
 	if (mdev->cram_hmac_tfm) {
 		if (!drbd_do_auth(mdev)) {
@@ -874,7 +886,8 @@
 	int ds, i, rr;
 
 	e = drbd_alloc_ee(mdev, id, sector, data_size, GFP_KERNEL);
-	if (!e) return 0;
+	if (!e)
+		return 0;
 	bio = e->private_bio;
 	ds = data_size;
 	bio_for_each_segment(bvec, bio, i) {
@@ -994,7 +1007,8 @@
 	struct Tl_epoch_entry *e;
 
 	e = read_in_block(mdev, ID_SYNCER, sector, data_size);
-	if (!e) return FALSE;
+	if (!e)
+		return FALSE;
 
 	dec_rs_pending(mdev);
 
@@ -1057,7 +1071,8 @@
 	 * still no race with drbd_fail_pending_reads */
 	ok = recv_dless_read(mdev, req, sector, data_size);
 
-	if (ok) req_mod(req, data_received, 0);
+	if (ok)
+		req_mod(req, data_received, 0);
 	/* else: nothing. handled from drbd_disconnect...
 	 * I don't think we may complete this just yet
 	 * in case we are "on-disconnect: freeze" */
@@ -1098,7 +1113,8 @@
 		 * verify there are no pending write request to that area.
 		 */
 		ok = recv_resync_read(mdev, sector, data_size);
-		if (!ok) dec_local(mdev);
+		if (!ok)
+			dec_local(mdev);
 	} else {
 		if (DRBD_ratelimit(5*HZ, 5))
 			ERR("Can not write resync data to local disk.\n");
@@ -1373,7 +1389,8 @@
 				}
 			}
 #undef OVERLAPS
-			if (!have_conflict) break;
+			if (!have_conflict)
+				break;
 
 			/* Discard Ack only for the _first_ iteration */
 			if (first && discard && have_unacked) {
@@ -1659,15 +1676,17 @@
 			if (ch_peer == 0) { rv =  1; break; }
 			if (ch_self == 0) { rv = -1; break; }
 		}
-		if (mdev->net_conf->after_sb_0p == DiscardZeroChg) break;
+		if (mdev->net_conf->after_sb_0p == DiscardZeroChg)
+			break;
 	case DiscardLeastChg:
-		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. */
+		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. */
 			rv = test_bit(DISCARD_CONCURRENT, &mdev->flags)
 				? -1 : 1;
-		}
 		break;
 	case DiscardLocal:
 		rv = -1;
@@ -1698,8 +1717,10 @@
 		break;
 	case Consensus:
 		hg = drbd_asb_recover_0p(mdev);
-		if (hg == -1 && mdev->state.role == Secondary) rv = hg;
-		if (hg == 1  && mdev->state.role == Primary)   rv = hg;
+		if (hg == -1 && mdev->state.role == Secondary)
+			rv = hg;
+		if (hg == 1  && mdev->state.role == Primary)
+			rv = hg;
 		break;
 	case Violently:
 		rv = drbd_asb_recover_0p(mdev);
@@ -1826,23 +1847,27 @@
 
 	*rule_nr = 5;
 	peer = mdev->p_uuid[Bitmap] & ~((u64)1);
-	if (self == peer) return -1;
+	if (self == peer)
+		return -1;
 
 	*rule_nr = 6;
 	for ( i = History_start ; i <= History_end ; i++ ) {
 		peer = mdev->p_uuid[i] & ~((u64)1);
-		if (self == peer) return -2;
+		if (self == peer)
+			return -2;
 	}
 
 	*rule_nr = 7;
 	self = mdev->bc->md.uuid[Bitmap] & ~((u64)1);
 	peer = mdev->p_uuid[Current] & ~((u64)1);
-	if (self == peer) return 1;
+	if (self == peer)
+		return 1;
 
 	*rule_nr = 8;
 	for ( i = History_start ; i <= History_end ; i++ ) {
 		self = mdev->bc->md.uuid[i] & ~((u64)1);
-		if (self == peer) return 2;
+		if (self == peer)
+			return 2;
 	}
 
 	*rule_nr = 9;
@@ -1855,7 +1880,8 @@
 		self = mdev->p_uuid[i] & ~((u64)1);
 		for ( j = History_start ; j <= History_end ; j++ ) {
 			peer = mdev->p_uuid[j] & ~((u64)1);
-			if (self == peer) return -100;
+			if (self == peer)
+				return -100;
 		}
 	}
 
@@ -1873,7 +1899,8 @@
 	enum drbd_disk_state mydisk;
 
 	mydisk = mdev->state.disk;
-	if (mydisk == Negotiating) mydisk = mdev->new_state_tmp.disk;
+	if (mydisk == Negotiating)
+		mydisk = mdev->new_state_tmp.disk;
 
 	hg = drbd_uuid_compare(mdev, &rule_nr);
 
@@ -1894,7 +1921,8 @@
 	    (peer_disk == Inconsistent && mydisk > Inconsistent) )  {
 		int f = (hg == -100) || abs(hg) == 2;
 		hg = mydisk > Inconsistent ? 1 : -1;
-		if (f) hg = hg*2;
+		if (f)
+			hg = hg*2;
 		INFO("Becoming sync %s due to disk states.\n",
 		     hg > 0 ? "source" : "target");
 	}
@@ -2013,7 +2041,8 @@
 	    self == DiscardRemote || self == DiscardLocal ) return 1;
 
 	/* everything else is valid if they are equal on both sides. */
-	if (peer == self) return 0;
+	if (peer == self)
+		return 0;
 
 	/* everything es is invalid. */
 	return 1;
@@ -2100,7 +2129,8 @@
 	const char *s, sector_t a, sector_t b)
 {
 	sector_t d;
-	if (a == 0 || b == 0) return;
+	if (a == 0 || b == 0)
+		return;
 	d = (a > b) ? (a - b) : (b - a);
 	if ( d > (a>>3) || d > (b>>3))
 		WARN("Considerable difference in %s: %llus vs. %llus\n", s,
@@ -2184,7 +2214,8 @@
 				mdev->state.peer, mdev->state.pdsk);
 		dec_local(mdev);
 
-		if (nconn == conn_mask) return FALSE;
+		if (nconn == conn_mask)
+			return FALSE;
 
 		if (drbd_request_state(mdev, NS(conn, nconn)) < SS_Success) {
 			drbd_force_state(mdev, NS(conn, Disconnecting));
@@ -2228,7 +2259,7 @@
 	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);
+	kfree(mdev->p_uuid);
 	mdev->p_uuid = p_uuid;
 
 	return TRUE;
@@ -2310,7 +2341,8 @@
 	oconn = nconn = mdev->state.conn;
 	spin_unlock_irq(&mdev->req_lock);
 
-	if (nconn == WFReportParams) nconn = Connected;
+	if (nconn == WFReportParams)
+		nconn = Connected;
 
 	if (mdev->p_uuid && oconn <= Connected &&
 	    peer_state.disk >= Negotiating &&
@@ -2319,11 +2351,13 @@
 				peer_state.role, peer_state.disk);
 		dec_local(mdev);
 
-		if (nconn == conn_mask) return FALSE;
+		if (nconn == conn_mask)
+			return FALSE;
 	}
 
 	spin_lock_irq(&mdev->req_lock);
-	if (mdev->state.conn != oconn) goto retry;
+	if (mdev->state.conn != oconn)
+		goto retry;
 	os = mdev->state;
 	ns.i = mdev->state.i;
 	ns.conn = nconn;
@@ -2331,9 +2365,11 @@
 	ns.pdsk = peer_state.disk;
 	ns.peer_isp = ( peer_state.aftr_isp | peer_state.user_isp );
 	if ((nconn == Connected || nconn == WFBitMapS) &&
-	   ns.disk == Negotiating ) ns.disk = UpToDate;
+	   ns.disk == Negotiating )
+		ns.disk = UpToDate;
 	if ((nconn == Connected || nconn == WFBitMapT) &&
-	   ns.pdsk == Negotiating ) ns.pdsk = UpToDate;
+	   ns.pdsk == Negotiating )
+		ns.pdsk = UpToDate;
 	rv = _drbd_set_state(mdev, ns, ChgStateVerbose | ChgStateHard);
 	spin_unlock_irq(&mdev->req_lock);
 
@@ -2413,7 +2449,8 @@
 		num_words = min_t(size_t, BM_PACKET_WORDS, bm_words-bm_i );
 		want = num_words * sizeof(long);
 		ERR_IF(want != h->length) goto out;
-		if (want == 0) break;
+		if (want == 0)
+			break;
 		if (drbd_recv(mdev, buffer, want) != want)
 			goto out;
 
@@ -2429,7 +2466,8 @@
 		drbd_start_resync(mdev, SyncSource);
 	} else if (mdev->state.conn == WFBitMapT) {
 		ok = drbd_send_bitmap(mdev);
-		if (!ok) goto out;
+		if (!ok)
+			goto out;
 		ok = drbd_request_state(mdev, NS(conn, WFSyncUUID));
 		D_ASSERT( ok == SS_Success );
 	} else {
@@ -2465,7 +2503,8 @@
 
 int receive_UnplugRemote(struct drbd_conf *mdev, struct Drbd_Header *h)
 {
-	if (mdev->state.disk >= Inconsistent) drbd_kick_lo(mdev);
+	if (mdev->state.disk >= Inconsistent)
+		drbd_kick_lo(mdev);
 	return TRUE; /* cannot fail. */
 }
 
@@ -2749,10 +2788,12 @@
 	int rv;
 
 	rv = drbd_send_handshake(mdev);
-	if (!rv) goto break_c_loop;
+	if (!rv)
+		goto break_c_loop;
 
 	rv = drbd_recv_header(mdev, &p->head);
-	if (!rv) goto break_c_loop;
+	if (!rv)
+		goto break_c_loop;
 
 	if (p->head.command != HandShake) {
 		ERR( "expected HandShake packet, received: %s (0x%04x)\n",
@@ -2855,10 +2896,12 @@
 	get_random_bytes(my_challenge, CHALLENGE_LEN);
 
 	rv = drbd_send_cmd2(mdev, AuthChallenge, my_challenge, CHALLENGE_LEN);
-	if (!rv) goto fail;
+	if (!rv)
+		goto fail;
 
 	rv = drbd_recv_header(mdev, &p);
-	if (!rv) goto fail;
+	if (!rv)
+		goto fail;
 
 	if (p.command != AuthChallenge) {
 		ERR( "expected AuthChallenge packet, received: %s (0x%04x)\n",
@@ -2908,10 +2951,12 @@
 	}
 
 	rv = drbd_send_cmd2(mdev, AuthResponse, response, resp_size);
-	if (!rv) goto fail;
+	if (!rv)
+		goto fail;
 
 	rv = drbd_recv_header(mdev, &p);
-	if (!rv) goto fail;
+	if (!rv)
+		goto fail;
 
 	if (p.command != AuthResponse) {
 		ERR( "expected AuthResponse packet, received: %s (0x%04x)\n",
@@ -2959,9 +3004,9 @@
 		     resp_size, mdev->net_conf->cram_hmac_alg);
 
  fail:
-	if (peers_ch) kfree(peers_ch);
-	if (response) kfree(response);
-	if (right_response) kfree(right_response);
+	kfree(peers_ch);
+	kfree(response);
+	kfree(right_response);
 
 	return rv;
 }
@@ -3245,7 +3290,8 @@
 			spin_lock_irq(&mdev->req_lock);
 			empty = list_empty(&mdev->done_ee);
 			spin_unlock_irq(&mdev->req_lock);
-			if (empty) break;
+			if (empty)
+				break;
 			clear_bit(SIGNAL_ASENDER, &mdev->flags);
 			flush_signals(current);
 		}

Modified: branches/drbd-8.1/drbd/drbd_req.c
===================================================================
--- branches/drbd-8.1/drbd/drbd_req.c	2007-07-25 12:54:21 UTC (rev 3001)
+++ branches/drbd-8.1/drbd/drbd_req.c	2007-07-27 11:35:53 UTC (rev 3002)
@@ -200,7 +200,8 @@
 	/* we need to do the conflict detection stuff,
 	 * if we have the ee_hash (two_primaries) and
 	 * this has been on the network */
-	if ((s & RQ_NET_DONE) && mdev->ee_hash != NULL) {
+	if ((s & RQ_NET_DONE) && mdev->ee_hash != NULL)
+	{
 		const sector_t sector = req->sector;
 		const int size = req->size;
 
@@ -270,9 +271,12 @@
 	 *	the receiver,
 	 *	the bio_endio completion callbacks.
 	 */
-	if (s & RQ_NET_QUEUED) return;
-	if (s & RQ_NET_PENDING) return;
-	if (s & RQ_LOCAL_PENDING) return;
+	if (s & RQ_NET_QUEUED)
+		return;
+	if (s & RQ_NET_PENDING)
+		return;
+	if (s & RQ_LOCAL_PENDING)
+		return;
 
 	if (req->master_bio) {
 		/* this is data_received (remote read)
@@ -655,7 +659,8 @@
 	case connection_lost_while_pending:
 		/* transfer log cleanup after connection loss */
 		/* assert something? */
-		if (req->rq_state & RQ_NET_PENDING) dec_ap_pending(mdev);
+		if (req->rq_state & RQ_NET_PENDING)
+			dec_ap_pending(mdev);
 		req->rq_state &= ~(RQ_NET_OK|RQ_NET_PENDING);
 		req->rq_state |= RQ_NET_DONE;
 		/* if it is still queued, we may not complete it here.
@@ -687,7 +692,8 @@
 
 	case neg_acked:
 		/* assert something? */
-		if (req->rq_state & RQ_NET_PENDING) dec_ap_pending(mdev);
+		if (req->rq_state & RQ_NET_PENDING)
+			dec_ap_pending(mdev);
 		req->rq_state &= ~(RQ_NET_OK|RQ_NET_PENDING);
 		/* FIXME THINK! is it DONE now, or is it not? */
 		req->rq_state |= RQ_NET_DONE;
@@ -733,9 +739,12 @@
 	unsigned long sbnr, ebnr, bnr;
 	sector_t esector, nr_sectors;
 
-	if (mdev->state.disk == UpToDate) return 1;
-	if (mdev->state.disk >= Outdated) return 0;
-	if (mdev->state.disk <  Inconsistent) return 0;
+	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 */
 	nr_sectors = drbd_get_capacity(mdev->this_bdev);
 	esector = sector + (size>>9) -1;
@@ -956,8 +965,10 @@
 
 	/* mark them early for readability.
 	 * this just sets some state flags. */
-	if (remote) _req_mod(req, to_be_send, 0);
-	if (local)  _req_mod(req, to_be_submitted, 0);
+	if (remote)
+		_req_mod(req, to_be_send, 0);
+	if (local)
+		_req_mod(req, to_be_submitted, 0);
 
 	/* check this request on the colison detection hash tables.
 	 * if we have a conflict, just complete it here.
@@ -976,7 +987,8 @@
 			dec_local(mdev);
 			local = 0;
 		}
-		if (remote) dec_ap_pending(mdev);
+		if (remote)
+			dec_ap_pending(mdev);
 		dump_bio(mdev, req->master_bio, 1);
 		/* THINK: do we want to fail it (-EIO), or pretend success? */
 		bio_endio(req->master_bio, req->master_bio->bi_size, 0);
@@ -999,7 +1011,7 @@
 			_req_mod(req, queue_for_net_read, 0);
 	}
 	spin_unlock_irq(&mdev->req_lock);
-	if (b) kfree(b); /* if someone else has beaten us to it... */
+	kfree(b); /* if someone else has beaten us to it... */
 
 	if (local) {
 		/* FIXME what ref count do we have to ensure the backing_bdev
@@ -1022,7 +1034,7 @@
 	return 0;
 
 fail_and_free_req:
-	if (b) kfree(b);
+	kfree(b);
 	bio_endio(bio, bio->bi_size, err);
 	drbd_req_free(req);
 	return 0;
@@ -1107,7 +1119,8 @@
 		/* rather error out here than BUG in bio_split */
 		ERR("bio would need to, but cannot, be split: "
 		    "(vcnt=%u,idx=%u,size=%u,sector=%llu)\n",
-		    bio->bi_vcnt, bio->bi_idx, bio->bi_size, bio->bi_sector);
+		    bio->bi_vcnt, bio->bi_idx, bio->bi_size,
+		    (unsigned long long)bio->bi_sector);
 		bio_endio(bio, bio->bi_size, -EINVAL);
 		return 0;
 	} else {
@@ -1161,9 +1174,11 @@
 
 	limit = DRBD_MAX_SEGMENT_SIZE
 	      - ((bio_offset & (DRBD_MAX_SEGMENT_SIZE-1)) + bio_size);
-	if (limit < 0) limit = 0;
+	if (limit < 0)
+		limit = 0;
 	if (bio_size == 0) {
-		if (limit <= bvec->bv_len) limit = bvec->bv_len;
+		if (limit <= bvec->bv_len)
+			limit = bvec->bv_len;
 	} else if (limit && inc_local(mdev)) {
 		request_queue_t * const b =
 			mdev->bc->backing_bdev->bd_disk->queue;

Modified: branches/drbd-8.1/drbd/drbd_req.h
===================================================================
--- branches/drbd-8.1/drbd/drbd_req.h	2007-07-25 12:54:21 UTC (rev 3001)
+++ branches/drbd-8.1/drbd/drbd_req.h	2007-07-27 11:35:53 UTC (rev 3002)
@@ -235,7 +235,8 @@
 	struct drbd_request *req;
 
 	hlist_for_each_entry(req, n, slot, colision) {
-		if ((unsigned long)req == (unsigned long)id) {
+		if ((unsigned long)req == (unsigned long)id)
+		{
 			if (req->sector != sector) {
 				ERR("_ack_id_to_req: found req %p but it has "
 				    "wrong sector (%llus versus %llus)\n", req,
@@ -268,7 +269,8 @@
 	struct drbd_request *req;
 
 	hlist_for_each_entry(req, n, slot, colision) {
-		if ((unsigned long)req == (unsigned long)id) {
+		if ((unsigned long)req == (unsigned long)id)
+		{
 			D_ASSERT(req->sector == sector);
 			return req;
 		}

Modified: branches/drbd-8.1/drbd/drbd_worker.c
===================================================================
--- branches/drbd-8.1/drbd/drbd_worker.c	2007-07-25 12:54:21 UTC (rev 3001)
+++ branches/drbd-8.1/drbd/drbd_worker.c	2007-07-27 11:35:53 UTC (rev 3002)
@@ -64,7 +64,8 @@
  */
 int drbd_md_io_complete(struct bio *bio, unsigned int bytes_done, int error)
 {
-	if (bio->bi_size) return 1;
+	if (bio->bi_size)
+		return 1;
 	/* error parameter ignored:
 	 * drbd_md_sync_page_io explicitly tests bio_uptodate(bio); */
 
@@ -88,7 +89,8 @@
 	/* We are called each time a part of the bio is finished, but
 	 * we are only interested when the whole bio is finished, therefore
 	 * return as long as bio->bio_size is positive.  */
-	if (bio->bi_size) return 1;
+	if (bio->bi_size)
+		return 1;
 	if (!error && !uptodate) {
 		/* strange behaviour of some lower level drivers...
 		 * fail the request by clearing the uptodate flag,
@@ -134,7 +136,8 @@
 	mdev = e->mdev;
 
 	/* see above */
-	if (bio->bi_size) return 1;
+	if (bio->bi_size)
+		return 1;
 	if (!error && !uptodate) {
 		/* strange behaviour of some lower level drivers...
 		 * fail the request by clearing the uptodate flag,
@@ -169,20 +172,25 @@
 	 * done from "drbd_process_done_ee" within the appropriate w.cb
 	 * (e_end_block/e_end_resync_block) or from _drbd_clear_done_ee */
 
-	if (!is_syncer_req) mdev->epoch_size++;
+	if (!is_syncer_req)
+		mdev->epoch_size++;
 
 	do_wake = is_syncer_req
 		? list_empty(&mdev->sync_ee)
 		: list_empty(&mdev->active_ee);
 
-	if (error) __drbd_chk_io_error(mdev, FALSE);
+	if (error)
+		__drbd_chk_io_error(mdev, FALSE);
 	spin_unlock_irqrestore(&mdev->req_lock, flags);
 
-	if (is_syncer_req) drbd_rs_complete_io(mdev, e_sector);
+	if (is_syncer_req)
+		drbd_rs_complete_io(mdev, e_sector);
 
-	if (do_wake) wake_up(&mdev->ee_wait);
+	if (do_wake)
+		wake_up(&mdev->ee_wait);
 
-	if (do_al_complete_io) drbd_al_complete_io(mdev, e_sector);
+	if (do_al_complete_io)
+		drbd_al_complete_io(mdev, e_sector);
 
 	wake_asender(mdev);
 	dec_local(mdev);
@@ -201,7 +209,8 @@
 	int uptodate = bio_flagged(bio, BIO_UPTODATE);
 
 	/* see above */
-	if (bio->bi_size) return 1;
+	if (bio->bi_size)
+		return 1;
 	if (!error && !uptodate) {
 		/* strange behaviour of some lower level drivers...
 		 * fail the request by clearing the uptodate flag,
@@ -482,7 +491,8 @@
 	}
 
 	dt = (jiffies - mdev->rs_start - mdev->rs_paused) / HZ;
-	if (dt <= 0) dt = 1;
+	if (dt <= 0)
+		dt = 1;
 	db = mdev->rs_total;
 	dbdt = Bit2KB(db/dt);
 	mdev->rs_paused /= HZ;
@@ -690,7 +700,8 @@
 
 int w_send_write_hint(struct drbd_conf *mdev, struct drbd_work *w, int cancel)
 {
-	if (cancel) return 1;
+	if (cancel)
+		return 1;
 	return drbd_send_short_cmd(mdev, UnplugRemote);
 }
 
@@ -777,7 +788,8 @@
 	struct drbd_conf *odev = mdev;
 
 	while (1) {
-		if (odev->sync_conf.after == -1) return 1;
+		if (odev->sync_conf.after == -1)
+			return 1;
 		odev = minor_to_mdev(odev->sync_conf.after);
 		ERR_IF(!odev) return 1;
 		if ( (odev->state.conn >= SyncSource &&
@@ -800,7 +812,8 @@
 
 	for (i = 0; i < minor_count; i++) {
 		odev = minor_to_mdev(i);
-		if (!odev) continue;
+		if (!odev)
+			continue;
 		if (!_drbd_may_sync_now(odev))
 			rv |= ( _drbd_set_state(_NS(odev, aftr_isp, 1),
 						ChgStateHard|ScheduleAfter)
@@ -960,13 +973,15 @@
 
 		if (down_trylock(&mdev->data.work.s)) {
 			down(&mdev->data.mutex);
-			if (mdev->data.socket)drbd_tcp_flush(mdev->data.socket);
+			if (mdev->data.socket)
+				drbd_tcp_flush(mdev->data.socket);
 			up(&mdev->data.mutex);
 
 			intr = down_interruptible(&mdev->data.work.s);
 
 			down(&mdev->data.mutex);
-			if (mdev->data.socket) drbd_tcp_cork(mdev->data.socket);
+			if (mdev->data.socket)
+				drbd_tcp_cork(mdev->data.socket);
 			up(&mdev->data.mutex);
 		}
 

Modified: branches/drbd-8.1/drbd/linux/drbd_config.h
===================================================================
--- branches/drbd-8.1/drbd/linux/drbd_config.h	2007-07-25 12:54:21 UTC (rev 3001)
+++ branches/drbd-8.1/drbd/linux/drbd_config.h	2007-07-27 11:35:53 UTC (rev 3002)
@@ -22,7 +22,7 @@
 
 extern const char *drbd_buildtag(void);
 
-#define REL_VERSION "8.0.4"
+#define REL_VERSION "8.1.0-nqty" /* not quite there yet */
 #define API_VERSION 86
 #define PRO_VERSION 86
 

Modified: branches/drbd-8.1/drbd/lru_cache.c
===================================================================
--- branches/drbd-8.1/drbd/lru_cache.c	2007-07-25 12:54:21 UTC (rev 3001)
+++ branches/drbd-8.1/drbd/lru_cache.c	2007-07-27 11:35:53 UTC (rev 3002)
@@ -121,7 +121,8 @@
 	BUG_ON(!lc);
 	BUG_ON(!lc->nr_elements);
 	hlist_for_each_entry(e, n, lc->slot + lc_hash_fn(lc, enr), colision) {
-		if (e->lc_number == enr) return e;
+		if (e->lc_number == enr)
+			return e;
 	}
 	return NULL;
 }
@@ -224,7 +225,8 @@
 	e = lc_find(lc, enr);
 	if (e) {
 		++lc->hits;
-		if (e->refcnt++ == 0) lc->used++;
+		if (e->refcnt++ == 0)
+			lc->used++;
 		list_move(&e->list, &lc->in_use); /* Not evictable... */
 		RETURN(e);
 	}
@@ -281,7 +283,8 @@
 	e = lc_find(lc, enr);
 	if (e) {
 		++lc->hits;
-		if (e->refcnt++ == 0) lc->used++;
+		if (e->refcnt++ == 0)
+			lc->used++;
 		list_move(&e->list, &lc->in_use); /* Not evictable... */
 	}
 	RETURN(e);
@@ -335,7 +338,8 @@
 {
 	struct lc_element *e;
 
-	if (index < 0 || index >= lc->nr_elements) return;
+	if (index < 0 || index >= lc->nr_elements)
+		return;
 
 	e = lc_entry(lc, index);
 	e->lc_number = enr;

From drbd-cvs at lists.linbit.com  Fri Jul 27 15:07:26 2007
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Fri Jul 27 15:07:28 2007
Subject: [DRBD-cvs] svn commit by lars - r3003 - branches/drbd-8.1/drbd -
	unregister_blkdev is void now; add wrapper for older ke
Message-ID: <20070727130726.256E640095@garcon1.linbit.com>

Author: lars
Date: 2007-07-27 15:07:19 +0200 (Fri, 27 Jul 2007)
New Revision: 3003

Modified:
   branches/drbd-8.1/drbd/drbd_main.c
   branches/drbd-8.1/drbd/drbd_wrappers.h
Log:
unregister_blkdev is void now; add wrapper for older kernels.

Modified: branches/drbd-8.1/drbd/drbd_main.c
===================================================================
--- branches/drbd-8.1/drbd/drbd_main.c	2007-07-27 11:35:53 UTC (rev 3002)
+++ branches/drbd-8.1/drbd/drbd_main.c	2007-07-27 13:07:19 UTC (rev 3003)
@@ -2339,8 +2339,7 @@
 
 	kfree(minor_table);
 
-	if (unregister_blkdev(DRBD_MAJOR, DEVICE_NAME) != 0)
-		printk(KERN_ERR DEVICE_NAME": unregister of device failed\n");
+	drbd_unregister_blkdev(DRBD_MAJOR, DEVICE_NAME);
 
 	printk(KERN_INFO DEVICE_NAME": module cleanup done.\n");
 }

Modified: branches/drbd-8.1/drbd/drbd_wrappers.h
===================================================================
--- branches/drbd-8.1/drbd/drbd_wrappers.h	2007-07-27 11:35:53 UTC (rev 3002)
+++ branches/drbd-8.1/drbd/drbd_wrappers.h	2007-07-27 13:07:19 UTC (rev 3003)
@@ -185,6 +185,17 @@
 		);
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
+static inline void drbd_unregister_blkdev(unsigned int major, const char *name)
+{
+	int ret = unregister_blkdev(major,name);
+	if (ret)
+		printk(KERN_ERR DEVICE_NAME": unregister of device failed\n");
+}
+#else
+#define drbd_unregister_blkdev unregister_blkdev
+#endif
+
 #ifdef NEED_BACKPORT_OF_ATOMIC_ADD
 
 #if defined(__x86_64__)

