| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ccd.c,v 1.185 2020/10/06 18:45:23 mlelstv Exp $ */ | | 1 | /* $NetBSD: ccd.c,v 1.186 2022/02/11 23:20:09 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1996, 1997, 1998, 1999, 2007, 2009 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe, and by Andrew Doran. | | 8 | * by Jason R. Thorpe, and by Andrew Doran. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -78,27 +78,27 @@ | | | @@ -78,27 +78,27 @@ |
78 | * sc_stop, sc_bufq and b_resid from master buffers. | | 78 | * sc_stop, sc_bufq and b_resid from master buffers. |
79 | * | | 79 | * |
80 | * => a combination of CCDF_INITED, sc_inflight, and sc_iolock is used to | | 80 | * => a combination of CCDF_INITED, sc_inflight, and sc_iolock is used to |
81 | * serialize I/O and configuration changes. | | 81 | * serialize I/O and configuration changes. |
82 | * | | 82 | * |
83 | * => the in-core disk label does not change while the device is open. | | 83 | * => the in-core disk label does not change while the device is open. |
84 | * | | 84 | * |
85 | * On memory consumption: ccd fans out I/O requests and so needs to | | 85 | * On memory consumption: ccd fans out I/O requests and so needs to |
86 | * allocate memory. If the system is desperately low on memory, we | | 86 | * allocate memory. If the system is desperately low on memory, we |
87 | * single thread I/O. | | 87 | * single thread I/O. |
88 | */ | | 88 | */ |
89 | | | 89 | |
90 | #include <sys/cdefs.h> | | 90 | #include <sys/cdefs.h> |
91 | __KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.185 2020/10/06 18:45:23 mlelstv Exp $"); | | 91 | __KERNEL_RCSID(0, "$NetBSD: ccd.c,v 1.186 2022/02/11 23:20:09 riastradh Exp $"); |
92 | | | 92 | |
93 | #include <sys/param.h> | | 93 | #include <sys/param.h> |
94 | #include <sys/systm.h> | | 94 | #include <sys/systm.h> |
95 | #include <sys/kernel.h> | | 95 | #include <sys/kernel.h> |
96 | #include <sys/proc.h> | | 96 | #include <sys/proc.h> |
97 | #include <sys/errno.h> | | 97 | #include <sys/errno.h> |
98 | #include <sys/buf.h> | | 98 | #include <sys/buf.h> |
99 | #include <sys/kmem.h> | | 99 | #include <sys/kmem.h> |
100 | #include <sys/pool.h> | | 100 | #include <sys/pool.h> |
101 | #include <sys/module.h> | | 101 | #include <sys/module.h> |
102 | #include <sys/namei.h> | | 102 | #include <sys/namei.h> |
103 | #include <sys/stat.h> | | 103 | #include <sys/stat.h> |
104 | #include <sys/ioctl.h> | | 104 | #include <sys/ioctl.h> |
| @@ -1437,27 +1437,27 @@ ccdioctl(dev_t dev, u_long cmd, void *da | | | @@ -1437,27 +1437,27 @@ ccdioctl(dev_t dev, u_long cmd, void *da |
1437 | /* Free component info and interleave table. */ | | 1437 | /* Free component info and interleave table. */ |
1438 | kmem_free(cs->sc_cinfo, cs->sc_nccdisks * | | 1438 | kmem_free(cs->sc_cinfo, cs->sc_nccdisks * |
1439 | sizeof(struct ccdcinfo)); | | 1439 | sizeof(struct ccdcinfo)); |
1440 | kmem_free(cs->sc_itable, (cs->sc_nccdisks + 1) * | | 1440 | kmem_free(cs->sc_itable, (cs->sc_nccdisks + 1) * |
1441 | sizeof(struct ccdiinfo)); | | 1441 | sizeof(struct ccdiinfo)); |
1442 | } | | 1442 | } |
1443 | | | 1443 | |
1444 | aprint_normal("%s: detached\n", cs->sc_xname); | | 1444 | aprint_normal("%s: detached\n", cs->sc_xname); |
1445 | | | 1445 | |
1446 | /* Detach the disk. */ | | 1446 | /* Detach the disk. */ |
1447 | disk_detach(&cs->sc_dkdev); | | 1447 | disk_detach(&cs->sc_dkdev); |
1448 | bufq_free(cs->sc_bufq); | | 1448 | bufq_free(cs->sc_bufq); |
1449 | | | 1449 | |
1450 | /* also releases dv_lock */ | | 1450 | /* also releases sc_dvlock */ |
1451 | ccdput(cs); | | 1451 | ccdput(cs); |
1452 | | | 1452 | |
1453 | /* Don't break, otherwise cs is read again. */ | | 1453 | /* Don't break, otherwise cs is read again. */ |
1454 | return 0; | | 1454 | return 0; |
1455 | | | 1455 | |
1456 | case DIOCGCACHE: | | 1456 | case DIOCGCACHE: |
1457 | { | | 1457 | { |
1458 | int dkcache = 0; | | 1458 | int dkcache = 0; |
1459 | | | 1459 | |
1460 | /* | | 1460 | /* |
1461 | * We pass this call down to all components and report | | 1461 | * We pass this call down to all components and report |
1462 | * intersection of the flags returned by the components. | | 1462 | * intersection of the flags returned by the components. |
1463 | * If any errors out, we return error. CCD components | | 1463 | * If any errors out, we return error. CCD components |