All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: du: fix to skip not btrfs dir/file
@ 2016-07-06 12:25 Wang Shilong
  2016-07-06 13:35 ` Holger Hoffstätte
  0 siblings, 1 reply; 8+ messages in thread
From: Wang Shilong @ 2016-07-06 12:25 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba, wangshilong1991

'btrfs file du' is a very useful tool to watch my system
file usage with snapshot aware.

when trying to run following commands:
[root@localhost btrfs-progs]# btrfs file du /
     Total   Exclusive  Set shared  Filename
ERROR: Failed to lookup root id - Inappropriate ioctl for device
ERROR: cannot check space of '/': Unknown error -1

and My Filesystem looks like this:
[root@localhost btrfs-progs]# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
devtmpfs       devtmpfs   16G     0   16G   0% /dev
tmpfs          tmpfs      16G  368K   16G   1% /dev/shm
tmpfs          tmpfs      16G  1.4M   16G   1% /run
tmpfs          tmpfs      16G     0   16G   0% /sys/fs/cgroup
/dev/sda3      btrfs      60G   19G   40G  33% /
tmpfs          tmpfs      16G  332K   16G   1% /tmp
/dev/sdc       btrfs     2.8T  166G  1.7T   9% /data
/dev/sda2      xfs       2.0G  452M  1.6G  23% /boot
/dev/sda1      vfat      1.9G   11M  1.9G   1% /boot/efi
tmpfs          tmpfs     3.2G   24K  3.2G   1% /run/user/1000

So I installed Btrfs as my root partition, but boot partition
can be other fs.

We can Let btrfs tool aware of this is not a btrfs file or
directory and skip those files, so that someone like me
could just run 'btrfs file du /' to scan all btrfs filesystems.

After patch, it will look like:
   Total   Exclusive  Set shared  Filename
skipping not btrfs dir/file: boot
skipping not btrfs dir/file: dev
skipping not btrfs dir/file: proc
skipping not btrfs dir/file: run
skipping not btrfs dir/file: sys
     0.00B       0.00B           -  //root/.bash_logout
     0.00B       0.00B           -  //root/.bash_profile
     0.00B       0.00B           -  //root/.bashrc
     0.00B       0.00B           -  //root/.cshrc
     0.00B       0.00B           -  //root/.tcshrc

This works for me to analysis system usage and analysis
performaces.

Signed-off-by: Wang Shilong <wangshilong1991@gmail.com>
---
 cmds-fi-du.c   | 11 ++++++++++-
 cmds-inspect.c |  2 +-
 utils.c        |  8 ++++----
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/cmds-fi-du.c b/cmds-fi-du.c
index 12855a5..bf0e62c 100644
--- a/cmds-fi-du.c
+++ b/cmds-fi-du.c
@@ -389,8 +389,17 @@ static int du_walk_dir(struct du_dir_ctxt *ctxt, struct rb_root *shared_extents)
 						  dirfd(dirstream),
 						  shared_extents, &tot, &shr,
 						  0);
-				if (ret)
+				if (ret == -ENOTTY) {
+					fprintf(stdout,
+						"skipping not btrfs dir/file: %s\n",
+						entry->d_name);
+					continue;
+				} else if (ret) {
+					fprintf(stderr,
+						"failed to walk dir/file: %s :%s\n",
+						entry->d_name, strerror(-ret));
 					break;
+				}
 
 				ctxt->bytes_total += tot;
 				ctxt->bytes_shared += shr;
diff --git a/cmds-inspect.c b/cmds-inspect.c
index dd7b9dd..2ae44be 100644
--- a/cmds-inspect.c
+++ b/cmds-inspect.c
@@ -323,7 +323,7 @@ static int cmd_inspect_rootid(int argc, char **argv)
 
 	ret = lookup_ino_rootid(fd, &rootid);
 	if (ret) {
-		error("rootid failed with ret=%d", ret);
+		error("failed to lookup root id: %s", strerror(-ret));
 		goto out;
 	}
 
diff --git a/utils.c b/utils.c
index 578fdb0..f73b048 100644
--- a/utils.c
+++ b/utils.c
@@ -2815,6 +2815,8 @@ path:
 	if (fd < 0)
 		goto err;
 	ret = lookup_ino_rootid(fd, &id);
+	if (ret)
+		error("failed to lookup root id: %s", strerror(-ret));
 	close(fd);
 	if (ret < 0)
 		goto err;
@@ -3497,10 +3499,8 @@ int lookup_ino_rootid(int fd, u64 *rootid)
 	args.objectid = BTRFS_FIRST_FREE_OBJECTID;
 
 	ret = ioctl(fd, BTRFS_IOC_INO_LOOKUP, &args);
-	if (ret < 0) {
-		error("failed to lookup root id: %s", strerror(errno));
-		return ret;
-	}
+	if (ret < 0)
+		return -errno;
 
 	*rootid = args.treeid;
 
-- 
2.7.4


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

* Re: [PATCH] btrfs-progs: du: fix to skip not btrfs dir/file
  2016-07-06 12:25 [PATCH] btrfs-progs: du: fix to skip not btrfs dir/file Wang Shilong
@ 2016-07-06 13:35 ` Holger Hoffstätte
  2016-07-06 15:16   ` Wang Shilong
  2016-07-07  2:43   ` Eric Sandeen
  0 siblings, 2 replies; 8+ messages in thread
From: Holger Hoffstätte @ 2016-07-06 13:35 UTC (permalink / raw)
  To: Wang Shilong, linux-btrfs; +Cc: dsterba

On 07/06/16 14:25, Wang Shilong wrote:
> 'btrfs file du' is a very useful tool to watch my system
> file usage with snapshot aware.
> 
> when trying to run following commands:
> [root@localhost btrfs-progs]# btrfs file du /
>      Total   Exclusive  Set shared  Filename
> ERROR: Failed to lookup root id - Inappropriate ioctl for device
> ERROR: cannot check space of '/': Unknown error -1
> 
> and My Filesystem looks like this:
> [root@localhost btrfs-progs]# df -Th
> Filesystem     Type      Size  Used Avail Use% Mounted on
> devtmpfs       devtmpfs   16G     0   16G   0% /dev
> tmpfs          tmpfs      16G  368K   16G   1% /dev/shm
> tmpfs          tmpfs      16G  1.4M   16G   1% /run
> tmpfs          tmpfs      16G     0   16G   0% /sys/fs/cgroup
> /dev/sda3      btrfs      60G   19G   40G  33% /
> tmpfs          tmpfs      16G  332K   16G   1% /tmp
> /dev/sdc       btrfs     2.8T  166G  1.7T   9% /data
> /dev/sda2      xfs       2.0G  452M  1.6G  23% /boot
> /dev/sda1      vfat      1.9G   11M  1.9G   1% /boot/efi
> tmpfs          tmpfs     3.2G   24K  3.2G   1% /run/user/1000
> 
> So I installed Btrfs as my root partition, but boot partition
> can be other fs.
> 
> We can Let btrfs tool aware of this is not a btrfs file or
> directory and skip those files, so that someone like me
> could just run 'btrfs file du /' to scan all btrfs filesystems.
> 
> After patch, it will look like:
>    Total   Exclusive  Set shared  Filename
> skipping not btrfs dir/file: boot
> skipping not btrfs dir/file: dev
> skipping not btrfs dir/file: proc
> skipping not btrfs dir/file: run
> skipping not btrfs dir/file: sys
>      0.00B       0.00B           -  //root/.bash_logout
>      0.00B       0.00B           -  //root/.bash_profile
>      0.00B       0.00B           -  //root/.bashrc
>      0.00B       0.00B           -  //root/.cshrc
>      0.00B       0.00B           -  //root/.tcshrc
> 
> This works for me to analysis system usage and analysis
> performaces.

This is great, but can we please skip the "skipping .." messages?
Maybe it's just me but I really don't see the value of printing them
when they don't contribute to the result.
They also mess up the display. :)

thanks,
Holger


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

* Re: [PATCH] btrfs-progs: du: fix to skip not btrfs dir/file
  2016-07-06 13:35 ` Holger Hoffstätte
@ 2016-07-06 15:16   ` Wang Shilong
  2016-07-06 15:20     ` Hugo Mills
  2016-07-07  2:43   ` Eric Sandeen
  1 sibling, 1 reply; 8+ messages in thread
From: Wang Shilong @ 2016-07-06 15:16 UTC (permalink / raw)
  To: Holger Hoffstätte; +Cc: linux-btrfs, David Sterba

On Wed, Jul 6, 2016 at 10:35 PM, Holger Hoffstätte
<holger@applied-asynchrony.com> wrote:
> On 07/06/16 14:25, Wang Shilong wrote:
>> 'btrfs file du' is a very useful tool to watch my system
>> file usage with snapshot aware.
>>
>> when trying to run following commands:
>> [root@localhost btrfs-progs]# btrfs file du /
>>      Total   Exclusive  Set shared  Filename
>> ERROR: Failed to lookup root id - Inappropriate ioctl for device
>> ERROR: cannot check space of '/': Unknown error -1
>>
>> and My Filesystem looks like this:
>> [root@localhost btrfs-progs]# df -Th
>> Filesystem     Type      Size  Used Avail Use% Mounted on
>> devtmpfs       devtmpfs   16G     0   16G   0% /dev
>> tmpfs          tmpfs      16G  368K   16G   1% /dev/shm
>> tmpfs          tmpfs      16G  1.4M   16G   1% /run
>> tmpfs          tmpfs      16G     0   16G   0% /sys/fs/cgroup
>> /dev/sda3      btrfs      60G   19G   40G  33% /
>> tmpfs          tmpfs      16G  332K   16G   1% /tmp
>> /dev/sdc       btrfs     2.8T  166G  1.7T   9% /data
>> /dev/sda2      xfs       2.0G  452M  1.6G  23% /boot
>> /dev/sda1      vfat      1.9G   11M  1.9G   1% /boot/efi
>> tmpfs          tmpfs     3.2G   24K  3.2G   1% /run/user/1000
>>
>> So I installed Btrfs as my root partition, but boot partition
>> can be other fs.
>>
>> We can Let btrfs tool aware of this is not a btrfs file or
>> directory and skip those files, so that someone like me
>> could just run 'btrfs file du /' to scan all btrfs filesystems.
>>
>> After patch, it will look like:
>>    Total   Exclusive  Set shared  Filename
>> skipping not btrfs dir/file: boot
>> skipping not btrfs dir/file: dev
>> skipping not btrfs dir/file: proc
>> skipping not btrfs dir/file: run
>> skipping not btrfs dir/file: sys
>>      0.00B       0.00B           -  //root/.bash_logout
>>      0.00B       0.00B           -  //root/.bash_profile
>>      0.00B       0.00B           -  //root/.bashrc
>>      0.00B       0.00B           -  //root/.cshrc
>>      0.00B       0.00B           -  //root/.tcshrc
>>
>> This works for me to analysis system usage and analysis
>> performaces.
>
> This is great, but can we please skip the "skipping .." messages?
> Maybe it's just me but I really don't see the value of printing them
> when they don't contribute to the result.
> They also mess up the display. :)

I don't have a taste whether it needed or not, because it is somehow
useful to let users know some files/directories skipped....

Wait some other guys opinion for this...

thanks,
Shilong

>
> thanks,
> Holger
>

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

* Re: [PATCH] btrfs-progs: du: fix to skip not btrfs dir/file
  2016-07-06 15:16   ` Wang Shilong
@ 2016-07-06 15:20     ` Hugo Mills
  2016-07-06 15:42       ` Holger Hoffstätte
  0 siblings, 1 reply; 8+ messages in thread
From: Hugo Mills @ 2016-07-06 15:20 UTC (permalink / raw)
  To: Wang Shilong; +Cc: Holger Hoffstätte, linux-btrfs, David Sterba

[-- Attachment #1: Type: text/plain, Size: 3315 bytes --]

On Thu, Jul 07, 2016 at 12:16:01AM +0900, Wang Shilong wrote:
> On Wed, Jul 6, 2016 at 10:35 PM, Holger Hoffstätte
> <holger@applied-asynchrony.com> wrote:
> > On 07/06/16 14:25, Wang Shilong wrote:
> >> 'btrfs file du' is a very useful tool to watch my system
> >> file usage with snapshot aware.
> >>
> >> when trying to run following commands:
> >> [root@localhost btrfs-progs]# btrfs file du /
> >>      Total   Exclusive  Set shared  Filename
> >> ERROR: Failed to lookup root id - Inappropriate ioctl for device
> >> ERROR: cannot check space of '/': Unknown error -1
> >>
> >> and My Filesystem looks like this:
> >> [root@localhost btrfs-progs]# df -Th
> >> Filesystem     Type      Size  Used Avail Use% Mounted on
> >> devtmpfs       devtmpfs   16G     0   16G   0% /dev
> >> tmpfs          tmpfs      16G  368K   16G   1% /dev/shm
> >> tmpfs          tmpfs      16G  1.4M   16G   1% /run
> >> tmpfs          tmpfs      16G     0   16G   0% /sys/fs/cgroup
> >> /dev/sda3      btrfs      60G   19G   40G  33% /
> >> tmpfs          tmpfs      16G  332K   16G   1% /tmp
> >> /dev/sdc       btrfs     2.8T  166G  1.7T   9% /data
> >> /dev/sda2      xfs       2.0G  452M  1.6G  23% /boot
> >> /dev/sda1      vfat      1.9G   11M  1.9G   1% /boot/efi
> >> tmpfs          tmpfs     3.2G   24K  3.2G   1% /run/user/1000
> >>
> >> So I installed Btrfs as my root partition, but boot partition
> >> can be other fs.
> >>
> >> We can Let btrfs tool aware of this is not a btrfs file or
> >> directory and skip those files, so that someone like me
> >> could just run 'btrfs file du /' to scan all btrfs filesystems.
> >>
> >> After patch, it will look like:
> >>    Total   Exclusive  Set shared  Filename
> >> skipping not btrfs dir/file: boot
> >> skipping not btrfs dir/file: dev
> >> skipping not btrfs dir/file: proc
> >> skipping not btrfs dir/file: run
> >> skipping not btrfs dir/file: sys
> >>      0.00B       0.00B           -  //root/.bash_logout
> >>      0.00B       0.00B           -  //root/.bash_profile
> >>      0.00B       0.00B           -  //root/.bashrc
> >>      0.00B       0.00B           -  //root/.cshrc
> >>      0.00B       0.00B           -  //root/.tcshrc
> >>
> >> This works for me to analysis system usage and analysis
> >> performaces.
> >
> > This is great, but can we please skip the "skipping .." messages?
> > Maybe it's just me but I really don't see the value of printing them
> > when they don't contribute to the result.
> > They also mess up the display. :)
> 
> I don't have a taste whether it needed or not, because it is somehow
> useful to let users know some files/directories skipped....

   At the absolute minimum, I think that these messages should go to
stderr (like du does when it deosn't have permissions), and should go
away with -q. They're still irritating, but at least you can get rid
of them easily.

   Hugo.

> Wait some other guys opinion for this...
> 
> thanks,
> Shilong
> 
> >
> > thanks,
> > Holger
> >

-- 
Hugo Mills             | "There's a Martian war machine outside -- they want
hugo@... carfax.org.uk | to talk to you about a cure for the common cold."
http://carfax.org.uk/  |
PGP: E2AB1DE4          |                           Stephen Franklin, Babylon 5

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] btrfs-progs: du: fix to skip not btrfs dir/file
  2016-07-06 15:20     ` Hugo Mills
@ 2016-07-06 15:42       ` Holger Hoffstätte
  2016-07-06 15:56         ` Hugo Mills
  2016-07-11 10:20         ` David Sterba
  0 siblings, 2 replies; 8+ messages in thread
From: Holger Hoffstätte @ 2016-07-06 15:42 UTC (permalink / raw)
  To: Hugo Mills, Wang Shilong, linux-btrfs, David Sterba


[-- Attachment #1.1: Type: text/plain, Size: 3528 bytes --]

On 07/06/16 17:20, Hugo Mills wrote:
> On Thu, Jul 07, 2016 at 12:16:01AM +0900, Wang Shilong wrote:
>> On Wed, Jul 6, 2016 at 10:35 PM, Holger Hoffstätte
>> <holger@applied-asynchrony.com> wrote:
>>> On 07/06/16 14:25, Wang Shilong wrote:
>>>> 'btrfs file du' is a very useful tool to watch my system
>>>> file usage with snapshot aware.
>>>>
>>>> when trying to run following commands:
>>>> [root@localhost btrfs-progs]# btrfs file du /
>>>>      Total   Exclusive  Set shared  Filename
>>>> ERROR: Failed to lookup root id - Inappropriate ioctl for device
>>>> ERROR: cannot check space of '/': Unknown error -1
>>>>
>>>> and My Filesystem looks like this:
>>>> [root@localhost btrfs-progs]# df -Th
>>>> Filesystem     Type      Size  Used Avail Use% Mounted on
>>>> devtmpfs       devtmpfs   16G     0   16G   0% /dev
>>>> tmpfs          tmpfs      16G  368K   16G   1% /dev/shm
>>>> tmpfs          tmpfs      16G  1.4M   16G   1% /run
>>>> tmpfs          tmpfs      16G     0   16G   0% /sys/fs/cgroup
>>>> /dev/sda3      btrfs      60G   19G   40G  33% /
>>>> tmpfs          tmpfs      16G  332K   16G   1% /tmp
>>>> /dev/sdc       btrfs     2.8T  166G  1.7T   9% /data
>>>> /dev/sda2      xfs       2.0G  452M  1.6G  23% /boot
>>>> /dev/sda1      vfat      1.9G   11M  1.9G   1% /boot/efi
>>>> tmpfs          tmpfs     3.2G   24K  3.2G   1% /run/user/1000
>>>>
>>>> So I installed Btrfs as my root partition, but boot partition
>>>> can be other fs.
>>>>
>>>> We can Let btrfs tool aware of this is not a btrfs file or
>>>> directory and skip those files, so that someone like me
>>>> could just run 'btrfs file du /' to scan all btrfs filesystems.
>>>>
>>>> After patch, it will look like:
>>>>    Total   Exclusive  Set shared  Filename
>>>> skipping not btrfs dir/file: boot
>>>> skipping not btrfs dir/file: dev
>>>> skipping not btrfs dir/file: proc
>>>> skipping not btrfs dir/file: run
>>>> skipping not btrfs dir/file: sys
>>>>      0.00B       0.00B           -  //root/.bash_logout
>>>>      0.00B       0.00B           -  //root/.bash_profile
>>>>      0.00B       0.00B           -  //root/.bashrc
>>>>      0.00B       0.00B           -  //root/.cshrc
>>>>      0.00B       0.00B           -  //root/.tcshrc
>>>>
>>>> This works for me to analysis system usage and analysis
>>>> performaces.
>>>
>>> This is great, but can we please skip the "skipping .." messages?
>>> Maybe it's just me but I really don't see the value of printing them
>>> when they don't contribute to the result.
>>> They also mess up the display. :)
>>
>> I don't have a taste whether it needed or not, because it is somehow
>> useful to let users know some files/directories skipped....

When you run "find /path -type d" you don't get messages for all the
things you just didn't want to find either.

>    At the absolute minimum, I think that these messages should go to
> stderr (like du does when it deosn't have permissions), and should go
> away with -q. They're still irritating, but at least you can get rid
> of them easily.

If anything this should require a --verbose, not the other way
around. Maybe instead of breaking the output just indicate the
special status via "-- --" values, or default to 0.00?
Still, we're explicitly only interested in btrfs stuff and not
anything else, so printing non-information can only yield noise.

This is very much orthogonal to not printing anything after an
otherwise successful command execution.

-h



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 226 bytes --]

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

* Re: [PATCH] btrfs-progs: du: fix to skip not btrfs dir/file
  2016-07-06 15:42       ` Holger Hoffstätte
@ 2016-07-06 15:56         ` Hugo Mills
  2016-07-11 10:20         ` David Sterba
  1 sibling, 0 replies; 8+ messages in thread
From: Hugo Mills @ 2016-07-06 15:56 UTC (permalink / raw)
  To: Holger Hoffstätte; +Cc: Wang Shilong, linux-btrfs, David Sterba

[-- Attachment #1: Type: text/plain, Size: 4315 bytes --]

On Wed, Jul 06, 2016 at 05:42:33PM +0200, Holger Hoffstätte wrote:
> On 07/06/16 17:20, Hugo Mills wrote:
> > On Thu, Jul 07, 2016 at 12:16:01AM +0900, Wang Shilong wrote:
> >> On Wed, Jul 6, 2016 at 10:35 PM, Holger Hoffstätte
> >> <holger@applied-asynchrony.com> wrote:
> >>> On 07/06/16 14:25, Wang Shilong wrote:
> >>>> 'btrfs file du' is a very useful tool to watch my system
> >>>> file usage with snapshot aware.
> >>>>
> >>>> when trying to run following commands:
> >>>> [root@localhost btrfs-progs]# btrfs file du /
> >>>>      Total   Exclusive  Set shared  Filename
> >>>> ERROR: Failed to lookup root id - Inappropriate ioctl for device
> >>>> ERROR: cannot check space of '/': Unknown error -1
> >>>>
> >>>> and My Filesystem looks like this:
> >>>> [root@localhost btrfs-progs]# df -Th
> >>>> Filesystem     Type      Size  Used Avail Use% Mounted on
> >>>> devtmpfs       devtmpfs   16G     0   16G   0% /dev
> >>>> tmpfs          tmpfs      16G  368K   16G   1% /dev/shm
> >>>> tmpfs          tmpfs      16G  1.4M   16G   1% /run
> >>>> tmpfs          tmpfs      16G     0   16G   0% /sys/fs/cgroup
> >>>> /dev/sda3      btrfs      60G   19G   40G  33% /
> >>>> tmpfs          tmpfs      16G  332K   16G   1% /tmp
> >>>> /dev/sdc       btrfs     2.8T  166G  1.7T   9% /data
> >>>> /dev/sda2      xfs       2.0G  452M  1.6G  23% /boot
> >>>> /dev/sda1      vfat      1.9G   11M  1.9G   1% /boot/efi
> >>>> tmpfs          tmpfs     3.2G   24K  3.2G   1% /run/user/1000
> >>>>
> >>>> So I installed Btrfs as my root partition, but boot partition
> >>>> can be other fs.
> >>>>
> >>>> We can Let btrfs tool aware of this is not a btrfs file or
> >>>> directory and skip those files, so that someone like me
> >>>> could just run 'btrfs file du /' to scan all btrfs filesystems.
> >>>>
> >>>> After patch, it will look like:
> >>>>    Total   Exclusive  Set shared  Filename
> >>>> skipping not btrfs dir/file: boot
> >>>> skipping not btrfs dir/file: dev
> >>>> skipping not btrfs dir/file: proc
> >>>> skipping not btrfs dir/file: run
> >>>> skipping not btrfs dir/file: sys
> >>>>      0.00B       0.00B           -  //root/.bash_logout
> >>>>      0.00B       0.00B           -  //root/.bash_profile
> >>>>      0.00B       0.00B           -  //root/.bashrc
> >>>>      0.00B       0.00B           -  //root/.cshrc
> >>>>      0.00B       0.00B           -  //root/.tcshrc
> >>>>
> >>>> This works for me to analysis system usage and analysis
> >>>> performaces.
> >>>
> >>> This is great, but can we please skip the "skipping .." messages?
> >>> Maybe it's just me but I really don't see the value of printing them
> >>> when they don't contribute to the result.
> >>> They also mess up the display. :)
> >>
> >> I don't have a taste whether it needed or not, because it is somehow
> >> useful to let users know some files/directories skipped....
> 
> When you run "find /path -type d" you don't get messages for all the
> things you just didn't want to find either.

   No, but you do get messages about unreadable directories from find.

   Your example above would be "You asked for X and <thing> isn't an
X". That's not what these messages are about -- what we're seeing here
is "I tried to do what you asked to <thing>, but couldn't".

   Hugo.

> >    At the absolute minimum, I think that these messages should go to
> > stderr (like du does when it deosn't have permissions), and should go
> > away with -q. They're still irritating, but at least you can get rid
> > of them easily.
> 
> If anything this should require a --verbose, not the other way
> around. Maybe instead of breaking the output just indicate the
> special status via "-- --" values, or default to 0.00?
> Still, we're explicitly only interested in btrfs stuff and not
> anything else, so printing non-information can only yield noise.
> 
> This is very much orthogonal to not printing anything after an
> otherwise successful command execution.
> 
> -h
> 
> 




-- 
Hugo Mills             | "There's a Martian war machine outside -- they want
hugo@... carfax.org.uk | to talk to you about a cure for the common cold."
http://carfax.org.uk/  |
PGP: E2AB1DE4          |                           Stephen Franklin, Babylon 5

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] btrfs-progs: du: fix to skip not btrfs dir/file
  2016-07-06 13:35 ` Holger Hoffstätte
  2016-07-06 15:16   ` Wang Shilong
@ 2016-07-07  2:43   ` Eric Sandeen
  1 sibling, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2016-07-07  2:43 UTC (permalink / raw)
  To: Holger Hoffstätte, Wang Shilong, linux-btrfs; +Cc: dsterba

On 7/6/16 8:35 AM, Holger Hoffstätte wrote:
> On 07/06/16 14:25, Wang Shilong wrote:

...

>> After patch, it will look like:
>>    Total   Exclusive  Set shared  Filename
>> skipping not btrfs dir/file: boot
>> skipping not btrfs dir/file: dev
>> skipping not btrfs dir/file: proc
>> skipping not btrfs dir/file: run
>> skipping not btrfs dir/file: sys
>>      0.00B       0.00B           -  //root/.bash_logout
>>      0.00B       0.00B           -  //root/.bash_profile
>>      0.00B       0.00B           -  //root/.bashrc
>>      0.00B       0.00B           -  //root/.cshrc
>>      0.00B       0.00B           -  //root/.tcshrc
>>
>> This works for me to analysis system usage and analysis
>> performaces.
> 
> This is great, but can we please skip the "skipping .." messages?
> Maybe it's just me but I really don't see the value of printing them
> when they don't contribute to the result.
> They also mess up the display. :)

<driveby>
I agree, those messages add no value.
</driveby>

-Eric

> thanks,
> Holger


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

* Re: [PATCH] btrfs-progs: du: fix to skip not btrfs dir/file
  2016-07-06 15:42       ` Holger Hoffstätte
  2016-07-06 15:56         ` Hugo Mills
@ 2016-07-11 10:20         ` David Sterba
  1 sibling, 0 replies; 8+ messages in thread
From: David Sterba @ 2016-07-11 10:20 UTC (permalink / raw)
  To: Holger Hoffstätte
  Cc: Hugo Mills, Wang Shilong, linux-btrfs, David Sterba

On Wed, Jul 06, 2016 at 05:42:33PM +0200, Holger Hoffstätte wrote:
> >    At the absolute minimum, I think that these messages should go to
> > stderr (like du does when it deosn't have permissions), and should go
> > away with -q. They're still irritating, but at least you can get rid
> > of them easily.
> 
> If anything this should require a --verbose, not the other way
> around. Maybe instead of breaking the output just indicate the
> special status via "-- --" values, or default to 0.00?

The '--' replacement values sound good to me (0.00 would be confusing).

> Still, we're explicitly only interested in btrfs stuff and not
> anything else, so printing non-information can only yield noise.

I think the extra lines would happen mostly in scenario where
directories are mountpoints and thus have a potentially different
filesystem. If we print just a single line for a mountpoint (and not
descend to it), I don't think it will create that much noise in the
output.

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

end of thread, other threads:[~2016-07-11 10:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-06 12:25 [PATCH] btrfs-progs: du: fix to skip not btrfs dir/file Wang Shilong
2016-07-06 13:35 ` Holger Hoffstätte
2016-07-06 15:16   ` Wang Shilong
2016-07-06 15:20     ` Hugo Mills
2016-07-06 15:42       ` Holger Hoffstätte
2016-07-06 15:56         ` Hugo Mills
2016-07-11 10:20         ` David Sterba
2016-07-07  2:43   ` Eric Sandeen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.