Goffredo Baroncelli [Mon, 29 Oct 2012 17:53:20 +0000 (18:53 +0100)]
Update the man page with the new prefixes.
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Mark Fasheh [Thu, 7 Jun 2012 23:00:56 +0000 (16:00 -0700)]
btrfs-progs: mkfs support for extended inode refs
This patch turns on the BTRFS_FEATURE_INCOMPAT_EXTENDED_IREF superblock flag
when creating a new file system in mkfs, enabling extended inode refs.
Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Mark Fasheh [Thu, 7 Jun 2012 23:00:55 +0000 (16:00 -0700)]
btrfs-progs: add extended inode ref support to btrfsck
Add a function, process_inode_extref() to be called from process_one_leaf()
when an item type of BTRFS_INODE_EXTREF_KEY is encountered.
Similarly to process_inode_ref(), process_inode_extref() walks an extref and
adds an inode_backref structure for each reference found within.
I modified fsck's inode_backref to get a type field (ref_type) which helps
us internally track the exact type of backrefs found. Of course this field
could be overwritten in case of disk corruption (duplicate refs) but
duplicate refs themselves are tracked by btrfsck so that should not be an
issue as btrfsck is written today.
Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Mark Fasheh [Thu, 7 Jun 2012 23:00:54 +0000 (16:00 -0700)]
btrfs-progs: Basic support for extended inode refs
This patch syncs the extended inode ref definitions from kernels ctree.h and
adds support in btrfs-debug-tree for visualizing the state of extended refs
on disk.
Signed-off-by: Mark Fasheh <mfasheh@suse.de>
Chen Yang [Thu, 31 Jan 2013 08:21:24 +0000 (16:21 +0800)]
Btrfs-prog/send: fix wrong dump_fd check in cmd_send_start()
In cmd_send_start(), there is a check to make sure dump_fd is not a tty
before parsing command options. So if we use the option "-f file",
it doesn't work for the dump_fd has not been created. So fix it.
Signed-off-by: Cheng Yang <chenyang.fnst@cn.fujitsu.com>
Anand Jain [Thu, 31 Jan 2013 05:35:31 +0000 (13:35 +0800)]
Btrfs-progs: man btrfs: subcommands must be grouped together
Signed-off-by: Anand Jain <anand.jain@oracle.com>
David Sterba [Wed, 30 Jan 2013 18:02:21 +0000 (19:02 +0100)]
btrfs-progs: fix parallel build
Parallel build may fail due to late creation of version.h, fix the rule name
that does not match the filename.
Signed-off-by: David Sterba <dsterba@suse.cz>
Reviewed-by: Eri Sandeen <sandeen@redhat.com>
Eric Sandeen [Tue, 29 Jan 2013 20:32:28 +0000 (14:32 -0600)]
btrfs-progs: fix mkfs.btrfs -r option
Commit
605e806166847872bb91831b397d58f95027975a broke the
mkfs.btrfs -r option, because it calls make_btrfs
without ever setting dev_block_count, in the -r case,
so we tell it to make a filesystem of size 0.
Then we wander into ENOSPC land and segfault.
As a quick one-line-fix, just set the dev_block_count
to the size of the destination image file.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Stefan Behrens [Mon, 7 May 2012 12:00:20 +0000 (14:00 +0200)]
Btrfs-progs: add support for device replace procedure
This is the user mode part of the device replace patch series.
The command group "btrfs replace" is added with three commands:
- btrfs replace start srcdev|srcdevid targetdev [-Bfr] mount_point
- btrfs replace status mount_point [-1]
- btrfs replace cancel mount_point
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Stefan Behrens [Tue, 15 May 2012 09:30:39 +0000 (11:30 +0200)]
Btrfs-progs: add command to get/reset device stats via ioctl
"btrfs device stats" is used to retrieve and print the device stats.
"btrfs device stats -z" is used to atomically retrieve, reset and
print the stats.
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Stefan Behrens [Tue, 15 May 2012 10:05:44 +0000 (12:05 +0200)]
Btrfs-progs: make two utility functions globally available
Two convenient utility functions that have so far been local to scrub are
moved to utils.c.
They will be used in the device stats code in a following commit.
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Anand Jain [Mon, 28 Jan 2013 05:22:30 +0000 (13:22 +0800)]
Btrfs-progs: move open_file_or_dir() to utils.c
The definition of the function open_file_or_dir() is moved from common.c
to utils.c in order to be able to share some common code between scrub
and the device stats in the following step. That common code uses
open_file_or_dir(). Since open_file_or_dir() makes use of the function
dirfd(3), the required XOPEN version was raised from 6 to 7.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Original-Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
David Sterba [Mon, 28 Jan 2013 18:29:32 +0000 (19:29 +0100)]
btrfs-progs: fix build warnings in btrfslabel.c
Signed-off-by: David Sterba <dsterba@suse.cz>
Ben Peddell [Sun, 27 Jan 2013 05:45:43 +0000 (15:45 +1000)]
btrfs-progs: fix unaligned accesses v2
gcc optimizes out the memcpy calls at -O2 and -Os.
Replacing memcpy with memmove does't work - gcc treats memmove
the same way it treats memcpy.
This patch brings in {get|put}_unaligned_le{16|32|64} (using the
packed struct method), and uses them in the failing get/set calls.
On architectures where unaligned accesses are cheap, these unaligned
macros should be optimized out by the compiler.
Signed-off-by: Ben Peddell <klightspeed@killerwolves.net>
Gene Czarcinski [Sat, 26 Jan 2013 18:10:33 +0000 (13:10 -0500)]
Btrfs-progs: Fix trival compiler error in cmds-qgroup.c
The compiler does not realize that usage() never returns.
Initializing the variable keeps it quiet.
Signed-off-by: Gene Czarcinski <gene@czarc.net>
Wang Sheng-Hui [Sun, 18 Nov 2012 02:13:20 +0000 (10:13 +0800)]
btrfs-progs: update options in find-root.c
Remove the useless option "-v" and add the option "-o" in
the description of usage.
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Eric Sandeen [Thu, 24 Jan 2013 23:32:52 +0000 (17:32 -0600)]
btrfs-progs pretty/quiet build
A quieter build makes warnings more obvious.
This could probably be improved, but just to see
if people like this or if they hate it. :)
make V=1 overrides it and gets you the full
glory again.
[CC] ctree.o
[CC] disk-io.o
[CC] radix-tree.o
[CC] extent-tree.o
...
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Josef Bacik [Thu, 22 Jan 2009 19:25:44 +0000 (14:25 -0500)]
btrfs-progs: kill check for /'s in labels
This patch kills a check in mkfs's label stuff which doesn't allow labels that
have /'s in them. This causes problems for Anaconda which try to label volumes
with their mountpoints. Thanks,
Signed-off-by: Josef Bacik <jbacik@redhat.com>
Anand Jain [Thu, 24 Jan 2013 10:05:14 +0000 (18:05 +0800)]
Btrfs-progs: we need to have the string null terminated
Bug:
-------------
btrfs subvolume list / -a
ID 258 gen 4226 top level 384 path media/smbshare
::
btrfs subvolume list /home -a
ID 258 gen 4226 top level 5 path <FS_TREE>/__active/media/smbshare4.snap
In the first command's output, this path is printed correctly, however
in the second output it has "4.snap" appended, similar to the names of
the snapshots I made 22 hours ago.
------------
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reported-by: Brendan Hide <brendan@swiftspirit.co.za>
Chen Yang [Thu, 24 Jan 2013 11:53:40 +0000 (19:53 +0800)]
Btrfs-prog/send: fix wrong best-parent assignment in, find_good_parent()
We use find_good_parent() to look for a suit snapshot in the clone source
snapshots as the parent, not the source subvolume of the snapshot which
is about to be sent. fix it
Reviewed-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Cheng Yang <chenyang.fnst@cn.fujitsu.com>
Stefan Behrens [Fri, 2 Nov 2012 14:05:30 +0000 (15:05 +0100)]
btrfs-progs: Add btrfs-show-super
Just a small program to print the fields of a super block.
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Josef Bacik [Sat, 19 Jan 2013 18:06:20 +0000 (13:06 -0500)]
Btrfs-progs: add btrfs device ready command
This command will be used by things like dracut that wish to know very
simply if all of the devices have been added to the kernel cache yet for the
device to be fully mounted. This keeps initrd's from constantly having to
try to mount the file system until it succeeds every time a device is added
to the system. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
Josef Bacik [Sat, 19 Jan 2013 18:06:21 +0000 (13:06 -0500)]
Btrfs-progs: detect if the disk we are formatting is a ssd
Patch rebased because of changes in mkfs.c but otherwise the same
as created by Josef Bacik
SSD's do not gain anything by having metadata DUP turned on. The underlying
file system that is a part of all SSD's could easily map duplicate metadat
blocks into the same erase block which effectively eliminates the benefit of
duplicating the metadata on disk. So detect if we are formatting a single
SSD drive and if we are do not use DUP. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
Eric Sandeen [Sat, 19 Jan 2013 18:06:17 +0000 (13:06 -0500)]
btrfs-progs: Use sysconf instead of getpagesize
Rawhide is getting cranky with posix compliance, and a few
things have stopped building.
getpagesize() is now only available -with- __USE_XOPEN_EXTENDED
or __USE_BSD, and NOT __USE_XOPEN2K.
_GNU_SOURCE must define __USE_XOPEN2K because getpagesize()
has gone away for mkfs. I gave up and used sysconf.
Also, something used to pull in stat that no longer does, so
things like S_ISREG weren't getting defined.
The following fixes things for me.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Christian Hesse [Tue, 22 Jan 2013 20:51:19 +0000 (15:51 -0500)]
btrfs-progs: fix build, manpage compression command
man pages for btrfs-progs are compressed by gzip by default. In Makefile the
variable GZIP is use, this evaluates to 'gzip gzip' on my system. From man
gzip:
> The environment variable GZIP can hold a set of default options for gzip.
> These options are interpreted first and can be overwritten by explicit
> command line parameters.
So using any other variable name fixes this. Patch is attached.
Signed-off-by: Christian Hesse <list@eworm.de>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
Andreas Fischer [Mon, 21 Jan 2013 19:19:03 +0000 (19:19 +0000)]
Btrfs-progs: Fix typo in balance start usage; filetrs -> filters.
Fix typo in "btrfs balance start" usage documentation: 'filetrs' should have
been 'filters'.
Signed-off-by: Andreas Fischer <info@andreasfischer.net>
Stefan Behrens [Wed, 31 Oct 2012 16:56:56 +0000 (17:56 +0100)]
Btrfs-progs: fix an off-by-one in write_dev_supers()
Fix an off-by-one in write_dev_supers().
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Jan Schmidt [Tue, 6 Nov 2012 20:47:08 +0000 (21:47 +0100)]
Btrfs-progs: bugfix for subvolume parent determination in btrfs send
We missed to add the default subvolume, because it has no ROOT_BACKREF_ITEM.
This made get_parent always fail for direct decendants of the default
subvolume, resulting in lots of full streams where incremental streams were
requested.
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Reviewed-by: Alexander Block <ablock84@googlemail.com>
Jan Schmidt [Tue, 6 Nov 2012 20:47:07 +0000 (21:47 +0100)]
Btrfs-progs: correcting misnamed parameter options for btrfs send
Unfortunately, the command line options for btrfs send were misnamed. The
-i option should not be used to give "clone sources", we'll be using -c
instead.
Compatibily note: -i option was broken anyway, which makes it less critical
renaming it. For potential users of the old option style, we emit a fatal
warning if the -i option is used.
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Arvin Schnell [Sun, 20 Jan 2013 21:04:18 +0000 (16:04 -0500)]
btrfs-progs: initialize data before send ioctl
Likely not strictly needed but I noticed valgrind complaining about
uninitialised memory in the ioctl call.
Signed-off-by: Arvin Schnell <aschnell@suse.de>
Wang Shilong [Sun, 20 Jan 2013 21:04:16 +0000 (16:04 -0500)]
Btrfs-progs: check the relation of two group by real level numbers
Comparing qgroupid is not good way to check the relationship of two groups,
the right way is to compare the real level numbers.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
Wang Shilong [Sun, 20 Jan 2013 21:04:15 +0000 (16:04 -0500)]
Btrfs-progs: clean up reduplicate parse_qgroupid() and replace atoi with strtoull
1. parse_qgroupid() is implemented twice, clean up the reduplicate code.
2. atoi() can not detect errors, so use strtoull() instead of it.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
Wang Shilong [Sun, 20 Jan 2013 21:04:14 +0000 (16:04 -0500)]
Btrfs-progs: fix arg parsing for btrfs qgroup limit commands
We can use this command in two ways.
1. btrfs qgroup limit size qgroupid path
2. btrfs qgroup limit size path
Before applying this patch, we differentiate them by check the parsing result
of the second argument. It is not so good because it may make some mistakes,
For example:
btrfs qgroup limit 1M 123456
^ It is a subvolume name.
In fact, we can differentiate them just by the number of arguments, so fix it
by this way.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
Ulrik [Sun, 20 Jan 2013 21:04:08 +0000 (16:04 -0500)]
Btrfs-progs: correct btrfs receive usage string
Fix the usage string to specify the correct '-f' option for input file,
not '-i'.
Signed-off-by: Ulrik Sverdrup <ulrik.sverdrup@gmail.com>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
Nirbheek Chauhan [Sun, 20 Jan 2013 21:04:07 +0000 (16:04 -0500)]
Btrfs-progs: fix resolving of loop devices
The LOOP_GET_STATUS ioctl truncates filenames to 64 characters. We should get
the backing file for a given loop device from /sys/. This is how losetup does it
as well.
Signed-off-by: Nirbheek Chauhan <nirbheek.chauhan@collabora.co.uk>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
Tested-By: Hector Oron <hector.oron@collabora.co.uk>
Danny Kukawka [Mon, 21 Jan 2013 15:57:25 +0000 (16:57 +0100)]
btrfs-progs: Handle errors returned from open_ctree
Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
Signed-off-by: David Sterba <dsterba@suse.cz>
Wang Sheng-Hui [Thu, 16 Aug 2012 12:15:56 +0000 (20:15 +0800)]
btrfs-progs: add malloc check in transaction.h/btrfs_start_transaction
For malloc may fail, we should check it before assign
values to the struct btrfs_trans_handle *h.
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Arne Jansen [Tue, 29 Nov 2011 07:40:28 +0000 (08:40 +0100)]
Btrfs-progs: bugfix for scrubbing single devices
Scrub can be invoked to scrub only a single device of a (mounted) filesystem.
The code determines whether the given path is a mountpoint of a filesystem
by issueing a btrfs-specific ioctl to it. Only in case of EINVAL it assumed
it may be a device, all other errnos just caused it fail, but some devices
(correctly) return ENOTTY. This patch adds this to the error check.
Signed-off-by: Arne Jansen <sensille@gmx.net>
Goffredo Baroncelli [Fri, 21 Oct 2011 17:00:28 +0000 (19:00 +0200)]
Ignore the error ENXIO and ENOMEDIUM during a devs scan
Ignore the error ENXIO (device don't exists) and ENOMEDIUM (
No medium found -> like a cd tray empty) in the function
btrfs_scan_one_dir.
This avoids spurios errors due to an empty CD or a block device node
without a device (which is frequent in a static /dev).
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
David Sterba [Wed, 12 Oct 2011 11:36:13 +0000 (13:36 +0200)]
btrfs-progs: ignore -a option in mkfs
Let mkfs accept '-a' option and not complain. When a partition has non-zero
value in the fs_passno filed in /etc/fstab, the fsck is run but fails and boot
stops. As fsck does not break things currently, it's safe to ignore the option
and let the boot proceed.
Reference: https://bugzilla.novell.com/show_bug.cgi?id=655906
Signed-off-by: David Sterba <dsterba@suse.cz>
Simon Xu [Wed, 9 Jan 2013 10:32:44 +0000 (18:32 +0800)]
btrfs-progs: remove '-h' from btrfs man page
Remove '-h' from btrfs man page as it's not supported by the btrfs utility.
Signed-off-by: Simon Xu <xu.simon@oracle.com>
Simon Xu [Wed, 9 Jan 2013 07:31:07 +0000 (15:31 +0800)]
btrfs-progs: remove "device show" from btrfs man page
Remove "device show" from btrfs man page as it's not supported by the
btrfs utility.
Signed-off-by: Simon Xu <xu.simon@oracle.com>
Lluis Batlle i Rossell [Fri, 30 Nov 2012 10:08:39 +0000 (11:08 +0100)]
btrfs-progs: Fix getopt on arm platforms
There, 'char' is unsigned, so once assigned '-1' from getopt, it gets
the value 255. Then, it compared to '-1' gives false.
Signed-off-by: Lluis Batlle i Rossell <viric@viric.name>
Wang Sheng-Hui [Tue, 20 Nov 2012 06:26:46 +0000 (14:26 +0800)]
btrfs-progs: print the right mount checking info in restore.c
The mount status is checked against the arg <device> (argv[optind]),
not the <directory>. Correct the info printed on <device> mounted.
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Zach Brown [Thu, 15 Nov 2012 22:24:03 +0000 (14:24 -0800)]
btrfs-progs: fix 32bit int/pointer cast warnings
This uses uintptr_t to cast pointers to u64 ioctl arguments to silence
some 32bit build warnings:
cmds-inspect.c: In function ‘__ino_to_path_fd’:
cmds-inspect.c:47:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
cmds-inspect.c: In function ‘cmd_logical_resolve’:
cmds-inspect.c:171:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
Signed-off-by: Zach Brown <zab@redhat.com>
Kenji Okimoto [Thu, 15 Nov 2012 04:47:52 +0000 (13:47 +0900)]
btrfs-progs: plug memory leaks in btrfs_scan_one_dir() reported by cppcheck.
[utils.c:983]: (error) Memory leak: fullpath
Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
Kenji Okimoto [Thu, 15 Nov 2012 04:47:51 +0000 (13:47 +0900)]
btrfs-progs: check malloc() result
Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
Kenji Okimoto [Thu, 15 Nov 2012 04:47:50 +0000 (13:47 +0900)]
btrfs-progs: plug a memory leak reported by cppcheck
[src/btrfs/disk-io.c:462]: (error) Memory leak: log_root
Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
Wang Sheng-Hui [Wed, 14 Nov 2012 07:46:21 +0000 (15:46 +0800)]
btrfs-progs: update usage description for debug-tree.c
There are more options than "-e" only.
Update the description for the usage.
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Goffredo Baroncelli [Mon, 29 Oct 2012 17:53:19 +0000 (18:53 +0100)]
parse_size(): add new suffixes
Add new suffixes in parse_size() function. New suffixes are: T as
terabyte, P as petabyte, E as exabyte. Note these units are
multiply of 2 .
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Goffredo Baroncelli [Mon, 29 Oct 2012 17:53:18 +0000 (18:53 +0100)]
parse_size(): replace atoll() with strtoull()
Replace the function atoll with strtoull(); Check that the suffix for the
parse_size() input is of only one character.
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Goffredo Baroncelli [Mon, 29 Oct 2012 17:53:17 +0000 (18:53 +0100)]
Move parse_size() to utils.[hc]
Move the function from cmds-filesystem.c and mkfs.c to utils.c
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
David Sterba [Thu, 25 Oct 2012 15:27:57 +0000 (17:27 +0200)]
btrfs-progs: do not send stream into a terminal
Signed-off-by: David Sterba <dsterba@suse.cz>
Alex Lyakas [Wed, 17 Oct 2012 13:53:58 +0000 (15:53 +0200)]
btrfs-progs: Receive: preserve ownership for symlinks, by using 'lchown'
Signed-off-by: Alex Lyakas <alex.btrfs@zadarastorage.com>
Arne Jansen [Sun, 21 Oct 2012 14:34:33 +0000 (16:34 +0200)]
Btrfs-progs: fix unaligned accesses
There are some unaligned accesses in progs that cause malfunction or
crashes on ARM.
This patch fixes the ones we stumbled upon.
Signed-off-by: Arne Jansen <sensille@gmx.net>
Wang Sheng-Hui [Tue, 16 Oct 2012 07:29:15 +0000 (15:29 +0800)]
btrfs-progs: add -V description in print_usage
mkfs supports the option -V/--version.
Add its description to print_usage().
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
Sergei Trofimovich [Thu, 11 Oct 2012 08:43:48 +0000 (11:43 +0300)]
version.sh: fix version when built from tarball
[from 0.20-rc1 tarball]
Before the patch:
$ ./btrfs --version
Btrfs Btrfs v0.19
After the patch:
$ ./btrfs --version
Btrfs v0.20-rc1
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Wade Cline [Thu, 20 Sep 2012 21:26:28 +0000 (14:26 -0700)]
Btrfs-progs: Fix compiler warnings on PPC64
The kernel uses unsigned long long for u64, but PPC64 uses unsigned
long by default. This results in compilation warnings such as:
print-tree.c:333: warning: format '%llu' expects type 'long long
unsigned int', but argument 4 has type 'u64'
To fix this, the macro __KERNEL__ needs to be defined before including
the file <asm/types.h>. This can be done by defining the macro in
"kerncompat.h" and making it the first included file in the relevant
header files; this fixes the compiler warnings on PPC64.
Reviewed-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Wade Cline <clinew@linux.vnet.ibm.com>
Chris Mason [Fri, 5 Oct 2012 00:35:31 +0000 (20:35 -0400)]
Cast args to min to fix compiler warnings
Liu Bo [Fri, 31 Aug 2012 05:40:44 +0000 (05:40 +0000)]
Btrfs-progs: add options to change bufsize in logical to inode translation
Add an option 's' to set bufsize in logical to inode transition, then we are able
to read all the refs to the logical address.
Meanwhile, set a max value 64k for the bufsize.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Goffredo Baroncelli [Tue, 4 Sep 2012 17:59:26 +0000 (19:59 +0200)]
Correct un-initialized fsid variable
David Sterba [Fri, 7 Sep 2012 15:02:16 +0000 (09:02 -0600)]
btrfs-progs: pretty print key in extent_item
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Anand Jain [Fri, 21 Sep 2012 06:54:08 +0000 (00:54 -0600)]
Btrfs-progs: btrfs subvolume delete could delete subvolumes
With this user will be able to provide more than one subvolume
to delete.
eg: btrfs subvolume delete <subvol1> <subvol2>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Anand Jain [Fri, 21 Sep 2012 07:00:15 +0000 (01:00 -0600)]
Btrfs-progs: correct the mkfs.btrfs man page
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Zhi Yong Wu [Tue, 25 Sep 2012 02:02:16 +0000 (20:02 -0600)]
btrfs-progs: Fix up memory leakage
Some code pathes forget to free memory on exit.
Changelog from v1:
Fix the variable is used uncorrectly. [Ram Pai]
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Zhi Yong Wu [Tue, 25 Sep 2012 02:02:15 +0000 (20:02 -0600)]
btrfs-progs: Close file descriptor on exit
Need to close fd on exit.
Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Robin Dong [Fri, 28 Sep 2012 03:02:39 +0000 (21:02 -0600)]
btrfs-progs: limit the max value of leafsize and nodesize
Using mkfs.btrfs like:
mkfs.btrfs -l 131072 /dev/sda
will return no error, but after mount it, the dmesg will report:
BTRFS: couldn't mount because metadata blocksize (131072) was too large
The leafsize and nodesize are equal at present, so we just use one function
"check_leaf_or_node_size" to limit leaf and node size below BTRFS_MAX_METADATA_BLOCKSIZE.
Signed-off-by: Robin Dong <sanbai@taobao.com>
Reviewed-by: David Sterba <dave@jikos.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Goffredo Baroncelli [Mon, 1 Oct 2012 20:11:27 +0000 (14:11 -0600)]
pretty_sizes() returns incorrect values
pretty_sizes() returns incorrect values if the argument is < 1024.
pretty_sizes(0) -> 0.00 OK
pretty_sizes(102) -> 0.10 WRONG
pretty_sizes(1023) -> 1.00 WRONG
pretty_sizes(1024) -> 1.00KB OK
Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Wang Shilong [Thu, 27 Sep 2012 17:33:01 +0000 (01:33 +0800)]
Btrfs-Progs: update '-s' option without a argument.
Since '--sort' options was given ,and we can list snapshots in generation
order by --sort=+/-gen to replace '-s [0|1]' totally.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujistsu.com>
Wang Shilong [Thu, 27 Sep 2012 17:25:00 +0000 (01:25 +0800)]
Btrfs-progs: introduces '-a' option into subvolume list command
We list the subvolumes under current directory according to the input
subvolume.
However, if we still want to list all the subvolumes in the tree, we
can use '-a' option to help us.
There may be two kinds of path: absolute path , relative path .
The absolute path is beginning with "<FS_TREE>"
The relative path is under current path that you input.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Wang Shilong [Thu, 27 Sep 2012 17:04:20 +0000 (01:04 +0800)]
Btrfs-Progs: fix subvolumes's some full_path invaild problems.
In the privous way, we list all the subvolumes in the filesystem default.
But if a subvolume mounts on another directory, some result's full_path
may be invaild.
According to this, we try to list subvolumes under directoy only by default.
In this way, all the subvolume can be arrived by the full_path.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Miao Xie [Thu, 20 Sep 2012 11:04:22 +0000 (19:04 +0800)]
Btrfs-progs: introduce '-t' option into subvolume list command
This patch introduces '-t' option into subvolume list command. By this
option, we can output the result as a table.
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
wangshilong [Wed, 19 Sep 2012 09:21:51 +0000 (17:21 +0800)]
Btrfs-progs: introduce -g -c --sort options into btrfs subvol list command
This patch introduces '-g' '-c' '--sort' options
The option '-g' can help you filter the subvolumes by the generation, you may
use it just like:
btrfs subvol list -g +/-value <path>
'+' means the generation of the subvolumes should >= the value you specified.
'-' means the generation should <= the value
If you don't input either '+' nor '-', this command will list the subvolumes
that their generation equals to the value.
However if you want to find gengeration between value1 and value2
you may use the above like:
btrfs sub list -g -value1 -g +value2 <path>
The option '-c' can help you filter the subvolumes by the ogeneration, you may
use it just like:
btrfs subvol list -c +/-value <path>
The usage is the same to '-g'
You might want to list subvolumes in order of some items, such as root id, gen
and so on, you can use '--sort'. Now you can sort the subvolumes by root id,
gen, ogen and path.
For example:
If you want to list subvolumes in order of rootid, you can use the option like
that:
btrfs sub list --sort=+/-rooid <path>
Here, '+' means the result is sorted by ascending order. '-' is by descending
order. If you don't specify either '+' nor '-', the result is sorted by
default - ascending order.
If you want to combine sort items, you do it like that:
btrfs sub list --sort=-rootid,+path,ogen,gen <path>
Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Zhou Bo [Wed, 8 Aug 2012 08:54:54 +0000 (16:54 +0800)]
Btrfs-progs: update the manpage entries for the btrfs subvolume list
This patch adds the introduction of the new option '-r' into the man page of
'btrfs subvolume list' command.
Signed-off-by: Zhou Bo <zhoub-fnst@cn.fujitsu.com>
Miao Xie [Tue, 18 Sep 2012 09:14:37 +0000 (17:14 +0800)]
Btrfs-progs: enhance btrfs subvol list only to show read-only snapshots
We want 'btrfs subvolume list' only to list readonly subvolumes, this patch set
introduces a new option 'r' to implement it.
You can use the command like that:
btrfs subvolume list -r <path>
Original-Signed-off-by: Zhou Bo <zhoub-fnst@cn.fujitsu.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Miao Xie [Tue, 18 Sep 2012 06:51:49 +0000 (14:51 +0800)]
Btrfs-progs: restructure list_subvolumes
The current code of list_subvols() has very bad scalability, if we want to
add new filter conditions or new sort methods, we have to modify lots of code.
Beside that, the most code of list_snapshots() is similar to list_subvols(),
So I restructure list_subvols(), and split the subvolume filter function,
the subvolume sort function and the output function from list_subvols().
In order to implement it, we defined some importtant structures:
struct btrfs_list_filter {
btrfs_list_filter_func filter_func;
void *data;
};
struct btrfs_list_comparer {
btrfs_list_comp_func comp_func;
int is_descending;
};
struct {
char *name;
char *column_name;
int need_print;
} btrfs_list_columns[];
If we want to add a new filter condition, we can choose a suitable filter
function, or implement a new filter function[1], and add it into a set of
the filters, and then pass the filter set into list_subvols(). We also can
mix several filters (just add those filters into the set, and pass the set
into list_subvols()) if the users specify two or more filter conditions.
The subvolume sort function is similar to the subvolume filter function. The
differentiation is the order of comparers in the array which is passed into
list_subvols() show us the priority of the sort methods.
The output function is different with the above two functions, we define a
array to manage all the columns that can be outputed, and use a member variant
(->need_print) to control the output of the relative column. Some columns are
outputed by default. But we can change it according to the requirement of the
users.
After appling this patch, we needn't implement a independent list_snapshots()
function, just pass a filter function which is used to identify the snapshot
into list_subvols().
[1]: If we implement new filter functions or compare functions, we must add
them into the array all_filter_funcs or the array all_comp_funcs, and modify
the relative enum variants(btrfs_list_filter_enum, btrfs_list_comp_enum).
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Miao Xie [Sat, 1 Sep 2012 08:45:30 +0000 (16:45 +0800)]
Btrfs-progs: fix wrong way to check if the root item contains otime and uuid
Now we check if the root item contains otime and uuid or not by comparing
->generation_v2 and ->generation of the btrfs_root_item structure, it is
wrong because it is possbile that ->generation may equal to the first
variant of the next item. We fix this problem by check the size of btrfs_root_item,
if it is larger than the original one, the new btrfs_root_item contains otime
and uuid. we needn't worry the case that the new filesystem is mounted on the
old kernel. because the otime and uuid are not changed on the old kernel, we can
get the correct result even on the kernel.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Miao Xie [Sat, 1 Sep 2012 08:30:35 +0000 (16:30 +0800)]
Btrfs-progs: fix wrong usage of btrfs subvolume list command
Since the uuid output function has been implemented, we should update
the usage to tell the users.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Miao Xie [Sat, 1 Sep 2012 07:31:55 +0000 (15:31 +0800)]
Btrfs-progs: fix compile warning of implicit declaration of "list_snapshots"
This patch fixes the following warning:
cmds-subvolume.c:283:3: warning: implicit declaration of function "list_snapshots"
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Zhou Bo [Wed, 8 Aug 2012 08:54:48 +0000 (16:54 +0800)]
Btrfs-progs: move the function declarations to a new head file
Move the function declarations to a new head file.
Signed-off-by: Zhou Bo <zhoub-fnst@cn.fujitsu.com>
Anand Jain [Wed, 15 Aug 2012 08:29:53 +0000 (16:29 +0800)]
Btrfs-progs: seg fault in get_label_unmounted
btrfs f l /
No valid Btrfs found on /
Segmentation fault (core dumped)
open_ctree can return NULL, we need to check that.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Anand Jain [Tue, 14 Aug 2012 06:04:06 +0000 (14:04 +0800)]
Btrfs-progs: add -u to show subvol uuid
Applications would need to know the uuid to manage the configurations
associated with the subvol and snapshots
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Anand Jain [Fri, 3 Aug 2012 09:48:57 +0000 (17:48 +0800)]
Btrfs-progs: add otime to the snapshot list
Reviewed-by: Alexander Block <ablock84@googlemail.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Liu Bo [Fri, 3 Aug 2012 09:48:56 +0000 (17:48 +0800)]
Btrfs-progs: list snapshots by generation
The idea is that we usually use snapshot to backup/restore our data, and the
common way can be a cron script which makes lots of snapshots, so we can end
up with spending some time to find the latest snapshot to restore.
This adds a feature for 'btrfs subvolume list' to let it list snapshots by their
_created_ generation.
What we need to do is just to list them in descending order and get the latest
snapshot. What's more, we can find the oldest snapshot as well by listing
snapshots in ascending order.
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Liu Bo [Fri, 3 Aug 2012 09:48:55 +0000 (17:48 +0800)]
Btrfs-progs: show generation in command btrfs subvol list
This adds the ability to show root's modification generation when we use
btrfs subvol list.
NOTE:
Like file's atime and ctime, root's generation also has 'creation generation'
and 'modification generation'.
The generation that we're going to show is 'modification generation', and the
next patch is going to show 'creation generation'.
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Liu Bo [Fri, 3 Aug 2012 09:48:51 +0000 (17:48 +0800)]
Btrfs-progs: search subvolumes with proper objectid
Btrfs's subvolume/snapshot is limited to
[BTRFS_FIRST_FREE_OBJECTID, BTRFS_LAST_FREE_OBJECTID], so just apply the range.
Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com>
Miao Xie [Tue, 21 Aug 2012 06:16:27 +0000 (14:16 +0800)]
Btrfs-progs: fix wrong return value of check_owner_ref()
If we find the block by seach corresponding fs tree, we should return 0,
and tell the caller we pass the check.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Miao Xie [Fri, 10 Aug 2012 08:14:02 +0000 (16:14 +0800)]
Btrfs-progs: fix unresolved ref root message
btrfsck misinformed "unresolved ref root" message when there were several
snapshots in the file system. The patch(commit
cfdd42686c70) tried to fix
this bug, but didn't fix it completely. If the metadata was stored in a
shared leaf of the tree, the problem would happen again. This patch fixes
it by another way, we don't check the relationship of the trees when we
traverse the fs/file tree, we just do the check when we merge the snapshot
records to the root cache.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Miao Xie [Fri, 10 Aug 2012 05:12:16 +0000 (13:12 +0800)]
Btrfs-progs: fix wrong leaf when checking the trees relationship
The variant named 'leaf' in is_child_root() still hold old result after
we get the next leaf, it make btrfsck returns the wrong result, such as
"unresolved ref root ..", fix it.
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Miao Xie [Fri, 10 Aug 2012 02:46:16 +0000 (10:46 +0800)]
Btrfs-progs: fix several complie warning
This patch fixed the following warning:
cmds-send.c:464:6: warning: ‘ret' may be used uninitialized in this function [-Wuninitialized]
crc32c.c:121:1: warning: control reaches end of non-void function [-Wreturn-type]
send-utils.c:69:11: warning: ‘comp' may be used uninitialized in this function [-Wuninitialized]
send-utils.c:126:6: warning: ‘comp' may be used uninitialized in this function [-Wuninitialized]
send-utils.c:99:22: warning: ‘entry' may be used uninitialized in this function [-Wuninitialized]
btrfs.c:261:2: warning: implicit declaration of function ‘crc32c_optimization_init' [-Wimplicit-function-declaration]
btrfs.c:105:2: warning: ‘cmd' may be used uninitialized in this function [-Wuninitialized]
restore.c:435:12: warning: ignoring return value of ‘ftruncate', declared with attribute warn_unused_result [-Wunused-result]
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Tsutomu Itoh [Wed, 12 Sep 2012 04:30:19 +0000 (13:30 +0900)]
Btrfs-progs: fix arguments check of qgroup limit
Segmentation fault occurred in the following command.
# btrfs qgroup limit
Segmentation fault
So, we should check a minimum number of arguments.
Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Josef Bacik [Fri, 27 Jul 2012 12:37:55 +0000 (08:37 -0400)]
Btrfs-progs: only enforce a maximum size if we specify one
My patch
04609add88ef8428d725de6ef60f46a3ff0dbc8e
introduced a regression where if you mkfs'ed a group of disks with different
sizes it limited the disks to the size of the first one that is specified.
This was not the intent of my patch, I only want it to limit the size based
on the -b option, so I've reworked the code to pass in a max block count and
that fixes the issue. Thanks,
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
David Sterba [Tue, 17 Jul 2012 10:41:13 +0000 (12:41 +0200)]
btrfs-progs: fsck: understand the -s option
Short options have to be repeated at the getopt_long call.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 17 Jul 2012 10:18:10 +0000 (12:18 +0200)]
btrfs-progs: mkfs: create root directory with 755 permissions
That's what all other mkfs do and there's no reason for 0555.
Signed-off-by: David Sterba <dsterba@suse.cz>
David Sterba [Tue, 17 Jul 2012 10:30:16 +0000 (12:30 +0200)]
btrfs-progs: mkfs: rename nodiscard option to K
The original patch named the option -T, mkfs.xfs uses -K let's keep it
same.
Signed-off-by: David Sterba <dsterba@suse.cz>
Arne Jansen [Tue, 7 Aug 2012 10:37:54 +0000 (12:37 +0200)]
Btrfs progs: quota groups support
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Signed-off-by: Arne Jansen <sensille@gmx.net>
Jan Schmidt [Mon, 20 Aug 2012 11:40:18 +0000 (13:40 +0200)]
Btrfs-progs: replace find_mount_root from send code
find_mount_root had the problem that it tried to conclude from a file system
path to a mount point, taking the fsid as an indicator. This only works if
no two subvolumes (sharing the same btrfs fsid) are mounted in the same
hierarchy.
Now instead, we're parsing /etc/mtab and look for the longest match.
Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
Chris Mason [Thu, 9 Aug 2012 16:48:29 +0000 (12:48 -0400)]
Allow relative paths for btrfs send
The initial btrfs send code was easily confused by relative paths and by
anything that wasn't in the root of the FS. This fixes it to take
relative paths.
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Chris Mason [Wed, 25 Jul 2012 19:02:07 +0000 (15:02 -0400)]
Use intel hardware crc32c where available
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Chris Mason [Tue, 24 Jul 2012 16:17:42 +0000 (12:17 -0400)]
Switch to -O1 for optimizations to enable FORTIFY_SOURCE
Signed-off-by: Chris Mason <chris.mason@fusionio.com>