Re: Block Device arrays Relation?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/4/05, Xiangfei Jia <xjianz@xxxxxxxxx> wrote:
>
>  For block devices, the "blkdevs" array is used to hold all the registered
> block device drivers, and the maximum number of allowed block drivers is
> 255. There is another hash table array called "bdev_hashtable", which is
> array of struct "block_device".
>
>  I'm quite confused with these two arrays. (1) what is the relationship
> between the "blkdevs" and the "bdev_hashtable"??

blkdevs is an array used internally by block_dev.c (block-device
layer) to keep track of registered block devices whereas
bdev_hashtable array of type list-head is used to keep information
related to block_device in a hash formed which actually hold the
struct block_device type pointers/nodes (field bd_hash)

>  (2) Why a extra sruct, called "block_device" is necessary to be used?
>

struct block_device is actually there for keeping information about
the block_devices like bd_count (how-many times block_device is
claimed through bdget function), bd_inode is the inode having
data/fields filled with the block_device information see bdget
function (http://lxr.linux.no/source/fs/block_dev.c?v=2.4.28#L331),
bd_openers is used to keep track of how many times block_device is
opened and so other fields too used to keep information related to
block_device usage. Just look for struct block_device fields used in
block_dev.c file ...

I hope my explaination might clear some doubts for you !

By the way these blkdevs and bdev_hashtable (due to their limitations)
are removed in 2.6.xx series kernels



--
Fawad Lateef

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux