1219b2ee8SDavid du Colombier.SH 2219b2ee8SDavid du ColombierBlock Devices 3219b2ee8SDavid du Colombier.PP 4219b2ee8SDavid du ColombierThe block device I/O system is like a 5219b2ee8SDavid du Colombierprotocol stack of filters. 6219b2ee8SDavid du ColombierThere are a set of pseudo-devices that call 7219b2ee8SDavid du Colombierrecursively to other pseudo-devices and real devices. 8219b2ee8SDavid du ColombierThe protocol stack is compiled from a configuration 9219b2ee8SDavid du Colombierstring that specifies the order of pseudo-devices and devices. 10219b2ee8SDavid du ColombierEach pseudo-device and device has a set of entry points 11219b2ee8SDavid du Colombierthat corresponds to the operations that the file system 12219b2ee8SDavid du Colombierrequires of a device. 13219b2ee8SDavid du ColombierThe most notable operations are 14219b2ee8SDavid du Colombier.CW read , 15219b2ee8SDavid du Colombier.CW write , 16219b2ee8SDavid du Colombierand 17219b2ee8SDavid du Colombier.CW size . 18219b2ee8SDavid du Colombier.PP 19219b2ee8SDavid du ColombierThe device stack can best be described by 20219b2ee8SDavid du Colombierdescribing the syntax of the configuration string 21219b2ee8SDavid du Colombierthat specifies the stack. 22219b2ee8SDavid du ColombierConfiguration strings are used 23219b2ee8SDavid du Colombierduring the setup of the file system. 24219b2ee8SDavid du ColombierFor a description see 25219b2ee8SDavid du Colombier.I fsconfig (8). 26219b2ee8SDavid du ColombierIn the following recursive definition, 27219b2ee8SDavid du Colombier.I D 28219b2ee8SDavid du Colombierrepresents a 29219b2ee8SDavid du Colombierstring that specifies a block device. 30219b2ee8SDavid du Colombier.IP "\fID\fP = (\fIDD\fP...)" 31219b2ee8SDavid du Colombier.br 32219b2ee8SDavid du ColombierThis is a set of devices that 33219b2ee8SDavid du Colombierare concatenated to form a single device. 34219b2ee8SDavid du ColombierThe size of the catenated device is the 35219b2ee8SDavid du Colombiersum of the sizes of each sub-device. 36219b2ee8SDavid du Colombier.IP "\fID\fP = [\fIDD\fP...]" 37219b2ee8SDavid du Colombier.br 38219b2ee8SDavid du ColombierThis is the interleaving of the 39219b2ee8SDavid du Colombierindividual devices. 40219b2ee8SDavid du ColombierIf there are N devices in the list, 41219b2ee8SDavid du Colombierthen the pseudo-device is the N-way block 42219b2ee8SDavid du Colombierinterleaving of the sub-devices. 43219b2ee8SDavid du ColombierThe size of the interleaved device is 44219b2ee8SDavid du ColombierN times the size of the smallest sub-device. 45*6aeb1f0cSDavid du Colombier.IP "\fID\fP = {\fIDD\fP...}" 46*6aeb1f0cSDavid du Colombier.br 47*6aeb1f0cSDavid du ColombierThis is a set of devices that 48*6aeb1f0cSDavid du Colombierconstitute a `mirror' of the first sub-device, and form a single device. 49*6aeb1f0cSDavid du ColombierA write to the device is performed, 50*6aeb1f0cSDavid du Colombierat the same block address, 51*6aeb1f0cSDavid du Colombieron the sub-devices, in right-to-left order. 52*6aeb1f0cSDavid du ColombierA read from the device is performed on each sub-device, 53*6aeb1f0cSDavid du Colombierin left-to-right order, until a read succeeds without error, 54*6aeb1f0cSDavid du Colombieror the set is exhausted. 55*6aeb1f0cSDavid du ColombierOne can think of this as a poor man's RAID 1. 56*6aeb1f0cSDavid du ColombierThe size of the device is the size of the smallest sub-device. 57219b2ee8SDavid du Colombier.IP "\fID\fP = \f(CWp\fP\fIDN1.N2\fP" 58219b2ee8SDavid du Colombier.br 59219b2ee8SDavid du ColombierThis is a partition of a sub-device. 60219b2ee8SDavid du ColombierThe sub-device is partitioned into 100 equal pieces. 61219b2ee8SDavid du ColombierIf the size of the sub-device is not divisible by 100, 62219b2ee8SDavid du Colombierthen there will be some slop thrown away at the top. 63219b2ee8SDavid du ColombierThe pseudo-device starts at the N1-th piece and 64219b2ee8SDavid du Colombiercontinues for N2 pieces. Thus 65219b2ee8SDavid du Colombier.CW p\fID\fP67.33 66219b2ee8SDavid du Colombierwill be the 67219b2ee8SDavid du Colombierlast third of the device 68219b2ee8SDavid du Colombier.I D . 69219b2ee8SDavid du Colombier.IP "\fID\fP = \f(CWf\fP\fID\fP" 70219b2ee8SDavid du Colombier.br 71219b2ee8SDavid du ColombierThis is a fake write-once-read-many device simulated by a 72219b2ee8SDavid du Colombiersecond read-write device. 73219b2ee8SDavid du ColombierThis second device is partitioned 74219b2ee8SDavid du Colombierinto a set of block flags and a set of blocks. 75219b2ee8SDavid du ColombierThe flags are used to generate errors if a 76219b2ee8SDavid du Colombierblock is ever written twice or read without being written first. 77*6aeb1f0cSDavid du Colombier.IP "\fID\fP = \f(CWx\fP\fID\fP" 78*6aeb1f0cSDavid du Colombier.br 79*6aeb1f0cSDavid du ColombierThis is a byte-swapped version of the file system on D. 80*6aeb1f0cSDavid du ColombierSince the file server currently writes integers in metadata to disk 81*6aeb1f0cSDavid du Colombierin native byte order, moving a file system to a machine of the other 82*6aeb1f0cSDavid du Colombiermajor byte order (e.g., MIPS to Pentium) 83*6aeb1f0cSDavid du Colombierrequires the use of 84*6aeb1f0cSDavid du Colombier.CW x . 85*6aeb1f0cSDavid du ColombierIt knows the sizes of the various integer fields in the file system metadata. 86*6aeb1f0cSDavid du ColombierIdeally, the file server would follow the Plan 9 religion and write a consistent 87*6aeb1f0cSDavid du Colombierbyte order on disk, regardless of processor. 88*6aeb1f0cSDavid du ColombierIn the mean time, it should be possible to automatically determine the need 89*6aeb1f0cSDavid du Colombierfor byte-swapping by examining data in the super-block of each file system, 90*6aeb1f0cSDavid du Colombierthough this has not been implemented yet. 91219b2ee8SDavid du Colombier.IP "\fID\fP = \f(CWc\fP\fIDD\fP" 92219b2ee8SDavid du Colombier.br 93219b2ee8SDavid du ColombierThis is the cache/WORM device made up of a cache (read-write) 94219b2ee8SDavid du Colombierdevice and a WORM (write-once-read-many) device. 95219b2ee8SDavid du ColombierMore on this later. 96219b2ee8SDavid du Colombier.IP "\fID\fP = \f(CWo\fP" 97219b2ee8SDavid du Colombier.br 98219b2ee8SDavid du ColombierThis is the dump file system that is the 99219b2ee8SDavid du Colombiertwo-level hierarchy of all dumps ever taken on a cache/WORM. 100219b2ee8SDavid du ColombierThe read-only root of the cache/WORM file system 101219b2ee8SDavid du Colombier(on the dump taken Feb 18, 1995) can 102219b2ee8SDavid du Colombierbe referenced as 103219b2ee8SDavid du Colombier.CW /1995/0218 104219b2ee8SDavid du Colombierin this pseudo device. 105219b2ee8SDavid du ColombierThe second dump taken that day will be 106219b2ee8SDavid du Colombier.CW /1995/02181 . 107*6aeb1f0cSDavid du Colombier.IP "\fID\fP = \f(CWw\fP\fIN1.N2.N3\fP" 108219b2ee8SDavid du Colombier.br 109*6aeb1f0cSDavid du ColombierThis is a SCSI disk on controller N1, target N2 and logical unit number N3. 110*6aeb1f0cSDavid du Colombier.IP "\fID\fP = \f(CWh\fP\fIN1.N2.0\fP" 111*6aeb1f0cSDavid du Colombier.br 112*6aeb1f0cSDavid du ColombierThis is an (E)IDE or *ATA disk on controller N1, target N2 113*6aeb1f0cSDavid du Colombier(target 0 is the IDE master, 1 the slave device). 114*6aeb1f0cSDavid du ColombierThese disks are currently run via programmed I/O, not DMA, 115*6aeb1f0cSDavid du Colombierso they tend to be slower to access than SCSI disks. 116*6aeb1f0cSDavid du Colombier.IP "\fID\fP = \f(CWr\fP\fIN1\fP" 117219b2ee8SDavid du Colombier.br 1187dd7cddfSDavid du ColombierThis is the same as 1197dd7cddfSDavid du Colombier.CW w , 120*6aeb1f0cSDavid du Colombierbut refers to a side of a WORM disc. 121*6aeb1f0cSDavid du ColombierSee the 122*6aeb1f0cSDavid du Colombier.I j 123*6aeb1f0cSDavid du Colombierdevice. 124*6aeb1f0cSDavid du Colombier.IP "\fID\fP = \f(CWl\fP\fIN1\fP" 125*6aeb1f0cSDavid du Colombier.br 126*6aeb1f0cSDavid du ColombierThis is the same as 127*6aeb1f0cSDavid du Colombier.CW r , 1287dd7cddfSDavid du Colombierbut one block from the SCSI disk is removed for labeling. 1297dd7cddfSDavid du Colombier.IP "\fID\fP = \f(CWj(\fP\fID\d\s-2\&1\s+2\u\fID\d\s-2\&2\s+2\u\f(CW*)\fID\d\s-2\&3\s+2\u\f1" 1307dd7cddfSDavid du Colombier.br 1317dd7cddfSDavid du Colombier.I D\d\s-2\&1\s+2\u 1327dd7cddfSDavid du Colombieris the juke box SCSI interface. 1337dd7cddfSDavid du ColombierThe 1347dd7cddfSDavid du Colombier.I D\d\s-2\&2\s+2\u 's 1357dd7cddfSDavid du Colombierare the SCSI drives in the juke box 1367dd7cddfSDavid du Colombierand the 1377dd7cddfSDavid du Colombier.I D\d\s-2\&3\s+2\u 's 1387dd7cddfSDavid du Colombierare the demountable platters in the juke box. 1397dd7cddfSDavid du Colombier.I D\d\s-2\&1\s+2\u 1407dd7cddfSDavid du Colombierand 1417dd7cddfSDavid du Colombier.I D\d\s-2\&2\s+2\u 1427dd7cddfSDavid du Colombiermust be 1437dd7cddfSDavid du Colombier.CW w . 1447dd7cddfSDavid du Colombier.I D\d\s-2\&3\s+2\u 1457dd7cddfSDavid du Colombiermust be pseudo devices of 146*6aeb1f0cSDavid du Colombier.CW w , 147*6aeb1f0cSDavid du Colombier.CW r , 1487dd7cddfSDavid du Colombieror 1497dd7cddfSDavid du Colombier.CW l 1507dd7cddfSDavid du Colombierdevices. 151219b2ee8SDavid du Colombier.PP 152*6aeb1f0cSDavid du ColombierFor 153*6aeb1f0cSDavid du Colombier.CW w , 154*6aeb1f0cSDavid du Colombier.CW h , 155*6aeb1f0cSDavid du Colombier.CW l , 156219b2ee8SDavid du Colombierand 157219b2ee8SDavid du Colombier.CW r 158219b2ee8SDavid du Colombierdevices any of the configuration numbers 159219b2ee8SDavid du Colombiercan be replaced by an iterator of the form 160219b2ee8SDavid du Colombier.CW <\fIN1-N2\fP> . 161*6aeb1f0cSDavid du ColombierN1 can be greater than N2, indicating a descending sequence. 162219b2ee8SDavid du ColombierThus 163*6aeb1f0cSDavid du Colombier.Ex 164219b2ee8SDavid du Colombier [w0.<2-6>] 165*6aeb1f0cSDavid du Colombier.Ee 166219b2ee8SDavid du Colombieris the interleaved SCSI disks on SCSI targets 167219b2ee8SDavid du Colombier2 through 6 of SCSI controller 0. 168219b2ee8SDavid du ColombierThe main file system on 1697dd7cddfSDavid du ColombierEmelie 170219b2ee8SDavid du Colombieris defined by the configuration string 171*6aeb1f0cSDavid du Colombier.Ex 172*6aeb1f0cSDavid du Colombier c[w1.<0-5>.0]j(w6w5w4w3w2)(l<0-236>l<238-474>) 173*6aeb1f0cSDavid du Colombier.Ee 174219b2ee8SDavid du ColombierThis is a cache/WORM driver. 175219b2ee8SDavid du ColombierThe cache is three interleaved disks on SCSI controller 1 1767dd7cddfSDavid du Colombiertargets 0, 1, 2, 3, 4, and 5. 177219b2ee8SDavid du ColombierThe WORM half of the cache/WORM 1787dd7cddfSDavid du Colombieris 474 jukebox disks. 179*6aeb1f0cSDavid du ColombierAnother file server, 180*6aeb1f0cSDavid du Colombier.I choline , 181*6aeb1f0cSDavid du Colombierhas a main file system defined by 182*6aeb1f0cSDavid du Colombier.Ex 183*6aeb1f0cSDavid du Colombier c[w<1-3>]j(w1.<6-0>.0)(l<0-124>l<128-252>) 184*6aeb1f0cSDavid du Colombier.Ee 185*6aeb1f0cSDavid du ColombierThe order of 186*6aeb1f0cSDavid du Colombier.CW w1.<6-0>.0 187*6aeb1f0cSDavid du Colombiermatters here, since the optical jukebox's WORM drives's 188*6aeb1f0cSDavid du ColombierSCSI target ids, 189*6aeb1f0cSDavid du Colombieras delivered, 190*6aeb1f0cSDavid du Colombierrun in descending order relative to the numbers of the drives 191*6aeb1f0cSDavid du Colombierin SCSI commands 192*6aeb1f0cSDavid du Colombier(e.g., the jukebox controller is SCSI target 6, 193*6aeb1f0cSDavid du Colombierdrive #1 is SCSI target 5, 194*6aeb1f0cSDavid du Colombierand drive #6 is SCSI target 0). 195