public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* About block device request function.
@ 2002-01-10 21:27 Michael Zhu
  2002-01-11  6:42 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Zhu @ 2002-01-10 21:27 UTC (permalink / raw)
  To: linux-kernel

Hi, I have a question of the block device request
function. I use the following sentences to change the
request function of a block device.

spin_lock_irq(&io_request_lock);

original_make_request_fn =
blk_dev[i].request_queue.make_request_fn;

blk_dev[i].request_queue.make_request_fn =
kti_make_request_fn;

spin_unlock_irq(&io_request_lock);

"i" is the major number of a block device.

You know blk_dev[] is the global block device array.
When I use those sentences to change the floppy block
device's request function, it works. The major number
of the floppy disk is 2. But when I use the same one
to change the hard disk's request function, it doesn't
work. I found that the
blk_dev[3].request_queue.make_request_fn is NULL. Does
that mean that the make_request_fn() of the hard disk
is NULL. I can't believe it. Can anyone give me an
answer?

Michael


______________________________________________________________________ 
Web-hosting solutions for home and business! http://website.yahoo.ca

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: About block device request function.
  2002-01-10 21:27 Michael Zhu
@ 2002-01-11  6:42 ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2002-01-11  6:42 UTC (permalink / raw)
  To: Michael Zhu; +Cc: linux-kernel

On Thu, Jan 10 2002, Michael Zhu wrote:
> Hi, I have a question of the block device request
> function. I use the following sentences to change the
> request function of a block device.
> 
> spin_lock_irq(&io_request_lock);
> 
> original_make_request_fn =
> blk_dev[i].request_queue.make_request_fn;
> 
> blk_dev[i].request_queue.make_request_fn =
> kti_make_request_fn;
> 
> spin_unlock_irq(&io_request_lock);
> 
> "i" is the major number of a block device.
> 
> You know blk_dev[] is the global block device array.
> When I use those sentences to change the floppy block
> device's request function, it works. The major number
> of the floppy disk is 2. But when I use the same one
> to change the hard disk's request function, it doesn't
> work. I found that the
> blk_dev[3].request_queue.make_request_fn is NULL. Does
> that mean that the make_request_fn() of the hard disk
> is NULL. I can't believe it. Can anyone give me an
> answer?

Read drivers/block/ll_rw_blk.c:blk_get_queue() -- either a driver uses
the statically allocated per-major queue, or it provides its own and
defines a get_queue function to return it.

You are still heading in the wrong direction :/

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: About block device request function
@ 2002-01-11 13:53 Michael Zhu
  2002-01-11 13:57 ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Zhu @ 2002-01-11 13:53 UTC (permalink / raw)
  To: axboe; +Cc: linux-kernel

On Thu, Jan 10 2002, Jens Axboe wrote:
> 
> Read drivers/block/ll_rw_blk.c:blk_get_queue() -- >
> either a driver uses
> the statically allocated per-major queue, or it > >
> provides its own and
> defines a get_queue function to return it.
> 
> You are still heading in the wrong direction :/

You mean that I am still in the wrong direction? I
need to use the loop device to implement my project?
Can you give me the right directions? Thank you very
much.

Regards,

Michael



______________________________________________________________________ 
Web-hosting solutions for home and business! http://website.yahoo.ca

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: About block device request function
  2002-01-11 13:53 About block device request function Michael Zhu
@ 2002-01-11 13:57 ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2002-01-11 13:57 UTC (permalink / raw)
  To: Michael Zhu; +Cc: linux-kernel

On Fri, Jan 11 2002, Michael Zhu wrote:
> On Thu, Jan 10 2002, Jens Axboe wrote:
> > 
> > Read drivers/block/ll_rw_blk.c:blk_get_queue() -- >
> > either a driver uses
> > the statically allocated per-major queue, or it > >
> > provides its own and
> > defines a get_queue function to return it.
> > 
> > You are still heading in the wrong direction :/
> 
> You mean that I am still in the wrong direction? I
> need to use the loop device to implement my project?

For the 3rd time, yes!

> Can you give me the right directions? Thank you very
> much.

Look at the internation crypto patches for loop, there are oodles of
examples for you to look at.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-01-11 13:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-11 13:53 About block device request function Michael Zhu
2002-01-11 13:57 ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2002-01-10 21:27 Michael Zhu
2002-01-11  6:42 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox