Add option to silecne mkfs and print only errors, warnings or info on
user request like features or help.
Based on patch from Goffredo Baroncelli <kreijack@inwind.it>
Signed-off-by: David Sterba <dsterba@suse.cz>
block_iterate_proc uses the libext2fs error return codes when it doesn't
need them to return the error. We can push this out to __block_iterate_proc
and allow the reiserfs converter to share the code.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Adding a dirent consists of multiple steps that will need to be taken by
any converter.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
EXT2_FT_REG_FILE and BTRFS_FT_REG_FILE happen to share the same value, but
btrfs_insert_dir_item expects the btrfs version.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
DIV_ROUND_UP may not be defined, so define it if it's not already.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
In preparation to extend to other file systems, rename ext2_root to
image_root.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Hand off initialization of blk_iterate_data to init_blk_iterate_data and
pass the structure when the elements are the only values passed anyway.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Add a check to error out in the following case:
# ./btrfs qgroup limit T /mnt/
Invalid size argument given
Without this patch, btrfs-progs would parse the input as 0
and continue.
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
If we pass a negative value to command qgroup limit, btrfs-progs
would convert it to unsigned long long silently. That's a little
confusing to user, why I can limit my quota to a negative value.
This patch add a check in parse_limit, if the input value is negative,
error out to user.
Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Currently, we can not clear a limitation on a qgroup. Although
there is a 'none' choice provided to user to do it, it does not
work well.
It does not set the flag which user want to clear, then kernel
will never know what the user want to do at all.
*Without this commit*
# ./btrfs qgroup show -re /mnt
qgroupid rfer excl max_rfer max_excl
-------- ---- ---- -------- --------
0/5 2.19GiB 2.19GiB 5.00GiB none
0/257 100.02MiB 100.02MiB none none
# ./btrfs qgroup limit none /mnt
# ./btrfs qgroup show -re /mnt
qgroupid rfer excl max_rfer max_excl
-------- ---- ---- -------- --------
0/5 2.19GiB 2.19GiB 5.00GiB none
0/257 100.02MiB 100.02MiB none none
This patch will set the flag user want to clear and pass a
size=-1 to kernel. Then kernel will clear it correctly.
*With this commit*
# ./btrfs qgroup show -re /mnt
qgroupid rfer excl max_rfer max_excl
-------- ---- ---- -------- --------
0/5 2.19GiB 2.19GiB 5.00GiB none
0/257 100.02MiB 100.02MiB none none
# ./btrfs qgroup limit none /mnt
# ./btrfs qgroup show -re /mnt
qgroupid rfer excl max_rfer max_excl
-------- ---- ---- -------- --------
0/5 2.19GiB 2.19GiB none none
0/257 100.02MiB 100.02MiB none none
Reported-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Tested-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
There are two understanding of the '0' value in btrfs qgroup show.
(1) is no-limitation on this qgroup. (2) is the max-limitation is 0.
This patch make it showing in different way.
(1) max-limitation for 0 is still showing '0'.
(2) no-limitation will show 'none'.
qgroupid rfer excl max_rfer max_excl parent
-------- ---- ---- -------- -------- ------
0/5 2.19GiB 2.19GiB none none ---
0/257 100.02MiB 100.02MiB none none ---
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Tested-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Simple test to verify that the log_root is reset after the command, but
we yet need to provide a testing image with log_root set to something
sensible or crafted images with borked log_root pointer.
Signed-off-by: David Sterba <dsterba@suse.cz>
Curretnly there are no features set for the converted filesystem and
it's not possible to request it like in mkfs.
Add new option -O|--features, use -O list-all to show all that are
supported for convert.
Note: from now on, convert without any -O option will use the same
defaults as mkfs. The original behaviour was rather confusing.
Convert is now more verbose about the parameters of the btrfs filesytem.
Signed-off-by: David Sterba <dsterba@suse.cz>
scrub status for d4dc0da9-e8cc-4bfe-9b6f-2dcf8e0754f5
scrub started at Sat Jan 1 00:00:01 UTC 2000 and finished after 00:43:05
total bytes scrubbed: 111.17GiB with 0 errors
Signed-off-by: David Sterba <dsterba@suse.cz>
- capitalize UUID
- print otime with timezone
- rename 'Object ID' to 'Subvolume ID'
- add ID to Parent and Top level
Signed-off-by: David Sterba <dsterba@suse.cz>
In a chroot environment we may not have /proc mounted, which makes btrfs receive
freak out since it wants to know the base directory where are are mounted for
things like clone and such. Give an option to specify where the mountpoint is
in these cases so you can still do a btrfs receive in a chroot. Thanks,
Signed-off-by: Josef Bacik <jbacik@fb.com>
[added manpage documentation]
Signed-off-by: David Sterba <dsterba@suse.cz>
Here the delete code as below, is trying to check if the provided device
is a block device, there is a function for it. Use it.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Currently BTRFS allows you to make bad choices of data and
metadata levels. For example -d raid1 -m raid0 means you can
only use half your total disk space, but will lose everything
if 1 disk fails. It should give a warning in these cases.
When making a filesystem, check that metadata mode is at least
as redundant as the data mode. For example give warning when:
-d raid1 -m raid0
Signed-off-by: Sam Tygier <samtygier@yahoo.co.uk>
[make the check more visible in mkfs output]
Signed-off-by: David Sterba <dsterba@suse.cz>
A sample test for the misc-test category. Verify that btrfstune sets the
requested fs features. Now implemented extrefs, skinny-metadata and
seeding.
Signed-off-by: David Sterba <dsterba@suse.cz>
Sometimes we need to process the output of the command, but run_check
captures all the output into results file.
Signed-off-by: David Sterba <dsterba@suse.cz>
mkfs.btrfs -O list-all is a good options to list features,
publish it in the help.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Capabilities are cleared after chown, and the btrfs-stream encodes the
CHOWN command after any SET_XATTR command. So the capabilites are not
always preserved.
This could be fixed in kernel to emit the instructions in the right
order, but fix in userspace will make it work for older kernels.
If we see the capabilities among xattrs, cache the value and apply it
again in case it's followed by chown on that file.
Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=68891
Reported-by: Juan Orti Alcaine <j.orti.alcaine@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
This bug is found by making break point after change_fsid_prepare() and
then kill the unfinished change, then try to restore the unfinished fsid
change.
If fsid change is canceled, open_ctree will still fail even with
IGNORE_FSID_MIMATCH open ctree flag, since it can't find device with
mismatched fsid, making it unable to restoring.
Now add ignore_fsid_mismatch judgment in btrfs_find_device() to fix the
bug and allow later restore to work as expected.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Add two options, '-U' and '-u' for btrfstune.
For '-u', it is used to change fsid to a random new UUID.
For '-U', it is used to change fsid to a specified UUID.
Both will also change the internal use only chunk_tree_uuid to a random
new UUID.
Although there is a GNU getopt extension "::" to get optional
option-argument, but is forbidden by POSIX.1-2008, so use split options
here.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Now change_uuid() can auto detected unfinished fsid change and restore
it.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>