From patchwork Tue Jul 31 00:53:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Karbstein X-Patchwork-Id: 1256841 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id EE9973FCFC for ; Tue, 31 Jul 2012 00:54:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754743Ab2GaAyq (ORCPT ); Mon, 30 Jul 2012 20:54:46 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:56014 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754336Ab2GaAyp (ORCPT ); Mon, 30 Jul 2012 20:54:45 -0400 Received: by weyx8 with SMTP id x8so3987052wey.19 for ; Mon, 30 Jul 2012 17:54:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=pWFk9HIfoE6UO/DNLndHE6FRG6usOo1w58JdNQ35wQs=; b=o77IBYlQCb/c/iHXHng6aWEIUZSYz6spX2fKWtGxh89dJ7KfCGDVTIX3jQZBgGG+qB Ds6O2pHiF/XBC7n19rrpo/cmFK44R1hoHdutaSeFo0Kgm3XDxc8FWzyy7Sn2usmSaLQU Pg5J5VccGHRR8CzJBpqMpshnks5Vi9ahkFqn5FI4uf3zm5IicfRkWXYlS7Wfb9s6QlvT K8cBBmi1A3cYVvkepyJ99Ly5EdvXRCigJuRXxJlycLTSZTs+b/gBK1jAMOMAtADRIsiV 6d8Na2L7hsO+xlC7ZFBDbwpn8rK0Wa54bwc5AgdBjB2pM+10wAs0/nF5yJzt/Pmku1PI v9Ig== Received: by 10.216.140.15 with SMTP id d15mr6036367wej.204.1343696084128; Mon, 30 Jul 2012 17:54:44 -0700 (PDT) Received: from localhost.localdomain (ovid.karbstein.net. [95.129.51.85]) by mx.google.com with ESMTPS id l6sm3785384wiz.4.2012.07.30.17.54.42 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 30 Jul 2012 17:54:42 -0700 (PDT) From: Alexander Karbstein To: linux-btrfs@vger.kernel.org Cc: Alexander Karbstein Subject: [PATCH] Btrfs-progs: Enabled setting root subvolume with subvolid=0 Date: Tue, 31 Jul 2012 00:53:25 +0000 Message-Id: <1343696005-23703-1-git-send-email-alexander.karbstein@gmail.com> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The command btrfs subvolume set-default 0 /path/to/fs changed the default subvolume to whatever subvolume was currently mounted on /path/to/fs. This patch changes this behaviour to set the default subvolume to BTRFS_FS_TREE_OBJECTID in case the user asks for subvolid=0 Signed-off-by: Alexander Karbstein --- btrfs_cmds.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/btrfs_cmds.c b/btrfs_cmds.c index f2b6355..699d9b0 100644 --- a/btrfs_cmds.c +++ b/btrfs_cmds.c @@ -964,6 +964,11 @@ int do_set_default_subvol(int nargs, char **argv) fprintf(stderr, "ERROR: invalid tree id (%s)\n",subvolid); return 30; } + + /* Using the original root fs tree */ + if (objectid == 0ULL) { + objectid = BTRFS_FS_TREE_OBJECTID; + } ret = ioctl(fd, BTRFS_IOC_DEFAULT_SUBVOL, &objectid); e = errno; close(fd);