All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>
Subject: [PATCH] Btrfs: fix incompat flags setting
Date: Tue, 17 Jan 2012 15:00:41 +0800	[thread overview]
Message-ID: <4F151C99.9000503@cn.fujitsu.com> (raw)

The new snappy code reveals this old bug in btrfs, which happened to
work for LZO.

	# mkfs.btrfs /dev/loop2
	# mount /dev/loop2
	# umount /mnt
	# btrfsck /dev/loop2
	couldn't open because of unsupported option features (10).

The corresponding incompat flag was set, though we didn't mount with
snappy enabled.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---

This patch is for the snappy branch.

---
 fs/btrfs/disk-io.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 5924163..27101e4 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2115,9 +2115,9 @@ struct btrfs_root *open_ctree(struct super_block *sb,
 
 	features = btrfs_super_incompat_flags(disk_super);
 	features |= BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF;
-	if (tree_root->fs_info->compress_type & BTRFS_COMPRESS_LZO)
+	if (tree_root->fs_info->compress_type == BTRFS_COMPRESS_LZO)
 		features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_LZO;
-	if (tree_root->fs_info->compress_type & BTRFS_COMPRESS_SNAPPY)
+	if (tree_root->fs_info->compress_type == BTRFS_COMPRESS_SNAPPY)
 		features |= BTRFS_FEATURE_INCOMPAT_COMPRESS_SNAPPY;
 	btrfs_set_super_incompat_flags(disk_super, features);
 
-- 
1.7.3.1


             reply	other threads:[~2012-01-17  7:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-17  7:00 Li Zefan [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-06-11  9:10 [PATCH] Btrfs: fix incompat flags setting Li Zefan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F151C99.9000503@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=andi@firstfloor.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.