Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/raidframe Fix dump on raid.



details:   https://anonhg.NetBSD.org/src/rev/72e5d8c3d751
branches:  trunk
changeset: 342667:72e5d8c3d751
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Mon Jan 04 11:12:40 2016 +0000

description:
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:

 sys/dev/raidframe/rf_netbsdkintf.c |  17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)

diffs (55 lines):

diff -r 66c779fbd70d -r 72e5d8c3d751 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Mon Jan 04 10:02:15 2016 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Mon Jan 04 11:12:40 2016 +0000
@@ -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 @@
 
        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 @@
        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 @@
        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);



Home | Main Index | Thread Index | Old Index