fdatasync() does not work

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Adnan Abbas

    #1

    fdatasync() does not work

    Hi,

    I have a problem useing fdatasync()…

    This is how it goes.

    Setup:

    I have an external device connected through Firewire,
    I am running Redhat 2.4.
    I write to it in raw initiated mode (no File System)



    Scenario:

    I open the device using open() get a file descriptor. (flag set to
    O_SYNC)
    I write a block in a while loop using write()
    I call fdatasync() and check for success response in each loop
    I close using close()

    Now in this code if I disconnect the firewire cable during the loop I
    loose all the data.

    This tells me fdatasync() did not work. however if i have a 1sec sleep
    after each write i do get all the data on my disk but kills the
    throughput(slee p is not an option).

    Any clue why?

    Please assist….



    Adnan Abbas
  • Jonathan Adams

    #2
    Re: fdatasync() does not work

    In article <d1ac3351.04100 51242.436fdc05@ posting.google. com>,
    adnanx@gmail.co m (Adnan Abbas) wrote:
    [color=blue]
    > Hi,
    >
    > I have a problem useing fdatasync()…
    >
    > This is how it goes.
    >
    > Setup:
    >
    > I have an external device connected through Firewire,
    > I am running Redhat 2.4.
    > I write to it in raw initiated mode (no File System)[/color]
    [color=blue]
    > I open the device using open() get a file descriptor. (flag set to
    > O_SYNC)
    > I write a block in a while loop using write()
    > I call fdatasync() and check for success response in each loop
    > I close using close()
    >
    > Now in this code if I disconnect the firewire cable during the loop I
    > loose all the data.
    >
    > This tells me fdatasync() did not work. however if i have a 1sec sleep
    > after each write i do get all the data on my disk but kills the
    > throughput(slee p is not an option).
    >
    > Any clue why?[/color]

    Perhaps you should go to a Linux group -- this is a heavily
    platform-specific bug, and is off-topic for comp.lang.c.

    Cheers,
    - jonathan

    Comment

    • Jens.Toerring@physik.fu-berlin.de

      #3
      Re: fdatasync() does not work

      Adnan Abbas <adnanx@gmail.c om> wrote:[color=blue]
      > I have a problem useing fdatasync()…[/color]
      [color=blue]
      > This is how it goes.[/color]
      [color=blue]
      > Setup:[/color]
      [color=blue]
      > I have an external device connected through Firewire,
      > I am running Redhat 2.4.
      > I write to it in raw initiated mode (no File System)[/color]

      As have already been told that kind of stuff is off-topic here.
      <OT> Read the man page for fdatasync() carefully, perhaps you
      get an idea once you realize that it's talking about "files"
      all of the time and you compare that to the "(no File System)"
      you wrote yourself above. Add to that that a device file isn't
      a normal regular file.</OT>
      Regards, Jens
      --
      \ Jens Thoms Toerring ___ Jens.Toerring@p hysik.fu-berlin.de
      \______________ ____________ http://www.toerring.de

      Comment

      Working...