linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: Using O_DIRECT for file writing in a kernel module
@ 2005-02-12 14:26 Hanson, Jonathan M
  0 siblings, 0 replies; 3+ messages in thread
From: Hanson, Jonathan M @ 2005-02-12 14:26 UTC (permalink / raw)
  To: arjan; +Cc: linux-kernel

On Fri, 2005-02-11 at 17:58 -0700, Hanson, Jonathan M wrote:
> 	I'm trying to write to a file with the O_DIRECT flag from a
> kernel module in a 2.4 series of kernel on x86 hardware. I've learned
> that the O_DIRECT flag requires that the amount of data written and
the
> file offset pointer must be multiples of the underlying "block size."


ehhh why are you writing to a file from a kernel module? That's
generally considered a really bad idea....

[Jon M. Hanson] For what I'm doing I have no other choice but to write
to a file from my kernel module.


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

* Re: Using O_DIRECT for file writing in a kernel module
  2005-02-12  0:58 Hanson, Jonathan M
@ 2005-02-12  3:32 ` Arjan van de Ven
  0 siblings, 0 replies; 3+ messages in thread
From: Arjan van de Ven @ 2005-02-12  3:32 UTC (permalink / raw)
  To: Hanson, Jonathan M; +Cc: linux-kernel

On Fri, 2005-02-11 at 17:58 -0700, Hanson, Jonathan M wrote:
> 	I'm trying to write to a file with the O_DIRECT flag from a
> kernel module in a 2.4 series of kernel on x86 hardware. I've learned
> that the O_DIRECT flag requires that the amount of data written and the
> file offset pointer must be multiples of the underlying "block size."


ehhh why are you writing to a file from a kernel module? That's
generally considered a really bad idea....



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

* Using O_DIRECT for file writing in a kernel module
@ 2005-02-12  0:58 Hanson, Jonathan M
  2005-02-12  3:32 ` Arjan van de Ven
  0 siblings, 1 reply; 3+ messages in thread
From: Hanson, Jonathan M @ 2005-02-12  0:58 UTC (permalink / raw)
  To: linux-kernel

	I'm trying to write to a file with the O_DIRECT flag from a
kernel module in a 2.4 series of kernel on x86 hardware. I've learned
that the O_DIRECT flag requires that the amount of data written and the
file offset pointer must be multiples of the underlying "block size."
	To try things out I've been successful is writing to a file with
O_DIRECT in user space using multiples of PAGE_SIZE.
	However, when I try to do the same from my kernel module I'm
always greeted with an -EINVAL as the return code from the write call
when trying multiples of PAGE_SIZE. Then I realized that the kernel uses
four megabyte pages and not four kilobyte pages so I tried passing four
megabytes of data to the write call but also got -EINVAL in return.
	Is it possible to use O_DIRECT to write a file from a kernel
module? If so, what size of data do I need to pass so that it will work?
I've been through Google and the kernel source code but didn't see an
answer as to the size required to get it to work.
	Thanks in advance for any assistance offered.


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

end of thread, other threads:[~2005-02-12 14:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-12 14:26 Using O_DIRECT for file writing in a kernel module Hanson, Jonathan M
  -- strict thread matches above, loose matches on Subject: below --
2005-02-12  0:58 Hanson, Jonathan M
2005-02-12  3:32 ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).