fdatasync() does not work

A

Adnan Abbas

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
 
J

Jonathan Adams

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

Jens.Toerring

Adnan Abbas said:
I have a problem useing fdatasync()…
This is how it goes.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,147
Messages
2,570,833
Members
47,377
Latest member
MableYocum

Latest Threads

Top