public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] Btrfs: set a compat flag when setting default subvol
  2009-12-17 21:40 [PATCH] Btrfs: set a compat flag when setting default subvol Josef Bacik
@ 2009-12-17 21:30 ` Chris Mason
  0 siblings, 0 replies; 2+ messages in thread
From: Chris Mason @ 2009-12-17 21:30 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-btrfs

On Thu, Dec 17, 2009 at 04:40:24PM -0500, Josef Bacik wrote:
> This is just to mark the fs that it's been tinkered with to set the default
> subvolume.  It's a compatible change because older kernels will just ignore the
> default setting and mount the same thing they always have.  Thanks,

I actually don't think this is a compatible change.  If someone mounts
under 2.6.33 and gets one filesystem, they will expect the same FS under
2.6.32.  We should make sure they get what they expect or a friendly
error message.

-chris

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

* [PATCH] Btrfs: set a compat flag when setting default subvol
@ 2009-12-17 21:40 Josef Bacik
  2009-12-17 21:30 ` Chris Mason
  0 siblings, 1 reply; 2+ messages in thread
From: Josef Bacik @ 2009-12-17 21:40 UTC (permalink / raw)
  To: linux-btrfs

This is just to mark the fs that it's been tinkered with to set the default
subvolume.  It's a compatible change because older kernels will just ignore the
default setting and mount the same thing they always have.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
---
 fs/btrfs/ctree.h |    5 ++++-
 fs/btrfs/ioctl.c |    8 ++++++++
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 917211b..fa8a3e7 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -371,7 +371,10 @@ struct btrfs_super_block {
  */
 #define BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF	(1ULL << 0)
 
-#define BTRFS_FEATURE_COMPAT_SUPP		0ULL
+#define BTRFS_FEATURE_COMPAT_DEFAULT_SUBVOL	(1ULL << 0)
+
+#define BTRFS_FEATURE_COMPAT_SUPP		\
+	BTRFS_FEATURE_COMPAT_DEFAULT_SUBVOL
 #define BTRFS_FEATURE_COMPAT_RO_SUPP		0ULL
 #define BTRFS_FEATURE_INCOMPAT_SUPP		\
 	BTRFS_FEATURE_INCOMPAT_MIXED_BACKREF
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 81d8378..6a78711 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1563,6 +1563,8 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
 	struct btrfs_path *path;
 	struct btrfs_key location;
 	struct btrfs_disk_key disk_key;
+	struct btrfs_super_block *disk_super;
+	u64 features;
 	u64 objectid = 0;
 	u64 dir_id;
 
@@ -1610,6 +1612,12 @@ static long btrfs_ioctl_default_subvol(struct file *file, void __user *argp)
 	btrfs_mark_buffer_dirty(path->nodes[0]);
 	btrfs_free_path(path);
 
+	disk_super = &root->fs_info->super_copy;
+	features = btrfs_super_compat_flags(disk_super);
+	if (!(features & BTRFS_FEATURE_COMPAT_DEFAULT_SUBVOL)) {
+		features |= BTRFS_FEATURE_COMPAT_DEFAULT_SUBVOL;
+		btrfs_set_super_compat_flags(disk_super, features);
+	}
 	btrfs_end_transaction(trans, root);
 
 	return 0;
-- 
1.5.4.3


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

end of thread, other threads:[~2009-12-17 21:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-17 21:40 [PATCH] Btrfs: set a compat flag when setting default subvol Josef Bacik
2009-12-17 21:30 ` Chris Mason

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