fdatasync() does not work

  • Follow


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(sleep is not an option).

Any clue why?

Please assist…. 

 

Adnan Abbas
0
Reply adnanx (4) 10/5/2004 8:42:38 PM

In article <d1ac3351.0410051242.436fdc05@posting.google.com>,
 adnanx@gmail.com (Adnan Abbas) wrote:

> Hi,
> 
> I have a problem useing fdatasync()&#8230;
> 
> 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)

> 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(sleep is not an option).
> 
> Any clue why?

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
0
Reply jwadams (47) 10/5/2004 8:59:04 PM


Adnan Abbas <adnanx@gmail.com> wrote:
> I have a problem useing fdatasync()&#8230;

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

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@physik.fu-berlin.de
   \__________________________  http://www.toerring.de
0
Reply Jens.Toerring (807) 10/5/2004 9:03:45 PM

2 Replies
25 Views

(page loaded in 0.064 seconds)


Reply: