On 1/3/14, 9:48 AM, Theodore Ts'o wrote: > On Fri, Jan 03, 2014 at 11:16:02AM +0800, Huang Weller (CM/ESW12-CN) wrote: >> >> It sounds like the barrier test. We wrote such kind test tool >> before, the test program used ioctl(fd, BLKFLSBUF, 0) to set a >> barrier before next write operation. Do you think this ioctl is >> enough ? Because I saw the ext4 use it. I will do the test with that >> tool and then let you know the result. > > The BLKFLSBUF ioctl does __not__ send a CACHE FLUSH command to the > hardware device. It forces all of the dirty buffers in memory to the > storage device, and then it invalidates all the buffer cache, but it > does not send a CACHE FLUSH command to the hardware. Hence, the > hardware is free to write it to its on-disk cache, and not necessarily > guarantee that the data is written to stable store. (For an example > use case of BLKFLSBUF, we use it in e2fsck to drop the buffer cache > for benchmarking purposes.) Are you sure? for a bdev w/ ext4 on it: BLKFLSBUF fsync_bdev sync_filesystem sync_fs ext4_sync_fs blkdev_issue_flush -Eric -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html