lkml.org 
[lkml]   [2004]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: O_DIRECT
    On Wed, 21 Jul 2004 10:10:26 -0700
    Shesha Sreenivasamurthy <shesha@inostor.com> 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@inostor.com> 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/
    > >
    > >
    > >.
    > >
    > >
    > >
    >
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 14:04    [W:0.027 / U:65.456 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site