btrfs and mount in gentoo linux

2014-07-08 Thread Stefan G. Weichinger

Hello, btrfs-mailing-list,

I already tried to contact Chris Mason via pm but so far I didn't get a
reply so I taking this approach now:

I am a happy btrfs-user with gentoo linux for some time now and noticed
that the command mount does not show me which subvolid is mounted where.

eg.

# mount | grep sda2

/dev/sda2 on /mnt/btrfs_pool1 type btrfs
(rw,noatime,compress=lzo,ssd,space_cache)

/dev/sda2 on /mnt/oopsfiles type btrfs
(rw,noatime,compress=lzo,ssd,space_cache)

/dev/sda2 on /home type btrfs (rw,noatime,compress=lzo,ssd,space_cache)

See?

I filed a bug against util-linux at bugs.gentoo.org:

https://bugs.gentoo.org/show_bug.cgi?id=510148

but as you see from Comment 5 it isn't resolved yet due to don't know ;-)


Can you tell me where the problem/solution might be located?
Is it a known behavior in a way ... ?

Thanks for looking into it, I appreciate it ... I will then see to
report things back at the gentoo bugzilla to help improving btrfs
support in gentoo!

Regards, Stefan
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Fwd: btrfs Wiki account request

2014-07-08 Thread Sjon Hortensius
I wrote a simple alternative for a script that is currently on the
btrfs wiki (for showing quotas) in bash instead of Python. I have
attempted to add this to the page but after entering the captcha 15
times my account was rejected because of a missing bio. Maybe someone
can add this to https://btrfs.wiki.kernel.org/index.php/Quota_support:

#!/bin/bash

[[ ! -d $1 ]]  { echo Please pass mountpoint as first argument 2 ;
exit 1 ; }

while read x i x g x x l x p
do
volName[i]=$p
done  (btrfs subvolume list $1)

while read g r e
do
[[ -z $name ]]  echo -e subvol\tqgroup\ttotal\tunshared
group=${g##*/}
[[ ! -z ${volName[group]} ]]  name=${volName[group]} || name='(unknown)'
echo $name $g `numfmt --to=iec $r` `numfmt --to=iec $e`
done  (btrfs qgroup show $1 | tail -n+3) | column -t

Thanks,
Sjon

On Tue, Feb 4, 2014 at 5:38 PM, MediaWiki Mail wikiad...@kernel.org wrote:
 Sorry, your request for an account Sjon Hortensius has been rejected on 
 btrfs Wiki.

 try again with a useful bio

 There may be contact lists on site that you can use if you want to know more 
 about user account policy.
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs and mount in gentoo linux

2014-07-08 Thread Holger Hoffstätte

On Tue, 08 Jul 2014 21:07:30 +0200, Stefan G. Weichinger wrote:

 I am a happy btrfs-user with gentoo linux for some time now and noticed
 that the command mount does not show me which subvolid is mounted where.

Interestingly I just found that this came up in Fedora some time ago:
https://bugzilla.redhat.com/show_bug.cgi?id=743118

findmnt seems to do the trick, so the underlying functionality in
libmnt seems to work. Maybe Debian's mount does something differently?

Holger

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs and mount in gentoo linux

2014-07-08 Thread Chris Murphy

On Jul 8, 2014, at 1:07 PM, Stefan G. Weichinger li...@xunil.at wrote:
 
 Can you tell me where the problem/solution might be located?
 Is it a known behavior in a way … ?

It's known. Ubuntu has a patch so that mount shows subvolume names. This 
information is probably available on Gentoo with cat /proc/self/mountinfo.


Chris Murphy

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] btrfs-progs: ignore orphaned qgroups by default

2014-07-08 Thread Mark Fasheh
qgroup items are not deleted by btrfs when the underlying subvolume goes
away. As a result, btrfsck will print those as inconsistent. This can
clutter up the printout so we ignore them by default. They are still printed
if a full report (via --qgroup-report) is requested.

This patch and the ones it depends on (to do qgroup verification) can be
found at:

https://github.com/markfasheh/btrfs-progs-patches/tree/qgroup-verify

Signed-off-by: Mark Fasheh mfas...@suse.de
---
 qgroup-verify.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/qgroup-verify.c b/qgroup-verify.c
index 81a1651..2e1716d 100644
--- a/qgroup-verify.c
+++ b/qgroup-verify.c
@@ -38,6 +38,7 @@ static void add_bytes(u64 root_objectid, u64 num_bytes, int 
exclusive);
 
 struct qgroup_count {
u64 qgroupid;
+   int subvol_exists;
 
struct btrfs_disk_key   key;
struct btrfs_qgroup_info_item   diskinfo;
@@ -697,8 +698,10 @@ static int load_quota_info(struct btrfs_fs_info *info)
 {
int ret;
struct btrfs_root *root = info-quota_root;
+   struct btrfs_root *tmproot;
struct btrfs_path path;
struct btrfs_key key;
+   struct btrfs_key root_key;
struct btrfs_disk_key disk_key;
struct extent_buffer *leaf;
struct btrfs_qgroup_info_item *item;
@@ -745,6 +748,15 @@ static int load_quota_info(struct btrfs_fs_info *info)
fprintf(stderr, ERROR: out of memory\n);
goto out;
}
+
+   root_key.objectid = key.offset;
+   root_key.type = BTRFS_ROOT_ITEM_KEY;
+   root_key.offset = (u64)-1;
+   tmproot = btrfs_read_fs_root_no_cache(info, root_key);
+   if (tmproot  !IS_ERR(tmproot)) {
+   count-subvol_exists = 1;
+   free(tmproot);
+   }
}
 
ret = btrfs_next_leaf(root, path);
@@ -1008,7 +1020,7 @@ static void print_qgroup_difference(struct qgroup_count 
*count, int verbose)
 
is_different = excl_diff || ref_diff;
 
-   if (verbose || is_different) {
+   if (verbose || (is_different  count-subvol_exists)) {
printf(Counts for qgroup id: %llu %s\n,
   (unsigned long long)count-qgroupid,
   is_different ? are different : );
-- 
1.8.4.5

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs and mount in gentoo linux

2014-07-08 Thread Stefan G. Weichinger
Am 08.07.2014 22:20, schrieb Chris Murphy:
 
 On Jul 8, 2014, at 1:07 PM, Stefan G. Weichinger li...@xunil.at wrote:

 Can you tell me where the problem/solution might be located?
 Is it a known behavior in a way … ?
 
 It's known. Ubuntu has a patch so that mount shows subvolume names. 
 This information is probably available on Gentoo with cat 
 /proc/self/mountinfo.


Unfortunately no.

See example from my laptop:

# grep btrfs /proc/self/mountinfo
14 0 0:14 /rootfs / rw,noatime shared:1 - btrfs /dev/sda3
rw,compress=lzo,ssd,space_cache

51 14 0:14 / /mnt/uncow rw,noatime shared:19 - btrfs /dev/sda3
rw,compress=lzo,ssd,space_cache

156 14 0:35 / /home/sgw rw,noatime shared:117 - btrfs
/dev/mapper/_dev_sda4 rw,compress=lzo,ssd,space_cache


for reference: the subvols are:

# btrfs su list /
ID 256 gen 7982 top level 5 path rootfs
ID 275 gen 3972 top level 5 path __snapshots
ID 283 gen 3274 top level 275 path __snapshots/rootfs_2014_06_14
ID 288 gen 7465 top level 5 path uncow


What does the Ubuntu patch apply to? util-linux?

Thanks! Stefan

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs and mount in gentoo linux

2014-07-08 Thread Stefan G. Weichinger
Am 08.07.2014 22:19, schrieb Holger Hoffstätte:
 
 On Tue, 08 Jul 2014 21:07:30 +0200, Stefan G. Weichinger wrote:
 
 I am a happy btrfs-user with gentoo linux for some time now and noticed
 that the command mount does not show me which subvolid is mounted where.
 
 Interestingly I just found that this came up in Fedora some time ago:
 https://bugzilla.redhat.com/show_bug.cgi?id=743118
 
 findmnt seems to do the trick, so the underlying functionality in
 libmnt seems to work. Maybe Debian's mount does something differently?

findmnt does not fully show the subvolids or names:


# findmnt  | grep btrfs
//dev/sda3[/rootfs]btrfs
rw,noatime,compress=lzo,ssd,space_cache
├─/mnt/uncow /dev/sda3 btrfs
rw,noatime,compress=lzo,ssd,space_cache
└─/home/sgw  /dev/mapper/_dev_sda4 btrfs
rw,noatime,compress=lzo,ssd,space_cache

The [/rootfs] is something in the right direction ...

S
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs and mount in gentoo linux

2014-07-08 Thread Chris Murphy

On Jul 8, 2014, at 2:50 PM, Stefan G. Weichinger li...@xunil.at wrote:

 Am 08.07.2014 22:20, schrieb Chris Murphy:
 
 On Jul 8, 2014, at 1:07 PM, Stefan G. Weichinger li...@xunil.at wrote:
 
 Can you tell me where the problem/solution might be located?
 Is it a known behavior in a way … ?
 
 It's known. Ubuntu has a patch so that mount shows subvolume names. 
 This information is probably available on Gentoo with cat 
 /proc/self/mountinfo.
 
 
 Unfortunately no.
 
 See example from my laptop:
 
 # grep btrfs /proc/self/mountinfo
 14 0 0:14 /rootfs / rw,noatime shared:1 - btrfs /dev/sda3
 rw,compress=lzo,ssd,space_cache
 
 51 14 0:14 / /mnt/uncow rw,noatime shared:19 - btrfs /dev/sda3
 rw,compress=lzo,ssd,space_cache
 
 156 14 0:35 / /home/sgw rw,noatime shared:117 - btrfs
 /dev/mapper/_dev_sda4 rw,compress=lzo,ssd,space_cache

Well it looks to me you have used mount -o subvol=rootfs for the first 
instance, but you've not mounted a subvolume at /mnt/uncow and /home/sgw.

What kernel version is this? And I thought the kernel was entirely responsible 
for the contents of /proc?

http://ur1.ca/hpk57
The fourth column lists subvol names.

 
 What does the Ubuntu patch apply to? util-linux?

No idea.

Chris Murphy--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Btrfs: use BUG_ON

2014-07-08 Thread Himangi Saraogi
Use BUG_ON(x) rather than if(x) BUG();

The semantic patch that fixes this problem is as follows:

// smpl
@@ identifier x; @@
-if (x) BUG();
+BUG_ON(x);
// /smpl

Signed-off-by: Himangi Saraogi himangi...@gmail.com
Acked-by: Julia Lawall julia.law...@lip6.fr
---
 fs/btrfs/volumes.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 6104676..63e746e 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -2623,8 +2623,8 @@ again:
   found_key.offset);
if (ret == -ENOSPC)
failed++;
-   else if (ret)
-   BUG();
+   else
+   BUG_ON(ret);
}
 
if (found_key.offset == 0)
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs and mount in gentoo linux

2014-07-08 Thread Qu Wenruo


 Original Message 
Subject: Re: btrfs and mount in gentoo linux
From: Stefan G. Weichinger li...@xunil.at
To: linux-btrfs@vger.kernel.org
Date: 2014年07月09日 04:52

Am 08.07.2014 22:19, schrieb Holger Hoffstätte:

On Tue, 08 Jul 2014 21:07:30 +0200, Stefan G. Weichinger wrote:


I am a happy btrfs-user with gentoo linux for some time now and noticed
that the command mount does not show me which subvolid is mounted where.

Interestingly I just found that this came up in Fedora some time ago:
https://bugzilla.redhat.com/show_bug.cgi?id=743118

findmnt seems to do the trick, so the underlying functionality in
libmnt seems to work. Maybe Debian's mount does something differently?

findmnt does not fully show the subvolids or names:


# findmnt  | grep btrfs
//dev/sda3[/rootfs]btrfs
rw,noatime,compress=lzo,ssd,space_cache
├─/mnt/uncow /dev/sda3 btrfs
rw,noatime,compress=lzo,ssd,space_cache
└─/home/sgw  /dev/mapper/_dev_sda4 btrfs
rw,noatime,compress=lzo,ssd,space_cache

The [/rootfs] is something in the right direction ...
The bug is that, if you don't use 'subvol=' mount option but use default 
subvolume or 'subvolid=' mount option,

findmnt will not give the output.

Since 'subvol=' mount option differs from default subvolume mount or 
'subvolid=' mount option in calling behavior,

'subvol=' uses mount_subtree() vfs call, which records subtree mount info.
On the other hand, default subvolume mount or 'subvolid=' mount does not 
go through the vfs subtree mount

but use btrfs's implement, which does not report vfs submount.

I'll try to investigate further and find whether we can fix it to show 
more info.


Thanks,
Qu


S
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html