linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: fix incompat flags setting
@ 2012-01-17  7:00 Li Zefan
  0 siblings, 0 replies; 2+ messages in thread
From: Li Zefan @ 2012-01-17  7:00 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org; +Cc: Andi Kleen

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [PATCH] Btrfs: fix incompat flags setting
@ 2012-06-11  9:10 Li Zefan
  0 siblings, 0 replies; 2+ messages in thread
From: Li Zefan @ 2012-06-11  9:10 UTC (permalink / raw)
  To: linux-btrfs@vger.kernel.org

It's a bug, but it happens to work, as BTRFS_COMPRESS_LZO == 2, which
has only one bit set.

Signed-off-by: Li Zefan <lizefan@huawei.com>
---
 fs/btrfs/disk-io.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 7ae51de..fe82070 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2118,7 +2118,7 @@ int 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;
 
 	/*
-- 
1.7.9.7

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

end of thread, other threads:[~2012-06-11  9:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-17  7:00 [PATCH] Btrfs: fix incompat flags setting Li Zefan
  -- strict thread matches above, loose matches on Subject: below --
2012-06-11  9:10 Li Zefan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).