4

Assume that we don't invoke additional mount options like nodatacow and nodatasum. Operate only at file attributes level, which are controlled with lsattr/chattr.

  1. Does setting No_COW on a file (chattr +C) imply disabling data checksumming on it? The same way as mount options behave (nodatacow implies nodatasum).
  2. May it disable checksumming only for newly written extents and keep for reading existing ones?

1 Answer 1

4

1. Yes, setting No_COW on empty file does imply disabling data checksumming of it.

It's because you can't update the data and the checksum atomically -- at some point in the writing process, they must be inconsistent. This is considered a Bad Thing.

Setting No_COW on non-empty file currently not possible (see #2).

The conclusion is that disabling CoW on a per-file basis also loses checksum correctness of such file. This is not very obvious for a new user of Btrfs, and I think must be added to Btrfs wiki.

2. No, No_COW cannot be set on a non-empty file, so chattr +C cannot trigger checksumming for extents.

You can only usefully set +C on a file with no extents.

So by definition there won't be any pre-existing checksummed extents in that file.


This answer is a summary based on Btrfs mailing list discussion.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .