Messages in this thread | | | Date | Wed, 14 Jan 2009 15:43:46 +0100 | From | Jens Axboe <> | Subject | Re: ext2 + -osync: not as easy as it seems |
| |
On Wed, Jan 14 2009, Theodore Tso wrote: > On Wed, Jan 14, 2009 at 03:08:04PM +0100, Jens Axboe wrote: > > > > It also guarentees that when you get a completion for that barrier > > write, it's on safe storage. Think of it as a flush-write-flush > > operation, in the presence of write back caching. > > > > Is that true even if the barrier isn't attached to a write operation, > i.e., when using > > blkdev_issue_flush(sb, NULL); > > ?
No, since there's no specific write to protect in that case. The above will flush existing writes to platter, but has no bearing on writes submitted later (other than the obvious effect that they will be on disk later then previously submitted writes). So for blkdev_issue_flush(), when that returns with good status, then the writes are safe. In the absence of the barrier flag on a write, completion of that write may just mean that the disk drive is aware of it, not that it is in any way safe.
The hardware may even treat the flush as a noop and do absolutely nothing, which is perfectly valid if it guarantees us that it will never lose a submitted write.
-- Jens Axboe
| |