lkml.org 
[lkml]   [2016]   [Sep]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: Block-level access
    From
    Date
    On 09/01/2016 02:48 PM, Alex Austin wrote:
    > CC'ing linux-scsi and linux-block.
    >
    > Also, please CC me in replies.
    >
    > On Thu, Sep 1, 2016 at 4:43 PM, Alex Austin <aaustin@oceantechonline.com> wrote:
    >> Hello,
    >> What is the most performant way to directly interface with an attached hard
    >> drive? I've so far used read()/write() on /dev/sd_ but I find error handling
    >> exceedingly difficult, as I don't always even get errors reported, even if the
    >> open() call includes O_DIRECT. I've also used ioctl(SG_IO), but find that it's
    >> extremely slow due to the lack of queuing support in the API. Is there a
    >> mid-level API that will get me decent error handling while allowing command
    >> queuing, or do I just need to make multiple threads all doing separate SG_IO
    >> ioctls?

    What the most efficient way is to interface is with a hard drive depends
    on the I/O pattern. Are you aware that buffered I/O performs read-ahead?
    Have you already tried to tune the read-ahead setting (blockdev --getra
    / blockdev --setra)?

    BTW, if you need an example of how to queue SG_IO, you are welcome to
    have a look at the fio source code. You will probably be interested in
    the bsg API. See e.g. https://lwn.net/Articles/174469/.

    Bart.

    \
     
     \ /
      Last update: 2016-09-17 09:58    [W:4.131 / U:0.000 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site