geom_ccd.c (13070) | geom_ccd.c (13173) |
---|---|
1/* $Id$ */ | 1/* $Id: ccd.c,v 1.3 1995/12/28 00:22:45 asami Exp $ */ |
2 3/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */ 4 5/* 6 * Copyright (c) 1995 Jason R. Thorpe. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without --- 404 unchanged lines hidden (view full) --- 414 /* 415 * If uniform interleave is desired set all sizes to that of 416 * the smallest component. 417 */ 418 if (ccd->ccd_flags & CCDF_UNIFORM) { 419 for (ci = cs->sc_cinfo; 420 ci < &cs->sc_cinfo[cs->sc_nccdisks]; ci++) 421 ci->ci_size = minsize; | 2 3/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */ 4 5/* 6 * Copyright (c) 1995 Jason R. Thorpe. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without --- 404 unchanged lines hidden (view full) --- 414 /* 415 * If uniform interleave is desired set all sizes to that of 416 * the smallest component. 417 */ 418 if (ccd->ccd_flags & CCDF_UNIFORM) { 419 for (ci = cs->sc_cinfo; 420 ci < &cs->sc_cinfo[cs->sc_nccdisks]; ci++) 421 ci->ci_size = minsize; |
422 cs->sc_size = cs->sc_nccdisks * minsize; | 422 if (ccd->ccd_flags & CCDF_PARITY) 423 cs->sc_size = (cs->sc_nccdisks-1) * minsize; 424 else 425 cs->sc_size = cs->sc_nccdisks * minsize; |
423 } 424 425 /* 426 * Construct the interleave table. 427 */ 428 ccdinterleave(cs, ccd->ccd_unit); 429 430 /* --- 374 unchanged lines hidden (view full) --- 805 if (ii->ii_startblk > cbn) 806 break; 807 ii--; 808 off = cbn - ii->ii_startblk; 809 if (ii->ii_ndisk == 1) { 810 ccdisk = ii->ii_index[0]; 811 cbn = ii->ii_startoff + off; 812 } else { | 426 } 427 428 /* 429 * Construct the interleave table. 430 */ 431 ccdinterleave(cs, ccd->ccd_unit); 432 433 /* --- 374 unchanged lines hidden (view full) --- 808 if (ii->ii_startblk > cbn) 809 break; 810 ii--; 811 off = cbn - ii->ii_startblk; 812 if (ii->ii_ndisk == 1) { 813 ccdisk = ii->ii_index[0]; 814 cbn = ii->ii_startoff + off; 815 } else { |
813 ccdisk = ii->ii_index[off % ii->ii_ndisk]; 814 cbn = ii->ii_startoff + off / ii->ii_ndisk; | 816 if (cs->sc_cflags & CCDF_PARITY) { 817 ccdisk = ii->ii_index[off % (ii->ii_ndisk-1)]; 818 cbn = ii->ii_startoff + off / (ii->ii_ndisk-1); 819 if (cbn % ii->ii_ndisk <= ccdisk) 820 ccdisk++; 821 } 822 else { 823 ccdisk = ii->ii_index[off % ii->ii_ndisk]; 824 cbn = ii->ii_startoff + off / ii->ii_ndisk; 825 } |
815 } 816 cbn *= cs->sc_ileave; 817 ci = &cs->sc_cinfo[ccdisk]; 818 } 819 820 /* 821 * Fill in the component buf structure. 822 */ --- 210 unchanged lines hidden (view full) --- 1033 return (EBADF); 1034 1035 if (error = ccdlock(cs)) 1036 return (error); 1037 1038 /* Fill in some important bits. */ 1039 ccd.ccd_unit = unit; 1040 ccd.ccd_interleave = ccio->ccio_ileave; | 826 } 827 cbn *= cs->sc_ileave; 828 ci = &cs->sc_cinfo[ccdisk]; 829 } 830 831 /* 832 * Fill in the component buf structure. 833 */ --- 210 unchanged lines hidden (view full) --- 1044 return (EBADF); 1045 1046 if (error = ccdlock(cs)) 1047 return (error); 1048 1049 /* Fill in some important bits. */ 1050 ccd.ccd_unit = unit; 1051 ccd.ccd_interleave = ccio->ccio_ileave; |
1052 if ((ccio->ccio_flags & CCDF_PARITY) && 1053 !(ccio->ccio_flags & CCDF_UNIFORM)) { 1054 printf("ccd%d: parity forces uniform flag\n", unit); 1055 ccio->ccio_flags |= CCDF_UNIFORM; 1056 } |
|
1041 ccd.ccd_flags = ccio->ccio_flags & CCDF_USERMASK; 1042 1043 /* 1044 * Allocate space for and copy in the array of 1045 * componet pathnames and device numbers. 1046 */ 1047 cpp = malloc(ccio->ccio_ndisks * sizeof(char *), 1048 M_DEVBUF, M_WAITOK); --- 459 unchanged lines hidden --- | 1057 ccd.ccd_flags = ccio->ccio_flags & CCDF_USERMASK; 1058 1059 /* 1060 * Allocate space for and copy in the array of 1061 * componet pathnames and device numbers. 1062 */ 1063 cpp = malloc(ccio->ccio_ndisks * sizeof(char *), 1064 M_DEVBUF, M_WAITOK); --- 459 unchanged lines hidden --- |