summaryrefslogtreecommitdiff
path: root/sys/dev/raidframe
diff options
context:
space:
mode:
authormlelstv <mlelstv@NetBSD.org>2016-01-04 11:12:40 +0000
committermlelstv <mlelstv@NetBSD.org>2016-01-04 11:12:40 +0000
commitf78a006601d972bd26235d0ea88ee1bdee54ac68 (patch)
tree71e10386c09d135af23d068cf88278547cf44c93 /sys/dev/raidframe
parentb5241ff5d929e2f76a8a4a862468a056f82fbdad (diff)
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.
Diffstat (limited to 'sys/dev/raidframe')
-rw-r--r--sys/dev/raidframe/rf_netbsdkintf.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/dev/raidframe/rf_netbsdkintf.c b/sys/dev/raidframe/rf_netbsdkintf.c
index 4962dcf01fa..7527e3ca40d 100644
--- a/sys/dev/raidframe/rf_netbsdkintf.c
+++ b/sys/dev/raidframe/rf_netbsdkintf.c
@@ -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 *va, size_t size)
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, daddr_t blkno, int nblk)
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);