On 09/12/2010 07:41 PM, Tejun Heo wrote:
Hello,
On 09/12/2010 10:38 AM, Tao Ma wrote:
According to Documentation/block/barrier.txt,
QUEUE_ORDERED_DRAIN
Requests are ordered by draining the request queue and cache
flushing isn't needed.
Sequence: drain => barrier
QUEUE_ORDERED_DRAIN_FLUSH
Requests are ordered by draining the request queue and both
pre-barrier and post-barrier cache flushings are needed.
Sequence: drain => preflush => barrier => postflush
And for loop device, it call fsync in barrier request. See do_bio_filebacked in drivers/block/loop.c
bool barrier = !!(bio->bi_rw& REQ_HARDBARRIER);
struct file *file = lo->lo_backing_file;
if (barrier) {
if (unlikely(!file->f_op->fsync)) {
ret = -EOPNOTSUPP;
goto out;
}
ret = vfs_fsync(file, 0);
if (unlikely(ret)) {
ret = -EIO;
goto out;
}
}
So actually the sync is done in barrier and no extra flush is needed?
Or Do I misread the rules in barrier.txt?
Hmmm... maybe the doc was a bit confusing. Any device which has
writeback cache should have FLUSH in the queue ordered configuration.
The loop device used vfs_fsync() for cache flushing and didn't support
ordered sequence. As such, it should use draining for request
ordering and suports FLUSH, so the mode to use is DRAIN_FLUSH.
oh, thanks for the explanation.
Regards,
Tao
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html