mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: block device/VM question
@ 2002-08-29  5:45 Peter T. Breuer
  0 siblings, 0 replies; 14+ messages in thread
From: Peter T. Breuer @ 2002-08-29  5:45 UTC (permalink / raw)
  To: thunder; +Cc: linux kernel

"A month of sundays ago ptb wrote:"
> "A month of sundays ago ptb wrote:"
> > "A month of sundays ago Thunder from the hill wrote:"
> > > > And for the O_DIRECT flag we seem to do alloc_kiovec(1, &f->f_iobuf).
> > > 
> > > Perhaps we should go biovec here?

I've now tried opening the ram disk device O_DIRECT in 2.4.19. Same result
as on my driver: every write returns EINVAL.

How does one use O_DIRECT? It needs driver support?

Peter

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: block device/VM question
@ 2002-08-28 14:38 Peter T. Breuer
  0 siblings, 0 replies; 14+ messages in thread
From: Peter T. Breuer @ 2002-08-28 14:38 UTC (permalink / raw)
  To: linux kernel; +Cc: Thunder from the hill

"A month of sundays ago ptb wrote:"
> "A month of sundays ago Thunder from the hill wrote:"
> > > And for the O_DIRECT flag we seem to do alloc_kiovec(1, &f->f_iobuf).
> > 
> > Perhaps we should go biovec here?

State of play:

1) I abandoned doing the dentry_open with O_DIRECT flags bit
from within the driver, because every external access then errored
with EINVAL without getting to my driver functions.

2) I then just tried opening the device normally from userspace
but with O_DIRECT set. This is harder than it should have been - I had
to set nearly everything in features.h on before I got the desired
compilation (was it _XOPEN_SOURCE that did it? I forget), and surprise,
surprise, I get exactly the same effects as in (1). Every access
errors with EINVAL and my driver code never gets called. An open
with code compiled without O_DIRECT works fine, as usual.

I put a little debugging in the driver open call. With O_DIRECT
in the userspace open:

#881[12]: _open have O_DIRECT iobuf 0xcf935000 for part 0
#883[12]: _open have i_mapping 0xcce7f874 for part 0
#885[12]: _open have a_ops 0xc029ef40 for part 0
#889[12]: _open have direct_IO 0xc013edc0 for part 0

(I presume the latter is generic_file_direct_IO - it's not in my
map, but it's static so shouldn't be).

and without:

#881[14]: _open have ~O_DIRECT iobuf 0x0 for part 0
#883[14]: _open have i_mapping 0xcce7f874 for part 0
#885[14]: _open have a_ops 0xc029ef40 for part 0
#889[14]: _open have direct_IO 0xc013edc0 for part 0

So it looks as though some driver cooperation is required in
order for direct_IO/O_DIRECT to work.

What? Anyone know?


Peter

^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: block device/VM question
@ 2002-08-27 18:40 Peter T. Breuer
  0 siblings, 0 replies; 14+ messages in thread
From: Peter T. Breuer @ 2002-08-27 18:40 UTC (permalink / raw)
  To: ptb; +Cc: Thunder from the hill, linux kernel

"ago ptb wrote:"
> In dentry_open(), we get a struct file f = get_empty_filp(), and then
> fill out various of its fields with enormously obscure things.  And for
> the O_DIRECT flag we seem to do alloc_kiovec(1, &f->f_iobuf).
> 
> I feel that the latter is all I want to do, and the question is to what,
> where (I'll clean up on release). Do I do this every time the devices
> _open() function is called? Or just once, and what do I do it to? I
> should do it to the struct file that gets passed into to the driver
> open()? I'll try that. And set the flag.

Well, that was fun! I checked that on entry into the devices
open function, the file->f_iobuf field was null, and then called
alloc_kiovec on it while I set the O_DIRECT flag on file-_f_flags.

The result was that all read/write calls on the device failed
with EINVAL! Whee!

But ioctls worked. Apparently I am supposed to fill out
some more fields of something else with some methods. Hmm. OK.
I'll look. I guess this will be the a_ops field of i_mapping.


Peter


^ permalink raw reply	[flat|nested] 14+ messages in thread
[parent not found: <Pine.LNX.4.44.0208271100460.3234-100000@hawkeye.luckynet.adm>]
[parent not found: <Pine.LNX.4.44.0208271021020.3234-100000@hawkeye.luckynet.adm>]
* Re: block device/VM question
@ 2002-08-27 11:28 Peter T. Breuer
  0 siblings, 0 replies; 14+ messages in thread
From: Peter T. Breuer @ 2002-08-27 11:28 UTC (permalink / raw)
  To: linux-kernel

PTB  wrote:
> Is there any way of turning off VMS caching for a block device?

Well, I've been reading the 2.5.31 code, and it looks like if
the block device node is opened O_DIRECT and it has an
i_mapping->a_ops->direct_IO method, then file systems will use it
for read/write and won't go thorgh VMS.  I'll investigate.

Does anyone have a pointer for where to go in the 2.4 code?

Peter

^ permalink raw reply	[flat|nested] 14+ messages in thread
* block device/VM question
@ 2002-08-27  8:58 Peter T. Breuer
  2002-08-27 16:06 ` Thunder from the hill
  0 siblings, 1 reply; 14+ messages in thread
From: Peter T. Breuer @ 2002-08-27  8:58 UTC (permalink / raw)
  To: linux kernel

Hi

Is there any way of turning off VMS caching for a block device?

I want all reads to come down to the driver, where I decide what to do
about them.  I don't want reads to read locally cached buffers in VMS
unless I say so.  The reason is that the device might have a remote
writer.

I'll have a look at the raw character device later (but I recall
having looked before without it telling me anything - probably
they make a fake request and transfer it to the device queue
directly and treat the return with their own substituted end_req).
I need a block device - I can't mount a character device. Now
there's an idea! A mouse represented as a file system ..

Peter

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

end of thread, other threads:[~2002-08-29  5:41 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Pine.LNX.4.44.0208271118000.3234-100000@hawkeye.luckynet.adm>
2002-08-27 18:04 ` block device/VM question Peter T. Breuer
2002-08-27 19:13   ` Thunder from the hill
2002-08-27 19:28     ` Peter T. Breuer
2002-08-29  5:45 Peter T. Breuer
  -- strict thread matches above, loose matches on Subject: below --
2002-08-28 14:38 Peter T. Breuer
2002-08-27 18:40 Peter T. Breuer
     [not found] <Pine.LNX.4.44.0208271100460.3234-100000@hawkeye.luckynet.adm>
2002-08-27 17:12 ` Peter T. Breuer
     [not found] <Pine.LNX.4.44.0208271021020.3234-100000@hawkeye.luckynet.adm>
2002-08-27 16:32 ` Peter T. Breuer
2002-08-27 16:42   ` Thunder from the hill
2002-08-27 16:57     ` Peter T. Breuer
2002-08-27 11:28 Peter T. Breuer
2002-08-27  8:58 Peter T. Breuer
2002-08-27 16:06 ` Thunder from the hill
2002-08-27 16:14   ` Peter T. Breuer

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

all inboxes | Powered by JetHome®