All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Btrfs: make lzo the default compression scheme
@ 2011-05-26  3:39 Li Zefan
  2011-05-27  7:32 ` Sander
  2011-05-28 11:24 ` Chris Mason
  0 siblings, 2 replies; 5+ messages in thread
From: Li Zefan @ 2011-05-26  3:39 UTC (permalink / raw)
  To: linux-btrfs

As the lzo compression feature has been established for quite
a while, we are now ready to replace zlib with lzo as the default
compression scheme.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 fs/btrfs/disk-io.c |    2 +-
 fs/btrfs/ioctl.c   |    2 +-
 fs/btrfs/super.c   |    8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 16d335b..17c9e3a 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1753,7 +1753,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
 	 * In the long term, we'll store the compression type in the super
 	 * block, and it'll be used for per file compression control.
 	 */
-	fs_info->compress_type = BTRFS_COMPRESS_ZLIB;
+	fs_info->compress_type = BTRFS_COMPRESS_LZO;
 
 	ret = btrfs_parse_options(tree_root, options);
 	if (ret) {
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index c4f17e4..a86cc2d 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -747,7 +747,7 @@ static int btrfs_defrag_file(struct file *file,
 	u64 defrag_end = 0;
 	unsigned long i;
 	int ret;
-	int compress_type = BTRFS_COMPRESS_ZLIB;
+	int compress_type = BTRFS_COMPRESS_LZO;
 
 	if (range->flags & BTRFS_DEFRAG_RANGE_COMPRESS) {
 		if (range->compress_type > BTRFS_COMPRESS_TYPES)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index cd0c7cd..ab9fd9c 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -257,12 +257,12 @@ int btrfs_parse_options(struct btrfs_root *root, char *options)
 		case Opt_compress_type:
 			if (token == Opt_compress ||
 			    token == Opt_compress_force ||
-			    strcmp(args[0].from, "zlib") == 0) {
-				compress_type = "zlib";
-				info->compress_type = BTRFS_COMPRESS_ZLIB;
-			} else if (strcmp(args[0].from, "lzo") == 0) {
+			    strcmp(args[0].from, "lzo") == 0) {
 				compress_type = "lzo";
 				info->compress_type = BTRFS_COMPRESS_LZO;
+			} else if (strcmp(args[0].from, "zlib") == 0) {
+				compress_type = "zlib";
+				info->compress_type = BTRFS_COMPRESS_ZLIB;
 			} else {
 				ret = -EINVAL;
 				goto out;
-- 
1.7.3.1


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

* Re: [PATCH] Btrfs: make lzo the default compression scheme
  2011-05-26  3:39 [PATCH] Btrfs: make lzo the default compression scheme Li Zefan
@ 2011-05-27  7:32 ` Sander
  2011-05-27  7:41   ` Fajar A. Nugraha
  2011-05-28 11:24 ` Chris Mason
  1 sibling, 1 reply; 5+ messages in thread
From: Sander @ 2011-05-27  7:32 UTC (permalink / raw)
  To: Li Zefan; +Cc: linux-btrfs

Li Zefan wrote (ao):
> As the lzo compression feature has been established for quite
> a while, we are now ready to replace zlib with lzo as the default
> compression scheme.

Please be aware that grub2 currently can't load files from a btrfs with
lzo compression (on debian sid/experimental at least).

Just found out the hard way after a kernel upgrade on a system with no
separate /boot partition :-)

Found this: https://bugs.archlinux.org/task/23901

	Sander

-- 
Humilis IT Services and Solutions
http://www.humilis.net

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

* Re: [PATCH] Btrfs: make lzo the default compression scheme
  2011-05-27  7:32 ` Sander
@ 2011-05-27  7:41   ` Fajar A. Nugraha
  2011-05-28  5:12     ` C Anthony Risinger
  0 siblings, 1 reply; 5+ messages in thread
From: Fajar A. Nugraha @ 2011-05-27  7:41 UTC (permalink / raw)
  To: sander; +Cc: Li Zefan, linux-btrfs

On Fri, May 27, 2011 at 2:32 PM, Sander <sander@humilis.net> wrote:
> Li Zefan wrote (ao):
>> As the lzo compression feature has been established for quite
>> a while, we are now ready to replace zlib with lzo as the default
>> compression scheme.
>
> Please be aware that grub2 currently can't load files from a btrfs with
> lzo compression (on debian sid/experimental at least).
>
> Just found out the hard way after a kernel upgrade on a system with no
> separate /boot partition :-)
>
> Found this: https://bugs.archlinux.org/task/23901

IIRC what matters is compression actually used by the files.
If /boot/grub/* and kernel/initrd is not compressed, or compressed
with zlib, then grub2 can read it just fine, even when the filesystem
is usually mounted with -o compress=lzo (I'm using Ubuntu Natty).

I think the move to use lzo compression by default is a good thing, since:
- it's superior performance-wise to zlib
- btrfs is not really recommended (yet) for production uses, so it's
valid enough to assume users brave enough to use btrfs will know the
necessary workarounds (like having separate /boot, or temporary
remount with -o compress=zlib when upgrading kernel)
- even if by accident you ended with unbootable system due to lzo, you
can "fix" it using livecd and "btrfs filesystem defragment" to force
the needed files to be uncompressed/compressed with zlib.

-- 
Fajar

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

* Re: [PATCH] Btrfs: make lzo the default compression scheme
  2011-05-27  7:41   ` Fajar A. Nugraha
@ 2011-05-28  5:12     ` C Anthony Risinger
  0 siblings, 0 replies; 5+ messages in thread
From: C Anthony Risinger @ 2011-05-28  5:12 UTC (permalink / raw)
  To: Fajar A. Nugraha; +Cc: sander, Li Zefan, linux-btrfs

On Fri, May 27, 2011 at 2:41 AM, Fajar A. Nugraha <list@fajar.net> wrote:
> On Fri, May 27, 2011 at 2:32 PM, Sander <sander@humilis.net> wrote:
>> Li Zefan wrote (ao):
>>> As the lzo compression feature has been established for quite
>>> a while, we are now ready to replace zlib with lzo as the default
>>> compression scheme.
>>
>> Please be aware that grub2 currently can't load files from a btrfs with
>> lzo compression (on debian sid/experimental at least).
>>
>> Just found out the hard way after a kernel upgrade on a system with no
>> separate /boot partition :-)
>>
>> Found this: https://bugs.archlinux.org/task/23901
>
> IIRC what matters is compression actually used by the files.
> If /boot/grub/* and kernel/initrd is not compressed, or compressed
> with zlib, then grub2 can read it just fine, even when the filesystem
> is usually mounted with -o compress=lzo (I'm using Ubuntu Natty).
>
> I think the move to use lzo compression by default is a good thing, since:
> - it's superior performance-wise to zlib
> - btrfs is not really recommended (yet) for production uses, so it's
> valid enough to assume users brave enough to use btrfs will know the
> necessary workarounds (like having separate /boot, or temporary
> remount with -o compress=zlib when upgrading kernel)
> - even if by accident you ended with unbootable system due to lzo, you
> can "fix" it using livecd and "btrfs filesystem defragment" to force
> the needed files to be uncompressed/compressed with zlib.

i'd agree with the LZO default and everything else you've said, but i
was bitten by this too :-)

in my case however, i was using syslinux, and even though /boot was
not compressed syslinux still failed with something like:

"Found compressed data! cannot continue!"

... or similar, i don't recall exactly.  funny thing is, if i typed
out the full kernel boot line (which was super annoying for about a
week until i updated to a separate /boot) the system would start up
just fine ... so i don't know if syslinux was checking the incompat
bit or what, but it failed even though the files themselves were
technically ok.

something for others to keep in mind at the least.

C Anthony

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

* Re: [PATCH] Btrfs: make lzo the default compression scheme
  2011-05-26  3:39 [PATCH] Btrfs: make lzo the default compression scheme Li Zefan
  2011-05-27  7:32 ` Sander
@ 2011-05-28 11:24 ` Chris Mason
  1 sibling, 0 replies; 5+ messages in thread
From: Chris Mason @ 2011-05-28 11:24 UTC (permalink / raw)
  To: linux-btrfs

Excerpts from Li Zefan's message of 2011-05-25 23:39:03 -0400:
> As the lzo compression feature has been established for quite
> a while, we are now ready to replace zlib with lzo as the default
> compression scheme.

Just FYI I plan to take this for rc2.

-chris

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

end of thread, other threads:[~2011-05-28 11:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-26  3:39 [PATCH] Btrfs: make lzo the default compression scheme Li Zefan
2011-05-27  7:32 ` Sander
2011-05-27  7:41   ` Fajar A. Nugraha
2011-05-28  5:12     ` C Anthony Risinger
2011-05-28 11:24 ` Chris Mason

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.