Compression of large files

Atila Romero
2009-05-27T14:10:09Z

During a file write, if the compression doesn't proves to be economical
to a portion of the file, the whole file is marked as nocompress, and
subsequent writes don't use compression at all. This can be seen as a
feature, as it saves CPU in files like videos. But if the file is a dd
image of a disk, or other types of large files, this behavior is
undesirable, since different portions of the file will have different
compression ratios.
I only became aware of this after searching the source code, after
spending some hours trying to find out why the compression wasn't
working. This can be a really unexpected behavior for a end user who is
looking for compression.
The specific part of the code is at inode.c:
477 <#l477>
/* flag the file so we don't compress in the future */
478 <#l478> btrfs_set_flag(inode, NOCOMPRESS);

How about commenting line 478?

Atila