public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* Compression of large files
@ 2009-05-27 14:10 Atila Romero
  2009-05-27 14:41 ` Chris Mason
  0 siblings, 1 reply; 2+ messages in thread
From: Atila Romero @ 2009-05-27 14:10 UTC (permalink / raw)
  To: linux-btrfs

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Compression of large files
  2009-05-27 14:10 Compression of large files Atila Romero
@ 2009-05-27 14:41 ` Chris Mason
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Mason @ 2009-05-27 14:41 UTC (permalink / raw)
  To: Atila Romero; +Cc: linux-btrfs

On Wed, May 27, 2009 at 11:10:09AM -0300, Atila Romero wrote:
> 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?

The plan is to add a flag for the file to make it always compress even
when parts of the file do not compress well.

-chris


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-27 14:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-27 14:10 Compression of large files Atila Romero
2009-05-27 14:41 ` Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox