Module Name:    src
Committed By:   mlelstv
Date:           Mon Jan  4 11:12:40 UTC 2016

Modified Files:
        src/sys/dev/raidframe: rf_netbsdkintf.c

Log Message:
Fix dump on raid.
- offset dump by RF_PROTECTED_SECTORS (thanks oster@ for noticing)
- call component dump function with byte count instead of block count
- return -1 instead of errno values in dk_size for error conditions.

There are still issues with dumping.
- the raid device must be open, neither reading the disklabel
  nor flushing the component labels in rfmarkdirty is possible
  when dumping.
- dumping to a wedge component fails because the wedge driver only
  allows dumping to swap partitions, not raid partitions.


To generate a diff of this commit:
cvs rdiff -u -r1.335 -r1.336 src/sys/dev/raidframe/rf_netbsdkintf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.335 src/sys/dev/raidframe/rf_netbsdkintf.c:1.336
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.335	Sun Jan  3 08:17:24 2016
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Mon Jan  4 11:12:40 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.335 2016/01/03 08:17:24 mlelstv Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.336 2016/01/04 11:12:40 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.335 2016/01/03 08:17:24 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.336 2016/01/04 11:12:40 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -598,11 +598,11 @@ raidsize(dev_t dev)
 
 	unit = raidunit(dev);
 	if ((rs = raidget(unit, false)) == NULL)
-		return ENXIO;
+		return -1;
 	dksc = &rs->sc_dksc;
 
 	if ((rs->sc_flags & RAIDF_INITED) == 0)
-		return (ENODEV);
+		return -1;
 
 	return dk_size(dksc, dev);
 }
@@ -622,6 +622,13 @@ raiddump(dev_t dev, daddr_t blkno, void 
 	if ((rs->sc_flags & RAIDF_INITED) == 0)
 		return ENODEV;
 
+        /*
+           Note that blkno is relative to this particular partition.
+           By adding adding RF_PROTECTED_SECTORS, we get a value that
+	   is relative to the partition used for the underlying component.
+        */
+	blkno += RF_PROTECTED_SECTORS;
+
 	return dk_dump(dksc, dev, blkno, va, size);
 }
 
@@ -719,7 +726,7 @@ raid_dumpblocks(device_t dev, void *va, 
 	bdev = bdevsw_lookup(raidPtr->Disks[dumpto].dev);
 
 	error = (*bdev->d_dump)(raidPtr->Disks[dumpto].dev, 
-				blkno, va, nblk);
+				blkno, va, nblk * raidPtr->bytesPerSector);
 	
 out:
 	raidunlock(rs);

Reply via email to