Advertisement Advanced thin client solution for Linux, based on Open Source. Mix Windows and Linux applications on the same desktop.
Weekly Edition Return to the Kernel pageSponsored link Serve your customers, not your servers, with VERIO Linux VPS. Full-access test-drive here. |
Examining a kobject hierarchy
At the root of the block subsystem hierarchy is a subsystem called
block_subsys; it is defined in drivers/block/genhd.c. As
you'll recall from The Zen of Kobjects, a
Each kset contains its own kobject, and block_subsys is no exception. In this case, the kobject's parent field is explicitly set to NULL (indicated by the ground symbol in the picture). As a result, this kobject will be represented in the top level of the sysfs hierarchy; it is the kobject which lurks behind /sys/block.
Things do not end there, however; a gendisk structure is a complicated
thing. It contains, among other things, an array of partition entries (of
type struct hd_struct),
each of which has embedded within it, yes, a kobject. The parent of each
As you can see, the kobject type of a partition is ktype_part. This type implements the attributes you will see in the sysfs entries for each partition, including the starting block number and size.
The request queue and I/O scheduler information in sysfs is currently
read-only. There is no reason, however, why sysfs attributes could not be
used to change I/O scheduling parameters on the fly. The selectable I/O scheduler patch uses sysfs
attributes to change I/O schedulers completely, for example.
Putting it all together
So far, we have seen a number of disconnected pieces. The full diagram can
be found on this page; it
is a bit wide to be placed inline with the text (a small, illegible
version appears to the right). Also on that page, you'll
find a corresponding diagram showing the sysfs names the correspond to each
kobject.
The data structure as described is the full implementation of the /sys/block subtree of sysfs. The full sysfs tree contains rather more than this, of course. For each gendisk which shows up under /sys/block, there will be a separate entry under /sys/devices which describes the underlying hardware. Internally, the link between the two is contained in the driverfs_dev field of the gendisk structure. In sysfs, that link is represented as a symbolic link between the two sub-trees. Hopefully this series of pictures helps in the visualization of a portion of the sysfs tree and the device model data structure that implements it. The device model brings a great deal of apparent complexity, but, once the underlying concepts are grasped, the whole thing is approachable. (Log in to post comments)
legible images Posted Nov 1, 2003 1:45 UTC (Sat) by roelofs (subscriber, #2599) [Link] a small, illegible version appears to the rightIt could be more legible than it is with proper resizing (or, more specifically, with proper resampling). I happen to be most familiar with XV, so I'll describe how to do it there, but I know other viewer/converters (and the GIMP) have similar capabilities. In XV, make sure the mode is set to 24-bit (even for a palette image like this--smooth resizing requires more colors), set the size to whatever you like ("S" key or Image Size -> Set Size), smooth the reduced image ("s" key or Display -> Smooth), and then save it. As a PNG this will come out in RGB mode, but you can then reopen the small image, change the mode back to 8-bit, and save it as a colormapped PNG for a file-size reduction with minimal quality loss. Not everything in this particular image will be readable, but the legend certainly will be, as will much of the other text. Greg
Examining a kobject hierarchy Posted Nov 11, 2003 1:08 UTC (Tue) by mmarq (guest, #2332) [Link] Just a ideia.Unfortunately i cant tell by the source (i dont think so) if the I2O Linux kernel implementation follows the V2 spec defined at (http://www.intelligent-io.com/specs_resources/V2.0_spec.pdf ), but wouldn't it be grand if this, here exposed, 2.5 driver model could overlap, in the future with the I2O model at the communications level,..., that is, in a future Linux 3.0(?) spilt driver model, a "regular" driver module could "talk" with a I2O driver without any special translation layer or any other craft! IMO whats missing in this 2.5 driver model is a communications mechanism between the various "subsystems" or " driver specific kobjects", because of multi-purposed hardware and combo peripherals... So Why Not ? A "special" subsystem that implements "at least" a "host MessengerInstance" type of I2O V2 made of kobjects, so that this messaging layer could be used by a kind of kobjects driver model and at the same time by the I2O model... IMO this messaging layer rocks at the thecnical front, and also as it says in the draft spec paper: A sure anti lock-in, and future prove model,... No wonder M$ that had backed it with Intel droped it in the recycle bin,... Could also mean a great help for stoping the lack of support from the hardware industry to the Linux project.
|
Copyright © 2003, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.