From patchwork Thu Dec 17 21:40:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 68554 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBI4ixwE005715 for ; Fri, 18 Dec 2009 04:47:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1765371AbZLQVYo (ORCPT ); Thu, 17 Dec 2009 16:24:44 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1765360AbZLQVYo (ORCPT ); Thu, 17 Dec 2009 16:24:44 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4438 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1765335AbZLQVYn (ORCPT ); Thu, 17 Dec 2009 16:24:43 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBHLOgfP017477 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 17 Dec 2009 16:24:42 -0500 Received: from dhcp231-156.rdu.redhat.com (dhcp231-156.rdu.redhat.com [10.11.231.156]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBHLOgbQ026401 for ; Thu, 17 Dec 2009 16:24:42 -0500 Date: Thu, 17 Dec 2009 16:40:24 -0500 From: Josef Bacik To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: set a compat flag when setting default subvol Message-ID: <20091217214024.GC4122@dhcp231-156.rdu.redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org 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;