Re: O_DIRECT

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

 



On Wed, 21 Jul 2004 11:01:20 -0700
Shesha Sreenivasamurthy <shesha@xxxxxxxxxxx> wrote:

Hi Shesha,

> ohhh OK, if the block size is 4096, then the read/write size must be 
> integer multiple of 4096 ??? is it ???
> In general should the read/write length be a multiple of block size?

Yes, see my previous emails.

	greetings,
	Rob van Nieuwkerk

> Rob van Nieuwkerk wrote:
> 
> >On Wed, 21 Jul 2004 10:10:26 -0700
> >Shesha Sreenivasamurthy <shesha@xxxxxxxxxxx> wrote:
> >
> >Hi Shesha,
> >
> >You don't mention what the *size* of your read()/write() is.
> >Besides a requirement on the alignment of the read/write buffer
> >the size of the read()/write() must also be OK.
> >
> >	greetings,
> >	Rob van Nieuwkerk
> >
> >  
> >
> >>This is what I found ....
> >>
> >>Our driver sets the block size to be 4096. so BLKBSZGET will return 
> >>4096. So if I allin the memory at 4096 boundary, I cannot read using 
> >>O_DIRECT. But, if I set the block size to 512.  I can read/write 
> >>successfully. It also works with 1024, but no with 4096
> >>
> >>So the recepie what I am following is ...
> >>
> >>BLKBSZGET -> Get original block size
> >>BLKBSZSET ->  Set the block size to 512
> >>READ | WRITE Successfully ;)
> >>BLKBSZSET ->  Set back to the original block size
> >>
> >>-Shesha
> >>
> >>Rob van Nieuwkerk wrote:
> >>
> >>    
> >>
> >>>On Tue, 20 Jul 2004 10:27:57 -0700
> >>>Shesha Sreenivasamurthy <shesha@xxxxxxxxxxx> wrote:
> >>>
> >>>Hi Shesha,
> >>>
> >>> 
> >>>
> >>>      
> >>>
> >>>>I am having trouble with O_DIRECT. Trying to read or write from a block 
> >>>>device partition.
> >>>>
> >>>>1. Can O_DIRECT be used on a plain block device partition say 
> >>>>"/dev/sda11" without having a filesystem on it.
> >>>>   
> >>>>
> >>>>        
> >>>>
> >>>yes.
> >>>
> >>> 
> >>>
> >>>      
> >>>
> >>>>2. If no file system is created then what should be the softblock size. 
> >>>>I am using the IOCTL "BLKBSZGET". Is this correct?
> >>>>   
> >>>>
> >>>>        
> >>>>
> >>>yes.
> >>>
> >>> 
> >>>
> >>>      
> >>>
> >>>>3. Can we use SEEK_END with O_DIRECT on a partition without filesystem.
> >>>>   
> >>>>
> >>>>        
> >>>>
> >>>yes.
> >>>
> >>>I'm using these exact things in an application.
> >>>
> >>>Note that with 2.4 kernels the "granularity" you can use for offset
> >>>and r/w size is the softblock size (*).  For 2.6 the requirements are
> >>>much more relaxed: it's the device blocksize (typically 512 byte).
> >>>
> >>>(*): actually one of offset or r/w size has a smaller minimum if
> >>>I remember correctly.  Don't remember which one.  But if you assume
> >>>the softblock size as a minimum for both you're allways safe.
> >>>
> >>>	greetings,
> >>>	Rob van Nieuwkerk
> >>>
> >>>--
> >>>Kernelnewbies: Help each other learn about the Linux kernel.
> >>>Archive:       http://mail.nl.linux.org/kernelnewbies/
> >>>FAQ:           http://kernelnewbies.org/faq/
> >>>
> >>>
> >>>.
> >>>
> >>> 
> >>>
> >>>      
> >>>
> >
> >--
> >Kernelnewbies: Help each other learn about the Linux kernel.
> >Archive:       http://mail.nl.linux.org/kernelnewbies/
> >FAQ:           http://kernelnewbies.org/faq/
> >
> >
> >.
> >
> >  
> >
> 

--
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