diff mbox

Btrfs-progs: Enabled setting root subvolume with subvolid=0

Message ID 1343696005-23703-1-git-send-email-alexander.karbstein@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Karbstein July 31, 2012, 12:53 a.m. UTC
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 <alexander.karbstein@gmail.com>
---
 btrfs_cmds.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

Comments

liubo July 31, 2012, 1:26 a.m. UTC | #1
On 07/31/2012 08:53 AM, Alexander Karbstein wrote:

> 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 <alexander.karbstein@gmail.com>
> ---
>  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);


Seems that you're using an old btrfs-prog source code, now the file is cmds-subvolume.c

And also checkpatch.pl complains about style errors while checking this.

thanks,
liubo
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Karbstein July 31, 2012, 2:09 a.m. UTC | #2
Hello Liu,

thanks, you are so right. I just got it exactly the wrong way (I read
btrfs-progs-unstable and thought this must be the bleeding edge one
;-). I should have read your e-Mail before.
I will revise it asap. But I have to let it wait for tomorrow... Gotta
sleep now.

Best Regards,
Alex


2012/7/31 Liu Bo <liubo2009@cn.fujitsu.com>:
> On 07/31/2012 08:53 AM, Alexander Karbstein wrote:
>
>> 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 <alexander.karbstein@gmail.com>
>> ---
>>  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);
>
>
> Seems that you're using an old btrfs-prog source code, now the file is cmds-subvolume.c
>
> And also checkpatch.pl complains about style errors while checking this.
>
> thanks,
> liubo
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Karbstein July 31, 2012, 5:11 p.m. UTC | #3
Hello everybody,

here is my revised patch free from checkpatch warnings and based on the right
git tree.

Alexander Karbstein (1):
  Btrfs-progs: Enabled setting root subvolume with subvolid=0

 cmds-subvolume.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff mbox

Patch

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);