--- linux-2.4.19-orig/drivers/md/linear.c	Sun Sep 30 15:26:06 2001
+++ linux-2.4.19/drivers/md/linear.c	Tue Oct  1 16:43:36 2002
@@ -22,6 +22,7 @@
 #include <linux/slab.h>
 
 #include <linux/raid/linear.h>
+#include "md_evlog.h"
 
 #define MAJOR_NR MD_MAJOR
 #define MD_DRIVER
@@ -43,7 +44,7 @@
 	mddev->private = conf;
 
 	if (md_check_ordering(mddev)) {
-		printk("linear: disks are not ordered, aborting!\n");
+		EPRINTK("linear: disks are not ordered, aborting!\n");
 		goto out;
 	}
 	/*
@@ -132,7 +133,7 @@
   
 	if (block >= (hash->dev0->size + hash->dev0->offset)) {
 		if (!hash->dev1) {
-			printk ("linear_make_request : hash->dev1==NULL for block %ld\n",
+			EPRINTK ("linear_make_request : hash->dev1==NULL for block %ld\n",
 						block);
 			buffer_IO_error(bh);
 			return 0;
@@ -143,7 +144,7 @@
     
 	if (block >= (tmp_dev->size + tmp_dev->offset)
 				|| block < tmp_dev->offset) {
-		printk ("linear_make_request: Block %ld out of bounds on dev %s size %ld offset %ld\n", block, kdevname(tmp_dev->dev), tmp_dev->size, tmp_dev->offset);
+		EPRINTK ("linear_make_request: Block %ld out of bounds on dev %s size %ld offset %ld\n", block, kdevname(tmp_dev->dev), tmp_dev->size, tmp_dev->offset);
 		buffer_IO_error(bh);
 		return 0;
 	}
--- linux-2.4.19-orig/drivers/md/md.c	Tue Oct  1 16:46:48 2002
+++ linux-2.4.19/drivers/md/md.c	Tue Oct  1 16:46:13 2002
@@ -50,6 +50,7 @@
 #define MD_DRIVER
 
 #include <linux/blk.h>
+#include "md_evlog.h"
 
 #define DEBUG 0
 #if DEBUG
@@ -349,7 +350,7 @@
 	 */
 	ITERATE_RDEV(mddev,rdev,tmp) {
 		if (rdev->faulty) {
-			printk(KERN_ERR "md: md%d's device %s faulty, aborting.\n",
+			EPRINTK(KERN_ERR "md: md%d's device %s faulty, aborting.\n",
 			       mdidx(mddev), partition_name(rdev->dev));
 			goto abort;
 		}
@@ -364,7 +365,7 @@
 		goto abort;
 	}
 	if (mddev->nb_dev != mddev->sb->raid_disks) {
-		printk(KERN_ERR "md: md%d, array needs %d disks, has %d, aborting.\n",
+		EPRINTK(KERN_ERR "md: md%d, array needs %d disks, has %d, aborting.\n",
 			mdidx(mddev), mddev->sb->raid_disks, mddev->nb_dev);
 		goto abort;
 	}
@@ -378,12 +379,12 @@
 				c++;
 		}
 		if (!c) {
-			printk(KERN_ERR "md: md%d, missing disk #%d, aborting.\n",
+			EPRINTK(KERN_ERR "md: md%d, missing disk #%d, aborting.\n",
 			       mdidx(mddev), i);
 			goto abort;
 		}
 		if (c > 1) {
-			printk(KERN_ERR "md: md%d, too many disks #%d, aborting.\n",
+			EPRINTK(KERN_ERR "md: md%d, too many disks #%d, aborting.\n",
 			       mdidx(mddev), i);
 			goto abort;
 		}
@@ -442,7 +443,8 @@
    }
 #endif  
    if (changed) {
-     printk("md%d:validate_sb(%d): working=%d spare=%d failed=%d nr_disks=%d\n",            sb->md_minor, op, sb->working_disks, sb->spare_disks,
+     EPRINTK(KERN_INFO "md%d:validate_sb(%d): working=%d spare=%d failed=%d nr_disks=%d\n",
+	    sb->md_minor, op, sb->working_disks, sb->spare_disks,
             sb->failed_disks, sb->nr_disks);
      /* recalculate the checksum */
      sb->sb_csum = calc_sb_csum(sb);
@@ -506,7 +508,7 @@
 
 	rdev->sb = (mdp_super_t *) __get_free_page(GFP_KERNEL);
 	if (!rdev->sb) {
-		printk(OUT_OF_MEM);
+		EPRINTK(OUT_OF_MEM);
 		return -EINVAL;
 	}
 	md_clear_page(rdev->sb);
@@ -554,10 +556,10 @@
 		sb = (mdp_super_t *) bh->b_data;
 		memcpy (rdev->sb, sb, MD_SB_BYTES);
 	} else {
-		printk(NO_SB,partition_name(rdev->dev));
+		EPRINTK(NO_SB,partition_name(rdev->dev));
 		goto abort;
 	}
-	printk(KERN_INFO " [events: %08lx]\n", (unsigned long)rdev->sb->events_lo);
+	EPRINTK(KERN_INFO " [events: %08lx]\n", (unsigned long)rdev->sb->events_lo);
 	ret = 0;
 abort:
 	if (bh)
@@ -592,17 +594,17 @@
 	}
 
 	if (sb->md_magic != MD_SB_MAGIC) {
-		printk(BAD_MAGIC, partition_name(rdev->dev));
+		EPRINTK(BAD_MAGIC, partition_name(rdev->dev));
 		goto abort;
 	}
 
 	if (sb->md_minor >= MAX_MD_DEVS) {
-		printk(BAD_MINOR, partition_name(rdev->dev), sb->md_minor);
+		EPRINTK(BAD_MINOR, partition_name(rdev->dev), sb->md_minor);
 		goto abort;
 	}
 
 	if (calc_sb_csum(sb) != sb->sb_csum) {
-		printk(BAD_CSUM, partition_name(rdev->dev));
+		EPRINTK(BAD_CSUM, partition_name(rdev->dev));
 		goto abort;
 	}
 	ret = 0;
@@ -659,7 +661,7 @@
 	}
 	same_pdev = match_dev_unit(mddev, rdev->dev);
 	if (same_pdev)
-		printk( KERN_WARNING
+		EPRINTK( KERN_WARNING
 "md%d: WARNING: %s appears to be on the same physical disk as %s. True\n"
 "     protection against single-disk failure might be compromised.\n",
 			mdidx(mddev), partition_name(rdev->dev),
@@ -668,7 +670,7 @@
 	md_list_add(&rdev->same_set, &mddev->disks);
 	rdev->mddev = mddev;
 	mddev->nb_dev++;
-	printk(KERN_INFO "md: bind<%s,%d>\n", partition_name(rdev->dev), mddev->nb_dev);
+	EPRINTK(KERN_INFO "md: bind<%s,%d>\n", partition_name(rdev->dev), mddev->nb_dev);
 }
 
 static void unbind_rdev_from_array(mdk_rdev_t * rdev)
@@ -680,7 +682,7 @@
 	md_list_del(&rdev->same_set);
 	MD_INIT_LIST_HEAD(&rdev->same_set);
 	rdev->mddev->nb_dev--;
-	printk(KERN_INFO "md: unbind<%s,%d>\n", partition_name(rdev->dev),
+	EPRINTK(KERN_INFO "md: unbind<%s,%d>\n", partition_name(rdev->dev),
 						 rdev->mddev->nb_dev);
 	rdev->mddev = NULL;
 }
@@ -719,7 +721,7 @@
 
 static void export_rdev(mdk_rdev_t * rdev)
 {
-	printk(KERN_INFO "md: export_rdev(%s)\n",partition_name(rdev->dev));
+	EPRINTK(KERN_INFO "md: export_rdev(%s)\n",partition_name(rdev->dev));
 	if (rdev->mddev)
 		MD_BUG();
 	unlock_rdev(rdev);
@@ -727,7 +729,7 @@
 	md_list_del(&rdev->all);
 	MD_INIT_LIST_HEAD(&rdev->all);
 	if (rdev->pending.next != &rdev->pending) {
-		printk(KERN_INFO "md: (%s was pending)\n",
+		EPRINTK(KERN_INFO "md: (%s was pending)\n",
 			partition_name(rdev->dev));
 		md_list_del(&rdev->pending);
 		MD_INIT_LIST_HEAD(&rdev->pending);
@@ -802,7 +804,7 @@
 
 static void print_desc(mdp_disk_t *desc)
 {
-	printk(" DISK<N:%d,%s(%d,%d),R:%d,S:%d>\n", desc->number,
+	EPRINTK(" DISK<N:%d,%s(%d,%d),R:%d,S:%d>\n", desc->number,
 		partition_name(MKDEV(desc->major,desc->minor)),
 		desc->major,desc->minor,desc->raid_disk,desc->state);
 }
@@ -811,44 +813,44 @@
 {
 	int i;
 
-	printk(KERN_INFO "md:  SB: (V:%d.%d.%d) ID:<%08x.%08x.%08x.%08x> CT:%08x\n",
+	EPRINTK(KERN_INFO "md:  SB: (V:%d.%d.%d) ID:<%08x.%08x.%08x.%08x> CT:%08x\n",
 		sb->major_version, sb->minor_version, sb->patch_version,
 		sb->set_uuid0, sb->set_uuid1, sb->set_uuid2, sb->set_uuid3,
 		sb->ctime);
-	printk(KERN_INFO "md:     L%d S%08d ND:%d RD:%d md%d LO:%d CS:%d\n", sb->level,
+	EPRINTK(KERN_INFO "md:     L%d S%08d ND:%d RD:%d md%d LO:%d CS:%d\n", sb->level,
 		sb->size, sb->nr_disks, sb->raid_disks, sb->md_minor,
 		sb->layout, sb->chunk_size);
-	printk(KERN_INFO "md:     UT:%08x ST:%d AD:%d WD:%d FD:%d SD:%d CSUM:%08x E:%08lx\n",
+	EPRINTK(KERN_INFO "md:     UT:%08x ST:%d AD:%d WD:%d FD:%d SD:%d CSUM:%08x E:%08lx\n",
 		sb->utime, sb->state, sb->active_disks, sb->working_disks,
 		sb->failed_disks, sb->spare_disks,
 		sb->sb_csum, (unsigned long)sb->events_lo);
 
-	printk(KERN_INFO);
+	EPRINTK(KERN_INFO);
 	for (i = 0; i < MD_SB_DISKS; i++) {
 		mdp_disk_t *desc;
 
 		desc = sb->disks + i;
 		if (desc->number || desc->major || desc->minor ||
 		    desc->raid_disk || (desc->state && (desc->state != 4))) {
-			printk("     D %2d: ", i);
+			EPRINTK("     D %2d: ", i);
 			print_desc(desc);
 		}
 	}
-	printk(KERN_INFO "md:     THIS: ");
+	EPRINTK(KERN_INFO "md:     THIS: ");
 	print_desc(&sb->this_disk);
 
 }
 
 static void print_rdev(mdk_rdev_t *rdev)
 {
-	printk(KERN_INFO "md: rdev %s: O:%s, SZ:%08ld F:%d DN:%d ",
+	EPRINTK(KERN_INFO "md: rdev %s: O:%s, SZ:%08ld F:%d DN:%d ",
 		partition_name(rdev->dev), partition_name(rdev->old_dev),
 		rdev->size, rdev->faulty, rdev->desc_nr);
 	if (rdev->sb) {
-		printk(KERN_INFO "md: rdev superblock:\n");
+		EPRINTK(KERN_INFO "md: rdev superblock:\n");
 		print_sb(rdev->sb);
 	} else
-		printk(KERN_INFO "md: no rdev superblock!\n");
+		EPRINTK(KERN_INFO "md: no rdev superblock!\n");
 }
 
 void md_print_devices(void)
@@ -857,27 +859,27 @@
 	mdk_rdev_t *rdev;
 	mddev_t *mddev;
 
-	printk("\n");
-	printk("md:	**********************************\n");
-	printk("md:	* <COMPLETE RAID STATE PRINTOUT> *\n");
-	printk("md:	**********************************\n");
+	EPRINTK("\n");
+	EPRINTK("md:	**********************************\n");
+	EPRINTK("md:	* <COMPLETE RAID STATE PRINTOUT> *\n");
+	EPRINTK("md:	**********************************\n");
 	ITERATE_MDDEV(mddev,tmp) {
-		printk("md%d: ", mdidx(mddev));
+		EPRINTK("md%d: ", mdidx(mddev));
 
 		ITERATE_RDEV(mddev,rdev,tmp2)
-			printk("<%s>", partition_name(rdev->dev));
+			EPRINTK("<%s>", partition_name(rdev->dev));
 
 		if (mddev->sb) {
-			printk(" array superblock:\n");
+			EPRINTK(" array superblock:\n");
 			print_sb(mddev->sb);
 		} else
-			printk(" no array superblock.\n");
+			EPRINTK(" no array superblock.\n");
 
 		ITERATE_RDEV(mddev,rdev,tmp2)
 			print_rdev(rdev);
 	}
-	printk("md:	**********************************\n");
-	printk("\n");
+	EPRINTK("md:	**********************************\n");
+	EPRINTK("\n");
 }
 
 static int sb_equal(mdp_super_t *sb1, mdp_super_t *sb2)
@@ -890,7 +892,7 @@
 
 	if (!tmp1 || !tmp2) {
 		ret = 0;
-		printk(KERN_INFO "md.c: sb1 is not equal to sb2!\n");
+		EPRINTK(KERN_INFO "md.c: sb1 is not equal to sb2!\n");
 		goto abort;
 	}
 
@@ -974,7 +976,7 @@
 	dev = rdev->dev;
 	sb_offset = calc_dev_sboffset(dev, rdev->mddev, 1);
 	if (rdev->sb_offset != sb_offset) {
-		printk(KERN_INFO "%s's sb offset has changed from %ld to %ld, skipping\n",
+		EPRINTK(KERN_INFO "%s's sb offset has changed from %ld to %ld, skipping\n",
 		       partition_name(dev), rdev->sb_offset, sb_offset);
 		goto skip;
 	}
@@ -985,17 +987,17 @@
 	 */
 	size = calc_dev_size(dev, rdev->mddev, 1);
 	if (size != rdev->size) {
-		printk(KERN_INFO "%s's size has changed from %ld to %ld since import, skipping\n",
+		EPRINTK(KERN_INFO "%s's size has changed from %ld to %ld since import, skipping\n",
 		       partition_name(dev), rdev->size, size);
 		goto skip;
 	}
 
-	printk(KERN_INFO "(write) %s's sb offset: %ld\n", partition_name(dev), sb_offset);
+	EPRINTK(KERN_INFO "(write) %s's sb offset: %ld\n", partition_name(dev), sb_offset);
 	fsync_dev(dev);
 	set_blocksize(dev, MD_SB_BYTES);
 	bh = getblk(dev, sb_offset / MD_SB_BLOCKS, MD_SB_BYTES);
 	if (!bh) {
-		printk(GETBLK_FAILED, partition_name(dev));
+		EPRINTK(GETBLK_FAILED, partition_name(dev));
 		return 1;
 	}
 	memset(bh->b_data,0,bh->b_size);
@@ -1065,7 +1067,7 @@
 	int i;
 
 	if (!mddev->sb_dirty) {
-		printk("hm, md_update_sb() called without ->sb_dirty == 1, from %p.\n", __builtin_return_address(0));
+		EPRINTK("hm, md_update_sb() called without ->sb_dirty == 1, from %p.\n", __builtin_return_address(0));
 		return 0;
 	}
 	mddev->sb_dirty = 0;
@@ -1097,13 +1099,13 @@
 		return 0;
 
 	validate_sb(mddev->sb,9);
-	printk(KERN_INFO "md: updating md%d RAID superblock on device\n",
+	EPRINTK(KERN_INFO "md: updating md%d RAID superblock on device\n",
 					mdidx(mddev));
 
 	err = 0;
 	i = 0;
 	ITERATE_RDEV(mddev,rdev,tmp) {
-		printk(KERN_INFO "md: ");
+		EPRINTK(KERN_INFO "md: ");
 		if (rdev->faulty)
 			printk("(skipping faulty ");
 		if (rdev->alias_device)
@@ -1118,17 +1120,17 @@
 		} else
 			printk(")\n");
 		if (i > MD_SB_DISKS) {  /* ARC*/
-			printk("md_update_sb: iterate_rdev limit reached\n");
+			EPRINTK("md_update_sb: iterate_rdev limit reached\n");
 			break;
 			}
 		i++;
 	}
 	if (err) {
 		if (--count) {
-			printk(KERN_ERR "md: errors occurred during superblock update, repeating\n");
+			EPRINTK(KERN_ERR "md: errors occurred during superblock update, repeating\n");
 			goto repeat;
 		}
-		printk(KERN_ERR "md: excessive errors occurred during superblock update, exiting\n");
+		EPRINTK(KERN_ERR "md: excessive errors occurred during superblock update, exiting\n");
 	}
 	return 0;
 }
@@ -1154,13 +1156,13 @@
 
 	rdev = (mdk_rdev_t *) kmalloc(sizeof(*rdev), GFP_KERNEL);
 	if (!rdev) {
-		printk(KERN_ERR "md: could not alloc mem for %s!\n", partition_name(newdev));
+		EPRINTK(KERN_ERR "md: could not alloc mem for %s!\n", partition_name(newdev));
 		return -ENOMEM;
 	}
 	memset(rdev, 0, sizeof(*rdev));
 
 	if (is_mounted(newdev)) {
-		printk(KERN_WARNING "md: can not import %s, has active inodes!\n",
+		EPRINTK(KERN_WARNING "md: can not import %s, has active inodes!\n",
 			partition_name(newdev));
 		err = -EBUSY;
 		goto abort_free;
@@ -1171,7 +1173,7 @@
 
 	rdev->dev = newdev;
 	if (lock_rdev(rdev)) {
-		printk(KERN_ERR "md: could not lock %s, zero-size? Marking faulty.\n",
+		EPRINTK(KERN_ERR "md: could not lock %s, zero-size? Marking faulty.\n",
 			partition_name(newdev));
 		err = -EINVAL;
 		goto abort_free;
@@ -1183,7 +1185,7 @@
 	if (blk_size[MAJOR(newdev)])
 		size = blk_size[MAJOR(newdev)][MINOR(newdev)];
 	if (!size) {
-		printk(KERN_WARNING "md: %s has zero size, marking faulty!\n",
+		EPRINTK(KERN_WARNING "md: %s has zero size, marking faulty!\n",
 				partition_name(newdev));
 		err = -EINVAL;
 		goto abort_free;
@@ -1191,12 +1193,12 @@
 
 	if (on_disk) {
 		if ((err = read_disk_sb(rdev))) {
-			printk(KERN_WARNING "md: could not read %s's sb, not importing!\n",
+			EPRINTK(KERN_WARNING "md: could not read %s's sb, not importing!\n",
 			       partition_name(newdev));
 			goto abort_free;
 		}
 		if ((err = check_disk_sb(rdev))) {
-			printk(KERN_WARNING "md: %s has invalid sb, not importing!\n",
+			EPRINTK(KERN_WARNING "md: %s has invalid sb, not importing!\n",
 			       partition_name(newdev));
 			goto abort_free;
 		}
@@ -1281,7 +1283,7 @@
 			continue;
 		}
 		if (!sb_equal(sb, rdev->sb)) {
-			printk(INCONSISTENT, partition_name(rdev->dev));
+			EPRINTK(INCONSISTENT, partition_name(rdev->dev));
 			kick_rdev_from_array(rdev);
 			continue;
 		}
@@ -1311,7 +1313,7 @@
 					rdev->sb->events_hi--;
 		}
 
-		printk(KERN_INFO "md: %s's event counter: %08lx\n",
+		EPRINTK(KERN_INFO "md: %s's event counter: %08lx\n",
 		       partition_name(rdev->dev),
 			(unsigned long)rdev->sb->events_lo);
 		if (!freshest) {
@@ -1330,8 +1332,8 @@
 		}
 	}
 	if (out_of_date) {
-		printk(OUT_OF_DATE);
-		printk(KERN_INFO "md: freshest: %s\n", partition_name(freshest->dev));
+		EPRINTK(OUT_OF_DATE);
+		EPRINTK(KERN_INFO "md: freshest: %s\n", partition_name(freshest->dev));
 	}
 	memcpy (sb, freshest->sb, sizeof(*sb));
 
@@ -1350,7 +1352,7 @@
 		ev2 = md_event(sb);
 		++ev1;
 		if (ev1 < ev2) {
-			printk(KERN_WARNING "md: kicking non-fresh %s from array!\n",
+			EPRINTK(KERN_WARNING "md: kicking non-fresh %s from array!\n",
 						partition_name(rdev->dev));
 			kick_rdev_from_array(rdev);
 			continue;
@@ -1376,7 +1378,7 @@
 			((ev1 == ev2) || (ev1 == ev3))) {
 			mdp_disk_t *desc;
 
-			printk(KERN_WARNING "md: device name has changed from %s to %s since last import!\n",
+			EPRINTK(KERN_WARNING "md: device name has changed from %s to %s since last import!\n",
 			       partition_name(rdev->old_dev), partition_name(rdev->dev));
 			if (rdev->desc_nr == -1) {
 				MD_BUG();
@@ -1424,7 +1426,7 @@
 			ITERATE_RDEV(mddev,rdev,tmp) {
 				if (rdev->desc_nr != desc->number)
 					continue;
-				printk(KERN_WARNING "md%d: kicking faulty %s!\n",
+				EPRINTK(KERN_WARNING "md%d: kicking faulty %s!\n",
 					mdidx(mddev),partition_name(rdev->dev));
 				kick_rdev_from_array(rdev);
 				found = 1;
@@ -1433,7 +1435,7 @@
 			if (!found) {
 				if (dev == MKDEV(0,0))
 					continue;
-				printk(KERN_WARNING "md%d: removing former faulty %s!\n",
+				EPRINTK(KERN_WARNING "md%d: removing former faulty %s!\n",
 					mdidx(mddev), partition_name(dev));
 			}
 			remove_descriptor(desc, sb);
@@ -1475,7 +1477,7 @@
 		if (found)
 			continue;
 
-		printk(KERN_WARNING "md%d: former device %s is unavailable, removing from array!\n",
+		EPRINTK(KERN_WARNING "md%d: former device %s is unavailable, removing from array!\n",
 		       mdidx(mddev), partition_name(dev));
 		remove_descriptor(desc, sb);
 	}
@@ -1572,14 +1574,14 @@
 	if (sb->major_version != MD_MAJOR_VERSION ||
 			sb->minor_version > MD_MINOR_VERSION) {
 
-		printk(OLD_VERSION, mdidx(mddev), sb->major_version,
+		EPRINTK(OLD_VERSION, mdidx(mddev), sb->major_version,
 				sb->minor_version, sb->patch_version);
 		goto abort;
 	}
 
 	if ((sb->state != (1 << MD_SB_CLEAN)) && ((sb->level == 1) ||
 			(sb->level == 4) || (sb->level == 5)))
-		printk(NOT_CLEAN_IGNORE, mdidx(mddev));
+		EPRINTK(NOT_CLEAN_IGNORE, mdidx(mddev));
 
 	return 0;
 abort:
@@ -1614,7 +1616,7 @@
 		}
 		rdev->size = calc_dev_size(rdev->dev, mddev, persistent);
 		if (rdev->size < sb->chunk_size / 1024) {
-			printk(KERN_WARNING
+			EPRINTK(KERN_WARNING
 				"md: Dev %s smaller than chunk_size: %ldk < %dk\n",
 				partition_name(rdev->dev),
 				rdev->size, sb->chunk_size / 1024);
@@ -1648,7 +1650,7 @@
 			data_disks = sb->raid_disks-1;
 			break;
 		default:
-			printk(UNKNOWN_LEVEL, mdidx(mddev), sb->level);
+			EPRINTK(UNKNOWN_LEVEL, mdidx(mddev), sb->level);
 			goto abort;
 	}
 	if (!md_size[mdidx(mddev)])
@@ -1666,10 +1668,10 @@
 	}
 	md_maxreadahead[mdidx(mddev)] = readahead;
 
-	printk(KERN_INFO "md%d: max total readahead window set to %ldk\n",
+	EPRINTK(KERN_INFO "md%d: max total readahead window set to %ldk\n",
 		mdidx(mddev), readahead*(PAGE_SIZE/1024));
 
-	printk(KERN_INFO
+	EPRINTK(KERN_INFO
 		"md%d: %d data-disks, max readahead per data-disk: %ldk\n",
 			mdidx(mddev), data_disks, readahead/data_disks*(PAGE_SIZE/1024));
 	return 0;
@@ -1731,11 +1733,11 @@
 			 * we abort here to be on the safe side. We dont
 			 * want to continue the bad practice.
 			 */
-			printk(BAD_CHUNKSIZE);
+			EPRINTK(BAD_CHUNKSIZE);
 			return -EINVAL;
 		}
 		if (chunk_size > MAX_CHUNK_SIZE) {
-			printk(TOO_BIG_CHUNKSIZE, chunk_size, MAX_CHUNK_SIZE);
+			EPRINTK(TOO_BIG_CHUNKSIZE, chunk_size, MAX_CHUNK_SIZE);
 			return -EINVAL;
 		}
 		/*
@@ -1746,12 +1748,12 @@
 			return -EINVAL;
 		}
 		if (chunk_size < PAGE_SIZE) {
-			printk(TOO_SMALL_CHUNKSIZE, chunk_size, PAGE_SIZE);
+			EPRINTK(TOO_SMALL_CHUNKSIZE, chunk_size, PAGE_SIZE);
 			return -EINVAL;
 		}
 	} else
 		if (chunk_size)
-			printk(KERN_INFO "md: RAID level %d does not need chunksize! Continuing anyway.\n",
+			EPRINTK(KERN_INFO "md: RAID level %d does not need chunksize! Continuing anyway.\n",
 			       mddev->sb->level);
 
 	if (pnum >= MAX_PERSONALITY) {
@@ -1768,7 +1770,7 @@
 		if (!pers[pnum])
 #endif
 		{
-			printk(KERN_ERR "md: personality %d is not loaded!\n",
+			EPRINTK(KERN_ERR "md: personality %d is not loaded!\n",
 				pnum);
 			return -EINVAL;
 		}
@@ -1800,7 +1802,7 @@
 
 	err = mddev->pers->run(mddev);
 	if (err) {
-		printk(KERN_ERR "md: pers->run() failed ...\n");
+		EPRINTK(KERN_ERR "md: pers->run() failed ...\n");
 		mddev->pers = NULL;
 		return -EINVAL;
 	}
@@ -1843,7 +1845,7 @@
 		mddev->ro = 0;
 		set_device_ro(mddev_to_kdev(mddev), 0);
 
-		printk(KERN_INFO
+		EPRINTK(KERN_INFO
 			"md: md%d switched to read-write mode.\n", mdidx(mddev));
 		/*
 		 * Kick recovery or resync if necessary
@@ -1852,7 +1854,7 @@
 		if (mddev->pers->restart_resync)
 			mddev->pers->restart_resync(mddev);
 	} else {
-		printk(KERN_ERR "md: md%d has no personality assigned.\n",
+		EPRINTK(KERN_ERR "md: md%d has no personality assigned.\n",
 			mdidx(mddev));
 		err = -EINVAL;
 	}
@@ -1872,7 +1874,7 @@
 	kdev_t dev = mddev_to_kdev(mddev);
 
 	if (atomic_read(&mddev->active)>1) {
-		printk(STILL_IN_USE, mdidx(mddev));
+		EPRINTK(STILL_IN_USE, mdidx(mddev));
 		OUT(-EBUSY);
 	}
 
@@ -1921,7 +1923,7 @@
 			 * interrupted.
 			 */
 			if (!mddev->recovery_running && !resync_interrupted) {
-				printk(KERN_INFO "md: marking sb clean...\n");
+				EPRINTK(KERN_INFO "md: marking sb clean...\n");
 				mddev->sb->state |= 1 << MD_SB_CLEAN;
 			}
 			mddev->sb_dirty = 1;
@@ -1935,11 +1937,11 @@
 	 * Free resources if final stop
 	 */
 	if (!ro) {
-		printk(KERN_INFO "md: md%d stopped.\n", mdidx(mddev));
+		EPRINTK(KERN_INFO "md: md%d stopped.\n", mdidx(mddev));
 		free_mddev(mddev);
 
 	} else
-		printk(KERN_INFO "md: md%d switched to read-only mode.\n", mdidx(mddev));
+		EPRINTK(KERN_INFO "md: md%d switched to read-only mode.\n", mdidx(mddev));
 out:
 	return err;
 }
@@ -1971,16 +1973,16 @@
 		return;
 	}
 
-	printk(KERN_INFO "md: running: ");
+	EPRINTK(KERN_INFO "md: running: ");
 
 	ITERATE_RDEV(mddev,rdev,tmp) {
-		printk("<%s>", partition_name(rdev->dev));
+		EPRINTK("<%s>", partition_name(rdev->dev));
 	}
-	printk("\n");
+	EPRINTK("\n");
 
 	err = do_md_run (mddev);
 	if (err) {
-		printk(KERN_WARNING "md :do_md_run() returned %d\n", err);
+		EPRINTK(KERN_WARNING "md :do_md_run() returned %d\n", err);
 		/*
 		 * prevent the writeback of an unrunnable array
 		 */
@@ -2010,22 +2012,22 @@
 	kdev_t md_kdev;
 
 
-	printk(KERN_INFO "md: autorun ...\n");
+	EPRINTK(KERN_INFO "md: autorun ...\n");
 	while (pending_raid_disks.next != &pending_raid_disks) {
 		rdev0 = md_list_entry(pending_raid_disks.next,
 					 mdk_rdev_t, pending);
 
-		printk(KERN_INFO "md: considering %s ...\n", partition_name(rdev0->dev));
+		EPRINTK(KERN_INFO "md: considering %s ...\n", partition_name(rdev0->dev));
 		MD_INIT_LIST_HEAD(&candidates);
 		ITERATE_RDEV_PENDING(rdev,tmp) {
 			if (uuid_equal(rdev0, rdev)) {
 				if (!sb_equal(rdev0->sb, rdev->sb)) {
-					printk(KERN_WARNING
+					EPRINTK(KERN_WARNING
 					       "md: %s has same UUID as %s, but superblocks differ ...\n",
 					       partition_name(rdev->dev), partition_name(rdev0->dev));
 					continue;
 				}
-				printk(KERN_INFO "md:  adding %s ...\n", partition_name(rdev->dev));
+				EPRINTK(KERN_INFO "md:  adding %s ...\n", partition_name(rdev->dev));
 				md_list_del(&rdev->pending);
 				md_list_add(&rdev->pending, &candidates);
 			}
@@ -2038,7 +2040,7 @@
 		md_kdev = MKDEV(MD_MAJOR, rdev0->sb->md_minor);
 		mddev = kdev_to_mddev(md_kdev);
 		if (mddev) {
-			printk(KERN_WARNING "md: md%d already running, cannot run %s\n",
+			EPRINTK(KERN_WARNING "md: md%d already running, cannot run %s\n",
 			       mdidx(mddev), partition_name(rdev0->dev));
 			ITERATE_RDEV_GENERIC(candidates,pending,rdev,tmp)
 				export_rdev(rdev);
@@ -2046,12 +2048,12 @@
 		}
 		mddev = alloc_mddev(md_kdev);
 		if (!mddev) {
-			printk(KERN_ERR "md: cannot allocate memory for md drive.\n");
+			EPRINTK(KERN_ERR "md: cannot allocate memory for md drive.\n");
 			break;
 		}
 		if (md_kdev == countdev)
 			atomic_inc(&mddev->active);
-		printk(KERN_INFO "md: created md%d\n", mdidx(mddev));
+		EPRINTK(KERN_INFO "md: created md%d\n", mdidx(mddev));
 		ITERATE_RDEV_GENERIC(candidates,pending,rdev,tmp) {
 			bind_rdev_to_array(rdev, mddev);
 			md_list_del(&rdev->pending);
@@ -2059,7 +2061,7 @@
 		}
 		autorun_array(mddev);
 	}
-	printk(KERN_INFO "md: ... autorun DONE.\n");
+	EPRINTK(KERN_INFO "md: ... autorun DONE.\n");
 }
 
 /*
@@ -2101,7 +2103,7 @@
 	mdk_rdev_t *start_rdev = NULL, *rdev;
 
 	if ((err=md_import_device(startdev, 1))) {
-		printk(KERN_WARNING "md: could not import %s!\n", partition_name(startdev));
+		EPRINTK(KERN_WARNING "md: could not import %s!\n", partition_name(startdev));
 		goto abort;
 	}
 
@@ -2111,7 +2113,7 @@
 		goto abort;
 	}
 	if (start_rdev->faulty) {
-		printk(KERN_WARNING "md: can not autostart based on faulty %s!\n",
+		EPRINTK(KERN_WARNING "md: can not autostart based on faulty %s!\n",
 						partition_name(startdev));
 		goto abort;
 	}
@@ -2121,7 +2123,7 @@
 
 	err = detect_old_array(sb);
 	if (err) {
-		printk(KERN_WARNING "md: array version is too old to be autostarted ,"
+		EPRINTK(KERN_WARNING "md: array version is too old to be autostarted ,"
 		       "use raidtools 0.90 mkraid --upgrade to upgrade the array "
 		       "without data loss!\n");
 		goto abort;
@@ -2139,7 +2141,7 @@
 		if (dev == startdev)
 			continue;
 		if (md_import_device(dev, 1)) {
-			printk(KERN_WARNING "md: could not import %s, trying to run array nevertheless.\n",
+			EPRINTK(KERN_WARNING "md: could not import %s, trying to run array nevertheless.\n",
 			       partition_name(dev));
 			continue;
 		}
@@ -2264,7 +2266,7 @@
 	dev = MKDEV(info->major,info->minor);
 
 	if (find_rdev_all(dev)) {
-		printk(KERN_WARNING "md: device %s already used in a RAID array!\n",
+		EPRINTK(KERN_WARNING "md: device %s already used in a RAID array!\n",
 		       partition_name(dev));
 		return -EBUSY;
 	}
@@ -2272,7 +2274,7 @@
 		/* expecting a device which has a superblock */
 		err = md_import_device(dev, 1);
 		if (err) {
-			printk(KERN_WARNING "md: md_import_device returned %d\n", err);
+			EPRINTK(KERN_WARNING "md: md_import_device returned %d\n", err);
 			return -EINVAL;
 		}
 		rdev = find_rdev_all(dev);
@@ -2284,13 +2286,13 @@
 			mdk_rdev_t *rdev0 = md_list_entry(mddev->disks.next,
 							mdk_rdev_t, same_set);
 			if (!uuid_equal(rdev0, rdev)) {
-				printk(KERN_WARNING "md: %s has different UUID to %s\n",
+				EPRINTK(KERN_WARNING "md: %s has different UUID to %s\n",
 				       partition_name(rdev->dev), partition_name(rdev0->dev));
 				export_rdev(rdev);
 				return -EINVAL;
 			}
 			if (!sb_equal(rdev0->sb, rdev->sb)) {
-				printk(KERN_WARNING "md: %s has same UUID but different superblock to %s\n",
+				EPRINTK(KERN_WARNING "md: %s has same UUID but different superblock to %s\n",
 				       partition_name(rdev->dev), partition_name(rdev0->dev));
 				export_rdev(rdev);
 				return -EINVAL;
@@ -2316,7 +2318,7 @@
 	if ((info->state & (1<<MD_DISK_FAULTY))==0) {
 		err = md_import_device (dev, 0);
 		if (err) {
-			printk(KERN_WARNING "md: error, md_import_device() returned %d\n", err);
+			EPRINTK(KERN_WARNING "md: error, md_import_device() returned %d\n", err);
 			return -EINVAL;
 		}
 		rdev = find_rdev_all(dev);
@@ -2332,7 +2334,7 @@
 
 		persistent = !mddev->sb->not_persistent;
 		if (!persistent)
-			printk(KERN_INFO "md: nonpersistent superblock ...\n");
+			EPRINTK(KERN_INFO "md: nonpersistent superblock ...\n");
 
 		size = calc_dev_size(dev, mddev, persistent);
 		rdev->sb_offset = calc_dev_sboffset(dev, mddev, persistent);
@@ -2359,7 +2361,7 @@
 	if (!mddev->pers)
 		return -ENODEV;
 
-	printk(KERN_INFO "md: trying to generate %s error in md%d ... \n",
+	EPRINTK(KERN_INFO "md: trying to generate %s error in md%d ... \n",
 		partition_name(dev), mdidx(mddev));
 
 	rdev = find_rdev(mddev, dev);
@@ -2381,7 +2383,7 @@
 		MD_BUG();
 		return -ENODEV;
 	}
-	printk(KERN_INFO "md: okay, generating error!\n");
+	EPRINTK(KERN_INFO "md: okay, generating error!\n");
 //	q->oneshot_error = 1; // disabled for now
 
 	return 0;
@@ -2396,11 +2398,11 @@
 	if (!mddev->pers)
 		return -ENODEV;
 
-	printk(KERN_INFO "md: trying to remove %s from md%d ... \n",
+	EPRINTK(KERN_INFO "md: trying to remove %s from md%d ... \n",
 		partition_name(dev), mdidx(mddev));
 
 	if (!mddev->pers->diskop) {
-		printk(KERN_WARNING "md%d: personality does not support diskops!\n",
+		EPRINTK(KERN_WARNING "md%d: personality does not support diskops!\n",
 		       mdidx(mddev));
 		return -EINVAL;
 	}
@@ -2440,7 +2442,7 @@
 
 	return 0;
 busy:
-	printk(KERN_WARNING "md: cannot remove active disk %s from md%d ... \n",
+	EPRINTK(KERN_WARNING "md: cannot remove active disk %s from md%d ... \n",
 		partition_name(dev), mdidx(mddev));
 	return -EBUSY;
 }
@@ -2455,11 +2457,11 @@
 	if (!mddev->pers)
 		return -ENODEV;
 
-	printk(KERN_INFO "md: trying to hot-add %s to md%d ... \n",
+	EPRINTK(KERN_INFO "md: trying to hot-add %s to md%d ... \n",
 		partition_name(dev), mdidx(mddev));
 
 	if (!mddev->pers->diskop) {
-		printk(KERN_WARNING "md%d: personality does not support diskops!\n",
+		EPRINTK(KERN_WARNING "md%d: personality does not support diskops!\n",
 		       mdidx(mddev));
 		return -EINVAL;
 	}
@@ -2468,7 +2470,7 @@
 	size = calc_dev_size(dev, mddev, persistent);
 
 	if (size < mddev->sb->size) {
-		printk(KERN_WARNING "md%d: disk size %d blocks < array size %d\n",
+		EPRINTK(KERN_WARNING "md%d: disk size %d blocks < array size %d\n",
 				mdidx(mddev), size, mddev->sb->size);
 		return -ENOSPC;
 	}
@@ -2479,7 +2481,7 @@
 
 	err = md_import_device (dev, 0);
 	if (err) {
-		printk(KERN_WARNING "md: error, md_import_device() returned %d\n", err);
+		EPRINTK(KERN_WARNING "md: error, md_import_device() returned %d\n", err);
 		return -EINVAL;
 	}
 	rdev = find_rdev_all(dev);
@@ -2488,7 +2490,7 @@
 		return -EINVAL;
 	}
 	if (rdev->faulty) {
-		printk(KERN_WARNING "md: can not hot-add faulty %s disk to md%d!\n",
+		EPRINTK(KERN_WARNING "md: can not hot-add faulty %s disk to md%d!\n",
 				partition_name(dev), mdidx(mddev));
 		err = -EINVAL;
 		goto abort_export;
@@ -2513,7 +2515,7 @@
 			break;
 	}
 	if (i == MD_SB_DISKS) {
-		printk(KERN_WARNING "md%d: can not hot-add to full array!\n",
+		EPRINTK(KERN_WARNING "md%d: can not hot-add to full array!\n",
 		       mdidx(mddev));
 		err = -EBUSY;
 		goto abort_unbind_export;
@@ -2611,31 +2613,31 @@
 
 static int set_disk_info(mddev_t * mddev, void * arg)
 {
-	printk(KERN_INFO "md: not yet");
+	EPRINTK(KERN_INFO "md: not yet");
 	return -EINVAL;
 }
 
 static int clear_array(mddev_t * mddev)
 {
-	printk(KERN_INFO "md: not yet");
+	EPRINTK(KERN_INFO "md: not yet");
 	return -EINVAL;
 }
 
 static int write_raid_info(mddev_t * mddev)
 {
-	printk(KERN_INFO "md: not yet");
+	EPRINTK(KERN_INFO "md: not yet");
 	return -EINVAL;
 }
 
 static int protect_array(mddev_t * mddev)
 {
-	printk(KERN_INFO "md: not yet");
+	EPRINTK(KERN_INFO "md: not yet");
 	return -EINVAL;
 }
 
 static int unprotect_array(mddev_t * mddev)
 {
-	printk(KERN_INFO "md: not yet");
+	EPRINTK(KERN_INFO "md: not yet");
 	return -EINVAL;
 }
 
@@ -2725,7 +2727,7 @@
 		case SET_ARRAY_INFO:
 		case START_ARRAY:
 			if (mddev) {
-				printk(KERN_WARNING "md: array md%d already exists!\n",
+				EPRINTK(KERN_WARNING "md: array md%d already exists!\n",
 								mdidx(mddev));
 				err = -EEXIST;
 				goto abort;
@@ -2747,13 +2749,13 @@
 			 */
 			err = lock_mddev(mddev);
 			if (err) {
-				printk(KERN_WARNING "md: ioctl, reason %d, cmd %d\n",
+				EPRINTK(KERN_WARNING "md: ioctl, reason %d, cmd %d\n",
 				       err, cmd);
 				goto abort;
 			}
 
 			if (mddev->sb) {
-				printk(KERN_WARNING "md: array md%d already has a superblock!\n",
+				EPRINTK(KERN_WARNING "md: array md%d already has a superblock!\n",
 					mdidx(mddev));
 				err = -EBUSY;
 				goto abort_unlock;
@@ -2766,7 +2768,7 @@
 				}
 				err = set_array_info(mddev, &info);
 				if (err) {
-					printk(KERN_WARNING "md: couldnt set array info. %d\n", err);
+					EPRINTK(KERN_WARNING "md: couldnt set array info. %d\n", err);
 					goto abort_unlock;
 				}
 			}
@@ -2778,7 +2780,7 @@
 			 */
 			err = autostart_array((kdev_t)arg, dev);
 			if (err) {
-				printk(KERN_WARNING "md: autostart %s failed!\n",
+				EPRINTK(KERN_WARNING "md: autostart %s failed!\n",
 					partition_name((kdev_t)arg));
 				goto abort;
 			}
@@ -2797,7 +2799,7 @@
 	}
 	err = lock_mddev(mddev);
 	if (err) {
-		printk(KERN_INFO "md: ioctl lock interrupted, reason %d, cmd %d\n",err, cmd);
+		EPRINTK(KERN_INFO "md: ioctl lock interrupted, reason %d, cmd %d\n",err, cmd);
 		goto abort;
 	}
 	/* if we don't have a superblock yet, only ADD_NEW_DISK or STOP_ARRAY is allowed */
@@ -2938,7 +2940,7 @@
 		}
 
 		default:
-			printk(KERN_WARNING "md: %s(pid %d) used obsolete MD ioctl, "
+			EPRINTK(KERN_WARNING "md: %s(pid %d) used obsolete MD ioctl, "
 			       "upgrade your software to use new ictls.\n",
 			       current->comm, current->pid);
 			err = -EINVAL;
@@ -3320,7 +3322,7 @@
 	}
 
 	pers[pnum] = p;
-	printk(KERN_INFO "md: %s personality registered as nr %d\n", p->name, pnum);
+	EPRINTK(KERN_INFO "md: %s personality registered as nr %d\n", p->name, pnum);
 	return 0;
 }
 
@@ -3331,7 +3333,7 @@
 		return -EINVAL;
 	}
 
-	printk(KERN_INFO "md: %s personality unregistered\n", pers[pnum]->name);
+	EPRINTK(KERN_INFO "md: %s personality unregistered\n", pers[pnum]->name);
 	pers[pnum] = NULL;
 	return 0;
 }
@@ -3441,7 +3443,7 @@
 		if (mddev2 == mddev)
 			continue;
 		if (mddev2->curr_resync && match_mddev_units(mddev,mddev2)) {
-			printk(KERN_INFO "md: delaying resync of md%d until md%d "
+			EPRINTK(KERN_INFO "md: delaying resync of md%d until md%d "
 			       "has finished resync (they share one or more physical units)\n",
 			       mdidx(mddev), mdidx(mddev2));
 			serialize = 1;
@@ -3462,10 +3464,10 @@
 
 	max_sectors = mddev->sb->size<<1;
 
-	printk(KERN_INFO "md: syncing RAID array md%d\n", mdidx(mddev));
-	printk(KERN_INFO "md: minimum _guaranteed_ reconstruction speed: %d KB/sec/disc.\n",
+	EPRINTK(KERN_INFO "md: syncing RAID array md%d\n", mdidx(mddev));
+	EPRINTK(KERN_INFO "md: minimum _guaranteed_ reconstruction speed: %d KB/sec/disc.\n",
 						sysctl_speed_limit_min);
-	printk(KERN_INFO "md: using maximum available idle IO bandwith "
+	EPRINTK(KERN_INFO "md: using maximum available idle IO bandwith "
 	       "(but not more than %d KB/sec) for reconstruction.\n",
 	       sysctl_speed_limit_max);
 
@@ -3487,7 +3489,7 @@
 	 * Tune reconstruction:
 	 */
 	window = vm_max_readahead*(PAGE_SIZE/512);
-	printk(KERN_INFO "md: using %dk window, over a total of %d blocks.\n",
+	EPRINTK(KERN_INFO "md: using %dk window, over a total of %d blocks.\n",
 	       window/2,max_sectors/2);
 
 	atomic_set(&mddev->recovery_active, 0);
@@ -3531,7 +3533,7 @@
 			 * got a signal, exit.
 			 */
 			mddev->curr_resync = 0;
-			printk(KERN_INFO "md: md_do_sync() got signal ... exiting\n");
+			EPRINTK(KERN_INFO "md: md_do_sync() got signal ... exiting\n");
 			md_flush_signals();
 			err = -EINTR;
 			goto out;
@@ -3562,7 +3564,7 @@
 		} else
 			current->nice = -20;
 	}
-	printk(KERN_INFO "md: md%d: sync done.\n",mdidx(mddev));
+	EPRINTK(KERN_INFO "md: md%d: sync done.\n",mdidx(mddev));
 	err = 0;
 	/*
 	 * this also signals 'finished resyncing' to md_stop
@@ -3593,7 +3595,7 @@
 	mdp_disk_t *spare;
 	struct md_list_head *tmp;
 
-	printk(KERN_INFO "md: recovery thread got woken up ...\n");
+	EPRINTK(KERN_INFO "md: recovery thread got woken up ...\n");
 restart:
 	ITERATE_MDDEV(mddev,tmp) {
 		sb = mddev->sb;
@@ -3606,7 +3608,7 @@
 		if (mddev->sb_dirty)
 			md_update_sb(mddev);
 		if (!sb->spare_disks) {
-			printk(KERN_ERR "md%d: no spare disk to reconstruct array! "
+			EPRINTK(KERN_ERR "md%d: no spare disk to reconstruct array! "
 			       "-- continuing in degraded mode\n", mdidx(mddev));
 			continue;
 		}
@@ -3616,7 +3618,7 @@
 		spare = get_spare(mddev);
 		if (!spare)
 			continue;
-		printk(KERN_INFO "md%d: resyncing spare disk %s to replace failed disk\n",
+		EPRINTK(KERN_INFO "md%d: resyncing spare disk %s to replace failed disk\n",
 		       mdidx(mddev), partition_name(MKDEV(spare->major,spare->minor)));
 		if (!mddev->pers->diskop)
 			continue;
@@ -3626,7 +3628,7 @@
 		mddev->recovery_running = 1;
 		err = md_do_sync(mddev, spare);
 		if (err == -EIO) {
-			printk(KERN_INFO "md%d: spare disk %s failed, skipping to next spare.\n",
+			EPRINTK(KERN_INFO "md%d: spare disk %s failed, skipping to next spare.\n",
 			       mdidx(mddev), partition_name(MKDEV(spare->major,spare->minor)));
 			if (!disk_faulty(spare)) {
 				mddev->pers->diskop(mddev,&spare,DISKOP_SPARE_INACTIVE);
@@ -3672,7 +3674,7 @@
 		md_update_sb(mddev);
 		goto restart;
 	}
-	printk(KERN_INFO "md: recovery thread finished ...\n");
+	EPRINTK(KERN_INFO "md: recovery thread finished ...\n");
 
 }
 
@@ -3685,7 +3687,7 @@
 	if ((code == MD_SYS_DOWN) || (code == MD_SYS_HALT)
 					|| (code == MD_SYS_POWER_OFF)) {
 
-		printk(KERN_INFO "md: stopping all md devices.\n");
+		EPRINTK(KERN_INFO "md: stopping all md devices.\n");
 
 		ITERATE_MDDEV(mddev,tmp)
 			do_md_stop (mddev, 1);
@@ -3733,13 +3735,13 @@
 	static char * name = "mdrecoveryd";
 	int minor;
 
-	printk(KERN_INFO "md: md driver %d.%d.%d MAX_MD_DEVS=%d, MD_SB_DISKS=%d\n",
+	EPRINTK(KERN_INFO "md: md driver %d.%d.%d MAX_MD_DEVS=%d, MD_SB_DISKS=%d\n",
 			MD_MAJOR_VERSION, MD_MINOR_VERSION,
 			MD_PATCHLEVEL_VERSION, MAX_MD_DEVS, MD_SB_DISKS);
 
 	if (devfs_register_blkdev (MAJOR_NR, "md", &md_fops))
 	{
-		printk(KERN_ALERT "md: Unable to get major %d for md\n", MAJOR_NR);
+		EPRINTK(KERN_ALERT "md: Unable to get major %d for md\n", MAJOR_NR);
 		return (-1);
 	}
 	devfs_handle = devfs_mk_dir (NULL, "md", NULL);
@@ -3762,7 +3764,7 @@
 
 	md_recovery_thread = md_register_thread(md_do_recovery, NULL, name);
 	if (!md_recovery_thread)
-		printk(KERN_ALERT "md: bug: couldn't allocate md_recovery_thread\n");
+		EPRINTK(KERN_ALERT "md: bug: couldn't allocate md_recovery_thread\n");
 
 	md_register_reboot_notifier(&md_notifier);
 	raid_table_header = register_sysctl_table(raid_root_table, 1);
@@ -3807,13 +3809,13 @@
 	mdk_rdev_t *rdev;
 	int i;
 
-	printk(KERN_INFO "md: Autodetecting RAID arrays.\n");
+	EPRINTK(KERN_INFO "md: Autodetecting RAID arrays.\n");
 
 	for (i = 0; i < dev_cnt; i++) {
 		kdev_t dev = detected_devices[i];
 
 		if (md_import_device(dev,1)) {
-			printk(KERN_ALERT "md: could not import %s!\n",
+			EPRINTK(KERN_ALERT "md: could not import %s!\n",
 				partition_name(dev));
 			continue;
 		}
@@ -3870,14 +3872,14 @@
 	char *str1 = str;
 
 	if (get_option(&str, &minor) != 2) {	/* MD Number */
-		printk(KERN_WARNING "md: Too few arguments supplied to md=.\n");
+		EPRINTK(KERN_WARNING "md: Too few arguments supplied to md=.\n");
 		return 0;
 	}
 	if (minor >= MAX_MD_DEVS) {
-		printk(KERN_WARNING "md: md=%d, Minor device number too high.\n", minor);
+		EPRINTK(KERN_WARNING "md: md=%d, Minor device number too high.\n", minor);
 		return 0;
 	} else if (md_setup_args.device_names[minor]) {
-		printk(KERN_WARNING "md: md=%d, Specified more than once. "
+		EPRINTK(KERN_WARNING "md: md=%d, Specified more than once. "
 		       "Replacing previous definition.\n", minor);
 	}
 	switch (get_option(&str, &level)) {	/* RAID Personality */
@@ -3885,7 +3887,7 @@
 		if (level == 0 || level == -1) {
 			if (get_option(&str, &factor) != 2 ||	/* Chunk Size */
 					get_option(&str, &fault) != 2) {
-				printk(KERN_WARNING "md: Too few arguments supplied to md=.\n");
+				EPRINTK(KERN_WARNING "md: Too few arguments supplied to md=.\n");
 				return 0;
 			}
 			md_setup_args.pers[minor] = level;
@@ -3900,7 +3902,7 @@
 				pername = "raid0";
 				break;
 			default:
-				printk(KERN_WARNING
+				EPRINTK(KERN_WARNING
 				       "md: The kernel has not been configured for raid%d support!\n",
 				       level);
 				return 0;
@@ -3917,7 +3919,7 @@
 		pername="super-block";
 	}
 
-	printk(KERN_INFO "md: Will configure md%d (%s) from %s, below.\n",
+	EPRINTK(KERN_INFO "md: Will configure md%d (%s) from %s, below.\n",
 		minor, pername, str);
 	md_setup_args.device_names[minor] = str;
 
@@ -3957,7 +3959,7 @@
 				dev = MKDEV(major, minor);
 			}
 			if (dev == 0) {
-				printk(KERN_WARNING "md: Unknown device name: %s\n", devname);
+				EPRINTK(KERN_WARNING "md: Unknown device name: %s\n", devname);
 				break;
 			}
 
@@ -3972,16 +3974,16 @@
 			continue;
 
 		if (mddev_map[minor].mddev) {
-			printk(KERN_WARNING
+			EPRINTK(KERN_WARNING
 			       "md: Ignoring md=%d, already autodetected. (Use raid=noautodetect)\n",
 			       minor);
 			continue;
 		}
-		printk(KERN_INFO "md: Loading md%d: %s\n", minor, md_setup_args.device_names[minor]);
+		EPRINTK(KERN_INFO "md: Loading md%d: %s\n", minor, md_setup_args.device_names[minor]);
 
 		mddev = alloc_mddev(MKDEV(MD_MAJOR,minor));
 		if (!mddev) {
-			printk(KERN_ERR "md: kmalloc failed - cannot start array %d\n", minor);
+			EPRINTK(KERN_ERR "md: kmalloc failed - cannot start array %d\n", minor);
 			continue;
 		}
 		if (md_setup_args.pers[minor]) {
@@ -4026,11 +4028,11 @@
 		if (!err)
 			err = do_md_run(mddev);
 		if (err) {
-                       if (mddev != NULL) {
+                        if (mddev != NULL) {
 			   mddev->sb_dirty = 0;
 			   do_md_stop(mddev, 0);
 			}
-			printk(KERN_WARNING "md: starting md%d failed\n", minor);
+			EPRINTK(KERN_WARNING "md: starting md%d failed\n", minor);
 		}
 	}
 }
@@ -4060,7 +4062,7 @@
 int md__init md_run_setup(void)
 {
 	if (raid_setup_args.noautodetect)
-		printk(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=noautodetect)\n");
+		EPRINTK(KERN_INFO "md: Skipping autodetection of RAID arrays. (raid=noautodetect)\n");
 	else
 		autostart_arrays();
 	md_setup_drive();
--- /dev/null	Fri Mar 23 23:37:44 2001
+++ linux-2.4.19/drivers/md/md_evlog.h	Tue Oct  1 16:43:36 2002
@@ -0,0 +1,27 @@
+/*
+ * md_evlog.h
+ *
+ * Defines a macro for printk to allow substitution of a POSIX Event
+ * Log function instead, if that feature is configured in the kernel.
+ */
+
+#ifdef CONFIG_EVLOG
+/* Use POSIX Event Log function instead of printk, if configured. */
+#include <linux/evl_log.h>
+#define LOG_AIC7XXX 1001     /* event ids */
+#define LOG_SCSIMOD 1011     
+#define LOG_RAIDMD  1021     
+static inline int
+evl_xlate_ksev(const char *kstr)
+{
+       int n;
+       if (kstr == NULL) n = LOG_INFO;
+       else { n = kstr[1] - '0';  /* assumes "<n>" prefix */
+              if (n > 7) n = LOG_INFO; }
+        return (n);
+}
+#define EPRINTK(fmt, ...) (evl_xlate_ksev(fmt) >= LOG_INFO ? printk(fmt, ## __VA_ARGS__) : posix_log_printf(LOG_KERN, LOG_RAIDMD, evl_xlate_ksev(fmt), 0, fmt, ## __VA_ARGS__))
+#else
+/* Otherwise, use normal printk */
+#define EPRINTK(fmt, arg...)  printk(fmt, ##arg)
+#endif /* CONFIG_EVLOG */
--- linux-2.4.19-orig/drivers/md/raid0.c	Sun Sep 30 15:26:06 2001
+++ linux-2.4.19/drivers/md/raid0.c	Tue Oct  1 16:43:36 2002
@@ -20,6 +20,7 @@
 
 #include <linux/module.h>
 #include <linux/raid/raid0.h>
+#include "md_evlog.h"
 
 #define MAJOR_NR MD_MAJOR
 #define MD_DRIVER
@@ -38,12 +39,12 @@
 	conf->nr_strip_zones = 0;
  
 	ITERATE_RDEV_ORDERED(mddev,rdev1,j1) {
-		printk("raid0: looking at %s\n", partition_name(rdev1->dev));
+		EPRINTK("raid0: looking at %s\n", partition_name(rdev1->dev));
 		c = 0;
 		ITERATE_RDEV_ORDERED(mddev,rdev2,j2) {
-			printk("raid0:   comparing %s(%ld) with %s(%ld)\n", partition_name(rdev1->dev), rdev1->size, partition_name(rdev2->dev), rdev2->size);
+			EPRINTK("raid0:   comparing %s(%ld) with %s(%ld)\n", partition_name(rdev1->dev), rdev1->size, partition_name(rdev2->dev), rdev2->size);
 			if (rdev2 == rdev1) {
-				printk("raid0:   END\n");
+				EPRINTK("raid0:   END\n");
 				break;
 			}
 			if (rdev2->size == rdev1->size)
@@ -52,19 +53,19 @@
 				 * Not unique, dont count it as a new
 				 * group
 				 */
-				printk("raid0:   EQUAL\n");
+				EPRINTK("raid0:   EQUAL\n");
 				c = 1;
 				break;
 			}
-			printk("raid0:   NOT EQUAL\n");
+			EPRINTK("raid0:   NOT EQUAL\n");
 		}
 		if (!c) {
-			printk("raid0:   ==> UNIQUE\n");
+			EPRINTK("raid0:   ==> UNIQUE\n");
 			conf->nr_strip_zones++;
-			printk("raid0: %d zones\n", conf->nr_strip_zones);
+			EPRINTK("raid0: %d zones\n", conf->nr_strip_zones);
 		}
 	}
-		printk("raid0: FINAL %d zones\n", conf->nr_strip_zones);
+		EPRINTK("raid0: FINAL %d zones\n", conf->nr_strip_zones);
 
 	conf->strip_zone = vmalloc(sizeof(struct strip_zone)*
 				conf->nr_strip_zones);
@@ -80,30 +81,30 @@
 	{
 		struct strip_zone *zone = conf->strip_zone + i;
 
-		printk("raid0: zone %d\n", i);
+		EPRINTK("raid0: zone %d\n", i);
 		zone->dev_offset = current_offset;
 		smallest = NULL;
 		c = 0;
 
 		ITERATE_RDEV_ORDERED(mddev,rdev,j) {
 
-			printk("raid0: checking %s ...", partition_name(rdev->dev));
+			EPRINTK("raid0: checking %s ...", partition_name(rdev->dev));
 			if (rdev->size > current_offset)
 			{
-				printk(" contained as device %d\n", c);
+				EPRINTK(" contained as device %d\n", c);
 				zone->dev[c] = rdev;
 				c++;
 				if (!smallest || (rdev->size <smallest->size)) {
 					smallest = rdev;
-					printk("  (%ld) is smallest!.\n", rdev->size);
+					EPRINTK("  (%ld) is smallest!.\n", rdev->size);
 				}
 			} else
-				printk(" nope.\n");
+				EPRINTK(" nope.\n");
 		}
 
 		zone->nb_dev = c;
 		zone->size = (smallest->size - current_offset) * c;
-		printk("raid0: zone->nb_dev: %d, size: %ld\n",zone->nb_dev,zone->size);
+		EPRINTK("raid0: zone->nb_dev: %d, size: %ld\n",zone->nb_dev,zone->size);
 
 		if (!conf->smallest || (zone->size < conf->smallest->size))
 			conf->smallest = zone;
@@ -112,9 +113,9 @@
 		curr_zone_offset += zone->size;
 
 		current_offset = smallest->size;
-		printk("raid0: current zone offset: %ld\n", current_offset);
+		EPRINTK("raid0: current zone offset: %ld\n", current_offset);
 	}
-	printk("raid0: done.\n");
+	EPRINTK("raid0: done.\n");
 	return 0;
 }
 
@@ -131,21 +132,21 @@
 	mddev->private = (void *)conf;
  
 	if (md_check_ordering(mddev)) {
-		printk("raid0: disks are not ordered, aborting!\n");
+		EPRINTK("raid0: disks are not ordered, aborting!\n");
 		goto out_free_conf;
 	}
 
 	if (create_strip_zones (mddev)) 
 		goto out_free_conf;
 
-	printk("raid0 : md_size is %d blocks.\n", md_size[mdidx(mddev)]);
-	printk("raid0 : conf->smallest->size is %ld blocks.\n", conf->smallest->size);
+	EPRINTK("raid0 : md_size is %d blocks.\n", md_size[mdidx(mddev)]);
+	EPRINTK("raid0 : conf->smallest->size is %ld blocks.\n", conf->smallest->size);
 	nb_zone = md_size[mdidx(mddev)]/conf->smallest->size +
 			(md_size[mdidx(mddev)] % conf->smallest->size ? 1 : 0);
-	printk("raid0 : nb_zone is %ld.\n", nb_zone);
+	EPRINTK("raid0 : nb_zone is %ld.\n", nb_zone);
 	conf->nr_zones = nb_zone;
 
-	printk("raid0 : Allocating %ld bytes for hash.\n",
+	EPRINTK("raid0 : Allocating %ld bytes for hash.\n",
 				nb_zone*sizeof(struct raid0_hash));
 
 	conf->hash_table = vmalloc (sizeof (struct raid0_hash)*nb_zone);
@@ -274,16 +275,16 @@
 	return 1;
 
 bad_map:
-	printk ("raid0_make_request bug: can't convert block across chunks or bigger than %dk %ld %d\n", chunk_size, bh->b_rsector, bh->b_size >> 10);
+	EPRINTK ("raid0_make_request bug: can't convert block across chunks or bigger than %dk %ld %d\n", chunk_size, bh->b_rsector, bh->b_size >> 10);
 	goto outerr;
 bad_hash:
-	printk("raid0_make_request bug: hash==NULL for block %ld\n", block);
+	EPRINTK("raid0_make_request bug: hash==NULL for block %ld\n", block);
 	goto outerr;
 bad_zone0:
-	printk ("raid0_make_request bug: hash->zone0==NULL for block %ld\n", block);
+	EPRINTK ("raid0_make_request bug: hash->zone0==NULL for block %ld\n", block);
 	goto outerr;
 bad_zone1:
-	printk ("raid0_make_request bug: hash->zone1==NULL for block %ld\n", block);
+	EPRINTK ("raid0_make_request bug: hash->zone1==NULL for block %ld\n", block);
  outerr:
 	buffer_IO_error(bh);
 	return 0;
--- linux-2.4.19-orig/drivers/md/raid1.c	Tue Oct  1 16:40:27 2002
+++ linux-2.4.19/drivers/md/raid1.c	Tue Oct  1 16:43:36 2002
@@ -26,6 +26,7 @@
 #include <linux/slab.h>
 #include <linux/raid/raid1.h>
 #include <asm/atomic.h>
+#include "md_evlog.h"
 
 #define MAJOR_NR MD_MAJOR
 #define MD_DRIVER
@@ -337,7 +338,7 @@
 		}
 	}
 
-	printk (KERN_ERR "raid1_map(): huh, no more operational devices?\n");
+	EPRINTK (KERN_ERR "raid1_map(): huh, no more operational devices?\n");
 	return (-1);
 }
 
@@ -440,7 +441,7 @@
 		/*
 		 * oops, read error:
 		 */
-		printk(KERN_ERR "raid1: %s: rescheduling block %lu\n", 
+		EPRINTK(KERN_ERR "raid1: %s: rescheduling block %lu\n", 
 			 partition_name(bh->b_dev), bh->b_blocknr);
 		raid1_reschedule_retry(r1_bh);
 		return;
@@ -766,7 +767,7 @@
 	md_wakeup_thread(conf->thread);
 	if (!mirror->write_only)
 		conf->working_disks--;
-	printk (DISK_FAILED, partition_name (mirror->dev),
+	EPRINTK (DISK_FAILED, partition_name (mirror->dev),
 				 conf->working_disks);
 }
 
@@ -812,17 +813,17 @@
 	int i;
 	struct mirror_info *tmp;
 
-	printk("RAID1 conf printout:\n");
+	EPRINTK("RAID1 conf printout:\n");
 	if (!conf) {
-		printk("(conf==NULL)\n");
+		EPRINTK("(conf==NULL)\n");
 		return;
 	}
-	printk(" --- wd:%d rd:%d nd:%d\n", conf->working_disks,
+	EPRINTK(" --- wd:%d rd:%d nd:%d\n", conf->working_disks,
 			 conf->raid_disks, conf->nr_disks);
 
 	for (i = 0; i < MD_SB_DISKS; i++) {
 		tmp = conf->mirrors + i;
-		printk(" disk %d, s:%d, o:%d, n:%d rd:%d us:%d dev:%s\n",
+		EPRINTK(" disk %d, s:%d, o:%d, n:%d rd:%d us:%d dev:%s\n",
 			i, tmp->spare,tmp->operational,
 			tmp->number,tmp->raid_disk,tmp->used_slot,
 			partition_name(tmp->dev));
@@ -1161,7 +1162,7 @@
 	mddev_t *mddev = conf->mddev;
 	kdev_t dev;
 
-	if (mddev->sb_dirty)
+	if (mddev->sb_dirty) 
 		md_update_sb(mddev);
 
 	for (;;) {
@@ -1251,7 +1252,7 @@
 				 * as reconstruct is about to be aborted
 				 */
 
-				printk (IO_ERROR, partition_name(bh->b_dev), bh->b_blocknr);
+				EPRINTK (IO_ERROR, partition_name(bh->b_dev), bh->b_blocknr);
 				md_done_sync(mddev, bh->b_size>>9, 0);
 			}
 
@@ -1261,10 +1262,10 @@
 			dev = bh->b_dev;
 			raid1_map (mddev, &bh->b_dev);
 			if (bh->b_dev == dev) {
-				printk (IO_ERROR, partition_name(bh->b_dev), bh->b_blocknr);
+				EPRINTK (IO_ERROR, partition_name(bh->b_dev), bh->b_blocknr);
 				raid1_end_bh_io(r1_bh, 0);
 			} else {
-				printk (REDIRECT_SECTOR,
+				EPRINTK (REDIRECT_SECTOR,
 					partition_name(bh->b_dev), bh->b_blocknr);
 				bh->b_rdev = bh->b_dev;
 				bh->b_rsector = bh->b_blocknr;
@@ -1552,7 +1553,7 @@
 	MOD_INC_USE_COUNT;
 
 	if (sb->level != 1) {
-		printk(INVALID_LEVEL, mdidx(mddev), sb->level);
+		EPRINTK(INVALID_LEVEL, mdidx(mddev), sb->level);
 		goto out;
 	}
 	/*
@@ -1564,14 +1565,14 @@
 	conf = kmalloc(sizeof(raid1_conf_t), GFP_KERNEL);
 	mddev->private = conf;
 	if (!conf) {
-		printk(MEM_ERROR, mdidx(mddev));
+		EPRINTK(MEM_ERROR, mdidx(mddev));
 		goto out;
 	}
 	memset(conf, 0, sizeof(*conf));
 
 	ITERATE_RDEV(mddev,rdev,tmp) {
 		if (rdev->faulty) {
-			printk(ERRORS, partition_name(rdev->dev));
+			EPRINTK(ERRORS, partition_name(rdev->dev));
 		} else {
 			if (!rdev->sb) {
 				MD_BUG();
@@ -1600,24 +1601,24 @@
 		}
 		if (disk_active(descriptor)) {
 			if (!disk_sync(descriptor)) {
-				printk(NOT_IN_SYNC,
+				EPRINTK(NOT_IN_SYNC,
 					partition_name(rdev->dev));
 				continue;
 			}
 			if ((descriptor->number > MD_SB_DISKS) ||
 					 (disk_idx > sb->raid_disks)) {
 
-				printk(INCONSISTENT,
+				EPRINTK(INCONSISTENT,
 					partition_name(rdev->dev));
 				continue;
 			}
 			if (disk->operational) {
-				printk(ALREADY_RUNNING,
+				EPRINTK(ALREADY_RUNNING,
 					partition_name(rdev->dev),
 					disk_idx);
 				continue;
 			}
-			printk(OPERATIONAL, partition_name(rdev->dev),
+			EPRINTK(OPERATIONAL, partition_name(rdev->dev),
  					disk_idx);
 			disk->number = descriptor->number;
 			disk->raid_disk = disk_idx;
@@ -1633,7 +1634,7 @@
 		/*
 		 * Must be a spare disk ..
 		 */
-			printk(SPARE, partition_name(rdev->dev));
+			EPRINTK(SPARE, partition_name(rdev->dev));
 			disk->number = descriptor->number;
 			disk->raid_disk = disk_idx;
 			disk->dev = rdev->dev;
@@ -1656,7 +1657,7 @@
 	init_waitqueue_head(&conf->wait_ready);
 
 	if (!conf->working_disks) {
-		printk(NONE_OPERATIONAL, mdidx(mddev));
+		EPRINTK(NONE_OPERATIONAL, mdidx(mddev));
 		goto out_free_conf;
 	}
 
@@ -1673,7 +1674,7 @@
 	if (raid1_grow_r1bh(conf, NR_RESERVED_BUFS) < NR_RESERVED_BUFS ||
 	    raid1_grow_bh(conf, NR_RESERVED_BUFS*conf->raid_disks)
 	                      < NR_RESERVED_BUFS*conf->raid_disks) {
-		printk(MEM_ERROR, mdidx(mddev));
+		EPRINTK(MEM_ERROR, mdidx(mddev));
 		goto out_free_conf;
 	}
 
@@ -1708,7 +1709,7 @@
 
 
 	if (conf->working_disks != sb->raid_disks) {
-		printk(KERN_ALERT "raid1: md%d, not all disks are operational -- trying to recover array\n", mdidx(mddev));
+		EPRINTK(KERN_ALERT "raid1: md%d, not all disks are operational -- trying to recover array\n", mdidx(mddev));
 		start_recovery = 1;
 	}
 
@@ -1717,7 +1718,7 @@
 
 		conf->thread = md_register_thread(raid1d, conf, name);
 		if (!conf->thread) {
-			printk(THREAD_ERROR, mdidx(mddev));
+			EPRINTK(THREAD_ERROR, mdidx(mddev));
 			goto out_free_conf;
 		}
 	}
@@ -1728,11 +1729,11 @@
 
 		conf->resync_thread = md_register_thread(raid1syncd, conf,name);
 		if (!conf->resync_thread) {
-			printk(THREAD_ERROR, mdidx(mddev));
+			EPRINTK(THREAD_ERROR, mdidx(mddev));
 			goto out_free_conf;
 		}
 
-		printk(START_RESYNC, mdidx(mddev));
+		EPRINTK(START_RESYNC, mdidx(mddev));
 		conf->resync_mirrors = 1;
 		md_wakeup_thread(conf->resync_thread);
 	}
@@ -1756,7 +1757,7 @@
 		md_recover_arrays();
 
 
-	printk(ARRAY_IS_ACTIVE, mdidx(mddev), sb->active_disks, sb->raid_disks);
+	EPRINTK(ARRAY_IS_ACTIVE, mdidx(mddev), sb->active_disks, sb->raid_disks);
 	/*
 	 * Ok, everything is just fine now
 	 */
@@ -1793,7 +1794,7 @@
 			conf->resync_mirrors = 2;
 			md_interrupt_thread(conf->resync_thread);
 
-			printk(KERN_INFO "raid1: mirror resync was not fully finished, restarting next time.\n");
+			EPRINTK(KERN_INFO "raid1: mirror resync was not fully finished, restarting next time.\n");
 			return 1;
 		}
 		return 0;
--- linux-2.4.19-orig/drivers/md/raid5.c	Mon Feb 25 14:37:58 2002
+++ linux-2.4.19/drivers/md/raid5.c	Tue Oct  1 16:43:36 2002
@@ -23,6 +23,7 @@
 #include <linux/raid/raid5.h>
 #include <asm/bitops.h>
 #include <asm/atomic.h>
+#include "md_evlog.h"
 
 static mdk_personality_t raid5_personality;
 
@@ -205,7 +206,7 @@
 	for (i=disks; i--; ) {
 		if (sh->bh_read[i] || sh->bh_write[i] || sh->bh_written[i] ||
 		    buffer_locked(sh->bh_cache[i])) {
-			printk("sector=%lx i=%d %p %p %p %d\n",
+			EPRINTK("sector=%lx i=%d %p %p %p %d\n",
 			       sh->sector, i, sh->bh_read[i],
 			       sh->bh_write[i], sh->bh_written[i],
 			       buffer_locked(sh->bh_cache[i]));
@@ -282,7 +283,7 @@
 				}
 
 				if (conf->buffer_size != size) {
-					printk("raid5: switching cache buffer size, %d --> %d\n", oldsize, size);
+					EPRINTK("raid5: switching cache buffer size, %d --> %d\n", oldsize, size);
 					shrink_stripe_cache(conf);
 					if (size==0) BUG();
 					conf->buffer_size = size;
@@ -500,7 +501,7 @@
 				conf->working_disks--;
 				conf->failed_disks++;
 				md_wakeup_thread(conf->thread);
-				printk (KERN_ALERT
+				EPRINTK (KERN_ALERT
 					"raid5: Disk failure on %s, disabling device."
 					" Operation continuing on %d devices\n",
 					partition_name (dev), conf->working_disks);
@@ -514,7 +515,7 @@
 	if (conf->spare) {
 		disk = conf->spare;
 		if (disk->dev == dev) {
-			printk (KERN_ALERT
+			EPRINTK (KERN_ALERT
 				"raid5: Disk failure on spare %s\n",
 				partition_name (dev));
 			if (!conf->spare->operational) {
@@ -598,7 +599,7 @@
 			*dd_idx = (*pd_idx + 1 + *dd_idx) % raid_disks;
 			break;
 		default:
-			printk ("raid5: unsupported algorithm %d\n", conf->algorithm);
+			EPRINTK ("raid5: unsupported algorithm %d\n", conf->algorithm);
 	}
 
 	/*
@@ -633,7 +634,7 @@
 			i -= (sh->pd_idx + 1);
 			break;
 		default:
-			printk ("raid5: unsupported algorithm %d\n", conf->algorithm);
+			EPRINTK ("raid5: unsupported algorithm %d\n", conf->algorithm);
 	}
 
 	chunk_number = stripe * data_disks + i;
@@ -642,7 +643,7 @@
 
 	check = raid5_compute_sector (r_sector, raid_disks, data_disks, &dummy1, &dummy2, conf);
 	if (check != sh->sector || dummy1 != dd_idx || dummy2 != sh->pd_idx) {
-		printk("compute_blocknr: map not correct\n");
+		EPRINTK("compute_blocknr: map not correct\n");
 		return 0;
 	}
 	return blocknr;
@@ -676,7 +677,7 @@
 		if (buffer_uptodate(bh))
 			bh_ptr[count++] = bh;
 		else
-			printk("compute_block() %d, stripe %lu, %d not present\n", dd_idx, sh->sector, i);
+			EPRINTK("compute_block() %d, stripe %lu, %d not present\n", dd_idx, sh->sector, i);
 
 		check_xor();
 	}
@@ -787,7 +788,7 @@
 	else
 		bhp = &sh->bh_write[dd_idx];
 	while (*bhp) {
-		printk(KERN_NOTICE "raid5: multiple %d requests for sector %ld\n", rw, sh->sector);
+		EPRINTK(KERN_NOTICE "raid5: multiple %d requests for sector %ld\n", rw, sh->sector);
 		bhp = & (*bhp)->b_reqnext;
 	}
 	*bhp = bh;
@@ -1347,12 +1348,12 @@
 	down(&mddev->recovery_sem);
 	if (md_do_sync(mddev,NULL)) {
 		up(&mddev->recovery_sem);
-		printk("raid5: resync aborted!\n");
+		EPRINTK("raid5: resync aborted!\n");
 		return;
 	}
 	conf->resync_parity = 0;
 	up(&mddev->recovery_sem);
-	printk("raid5: resync finished.\n");
+	EPRINTK("raid5: resync finished.\n");
 }
 
 static int raid5_run (mddev_t *mddev)
@@ -1369,7 +1370,7 @@
 	MOD_INC_USE_COUNT;
 
 	if (sb->level != 5 && sb->level != 4) {
-		printk("raid5: md%d: raid level not set to 4/5 (%d)\n", mdidx(mddev), sb->level);
+		EPRINTK("raid5: md%d: raid level not set to 4/5 (%d)\n", mdidx(mddev), sb->level);
 		MOD_DEC_USE_COUNT;
 		return -EIO;
 	}
@@ -1411,7 +1412,7 @@
 		disk = conf->disks + raid_disk;
 
 		if (disk_faulty(desc)) {
-			printk(KERN_ERR "raid5: disabled device %s (errors detected)\n", partition_name(rdev->dev));
+			EPRINTK(KERN_ERR "raid5: disabled device %s (errors detected)\n", partition_name(rdev->dev));
 			if (!rdev->faulty) {
 				MD_BUG();
 				goto abort;
@@ -1428,19 +1429,19 @@
 		}
 		if (disk_active(desc)) {
 			if (!disk_sync(desc)) {
-				printk(KERN_ERR "raid5: disabled device %s (not in sync)\n", partition_name(rdev->dev));
+				EPRINTK(KERN_ERR "raid5: disabled device %s (not in sync)\n", partition_name(rdev->dev));
 				MD_BUG();
 				goto abort;
 			}
 			if (raid_disk > sb->raid_disks) {
-				printk(KERN_ERR "raid5: disabled device %s (inconsistent descriptor)\n", partition_name(rdev->dev));
+				EPRINTK(KERN_ERR "raid5: disabled device %s (inconsistent descriptor)\n", partition_name(rdev->dev));
 				continue;
 			}
 			if (disk->operational) {
-				printk(KERN_ERR "raid5: disabled device %s (device %d already operational)\n", partition_name(rdev->dev), raid_disk);
+				EPRINTK(KERN_ERR "raid5: disabled device %s (device %d already operational)\n", partition_name(rdev->dev), raid_disk);
 				continue;
 			}
-			printk(KERN_INFO "raid5: device %s operational as raid disk %d\n", partition_name(rdev->dev), raid_disk);
+			EPRINTK(KERN_INFO "raid5: device %s operational as raid disk %d\n", partition_name(rdev->dev), raid_disk);
 	
 			disk->number = desc->number;
 			disk->raid_disk = raid_disk;
@@ -1453,7 +1454,7 @@
 			/*
 			 * Must be a spare disk ..
 			 */
-			printk(KERN_INFO "raid5: spare disk %s\n", partition_name(rdev->dev));
+			EPRINTK(KERN_INFO "raid5: spare disk %s\n", partition_name(rdev->dev));
 			disk->number = desc->number;
 			disk->raid_disk = raid_disk;
 			disk->dev = rdev->dev;
@@ -1504,20 +1505,20 @@
 	}
 #endif
 	if (!conf->chunk_size || conf->chunk_size % 4) {
-		printk(KERN_ERR "raid5: invalid chunk size %d for md%d\n", conf->chunk_size, mdidx(mddev));
+		EPRINTK(KERN_ERR "raid5: invalid chunk size %d for md%d\n", conf->chunk_size, mdidx(mddev));
 		goto abort;
 	}
 	if (conf->algorithm > ALGORITHM_RIGHT_SYMMETRIC) {
-		printk(KERN_ERR "raid5: unsupported parity algorithm %d for md%d\n", conf->algorithm, mdidx(mddev));
+		EPRINTK(KERN_ERR "raid5: unsupported parity algorithm %d for md%d\n", conf->algorithm, mdidx(mddev));
 		goto abort;
 	}
 	if (conf->failed_disks > 1) {
-		printk(KERN_ERR "raid5: not enough operational devices for md%d (%d/%d failed)\n", mdidx(mddev), conf->failed_disks, conf->raid_disks);
+		EPRINTK(KERN_ERR "raid5: not enough operational devices for md%d (%d/%d failed)\n", mdidx(mddev), conf->failed_disks, conf->raid_disks);
 		goto abort;
 	}
 
 	if (conf->working_disks != sb->raid_disks) {
-		printk(KERN_ALERT "raid5: md%d, not all disks are operational -- trying to recover array\n", mdidx(mddev));
+		EPRINTK(KERN_ALERT "raid5: md%d, not all disks are operational -- trying to recover array\n", mdidx(mddev));
 		start_recovery = 1;
 	}
 
@@ -1526,7 +1527,7 @@
 
 		conf->thread = md_register_thread(raid5d, conf, name);
 		if (!conf->thread) {
-			printk(KERN_ERR "raid5: couldn't allocate thread for md%d\n", mdidx(mddev));
+			EPRINTK(KERN_ERR "raid5: couldn't allocate thread for md%d\n", mdidx(mddev));
 			goto abort;
 		}
 	}
@@ -1534,11 +1535,11 @@
 	memory = conf->max_nr_stripes * (sizeof(struct stripe_head) +
 		 conf->raid_disks * ((sizeof(struct buffer_head) + PAGE_SIZE))) / 1024;
 	if (grow_stripes(conf, conf->max_nr_stripes, GFP_KERNEL)) {
-		printk(KERN_ERR "raid5: couldn't allocate %dkB for buffers\n", memory);
+		EPRINTK(KERN_ERR "raid5: couldn't allocate %dkB for buffers\n", memory);
 		shrink_stripes(conf, conf->max_nr_stripes);
 		goto abort;
 	} else
-		printk(KERN_INFO "raid5: allocated %dkB for md%d\n", memory, mdidx(mddev));
+		EPRINTK(KERN_INFO "raid5: allocated %dkB for md%d\n", memory, mdidx(mddev));
 
 	/*
 	 * Regenerate the "device is in sync with the raid set" bit for
@@ -1556,20 +1557,20 @@
 	sb->active_disks = conf->working_disks;
 
 	if (sb->active_disks == sb->raid_disks)
-		printk("raid5: raid level %d set md%d active with %d out of %d devices, algorithm %d\n", conf->level, mdidx(mddev), sb->active_disks, sb->raid_disks, conf->algorithm);
+		EPRINTK("raid5: raid level %d set md%d active with %d out of %d devices, algorithm %d\n", conf->level, mdidx(mddev), sb->active_disks, sb->raid_disks, conf->algorithm);
 	else
-		printk(KERN_ALERT "raid5: raid level %d set md%d active with %d out of %d devices, algorithm %d\n", conf->level, mdidx(mddev), sb->active_disks, sb->raid_disks, conf->algorithm);
+		EPRINTK(KERN_ALERT "raid5: raid level %d set md%d active with %d out of %d devices, algorithm %d\n", conf->level, mdidx(mddev), sb->active_disks, sb->raid_disks, conf->algorithm);
 
 	if (!start_recovery && !(sb->state & (1 << MD_SB_CLEAN))) {
 		const char * name = "raid5syncd";
 
 		conf->resync_thread = md_register_thread(raid5syncd, conf,name);
 		if (!conf->resync_thread) {
-			printk(KERN_ERR "raid5: couldn't allocate thread for md%d\n", mdidx(mddev));
+			EPRINTK(KERN_ERR "raid5: couldn't allocate thread for md%d\n", mdidx(mddev));
 			goto abort;
 		}
 
-		printk("raid5: raid set md%d not clean; reconstructing parity\n", mdidx(mddev));
+		EPRINTK("raid5: raid set md%d not clean; reconstructing parity\n", mdidx(mddev));
 		conf->resync_parity = 1;
 		md_wakeup_thread(conf->resync_thread);
 	}
@@ -1590,7 +1591,7 @@
 		kfree(conf);
 	}
 	mddev->private = NULL;
-	printk(KERN_ALERT "raid5: failed to run raid set md%d\n", mdidx(mddev));
+	EPRINTK(KERN_ALERT "raid5: failed to run raid set md%d\n", mdidx(mddev));
 	MOD_DEC_USE_COUNT;
 	return -EIO;
 }
@@ -1604,7 +1605,7 @@
 		if (conf->resync_parity) {
 			conf->resync_parity = 2;
 			md_interrupt_thread(thread);
-			printk(KERN_INFO "raid5: parity resync was not fully finished, restarting next time.\n");
+			EPRINTK(KERN_INFO "raid5: parity resync was not fully finished, restarting next time.\n");
 			return 1;
 		}
 		return 0;
@@ -1621,12 +1622,12 @@
 			MD_BUG();
 			return 0;
 		}
-		printk("raid5: waking up raid5resync.\n");
+		EPRINTK("raid5: waking up raid5resync.\n");
 		conf->resync_parity = 1;
 		md_wakeup_thread(conf->resync_thread);
 		return 1;
 	} else
-		printk("raid5: no restart-resync needed.\n");
+		EPRINTK("raid5: no restart-resync needed.\n");
 	return 0;
 }
 
@@ -1651,14 +1652,14 @@
 {
 	int i;
 
-	printk("sh %lu, size %d, pd_idx %d, state %ld.\n", sh->sector, sh->size, sh->pd_idx, sh->state);
-	printk("sh %lu,  count %d.\n", sh->sector, atomic_read(&sh->count));
-	printk("sh %lu, ", sh->sector);
+	EPRINTK("sh %lu, size %d, pd_idx %d, state %ld.\n", sh->sector, sh->size, sh->pd_idx, sh->state);
+	EPRINTK("sh %lu,  count %d.\n", sh->sector, atomic_read(&sh->count));
+	EPRINTK("sh %lu, ", sh->sector);
 	for (i = 0; i < MD_SB_DISKS; i++) {
 		if (sh->bh_cache[i])
-			printk("(cache%d: %p %ld) ", i, sh->bh_cache[i], sh->bh_cache[i]->b_state);
+			EPRINTK("(cache%d: %p %ld) ", i, sh->bh_cache[i], sh->bh_cache[i]->b_state);
 	}
-	printk("\n");
+	EPRINTK("\n");
 }
 
 static void printall (raid5_conf_t *conf)
@@ -1705,12 +1706,12 @@
 	int i;
 	struct disk_info *tmp;
 
-	printk("RAID5 conf printout:\n");
+	EPRINTK("RAID5 conf printout:\n");
 	if (!conf) {
-		printk("(conf==NULL)\n");
+		EPRINTK("(conf==NULL)\n");
 		return;
 	}
-	printk(" --- rd:%d wd:%d fd:%d\n", conf->raid_disks,
+	EPRINTK(" --- rd:%d wd:%d fd:%d\n", conf->raid_disks,
 		 conf->working_disks, conf->failed_disks);
 
 #if RAID5_DEBUG
@@ -1719,7 +1720,7 @@
 	for (i = 0; i < conf->working_disks+conf->failed_disks; i++) {
 #endif
 		tmp = conf->disks + i;
-		printk(" disk %d, s:%d, o:%d, n:%d rd:%d us:%d dev:%s\n",
+		EPRINTK(" disk %d, s:%d, o:%d, n:%d rd:%d us:%d dev:%s\n",
 			i, tmp->spare,tmp->operational,
 			tmp->number,tmp->raid_disk,tmp->used_slot,
 			partition_name(tmp->dev));
--- linux-2.4.19-orig/drivers/md/xor.c	Sun Sep 30 15:26:06 2001
+++ linux-2.4.19/drivers/md/xor.c	Tue Oct  1 16:43:36 2002
@@ -21,6 +21,7 @@
 #include <linux/raid/md.h>
 #include <linux/raid/xor.h>
 #include <asm/xor.h>
+#include "md_evlog.h"
 
 /* The xor routines to use.  */
 static struct xor_block_template *active_template;
@@ -92,7 +93,7 @@
 	speed = max * (HZ * BENCH_SIZE / 1024);
 	tmpl->speed = speed;
 
-	printk("   %-10s: %5d.%03d MB/sec\n", tmpl->name,
+	EPRINTK(KERN_INFO "   %-10s: %5d.%03d MB/sec\n", tmpl->name,
 	       speed / 1000, speed % 1000);
 }
 
@@ -104,12 +105,12 @@
 
 	b1 = (void *) md__get_free_pages(GFP_KERNEL, 2);
 	if (! b1) {
-		printk("raid5: Yikes!  No memory available.\n");
+		EPRINTK(KERN_ERR "raid5: Yikes!  No memory available.\n");
 		return -ENOMEM;
 	}
 	b2 = b1 + 2*PAGE_SIZE + BENCH_SIZE;
 
-	printk(KERN_INFO "raid5: measuring checksumming speed\n");
+	EPRINTK(KERN_INFO "raid5: measuring checksumming speed\n");
 	sti();
 
 #define xor_speed(templ)	do_xor_speed((templ), b1, b2)
@@ -130,7 +131,7 @@
 #endif
 
 	active_template = fastest;
-	printk("raid5: using function: %s (%d.%03d MB/sec)\n",
+	EPRINTK(KERN_INFO "raid5: using function: %s (%d.%03d MB/sec)\n",
 	       fastest->name, fastest->speed / 1000, fastest->speed % 1000);
 
 	return 0;
