Re: Why is fsync so much slower than O_SYNC?

From: Jeffrey Siegal
Date: Thu Mar 18 2004 - 10:46:25 EST


Andrew Morton wrote:
This is because ext3 is being dumb. It is forcing a journal commit even
when the inode has not been altered.

Here's a moderately-tested 2.6 fix. A 2.4 fix would be similar.


File overwrite:

vmm:/mnt/hda5> ~/fsync-is-sucky O_SYNC:
Creating
Starting
iter = 1000, latency = 0.191464ms

O_DSYNC:
Creating
Starting
iter = 1000, latency = 0.181637ms

fsync:
Creating
Starting
iter = 1000, latency = 0.186326ms

fdatasync:
Creating
Starting
iter = 1000, latency = 0.193013ms

Hmm, this doesn't seem right. For an overwrite, it should still be waiting for just the data page to be written out, and that should take about 8ms (for a 7200rpm drive), and the append case should take longer, since it requires writing both the data page and then the journal.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/