Skip to contentSkip to conversation

block_device_operations

Linux-ia64 Guangyu Fang 2 participants 2 messages May 16, 2000

lore
Share & tools
lore
#0 lore raw

Hi,

I'm using TurboLinux 2.3.99-pre6-000501-18. Since <linux/fs.h> has the following definition:

struct block_device_operations {
	int (*open) (struct inode *, struct file *);
	int (*release) (struct inode *, struct file *);
	int (*ioctl) (struct inode *, struct file *, unsigned, unsigned
long);
	int (*check_media_change) (kdev_t);
	int (*revalidate) (kdev_t);
};

Does it mean that block device can not do read/write operations? Is there any work around?

Thanks.

Gary

#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Guangyu Fang

Gary> Hi, I'm using TurboLinux 2.3.99-pre6-000501-18. Since Gary> <linux/fs.h> has the following definition:

Gary> struct block_device_operations { int (*open) (struct inode *, Gary> struct file *); int (*release) (struct inode *, struct file Gary> *); int (*ioctl) (struct inode *, struct file *, unsigned, Gary> unsigned long); int (*check_media_change) (kdev_t); int Gary> (*revalidate) (kdev_t); };

Gary> Does it mean that block device can not do read/write Gary> operations? Is there any work around?

Yup, the Linux kernel developers recently discovered that they can get an infinite speed up in disk read/write bandwidth by not doing the I/O at all. With gobs of memory, how needs disks anyhow? ;-)

Seriously though: I/O is done through I/O requests. There is (at least) one request queue per major device number. The request function is defined in <linux/blk.h>. For example, drivers/ide/hd.c does:

	blk_init_queue(BLK_DEFAULT_QUEUE(MAJOR_NR), DEVICE_REQUEST);

and if you look at blk.h, this will expand into:

	blk_init_queue(&blk-dev[MAJOR_NR].request_queue, do_hd_request);

Hope this resolves the mystery.

	--david