[ Pobierz całość w formacie PDF ] .As there are 32 sectors ina track and 64 read write heads, this partition is a whole number of cylinders in size.fdisk alligns partitions on cylinder boundaries by default.It starts at the outermostcylinder 0 and extends inwards, towards the spindle, for 478 cylinders.The secondpartition, the swap partition, starts at the next cylinder 478 and extends to theinnermost cylinder of the disk.During initialization Linux maps the topology of the hard disks in the system.Itnds out how many hard disks there are and of what type.Additionally, Linuxdiscovers how the individual disks have been partitioned.This is all represented by alist of gendisk data structures pointed at by the gendisk head list pointer.As eachdisk subsystem, for example IDE, is initialized it generates gendisk data structuresrepresenting the disks that it nds.It does this at the same time as it registers its leoperations and adds its entry into the blk dev data structure.Each gendisk datastructure has a unique major device number and these match the major numbersof the block special devices.For example, the SCSI disk subsystem creates a singlegendisk entry ` ` sd' ' with a major number of 8, the major number of all SCSIdisk devices.Figure 8.3 shows two gendisk entries, the rst one for the SCSI diskpsubsystem and the second for an IDE disk controller.This is ide0, the primary IDEcontroller.Although the disk subsystems build the gendisk entries during their initializationthey are only used by Linux during partition checking.Instead, each disk subsystemmaintains its own data structures which allow it to map device special major andminor device numbers to partitions within physical disks.Whenever a block deviceis read from or written to, either via the bu er cache or le operations, the kerneldirects the operation to the appropriate device using the major device number foundin its block special device le for example dev sda2.It is the individual devicedriver or subsystem that maps the minor device number to the real physical device.8.5.1 IDE DisksThe most common disks used in Linux systems today are Integrated Disk Electronicor IDE disks.IDE is a disk interface rather than an I O bus like SCSI.Each IDEcontroller can support up to two disks, one the master disk and the other the slavedisk.The master and slave functions are usually set by jumpers on the disk.Therst IDE controller in the system is known as the primary IDE controller, the nextthe secondary controller and so on.IDE can manage about 3.3 Mbytes per secondof data transfer to or from the disk and the maximum IDE disk size is 538Mbytes.Extended IDE, or EIDE, has raised the disk size to a maximum of 8.6 Gbytes and thedata transfer rate up to 16.6 Mbytes per second.IDE and EIDE disks are cheaperthan SCSI disks and most modern PCs contain one or more on board IDE controllers.Linux names IDE disks in the order in which it nds their controllers.The masterdisk on the primary controller is dev hda and the slave disk is dev hdb.dev hdcis the master disk on the secondary IDE controller.The IDE subsystem registers IDEcontrollers and not disks with the Linux kernel.The major identi er for the primaryIDE controller is 3 and is 22 for the secondary IDE controller.This means that if asystem has two IDE controllers there will be entries for the IDE subsystem at indicesat 3 and 22 in the blk dev and blkdevs vectors.The block special les for IDE disksre ect this numbering, disks dev hda and dev hdb, both connected to the primaryIDE controller, have a major identi er of 3.Any le or bu er cache operations forthe IDE subsystem operations on these block special les will be directed to the IDEsubsystem as the kernel uses the major identi er as an index.When the request ismade, it is up to the IDE subsystem to work out which IDE disk the request is for.To do this the IDE subsystem uses the minor device number from the device specialidenti er, this contains information that allows it to direct the request to the correctpartition of the correct disk.The device identi er for dev hdb, the slave IDE driveon the primary IDE controller is 3,64.The device identi er for the rst partitionof that disk dev hdb1 is 3,65.8.5.2 Initializing the IDE SubsystemIDE disks have been around for much of the IBM PC's history.Throughout thistime the interface to these devices has changed.This makes the initialization of theIDE subsystem more complex than it might at rst appear.The maximum number of IDE controllers that Linux can support is 4.Each con-troller is represented by an ide hwif t data structure in the ide hwifs vector.Eachide hwif t data structure contains two ide drive t data structures, one per pos-sible supported master and slave IDE drive.During the initializing of the IDEsubsystem, Linux rst looks to see if there is information about the disks presentin the system's CMOS memory.This is battery backed memory that does not loseits contents when the PC is powered o.This CMOS memory is actually in thesystem's real time clock device which always runs no matter if your PC is on or o.The CMOS memory locations are set up by the system's BIOS and tell Linux whatIDE controllers and drives have been found.Linux retrieves the found disk's geom-etry from BIOS and uses the information to set up the ide hwif t data structurefor this drive.More modern PCs use PCI chipsets such as Intel's 82430 VX chipsetwhich includes a PCI EIDE controller.The IDE subsystem uses PCI BIOS call-backs to locate the PCI E IDE controllers in the system.It then calls PCI speci cinterrogation routines for those chipsets that are present.Once each IDE interface or controller has been discovered, its ide hwif t is set upto re ect the controllers and attached disks.During operation the IDE driver writescommands to IDE command registers that exist in the I O memory space.Thedefault I O address for the primary IDE controller's control and status registers is0x1F0 - 0x1F7.These addresses were set by convention in the early days of the IBMPC.The IDE driver registers each controller with the Linux block bu er cache andVFS, adding it to the blk dev and blkdevs vectors respectively.The IDE drive willalso request control of the appropriate interrupt.Again these interrupts are set byconvention to be 14 for the primary IDE controller and 15 for the secondary IDEcontroller.However, they like all IDE details, can be overridden by command lineoptions to the kernel.The IDE driver also adds a gendisk entry into the list ofgendisk's discovered during boot for each IDE controller found.This list will laterbe used to discover the partition tables of all of the hard disks found at boot time.The partition checking code understands that IDE controllers may each control twoIDE disks.8.5.3 SCSI DisksThe SCSI Small Computer System Interface bus is an e cient peer-to-peer databus that supports up to eight devices per bus, including one or more hosts.Eachdevice has to have a unique identi er and this is usually set by jumpers on the disks.Data can be transfered synchronously or asynchronously between any two deviceson the bus and with 32 bit wide data transfers up to 40 Mbytes per second arepossible.The SCSI bus transfers both data and state information between devices,and a single transaction between an initiator and a target can involve up to eightdistinct phases.You can tell the current phase of a SCSI bus from ve signals fromthe bus.The eight phases are:BUS FREE No device has control of the bus and there are no transactions currentlyhappening,ARBITRATION A SCSI device has attempted to get control of the SCSI bus, itdoes this by asserting its SCSI identifer onto the address pins.The highestnumber SCSI identi er wins
[ Pobierz całość w formacie PDF ] zanotowane.pldoc.pisz.plpdf.pisz.plmikr.xlx.pl
|