Subject: patch for fs/btrfs/super.c in 2.6.32.19
From: Corey Wright <undefined@pobox.com>
Date: Mon, 16 Aug 2010 12:45:23 -0500
Mon, 16 Aug 2010 12:45:23 -0500
the attached patch should replace the patches to fs/btrfs/super.c within
patch-2.6.32.17-vs2.3.0.36.29.4.diff to allow it to correctly apply to
2.6.32.19.  after applying the patch the kernel builds (where before it
stopped with errors about "info" undefined in btrfs_parse_early_options).

patch-2.6.32.17-vs2.3.0.36.29.4.diff applies to 2.6.32.19 without any
failures (well, except for patching EXTRAVERSION in Makefile), but patch
(the application) really messes things up in fs/btrfs/super.c by fuzzing
the third patch to that file and applying it to the wrong function
(btrfs_parse_early_options instead of btrfs_parse_options).  the addition
of the Opt_err case at the end of btrfs_parse_options's switch statement
seems to be what confused patch, though why patch thought
btrfs_parse_early_options's switch statement was the better match is not
readily apparent to me.

last night i looked in http://vserver.13thfloor.at/Experimental/ for a
patch to 2.6.32.19 and the irc logs for references to "btrfs", but i
didn't see anything, so i presume this is new and useful.

corey
-- 
undefined@pobox.com


--- linux-2.6.32.19/fs/btrfs/super.c	2010-08-16 10:52:40.000000000 -0500
+++ linux-2.6.32.19-vs2.3.0.36.29.4/fs/btrfs/super.c	2010-08-16 12:06:46.000000000 -0500
@@ -67,7 +67,7 @@ enum {
 	Opt_max_extent, Opt_max_inline, Opt_alloc_start, Opt_nobarrier,
 	Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl,
 	Opt_compress, Opt_notreelog, Opt_ratio, Opt_flushoncommit,
-	Opt_discard, Opt_err,
+	Opt_tag, Opt_notag, Opt_tagid, Opt_discard, Opt_err,
 };
 
 static match_table_t tokens = {
@@ -90,6 +90,9 @@ static match_table_t tokens = {
 	{Opt_flushoncommit, "flushoncommit"},
 	{Opt_ratio, "metadata_ratio=%d"},
 	{Opt_discard, "discard"},
+	{Opt_tag, "tag"},
+	{Opt_notag, "notag"},
+	{Opt_tagid, "tagid=%u"},
 	{Opt_err, NULL},
 };
 
@@ -264,6 +267,22 @@ int btrfs_parse_options(struct btrfs_roo
 		case Opt_discard:
 			btrfs_set_opt(info->mount_opt, DISCARD);
 			break;
+#ifndef CONFIG_TAGGING_NONE
+		case Opt_tag:
+			printk(KERN_INFO "btrfs: use tagging\n");
+			btrfs_set_opt(info->mount_opt, TAGGED);
+			break;
+		case Opt_notag:
+			printk(KERN_INFO "btrfs: disabled tagging\n");
+			btrfs_clear_opt(info->mount_opt, TAGGED);
+			break;
+#endif
+#ifdef CONFIG_PROPAGATE
+		case Opt_tagid:
+			/* use args[0] */
+			btrfs_set_opt(info->mount_opt, TAGGED);
+			break;
+#endif
 		case Opt_err:
 			printk(KERN_INFO "btrfs: unrecognized mount option "
 			       "'%s'\n", p);
@@ -585,6 +604,12 @@ static int btrfs_remount(struct super_bl
 	if (ret)
 		return -EINVAL;
 
+	if (btrfs_test_opt(root, TAGGED) && !(sb->s_flags & MS_TAGGED)) {
+		printk("btrfs: %s: tagging not permitted on remount.\n",
+			sb->s_id);
+		return -EINVAL;
+	}
+
 	if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
 		return 0;