Re: btrfs and write barriers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2019/4/2 上午3:22, Hendrik Friedel wrote:
> Dear btrfs-team,
> 
> I am aware, that barriers are essential for btrfs [1].
> I have some questions on that topic:
> 1) I am not aware how to determine, whether barriers are supported,
> except for searching dmesg for a message that barriers are disabled. Is
> that correct? It would be nice, if that could be determined before
> creating the FS.

That wiki line of barrier is out of date in fact.

The truth is, spec of SATA/SCSI/NVMe forces all devices to support at
least FLUSH (to flush all cached data in the controller to disk or
another persistent cache).

For the FUA (you can consider it as atomic write), if the controller
doesn't support it, kernel will emulate it by FLUSH/WRITE/FLUSH.

So even you see something like the following from dmesg:
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't
support DPO or FUA

It means nothing wrong. Don't panic.

In fact, for most SATA devices, libata disable FUA by default.
And all other fs is OK with FLUSH only.

> 2) I find the location of the (only?) warning -dmesg- well hidden. I
> think it would be better to notify the user when creating the file-system.
> 3) Even more, it would be good, if btrfs would disable the write cache
> in that case, so that one does not need to rely on the user

Personally speaking, if user really believes it's write cache causing
the problem or want to be extra safe, then they should disable cache.

As long as FLUSH is implemented without problem, the only faulty part is
btrfs itself and I haven't found any proof of either yet.

Thanks,
Qu

> 4) If [2] is still valid, there are drives 'lying' about their barrier
> support. Can someone comment? If that is the case, it would be even
> advisable to provide a test to test the actual capability. In fact, if
> this is still valid, this may be the reason for some btrfs corruptions
> that have been discussed here. [I did read, that LVM/Device-Mapper does
> not support barriers, but I think that this is outdated]
> 
> Greetings,
> Hendrik
> 
> 
> [1]
> https://btrfs.wiki.kernel.org/index.php/FAQ#I_see_a_warning_in_dmesg_about_barriers_being_disabled_when_mounting_my_filesystem._What_does_that_mean.3F
> 
> [2] https://brad.livejournal.com/2116715.html
> 

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux