The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/raidframe/rf_raid4.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: rf_raid4.c,v 1.8 2003/12/30 21:59:03 oster Exp $       */
    2 /*
    3  * Copyright (c) 1995 Carnegie-Mellon University.
    4  * All rights reserved.
    5  *
    6  * Author: Rachad Youssef
    7  *
    8  * Permission to use, copy, modify and distribute this software and
    9  * its documentation is hereby granted, provided that both the copyright
   10  * notice and this permission notice appear in all copies of the
   11  * software, derivative works or modified versions, and any portions
   12  * thereof, and that both notices appear in supporting documentation.
   13  *
   14  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   15  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
   16  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   17  *
   18  * Carnegie Mellon requests users of this software to return to
   19  *
   20  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   21  *  School of Computer Science
   22  *  Carnegie Mellon University
   23  *  Pittsburgh PA 15213-3890
   24  *
   25  * any improvements or extensions that they make and grant Carnegie the
   26  * rights to redistribute these changes.
   27  */
   28 
   29 /***************************************
   30  *
   31  * rf_raid4.c -- implements RAID Level 4
   32  *
   33  ***************************************/
   34 
   35 #include <sys/cdefs.h>
   36 __KERNEL_RCSID(0, "$NetBSD: rf_raid4.c,v 1.8 2003/12/30 21:59:03 oster Exp $");
   37 
   38 #include "rf_raid.h"
   39 #include "rf_dag.h"
   40 #include "rf_dagutils.h"
   41 #include "rf_dagfuncs.h"
   42 #include "rf_dagffrd.h"
   43 #include "rf_dagffwr.h"
   44 #include "rf_dagdegrd.h"
   45 #include "rf_dagdegwr.h"
   46 #include "rf_raid4.h"
   47 #include "rf_general.h"
   48 
   49 typedef struct RF_Raid4ConfigInfo_s {
   50         RF_RowCol_t *stripeIdentifier;  /* filled in at config time & used by
   51                                          * IdentifyStripe */
   52 }       RF_Raid4ConfigInfo_t;
   53 
   54 
   55 
   56 int 
   57 rf_ConfigureRAID4(RF_ShutdownList_t **listp, RF_Raid_t *raidPtr,
   58                   RF_Config_t *cfgPtr)
   59 {
   60         RF_RaidLayout_t *layoutPtr = &raidPtr->Layout;
   61         RF_Raid4ConfigInfo_t *info;
   62         int     i;
   63 
   64         /* create a RAID level 4 configuration structure ... */
   65         RF_MallocAndAdd(info, sizeof(RF_Raid4ConfigInfo_t), (RF_Raid4ConfigInfo_t *), raidPtr->cleanupList);
   66         if (info == NULL)
   67                 return (ENOMEM);
   68         layoutPtr->layoutSpecificInfo = (void *) info;
   69 
   70         /* ... and fill it in. */
   71         RF_MallocAndAdd(info->stripeIdentifier, raidPtr->numCol * sizeof(RF_RowCol_t), (RF_RowCol_t *), raidPtr->cleanupList);
   72         if (info->stripeIdentifier == NULL)
   73                 return (ENOMEM);
   74         for (i = 0; i < raidPtr->numCol; i++)
   75                 info->stripeIdentifier[i] = i;
   76 
   77         /* fill in the remaining layout parameters */
   78         layoutPtr->numStripe = layoutPtr->stripeUnitsPerDisk;
   79         layoutPtr->numDataCol = raidPtr->numCol - 1;
   80         layoutPtr->dataSectorsPerStripe = layoutPtr->numDataCol * layoutPtr->sectorsPerStripeUnit;
   81         layoutPtr->numParityCol = 1;
   82         raidPtr->totalSectors = layoutPtr->stripeUnitsPerDisk * layoutPtr->numDataCol * layoutPtr->sectorsPerStripeUnit;
   83 
   84         return (0);
   85 }
   86 
   87 int 
   88 rf_GetDefaultNumFloatingReconBuffersRAID4(RF_Raid_t *raidPtr)
   89 {
   90         return (20);
   91 }
   92 
   93 RF_HeadSepLimit_t 
   94 rf_GetDefaultHeadSepLimitRAID4(RF_Raid_t *raidPtr)
   95 {
   96         return (20);
   97 }
   98 
   99 void 
  100 rf_MapSectorRAID4(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector,
  101                   RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap)
  102 {
  103         RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit;
  104         *col = SUID % raidPtr->Layout.numDataCol;
  105         *diskSector = (SUID / (raidPtr->Layout.numDataCol)) * raidPtr->Layout.sectorsPerStripeUnit +
  106             (raidSector % raidPtr->Layout.sectorsPerStripeUnit);
  107 }
  108 
  109 void 
  110 rf_MapParityRAID4(RF_Raid_t *raidPtr, RF_RaidAddr_t raidSector,
  111                   RF_RowCol_t *col, RF_SectorNum_t *diskSector, int remap)
  112 {
  113         RF_StripeNum_t SUID = raidSector / raidPtr->Layout.sectorsPerStripeUnit;
  114 
  115         *col = raidPtr->Layout.numDataCol;
  116         *diskSector = (SUID / (raidPtr->Layout.numDataCol)) * raidPtr->Layout.sectorsPerStripeUnit +
  117             (raidSector % raidPtr->Layout.sectorsPerStripeUnit);
  118 }
  119 
  120 void 
  121 rf_IdentifyStripeRAID4(RF_Raid_t *raidPtr, RF_RaidAddr_t addr,
  122                        RF_RowCol_t **diskids)
  123 {
  124         RF_Raid4ConfigInfo_t *info = raidPtr->Layout.layoutSpecificInfo;
  125 
  126         *diskids = info->stripeIdentifier;
  127 }
  128 
  129 void 
  130 rf_MapSIDToPSIDRAID4(RF_RaidLayout_t *layoutPtr, RF_StripeNum_t stripeID,
  131                      RF_StripeNum_t *psID, RF_ReconUnitNum_t *which_ru)
  132 {
  133         *which_ru = 0;
  134         *psID = stripeID;
  135 }

Cache object: 400593d931d8fcfb331f946976b14847


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.