1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_MD_RAID_H 28*0Sstevel@tonic-gate #define _SYS_MD_RAID_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #include <sys/lvm/mdvar.h> 33*0Sstevel@tonic-gate #include <sys/lvm/md_rename.h> 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gate #ifdef __cplusplus 36*0Sstevel@tonic-gate extern "C" { 37*0Sstevel@tonic-gate #endif 38*0Sstevel@tonic-gate 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate /* 41*0Sstevel@tonic-gate * following bits are used in status word in the common section 42*0Sstevel@tonic-gate * of unit structure: un_status 43*0Sstevel@tonic-gate */ 44*0Sstevel@tonic-gate #define RAID_UNMAGIC 0xBADBABE0 45*0Sstevel@tonic-gate #define RAID_PSMAGIC 0xBADBABE1 46*0Sstevel@tonic-gate #define RAID_CSMAGIC 0xBADBABE2 47*0Sstevel@tonic-gate #define RAID_PWMAGIC 0xBADBABE3 48*0Sstevel@tonic-gate #define RAID_BUFMAGIC 0xBADBABE4 49*0Sstevel@tonic-gate /* 50*0Sstevel@tonic-gate * These are the major constants for the definition of a raid device 51*0Sstevel@tonic-gate */ 52*0Sstevel@tonic-gate #define PWCNT_MIN 10 /* mininum # prewrites */ 53*0Sstevel@tonic-gate #define PWCNT_MAX 100 /* maximum # prewrites */ 54*0Sstevel@tonic-gate #define RAID_MIN_INTERLACE (DEV_BSIZE * 2) 55*0Sstevel@tonic-gate 56*0Sstevel@tonic-gate #define UNIT_STATE(un) ((un)->un_state) 57*0Sstevel@tonic-gate #define COLUMN_STATE(un, column) ((un)->un_column[(column)].un_devstate) 58*0Sstevel@tonic-gate 59*0Sstevel@tonic-gate #define COLUMN_STATE_ONLY(un, column) (\ 60*0Sstevel@tonic-gate ((un)->un_column[(column)].un_devstate == RCS_INIT) || \ 61*0Sstevel@tonic-gate ((un)->un_column[(column)].un_devstate == RCS_OKAY) || \ 62*0Sstevel@tonic-gate ((un)->un_column[(column)].un_devstate == RCS_ERRED) || \ 63*0Sstevel@tonic-gate ((un)->un_column[(column)].un_devstate == RCS_RESYNC) || \ 64*0Sstevel@tonic-gate ((un)->un_column[(column)].un_devstate == RCS_LAST_ERRED) || \ 65*0Sstevel@tonic-gate ((un)->un_column[(column)].un_devstate == RCS_REGEN))) 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate #define COLUMN_ISUP(un, column) (\ 68*0Sstevel@tonic-gate ((un)->un_column[(column)].un_devstate == RCS_OKAY) || \ 69*0Sstevel@tonic-gate ((un)->un_column[(column)].un_devstate == RCS_RESYNC) || \ 70*0Sstevel@tonic-gate ((un)->un_column[(column)].un_devstate == RCS_LAST_ERRED)) 71*0Sstevel@tonic-gate 72*0Sstevel@tonic-gate #define COLUMN_ISOKAY(un, column) (\ 73*0Sstevel@tonic-gate ((un)->un_column[(column)].un_devstate == RCS_OKAY)) 74*0Sstevel@tonic-gate 75*0Sstevel@tonic-gate #define COLUMN_ISLASTERR(un, column) (\ 76*0Sstevel@tonic-gate ((un)->un_column[(column)].un_devstate == RCS_LAST_ERRED)) 77*0Sstevel@tonic-gate 78*0Sstevel@tonic-gate #define WRITE_ALT(un, column) ( \ 79*0Sstevel@tonic-gate ((un)->un_column[(column)].un_alt_dev != NODEV64) && \ 80*0Sstevel@tonic-gate (((un)->un_column[(column)].un_devflags & MD_RAID_WRITE_ALT))) 81*0Sstevel@tonic-gate 82*0Sstevel@tonic-gate #define HOTSPARED(un, column) ( \ 83*0Sstevel@tonic-gate ((un)->un_column[(column)].un_hs_id != 0)) 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate #define OVERLAPED(blk1, lblk1, blk2, lblk2) ( \ 86*0Sstevel@tonic-gate (((blk1 > lblk2) ? 1 : 0) || \ 87*0Sstevel@tonic-gate ((lblk1 < blk2) ? 1 : 0))) 88*0Sstevel@tonic-gate 89*0Sstevel@tonic-gate 90*0Sstevel@tonic-gate /* 91*0Sstevel@tonic-gate * Note: magic is needed only to set rpw_magic, not rpw_magic_ext! 92*0Sstevel@tonic-gate */ 93*0Sstevel@tonic-gate #define RAID_FILLIN_RPW(buf, un, sum, colnum, \ 94*0Sstevel@tonic-gate blkno, blkcnt, id, \ 95*0Sstevel@tonic-gate colcount, col, magic) { \ 96*0Sstevel@tonic-gate if ((un)->c.un_revision == MD_64BIT_META_DEV) { \ 97*0Sstevel@tonic-gate raid_pwhdr_t *rpw64 = (raid_pwhdr_t *)(void *)(buf);\ 98*0Sstevel@tonic-gate rpw64->rpw_magic = magic; \ 99*0Sstevel@tonic-gate rpw64->rpw_sum = sum; \ 100*0Sstevel@tonic-gate rpw64->rpw_columnnum = colnum; \ 101*0Sstevel@tonic-gate rpw64->rpw_blkno = (diskaddr_t)blkno; \ 102*0Sstevel@tonic-gate rpw64->rpw_blkcnt = blkcnt; \ 103*0Sstevel@tonic-gate rpw64->rpw_id = id; \ 104*0Sstevel@tonic-gate rpw64->rpw_colcount = colcount; \ 105*0Sstevel@tonic-gate rpw64->rpw_column = col; \ 106*0Sstevel@tonic-gate rpw64->rpw_unit = MD_SID(un); \ 107*0Sstevel@tonic-gate rpw64->rpw_magic_ext = RAID_PWMAGIC; \ 108*0Sstevel@tonic-gate rpw64->rpw_origcolumncnt = (un)->un_origcolumncnt; \ 109*0Sstevel@tonic-gate rpw64->rpw_totalcolumncnt = (un)->un_totalcolumncnt; \ 110*0Sstevel@tonic-gate rpw64->rpw_segsize = (un)->un_segsize; \ 111*0Sstevel@tonic-gate rpw64->rpw_segsincolumn = (diskaddr_t)((un)->un_segsincolumn);\ 112*0Sstevel@tonic-gate rpw64->rpw_pwcnt = (un)->un_pwcnt; \ 113*0Sstevel@tonic-gate rpw64->rpw_pwsize = (un)->un_pwsize; \ 114*0Sstevel@tonic-gate rpw64->rpw_devstart = \ 115*0Sstevel@tonic-gate (diskaddr_t)((un)->un_column[col].un_orig_devstart);\ 116*0Sstevel@tonic-gate rpw64->rpw_pwstart = \ 117*0Sstevel@tonic-gate (diskaddr_t)((un)->un_column[col].un_orig_pwstart);\ 118*0Sstevel@tonic-gate } else { \ 119*0Sstevel@tonic-gate raid_pwhdr32_od_t *rpw32 = \ 120*0Sstevel@tonic-gate (raid_pwhdr32_od_t *)(void *)(buf); \ 121*0Sstevel@tonic-gate rpw32->rpw_magic = magic; \ 122*0Sstevel@tonic-gate rpw32->rpw_sum = sum; \ 123*0Sstevel@tonic-gate rpw32->rpw_columnnum = colnum; \ 124*0Sstevel@tonic-gate rpw32->rpw_blkno = (daddr_t)blkno; \ 125*0Sstevel@tonic-gate rpw32->rpw_blkcnt = blkcnt; \ 126*0Sstevel@tonic-gate rpw32->rpw_id = id; \ 127*0Sstevel@tonic-gate rpw32->rpw_colcount = colcount; \ 128*0Sstevel@tonic-gate rpw32->rpw_column = col; \ 129*0Sstevel@tonic-gate rpw32->rpw_unit = MD_SID(un); \ 130*0Sstevel@tonic-gate rpw32->rpw_magic_ext = RAID_PWMAGIC; \ 131*0Sstevel@tonic-gate rpw32->rpw_origcolumncnt = (un)->un_origcolumncnt; \ 132*0Sstevel@tonic-gate rpw32->rpw_totalcolumncnt = (un)->un_totalcolumncnt; \ 133*0Sstevel@tonic-gate rpw32->rpw_segsize = (daddr_t)((un)->un_segsize); \ 134*0Sstevel@tonic-gate rpw32->rpw_segsincolumn = (daddr_t)((un)->un_segsincolumn);\ 135*0Sstevel@tonic-gate rpw32->rpw_pwcnt = (un)->un_pwcnt; \ 136*0Sstevel@tonic-gate rpw32->rpw_pwsize = (un)->un_pwsize; \ 137*0Sstevel@tonic-gate rpw32->rpw_devstart = \ 138*0Sstevel@tonic-gate (daddr_t)((un)->un_column[col].un_orig_devstart);\ 139*0Sstevel@tonic-gate rpw32->rpw_pwstart = \ 140*0Sstevel@tonic-gate (daddr_t)((un)->un_column[col].un_orig_pwstart);\ 141*0Sstevel@tonic-gate } \ 142*0Sstevel@tonic-gate } 143*0Sstevel@tonic-gate 144*0Sstevel@tonic-gate #define RAID_CONVERT_RPW(rpw32, rpw64) { \ 145*0Sstevel@tonic-gate (rpw64)->rpw_magic = (rpw32)->rpw_magic; \ 146*0Sstevel@tonic-gate (rpw64)->rpw_sum = (rpw32)->rpw_sum; \ 147*0Sstevel@tonic-gate (rpw64)->rpw_columnnum = (rpw32)->rpw_columnnum; \ 148*0Sstevel@tonic-gate (rpw64)->rpw_blkno = (rpw32)->rpw_blkno; \ 149*0Sstevel@tonic-gate (rpw64)->rpw_blkcnt = (rpw32)->rpw_blkcnt; \ 150*0Sstevel@tonic-gate (rpw64)->rpw_id = (rpw32)->rpw_id; \ 151*0Sstevel@tonic-gate (rpw64)->rpw_colcount = (rpw32)->rpw_colcount; \ 152*0Sstevel@tonic-gate (rpw64)->rpw_column = (rpw32)->rpw_column; \ 153*0Sstevel@tonic-gate (rpw64)->rpw_unit = (rpw32)->rpw_unit; \ 154*0Sstevel@tonic-gate (rpw64)->rpw_magic_ext = (rpw32)->rpw_magic_ext; \ 155*0Sstevel@tonic-gate (rpw64)->rpw_origcolumncnt = (rpw32)->rpw_origcolumncnt; \ 156*0Sstevel@tonic-gate (rpw64)->rpw_totalcolumncnt = (rpw32)->rpw_totalcolumncnt; \ 157*0Sstevel@tonic-gate (rpw64)->rpw_segsize = (rpw32)->rpw_segsize; \ 158*0Sstevel@tonic-gate (rpw64)->rpw_segsincolumn = (rpw32)->rpw_segsincolumn; \ 159*0Sstevel@tonic-gate (rpw64)->rpw_pwcnt = (rpw32)->rpw_pwcnt; \ 160*0Sstevel@tonic-gate (rpw64)->rpw_pwsize = (rpw32)->rpw_pwsize; \ 161*0Sstevel@tonic-gate (rpw64)->rpw_devstart = (rpw32)->rpw_devstart; \ 162*0Sstevel@tonic-gate (rpw64)->rpw_pwstart = (rpw32)->rpw_pwstart; \ 163*0Sstevel@tonic-gate } 164*0Sstevel@tonic-gate 165*0Sstevel@tonic-gate typedef struct mr_scoreboard { 166*0Sstevel@tonic-gate int sb_column; 167*0Sstevel@tonic-gate int sb_flags; 168*0Sstevel@tonic-gate diskaddr_t sb_start_blk; 169*0Sstevel@tonic-gate diskaddr_t sb_last_blk; 170*0Sstevel@tonic-gate void *sb_cs; 171*0Sstevel@tonic-gate } mr_scoreboard_t; 172*0Sstevel@tonic-gate 173*0Sstevel@tonic-gate #define SB_AVAIL (0x00000001) /* useable and valid blocks */ 174*0Sstevel@tonic-gate #define SB_INUSE (0x00000002) /* being used */ 175*0Sstevel@tonic-gate #define SB_UNUSED (0x00000004) /* useable and no valid blocks */ 176*0Sstevel@tonic-gate #define SB_INVAL_PEND (0x00000008) /* being invalidated */ 177*0Sstevel@tonic-gate 178*0Sstevel@tonic-gate typedef struct mr_pw_reserve { 179*0Sstevel@tonic-gate uint_t pw_magic; 180*0Sstevel@tonic-gate int pw_column; 181*0Sstevel@tonic-gate int pw_free; 182*0Sstevel@tonic-gate mr_scoreboard_t pw_sb[1]; 183*0Sstevel@tonic-gate } mr_pw_reserve_t; 184*0Sstevel@tonic-gate 185*0Sstevel@tonic-gate 186*0Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 187*0Sstevel@tonic-gate #pragma pack(4) 188*0Sstevel@tonic-gate #endif 189*0Sstevel@tonic-gate typedef struct mr_column { 190*0Sstevel@tonic-gate rcs_state_t un_devstate; 191*0Sstevel@tonic-gate rcs_flags_t un_devflags; 192*0Sstevel@tonic-gate md_timeval32_t un_devtimestamp; /* time of last state change, 32 bit */ 193*0Sstevel@tonic-gate 194*0Sstevel@tonic-gate mddb_recid_t un_hs_id; 195*0Sstevel@tonic-gate diskaddr_t un_hs_pwstart; 196*0Sstevel@tonic-gate diskaddr_t un_hs_devstart; 197*0Sstevel@tonic-gate mdkey_t un_hs_key; 198*0Sstevel@tonic-gate 199*0Sstevel@tonic-gate 200*0Sstevel@tonic-gate md_dev64_t un_orig_dev; /* original device, 64 bit */ 201*0Sstevel@tonic-gate mdkey_t un_orig_key; 202*0Sstevel@tonic-gate diskaddr_t un_orig_pwstart; 203*0Sstevel@tonic-gate diskaddr_t un_orig_devstart; 204*0Sstevel@tonic-gate 205*0Sstevel@tonic-gate md_dev64_t un_dev; /* current read/write dev */ 206*0Sstevel@tonic-gate diskaddr_t un_pwstart; 207*0Sstevel@tonic-gate diskaddr_t un_devstart; 208*0Sstevel@tonic-gate 209*0Sstevel@tonic-gate md_dev64_t un_alt_dev; /* write to if resync */ 210*0Sstevel@tonic-gate diskaddr_t un_alt_pwstart; 211*0Sstevel@tonic-gate diskaddr_t un_alt_devstart; 212*0Sstevel@tonic-gate } mr_column_t; 213*0Sstevel@tonic-gate 214*0Sstevel@tonic-gate /* 215*0Sstevel@tonic-gate * mr_column32_od is for old 32 bit format only 216*0Sstevel@tonic-gate */ 217*0Sstevel@tonic-gate typedef struct mr_column32_od { 218*0Sstevel@tonic-gate rcs_state_t un_devstate; 219*0Sstevel@tonic-gate rcs_flags_t un_devflags; 220*0Sstevel@tonic-gate struct timeval32 un_devtimestamp; /* time of last state change */ 221*0Sstevel@tonic-gate caddr32_t xx_un_pw_reserve; 222*0Sstevel@tonic-gate 223*0Sstevel@tonic-gate mddb_recid_t un_hs_id; 224*0Sstevel@tonic-gate daddr32_t un_hs_pwstart; 225*0Sstevel@tonic-gate daddr32_t un_hs_devstart; 226*0Sstevel@tonic-gate mdkey_t un_hs_key; 227*0Sstevel@tonic-gate 228*0Sstevel@tonic-gate dev32_t un_orig_dev; /* original device */ 229*0Sstevel@tonic-gate mdkey_t un_orig_key; 230*0Sstevel@tonic-gate daddr32_t un_orig_pwstart; 231*0Sstevel@tonic-gate daddr32_t un_orig_devstart; 232*0Sstevel@tonic-gate 233*0Sstevel@tonic-gate dev32_t un_dev; /* current read/write dev */ 234*0Sstevel@tonic-gate daddr32_t un_pwstart; 235*0Sstevel@tonic-gate daddr32_t un_devstart; 236*0Sstevel@tonic-gate 237*0Sstevel@tonic-gate dev32_t un_alt_dev; /* write to if resync */ 238*0Sstevel@tonic-gate daddr32_t un_alt_pwstart; 239*0Sstevel@tonic-gate daddr32_t un_alt_devstart; 240*0Sstevel@tonic-gate } mr_column32_od_t; 241*0Sstevel@tonic-gate 242*0Sstevel@tonic-gate 243*0Sstevel@tonic-gate /* 244*0Sstevel@tonic-gate * Incore only elements structures 245*0Sstevel@tonic-gate */ 246*0Sstevel@tonic-gate typedef struct mr_column_ic { 247*0Sstevel@tonic-gate mr_pw_reserve_t *un_pw_reserve; 248*0Sstevel@tonic-gate } mr_column_ic_t; 249*0Sstevel@tonic-gate 250*0Sstevel@tonic-gate typedef struct mr_unit_ic { 251*0Sstevel@tonic-gate caddr_t _t_un_pbuffer; 252*0Sstevel@tonic-gate caddr_t _t_un_dbuffer; 253*0Sstevel@tonic-gate struct md_raidcs *_t_un_linlck_chn; 254*0Sstevel@tonic-gate kmutex_t _t_un_linlck_mx; 255*0Sstevel@tonic-gate kcondvar_t _t_un_linlck_cv; 256*0Sstevel@tonic-gate kmutex_t _t_un_mx; 257*0Sstevel@tonic-gate kcondvar_t _t_un_cv; 258*0Sstevel@tonic-gate mr_column_ic_t *_t_un_column_ic; 259*0Sstevel@tonic-gate } mr_unit_ic_t; 260*0Sstevel@tonic-gate 261*0Sstevel@tonic-gate typedef struct mr_unit { 262*0Sstevel@tonic-gate mdc_unit_t c; 263*0Sstevel@tonic-gate int un_raid_res; 264*0Sstevel@tonic-gate uint_t un_magic; 265*0Sstevel@tonic-gate rus_state_t un_state; 266*0Sstevel@tonic-gate md_timeval32_t un_timestamp; /* 32 bit fixed size */ 267*0Sstevel@tonic-gate uint_t un_origcolumncnt; 268*0Sstevel@tonic-gate uint_t un_totalcolumncnt; 269*0Sstevel@tonic-gate uint_t un_rflags; 270*0Sstevel@tonic-gate uint_t un_segsize; 271*0Sstevel@tonic-gate diskaddr_t un_segsincolumn; 272*0Sstevel@tonic-gate uint_t un_maxio; /* in blks */ 273*0Sstevel@tonic-gate uint_t un_iosize; /* in blks */ 274*0Sstevel@tonic-gate uint_t un_linlck_flg; 275*0Sstevel@tonic-gate uint_t un_pwcnt; 276*0Sstevel@tonic-gate uint_t un_pwsize; 277*0Sstevel@tonic-gate long long un_pwid; 278*0Sstevel@tonic-gate uint_t un_percent_done; 279*0Sstevel@tonic-gate uint_t un_resync_copysize; /* in blks */ 280*0Sstevel@tonic-gate hsp_t un_hsp_id; 281*0Sstevel@tonic-gate /* 282*0Sstevel@tonic-gate * This union has to begin at an 8 byte aligned address. 283*0Sstevel@tonic-gate * If not, this structure has different sizes in 32 / 64 bit 284*0Sstevel@tonic-gate * environments, since in a 64 bit environment the compiler 285*0Sstevel@tonic-gate * adds paddings before a long long, if it doesn't start at an 8byte 286*0Sstevel@tonic-gate * aligned address. 287*0Sstevel@tonic-gate * Be careful if you add or remove structure elements before it! 288*0Sstevel@tonic-gate */ 289*0Sstevel@tonic-gate 290*0Sstevel@tonic-gate union { 291*0Sstevel@tonic-gate struct { 292*0Sstevel@tonic-gate diskaddr_t _t_un_resync_line_index; 293*0Sstevel@tonic-gate uint_t _t_un_resync_segment; 294*0Sstevel@tonic-gate int _t_un_resync_index; 295*0Sstevel@tonic-gate } _resync; 296*0Sstevel@tonic-gate struct { 297*0Sstevel@tonic-gate diskaddr_t _t_un_grow_tb; 298*0Sstevel@tonic-gate uint_t _t_un_init_colcnt; 299*0Sstevel@tonic-gate u_longlong_t _t_un_init_iocnt; 300*0Sstevel@tonic-gate } _init; 301*0Sstevel@tonic-gate } _t_un; 302*0Sstevel@tonic-gate 303*0Sstevel@tonic-gate /* 304*0Sstevel@tonic-gate * This union has to begin at an 8 byte aligned address. 305*0Sstevel@tonic-gate * Be careful if you add or remove structure elements before it! 306*0Sstevel@tonic-gate */ 307*0Sstevel@tonic-gate union { 308*0Sstevel@tonic-gate mr_unit_ic_t *_mr_ic; 309*0Sstevel@tonic-gate uint_t _mr_ic_pad[2]; 310*0Sstevel@tonic-gate } un_mr_ic; 311*0Sstevel@tonic-gate 312*0Sstevel@tonic-gate mr_column_t un_column[1]; 313*0Sstevel@tonic-gate } mr_unit_t; 314*0Sstevel@tonic-gate 315*0Sstevel@tonic-gate #define mr_ic un_mr_ic._mr_ic 316*0Sstevel@tonic-gate #define un_pbuffer mr_ic->_t_un_pbuffer 317*0Sstevel@tonic-gate #define un_dbuffer mr_ic->_t_un_dbuffer 318*0Sstevel@tonic-gate #define un_linlck_chn mr_ic->_t_un_linlck_chn 319*0Sstevel@tonic-gate #define un_linlck_mx mr_ic->_t_un_linlck_mx 320*0Sstevel@tonic-gate #define un_linlck_cv mr_ic->_t_un_linlck_cv 321*0Sstevel@tonic-gate #define un_mx mr_ic->_t_un_mx 322*0Sstevel@tonic-gate #define un_cv mr_ic->_t_un_cv 323*0Sstevel@tonic-gate #define un_column_ic mr_ic->_t_un_column_ic 324*0Sstevel@tonic-gate 325*0Sstevel@tonic-gate /* 326*0Sstevel@tonic-gate * For old 32 bit format use only 327*0Sstevel@tonic-gate */ 328*0Sstevel@tonic-gate typedef struct mr_unit32_od { 329*0Sstevel@tonic-gate mdc_unit32_od_t c; 330*0Sstevel@tonic-gate caddr32_t xx_un_raid_res; 331*0Sstevel@tonic-gate uint_t un_magic; 332*0Sstevel@tonic-gate rus_state_t un_state; 333*0Sstevel@tonic-gate struct timeval32 un_timestamp; 334*0Sstevel@tonic-gate uint_t un_origcolumncnt; 335*0Sstevel@tonic-gate uint_t un_totalcolumncnt; 336*0Sstevel@tonic-gate uint_t un_rflags; 337*0Sstevel@tonic-gate uint_t un_segsize; 338*0Sstevel@tonic-gate uint_t un_segsincolumn; 339*0Sstevel@tonic-gate uint_t un_maxio; 340*0Sstevel@tonic-gate uint_t un_iosize; 341*0Sstevel@tonic-gate caddr32_t xx_un_pbuffer; 342*0Sstevel@tonic-gate caddr32_t xx_un_dbuffer; 343*0Sstevel@tonic-gate uint_t un_linlck_flg; 344*0Sstevel@tonic-gate caddr32_t xx_un_linlck_chn; 345*0Sstevel@tonic-gate uint_t un_pwcnt; 346*0Sstevel@tonic-gate uint_t un_pwsize; 347*0Sstevel@tonic-gate long long un_pwid; 348*0Sstevel@tonic-gate uint_t un_rebuild_size; 349*0Sstevel@tonic-gate uint_t un_percent_done; 350*0Sstevel@tonic-gate union { 351*0Sstevel@tonic-gate struct { 352*0Sstevel@tonic-gate uint_t _t_un_resync_segment; 353*0Sstevel@tonic-gate int _t_un_resync_index; 354*0Sstevel@tonic-gate uint_t _t_un_resync_line_index; 355*0Sstevel@tonic-gate } _resync; 356*0Sstevel@tonic-gate struct { 357*0Sstevel@tonic-gate daddr32_t _t_un_grow_tb; 358*0Sstevel@tonic-gate uint_t _t_un_init_colcnt; 359*0Sstevel@tonic-gate uint_t _t_un_init_iocnt; 360*0Sstevel@tonic-gate } _init; 361*0Sstevel@tonic-gate } _t_un; 362*0Sstevel@tonic-gate uint_t un_resync_copysize; 363*0Sstevel@tonic-gate 364*0Sstevel@tonic-gate /* 365*0Sstevel@tonic-gate * This spot is 8 byte aligned!!! 366*0Sstevel@tonic-gate * Don't change this arrangement. 367*0Sstevel@tonic-gate */ 368*0Sstevel@tonic-gate union { 369*0Sstevel@tonic-gate struct { 370*0Sstevel@tonic-gate mr_unit_ic_t *_t_mr_ic; 371*0Sstevel@tonic-gate } _mric; 372*0Sstevel@tonic-gate struct { 373*0Sstevel@tonic-gate uint_t xx_un_linlck_mx[2]; 374*0Sstevel@tonic-gate } _lckmx; 375*0Sstevel@tonic-gate } _unic; 376*0Sstevel@tonic-gate 377*0Sstevel@tonic-gate short xx_un_linlck_cv; 378*0Sstevel@tonic-gate int xx_un_mx[2]; 379*0Sstevel@tonic-gate short xx_un_cv; 380*0Sstevel@tonic-gate hsp_t un_hsp_id; 381*0Sstevel@tonic-gate mr_column32_od_t un_column[1]; 382*0Sstevel@tonic-gate } mr_unit32_od_t; 383*0Sstevel@tonic-gate 384*0Sstevel@tonic-gate typedef struct raid_pwhdr { 385*0Sstevel@tonic-gate uint_t rpw_magic; 386*0Sstevel@tonic-gate uint_t rpw_sum; 387*0Sstevel@tonic-gate int rpw_columnnum; 388*0Sstevel@tonic-gate diskaddr_t rpw_blkno; 389*0Sstevel@tonic-gate uint_t rpw_blkcnt; 390*0Sstevel@tonic-gate long long rpw_id; 391*0Sstevel@tonic-gate uint_t rpw_colcount; 392*0Sstevel@tonic-gate uint_t rpw_column; 393*0Sstevel@tonic-gate uint_t rpw_unit; 394*0Sstevel@tonic-gate uint_t rpw_magic_ext; 395*0Sstevel@tonic-gate uint_t rpw_origcolumncnt; 396*0Sstevel@tonic-gate uint_t rpw_totalcolumncnt; 397*0Sstevel@tonic-gate uint_t rpw_segsize; 398*0Sstevel@tonic-gate diskaddr_t rpw_segsincolumn; 399*0Sstevel@tonic-gate uint_t rpw_pwcnt; 400*0Sstevel@tonic-gate uint_t rpw_pwsize; 401*0Sstevel@tonic-gate diskaddr_t rpw_devstart; 402*0Sstevel@tonic-gate diskaddr_t rpw_pwstart; 403*0Sstevel@tonic-gate char rpw_filler[12]; 404*0Sstevel@tonic-gate } raid_pwhdr_t; 405*0Sstevel@tonic-gate 406*0Sstevel@tonic-gate /* 407*0Sstevel@tonic-gate * For old 32 bit pre-write area 408*0Sstevel@tonic-gate */ 409*0Sstevel@tonic-gate typedef struct raid_pwhdr32_od { 410*0Sstevel@tonic-gate uint_t rpw_magic; 411*0Sstevel@tonic-gate uint_t rpw_sum; 412*0Sstevel@tonic-gate int rpw_columnnum; 413*0Sstevel@tonic-gate daddr32_t rpw_blkno; 414*0Sstevel@tonic-gate daddr32_t rpw_blkcnt; 415*0Sstevel@tonic-gate long long rpw_id; 416*0Sstevel@tonic-gate uint_t rpw_colcount; 417*0Sstevel@tonic-gate uint_t rpw_column; 418*0Sstevel@tonic-gate uint_t rpw_unit; 419*0Sstevel@tonic-gate uint_t rpw_magic_ext; 420*0Sstevel@tonic-gate uint_t rpw_origcolumncnt; 421*0Sstevel@tonic-gate uint_t rpw_totalcolumncnt; 422*0Sstevel@tonic-gate uint_t rpw_segsize; 423*0Sstevel@tonic-gate uint_t rpw_segsincolumn; 424*0Sstevel@tonic-gate uint_t rpw_pwcnt; 425*0Sstevel@tonic-gate uint_t rpw_pwsize; 426*0Sstevel@tonic-gate uint_t rpw_devstart; 427*0Sstevel@tonic-gate uint_t rpw_pwstart; 428*0Sstevel@tonic-gate rus_state_t rpw_unit_state; 429*0Sstevel@tonic-gate rcs_state_t rpw_next_column_state; 430*0Sstevel@tonic-gate rcs_state_t rpw_prev_column_state; 431*0Sstevel@tonic-gate } raid_pwhdr32_od_t; 432*0Sstevel@tonic-gate #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4 433*0Sstevel@tonic-gate #pragma pack() 434*0Sstevel@tonic-gate #endif 435*0Sstevel@tonic-gate 436*0Sstevel@tonic-gate #ifdef _KERNEL 437*0Sstevel@tonic-gate 438*0Sstevel@tonic-gate /* 439*0Sstevel@tonic-gate * the buffer header is only bp_mapin if it is needed. It is needed on 440*0Sstevel@tonic-gate * all writes and on some reads. ps_mapin is non zero if the buffer is 441*0Sstevel@tonic-gate * maped in. ps_mapin_mx protect ps_mapin. The protocol for usage is 442*0Sstevel@tonic-gate * 443*0Sstevel@tonic-gate * 1) check for non-zero and continue if non-zero 444*0Sstevel@tonic-gate * 2) aquire the ps_mapin_mx 445*0Sstevel@tonic-gate * 3) recheck for non-zero and continue if non-zero 446*0Sstevel@tonic-gate * 4) bp_mapin 447*0Sstevel@tonic-gate * 5) set ps_mapin to non-zero 448*0Sstevel@tonic-gate * 6) drop ps_mapin_mx 449*0Sstevel@tonic-gate * 450*0Sstevel@tonic-gate * the reason for this is to avoid the mutex when possible. 451*0Sstevel@tonic-gate */ 452*0Sstevel@tonic-gate typedef struct md_raidps { /* raid parent save */ 453*0Sstevel@tonic-gate DAEMON_QUEUE 454*0Sstevel@tonic-gate uint_t ps_magic; 455*0Sstevel@tonic-gate mr_unit_t *ps_un; 456*0Sstevel@tonic-gate mdi_unit_t *ps_ui; 457*0Sstevel@tonic-gate buf_t *ps_bp; 458*0Sstevel@tonic-gate caddr_t ps_addr; 459*0Sstevel@tonic-gate int ps_flags; 460*0Sstevel@tonic-gate int ps_error; 461*0Sstevel@tonic-gate int ps_frags; 462*0Sstevel@tonic-gate int ps_pwfrags; 463*0Sstevel@tonic-gate int ps_mapin; /* buffer maped in if non zero */ 464*0Sstevel@tonic-gate kmutex_t ps_mx; 465*0Sstevel@tonic-gate kmutex_t ps_mapin_mx; /* protects ps_mapin */ 466*0Sstevel@tonic-gate } md_raidps_t; 467*0Sstevel@tonic-gate 468*0Sstevel@tonic-gate /* flags for parent save area */ 469*0Sstevel@tonic-gate 470*0Sstevel@tonic-gate #define MD_RPS_ERROR 0x0001 471*0Sstevel@tonic-gate #define MD_RPS_READ 0x0020 472*0Sstevel@tonic-gate #define MD_RPS_WRITE 0x0040 473*0Sstevel@tonic-gate #define MD_RPS_DONE 0x0080 474*0Sstevel@tonic-gate #define MD_RPS_INUSE 0x0100 475*0Sstevel@tonic-gate #define MD_RPS_IODONE 0x0200 476*0Sstevel@tonic-gate #define MD_RPS_HSREQ 0x0400 477*0Sstevel@tonic-gate 478*0Sstevel@tonic-gate /* 479*0Sstevel@tonic-gate * used in cs_state to describe the type of io operation in progress 480*0Sstevel@tonic-gate */ 481*0Sstevel@tonic-gate enum raid_io_stage { 482*0Sstevel@tonic-gate RAID_NONE = 0x0, 483*0Sstevel@tonic-gate RAID_READ_DONE = 0x1, 484*0Sstevel@tonic-gate RAID_WRITE_DONE = 0x2, 485*0Sstevel@tonic-gate RAID_PREWRITE_DONE = 0x4, 486*0Sstevel@tonic-gate RAID_WRITE_PONLY_DONE = 0x8, 487*0Sstevel@tonic-gate RAID_WRITE_DONLY_DONE = 0x10, 488*0Sstevel@tonic-gate RAID_LINE_PWDONE = 0x20 489*0Sstevel@tonic-gate }; 490*0Sstevel@tonic-gate 491*0Sstevel@tonic-gate typedef struct md_raidcbuf { 492*0Sstevel@tonic-gate DAEMON_QUEUE 493*0Sstevel@tonic-gate uint_t cbuf_magic; 494*0Sstevel@tonic-gate struct md_raidcbuf *cbuf_next; /* 0x10 */ 495*0Sstevel@tonic-gate mr_unit_t *cbuf_un; 496*0Sstevel@tonic-gate md_raidps_t *cbuf_ps; 497*0Sstevel@tonic-gate int cbuf_column; 498*0Sstevel@tonic-gate size_t cbuf_bcount; /* 0x20 */ 499*0Sstevel@tonic-gate caddr_t cbuf_buffer; 500*0Sstevel@tonic-gate int cbuf_sum; 501*0Sstevel@tonic-gate int cbuf_pwslot; 502*0Sstevel@tonic-gate int cbuf_pwcnt; /* 0x30 */ 503*0Sstevel@tonic-gate int cbuf_flags; 504*0Sstevel@tonic-gate buf_t cbuf_bp; 505*0Sstevel@tonic-gate uint_t cbuf_pad[4]; 506*0Sstevel@tonic-gate } md_raidcbuf_t; 507*0Sstevel@tonic-gate #define CBUF_PW_INVALIDATE (0x00000001) 508*0Sstevel@tonic-gate #define CBUF_WRITE (0x00000002) 509*0Sstevel@tonic-gate 510*0Sstevel@tonic-gate typedef struct md_raidcs { 511*0Sstevel@tonic-gate DAEMON_QUEUE 512*0Sstevel@tonic-gate uint_t cs_magic; 513*0Sstevel@tonic-gate minor_t cs_mdunit; 514*0Sstevel@tonic-gate mr_unit_t *cs_un; 515*0Sstevel@tonic-gate int cs_flags; 516*0Sstevel@tonic-gate md_raidps_t *cs_ps; 517*0Sstevel@tonic-gate diskaddr_t cs_line; 518*0Sstevel@tonic-gate void (*cs_call)(); 519*0Sstevel@tonic-gate void (*cs_error_call)(); 520*0Sstevel@tonic-gate void (*cs_retry_call)(); 521*0Sstevel@tonic-gate struct md_raidcs *cs_linlck_next; 522*0Sstevel@tonic-gate struct md_raidcs *cs_linlck_prev; 523*0Sstevel@tonic-gate long long cs_pwid; 524*0Sstevel@tonic-gate int cs_dcolumn; 525*0Sstevel@tonic-gate int cs_dpwslot; 526*0Sstevel@tonic-gate uint_t cs_dflags; 527*0Sstevel@tonic-gate int cs_pcolumn; 528*0Sstevel@tonic-gate int cs_ppwslot; 529*0Sstevel@tonic-gate uint_t cs_pflags; 530*0Sstevel@tonic-gate size_t cs_bcount; 531*0Sstevel@tonic-gate uint_t cs_blkcnt; 532*0Sstevel@tonic-gate diskaddr_t cs_blkno; 533*0Sstevel@tonic-gate diskaddr_t cs_lastblk; 534*0Sstevel@tonic-gate int cs_loop; 535*0Sstevel@tonic-gate caddr_t cs_addr; /* base address of io */ 536*0Sstevel@tonic-gate off_t cs_offset; /* offset into the base */ 537*0Sstevel@tonic-gate caddr_t cs_dbuffer; 538*0Sstevel@tonic-gate caddr_t cs_pbuffer; 539*0Sstevel@tonic-gate int cs_frags; 540*0Sstevel@tonic-gate int cs_strategy_flag; 541*0Sstevel@tonic-gate void *cs_strategy_private; 542*0Sstevel@tonic-gate md_raidcbuf_t *cs_buflist; 543*0Sstevel@tonic-gate int cs_error; 544*0Sstevel@tonic-gate int cs_resync_check; 545*0Sstevel@tonic-gate int cs_rstate; 546*0Sstevel@tonic-gate enum raid_io_stage cs_stage; /* current io stage */ 547*0Sstevel@tonic-gate md_raidcbuf_t *cs_pw_inval_list; 548*0Sstevel@tonic-gate 549*0Sstevel@tonic-gate kmutex_t cs_mx; 550*0Sstevel@tonic-gate 551*0Sstevel@tonic-gate buf_t cs_pbuf; 552*0Sstevel@tonic-gate uint_t cs_pad1; 553*0Sstevel@tonic-gate buf_t cs_hbuf; 554*0Sstevel@tonic-gate uint_t cs_pad2; 555*0Sstevel@tonic-gate /* Add new structure members HERE!! */ 556*0Sstevel@tonic-gate buf_t cs_dbuf; 557*0Sstevel@tonic-gate /* DO NOT add struture members here; cs_dbuf is dynamically sized */ 558*0Sstevel@tonic-gate } md_raidcs_t; 559*0Sstevel@tonic-gate 560*0Sstevel@tonic-gate /* value definitions for cs_resync_check */ 561*0Sstevel@tonic-gate #define RCL_OKAY 0x01 /* write to both orig and alt */ 562*0Sstevel@tonic-gate #define RCL_ERRED 0x08 /* treat column as rcs_ERRED */ 563*0Sstevel@tonic-gate 564*0Sstevel@tonic-gate #define RCL_DATA_MASK 0x000000ff 565*0Sstevel@tonic-gate #define RCL_PARITY_MASK 0x0000ff00 566*0Sstevel@tonic-gate #define RCL_PARITY_OFFSET 8 /* insure masks match offset */ 567*0Sstevel@tonic-gate 568*0Sstevel@tonic-gate #define RCL_PARITY(value) (((value) & RCL_PARITY_MASK) >> \ 569*0Sstevel@tonic-gate RCL_PARITY_OFFSET) 570*0Sstevel@tonic-gate 571*0Sstevel@tonic-gate #define RCL_DATA(value) ((value) & RCL_DATA_MASK) 572*0Sstevel@tonic-gate 573*0Sstevel@tonic-gate /* value definitions for cs_flags */ 574*0Sstevel@tonic-gate #define MD_RCS_ISCALL 0x000001 /* call cs_call in interrupt */ 575*0Sstevel@tonic-gate #define MD_RCS_UNDBUF 0x000002 /* holding unit data buffer */ 576*0Sstevel@tonic-gate #define MD_RCS_UNPBUF 0x000004 /* holding unit parity buffer */ 577*0Sstevel@tonic-gate #define MD_RCS_MPBUF 0x000008 578*0Sstevel@tonic-gate #define MD_RCS_HAVE_PW_SLOTS 0x000010 /* pw slots gotten */ 579*0Sstevel@tonic-gate #define MD_RCS_PWDONE 0x000040 /* pwfrags are decremented */ 580*0Sstevel@tonic-gate #define MD_RCS_READER 0x000100 /* reader line lock needed */ 581*0Sstevel@tonic-gate #define MD_RCS_WRITER 0x000200 /* writer line lock needed */ 582*0Sstevel@tonic-gate #define MD_RCS_LLOCKD 0x000400 /* line lock held */ 583*0Sstevel@tonic-gate #define MD_RCS_WAITING 0x000800 /* line lock waiting */ 584*0Sstevel@tonic-gate #define MD_RCS_LINE 0x001000 /* full line write */ 585*0Sstevel@tonic-gate #define MD_RCS_ERROR 0x010000 /* I/O error on this child */ 586*0Sstevel@tonic-gate #define MD_RCS_RECOVERY 0x020000 587*0Sstevel@tonic-gate 588*0Sstevel@tonic-gate /* value definitions for cs_pflags or cs_dflags */ 589*0Sstevel@tonic-gate #define MD_RCS_ISUP 0x0002 590*0Sstevel@tonic-gate 591*0Sstevel@tonic-gate /* value definitions for gcs_flags */ 592*0Sstevel@tonic-gate #define MD_RGCS_ALLOCBUF 0x0001 593*0Sstevel@tonic-gate /* returned value from raid_replay() */ 594*0Sstevel@tonic-gate #define RAID_RPLY_SUCCESS 0x0000 595*0Sstevel@tonic-gate #define RAID_RPLY_ALLOCFAIL 0x0001 596*0Sstevel@tonic-gate #define RAID_RPLY_COMPREPLAY 0x0002 597*0Sstevel@tonic-gate #define RAID_RPLY_READONLY 0x0004 598*0Sstevel@tonic-gate #define RAID_RPLY_EIO 0x0008 599*0Sstevel@tonic-gate 600*0Sstevel@tonic-gate typedef struct raid_rplybuf { 601*0Sstevel@tonic-gate caddr_t rpl_data; 602*0Sstevel@tonic-gate buf_t *rpl_buf; 603*0Sstevel@tonic-gate } raid_rplybuf_t; 604*0Sstevel@tonic-gate 605*0Sstevel@tonic-gate typedef struct raid_rplylst { 606*0Sstevel@tonic-gate struct raid_rplylst *rpl_next; 607*0Sstevel@tonic-gate uint_t rpl_colcnt; 608*0Sstevel@tonic-gate long long rpl_id; 609*0Sstevel@tonic-gate int rpl_column1; 610*0Sstevel@tonic-gate uint_t rpl_slot1; 611*0Sstevel@tonic-gate raid_pwhdr_t rpl_pwhdr1; 612*0Sstevel@tonic-gate int rpl_column2; 613*0Sstevel@tonic-gate uint_t rpl_slot2; 614*0Sstevel@tonic-gate raid_pwhdr_t rpl_pwhdr2; 615*0Sstevel@tonic-gate } raid_rplylst_t; 616*0Sstevel@tonic-gate 617*0Sstevel@tonic-gate /* Externals from raid.c */ 618*0Sstevel@tonic-gate extern int raid_build_incore(void *, int); 619*0Sstevel@tonic-gate extern void reset_raid(mr_unit_t *, minor_t, int); 620*0Sstevel@tonic-gate 621*0Sstevel@tonic-gate /* Externals from raid_ioctl.c */ 622*0Sstevel@tonic-gate extern int md_raid_ioctl(dev_t dev, int cmd, void *data, 623*0Sstevel@tonic-gate int mode, IOLOCK *lockp); 624*0Sstevel@tonic-gate 625*0Sstevel@tonic-gate /* rename named service functions */ 626*0Sstevel@tonic-gate md_ren_svc_t raid_rename_check; 627*0Sstevel@tonic-gate md_ren_svc_t raid_rename_lock; 628*0Sstevel@tonic-gate md_ren_void_svc_t raid_rename_unlock; 629*0Sstevel@tonic-gate 630*0Sstevel@tonic-gate 631*0Sstevel@tonic-gate /* redefinitions of the union shared by resync and init */ 632*0Sstevel@tonic-gate #define un_resync_segment _t_un._resync._t_un_resync_segment 633*0Sstevel@tonic-gate #define un_resync_index _t_un._resync._t_un_resync_index 634*0Sstevel@tonic-gate #define un_resync_line_index _t_un._resync._t_un_resync_line_index 635*0Sstevel@tonic-gate 636*0Sstevel@tonic-gate #define un_grow_tb _t_un._init._t_un_grow_tb 637*0Sstevel@tonic-gate #define un_init_colcnt _t_un._init._t_un_init_colcnt 638*0Sstevel@tonic-gate #define un_init_iocnt _t_un._init._t_un_init_iocnt 639*0Sstevel@tonic-gate 640*0Sstevel@tonic-gate #define MD_RFLAG_NEEDBUF (0x0001) 641*0Sstevel@tonic-gate #define MD_RFLAG_CLEAR (0x0002) 642*0Sstevel@tonic-gate #define MD_RFLAG_KEEP (0x0004) 643*0Sstevel@tonic-gate #define MD_RFLAG_NEEDPW (0x0008) 644*0Sstevel@tonic-gate 645*0Sstevel@tonic-gate 646*0Sstevel@tonic-gate extern void raid_set_state(mr_unit_t *un, int col, 647*0Sstevel@tonic-gate rcs_state_t new_state, int force); 648*0Sstevel@tonic-gate extern int raid_replay(mr_unit_t *un); 649*0Sstevel@tonic-gate extern void raid_commit(mr_unit_t *un, mddb_recid_t *extras); 650*0Sstevel@tonic-gate extern char *raid_unit_state(rus_state_t state); 651*0Sstevel@tonic-gate extern intptr_t raid_hotspares(); 652*0Sstevel@tonic-gate extern void raid_hs_release(hs_cmds_t cmd, mr_unit_t *un, 653*0Sstevel@tonic-gate mddb_recid_t *recids, int hs_index); 654*0Sstevel@tonic-gate extern int raid_internal_open(minor_t mnum, int flag, int otyp, 655*0Sstevel@tonic-gate int oflags); 656*0Sstevel@tonic-gate extern int raid_internal_close(minor_t mnum, int otyp, 657*0Sstevel@tonic-gate int init_pw, int cflags); 658*0Sstevel@tonic-gate extern int raid_build_pwslot(mr_unit_t *unit, int column_index); 659*0Sstevel@tonic-gate extern void raid_free_pwslot(mr_unit_t *unit, int column_index); 660*0Sstevel@tonic-gate extern void release_resync_request(minor_t mnum); 661*0Sstevel@tonic-gate extern int resync_request(minor_t mnum, int column_index, 662*0Sstevel@tonic-gate size_t copysize, md_error_t *ep); 663*0Sstevel@tonic-gate extern int raid_resync_unit(minor_t mnum, md_error_t *ep); 664*0Sstevel@tonic-gate extern void raid_line_reader_lock(md_raidcs_t *cs, 665*0Sstevel@tonic-gate int resync_thread); 666*0Sstevel@tonic-gate extern void raid_line_exit(md_raidcs_t *cs); 667*0Sstevel@tonic-gate extern int raid_state_cnt(mr_unit_t *un, rcs_state_t state); 668*0Sstevel@tonic-gate extern int raid_build_pw_reservation(mr_unit_t *un, 669*0Sstevel@tonic-gate int colindex); 670*0Sstevel@tonic-gate extern int init_pw_area(mr_unit_t *un, md_dev64_t dev_to_write, 671*0Sstevel@tonic-gate diskaddr_t pwstart, uint_t col); 672*0Sstevel@tonic-gate extern void init_buf(buf_t *bp, int flags, size_t size); 673*0Sstevel@tonic-gate extern void destroy_buf(buf_t *bp); 674*0Sstevel@tonic-gate extern void reset_buf(buf_t *bp, int flags, size_t size); 675*0Sstevel@tonic-gate extern void md_raid_strategy(buf_t *pb, int flag, void *private); 676*0Sstevel@tonic-gate extern void raid_free_pw_reservation(mr_unit_t *un, 677*0Sstevel@tonic-gate int colindex); 678*0Sstevel@tonic-gate extern void raid_fillin_rpw(mr_unit_t *un, 679*0Sstevel@tonic-gate raid_pwhdr_t *pwhdrp, int col); 680*0Sstevel@tonic-gate #endif /* _KERNEL */ 681*0Sstevel@tonic-gate 682*0Sstevel@tonic-gate #ifdef __cplusplus 683*0Sstevel@tonic-gate } 684*0Sstevel@tonic-gate #endif 685*0Sstevel@tonic-gate 686*0Sstevel@tonic-gate #endif /* _SYS_MD_RAID_H */ 687