summaryrefslogtreecommitdiff
path: root/cmds-fi-du.c
Commit message (Collapse)AuthorAge
* btrfs-progs: move fs features declarations to own header from utilsDavid Sterba2017-03-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: move help defines to own headerDavid Sterba2017-03-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi du: don't redefine standard macro/functionDavid Sterba2016-11-09
| | | | | | The macro dprintf is defined in stdio.h, rename it. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: rename lookup_ino_rootidDavid Sterba2016-11-09
| | | | | | It does not resolve the inode number but path where fd has been opened. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: build: detect fiemap shared flag but don't fail buildDavid Sterba2016-10-25
| | | | | | | | | | | | | | The FIEMAP_EXTENT_SHARED fiemap flag was introduced in 2.6.33. If the headers do not provide the definition, the build will fail. The support of the fiemap sharing depends on the running kernel. There are still systems with 2.6.32 kernel headers but running newer versions. To support such environment, don't fail build, provide own defintion of the structure and detect if there's an old kernel in use in the relevant command (btrfs fi du). Reported-by: Abhay Sachan <lkp.abhay@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi du: improved error handling in mark_inode_seenDavid Sterba2016-10-03
| | | | | | The callchain handles errors, don't crash on unexpected condition. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi du: catch bogus extent lengthsDavid Sterba2016-10-03
| | | | | | | If we get a zero-length from the ioctl for whatever reason, we should not crash. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: do not set optind if not necessaryDavid Sterba2016-07-13
| | | | | | | In the subcommand callbacks that are called just once, we don't need to explicitly reset optind. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: du: fix to skip not btrfs dir/fileWang Shilong2016-07-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'btrfs file du' is a very useful tool to watch my system file usage information 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 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> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: typo review of strings and commentsNicholas D Steeves2016-06-01
| | | | | Signed-off-by: Nicholas D Steeves <nsteeves@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi du: switch to negative error codesDavid Sterba2016-05-11
| | | | | | We're using the kernel-style negative error numbers. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fix fi du so it works in more casesAustin S. Hemmelgarn2016-03-30
| | | | | | | | | | | | | | | Currently, btrfs fi du uses open_file_or_dir(), which tries to open it's argument with O_RDWR. Because of POSIX semantics, this fails for non-root users when the file is read-only or is an executable that is being run currently, or for all users (including root) when the filesystem is read-only. This results in a somewhat confusing 'Unknown error -1' message when trying to check such files. Switch to using open_file_or_dir3() with O_RDONLY passed in the flags, as this avoids the limitations listed above, and we have no need to write to the files anyway (and thus shouldn't be opening them writable). Signed-off-by: Austin S. Hemmelgarn <ahferroin7@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi du: fix incorrect column orderAlexander Fougner2016-03-18
| | | | | Signed-off-by: Alexander Fougner <fougner89@gmail.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi du: make the output more alignedDavid Sterba2016-03-15
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi du: update help textDavid Sterba2016-03-15
| | | | | | | Move the command-specific options to the beginning, add missing long option. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: switch more error messages to common helpersDavid Sterba2016-03-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi du: add long options for unitsDavid Sterba2016-03-14
| | | | | | Drop -h, add just the common long options for now. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi du: switch to u64David Sterba2016-03-14
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: fi du: Calculate space shared by each directory arguments file setMark Fasheh2016-03-14
| | | | | | | | | | | | | | Here we define each file set as those found by a recursive search of a single directory argument to btrfs fi du. This isn't as simple as adding up shared extents - they may be shared with each other, and may also overlap. This patch uses an interval tree to store shared extents we find while fiemapping files. After collecting them, a 'set shared' count is calculated by summing (without overlap) each shared region discovered. This is then displayed to the user as 'set shared'. Signed-off-by: Mark Fasheh <mfasheh@suse.de> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: filesystem: add 'du' commandMark Fasheh2016-03-14
'btrfs du' differs from regular du in that it will work to resolve which blocks are shared between files in its list. This gives the user a more accurate bytecount from which they can make decisions regarding management of their file space. We still print a total number of bytes counted (like regular du), but also print the number of bytes which were found to have been shared amongst the file set provided. From there it becomes trivial to calculate how much space is exclusively owned. Signed-off-by: Mark Fasheh <mfasheh@suse.de> [ rename files to reflect the filesystem command group, add GPL v2 file headers ] Signed-off-by: David Sterba <dsterba@suse.com>