summaryrefslogtreecommitdiff
path: root/utils.h
Commit message (Collapse)AuthorAge
* btrfs-progs: Allow debug-tree to be executed on regular file.Qu Wenruo2015-01-09
| | | | | | | | | | | The commit 1bad43fbe002 ("btrfs-progs: refine btrfs-debug-tree error prompt when a mount point given") add judgement on btrfs-debug-tree to restrict only block device to be executed on, but the command can also be used on regular file, so add regular file support for the judgement. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: move check_arg_type() to util.cGui Hecheng2014-12-29
| | | | | | | | | The check_arg_type() function does quite generic thing, move it to utils.c. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: move contents of math.h to utils.h and deleteDavid Sterba2014-12-19
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: cleanup: avoid to use literal for getopt valSatoru Takeuchi2014-12-19
| | | | Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: basic support for TREE_SEARCH_V2 ioctlDavid Sterba2014-12-10
| | | | | | Add the interface and helper that checks if the v2 ioctl is supported. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add count_digits() function to help calculate filename len.Qu Wenruo2014-12-10
| | | | | | | | Add count_digits() function in utils.h to help calculate filename with ino suffix. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add command btrfs filesystem disk-usageGoffredo Baroncelli2014-12-04
| | | | | Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Enhance the command btrfs filesystem dfGoffredo Baroncelli2014-12-04
| | | | | | | | | | Enhance the command "btrfs filesystem df" to show space usage information for a mount point(s). It shows also an estimation of the space available, on the basis of the current one used. Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it> [code moved under #if 0 instead of deletion] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: move group type and profile pretty printers to utilsDavid Sterba2014-12-04
| | | | | | Move and add the btrfs_ prefix. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: use proper size for argv0 substitutionDavid Sterba2014-11-18
| | | | | | | | | | | | Make run from a long base path will overflow the argv0 buffer during tests. Otherwise, this would happen for all the standalone binaries that use set_argv0. Original report: https://bbs.archlinux.org/viewtopic.php?id=189861 Reported-by: WorMzy Tykashi <wormzy.tykashi@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: optimize btrfs_scan_lblkid() for multiple callsAnand Jain2014-11-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | btrfs_scan_lblikd() is called by most the device related command functions. And btrfs_scan_lblkid() is most expensive function and it becomes more expensive as number of devices in the system increase. Further some threads call this function more than once for absolutely no extra benefit and the real waste of resources. Below list of threads and number of times btrfs_scan_lblkid() is called in that thread. btrfs-find-root 1 btrfs rescue super-recover 2 btrfs-debug-tree 1 btrfs-image -r 2 btrfs check 2 btrfs restore 2 calc-size NC btrfs-corrupt-block NC btrfs-image NC btrfs-map-logical 1 btrfs-select-super NC btrfstune 2 btrfs-zero-log NC tester NC quick-test.c NC btrfs-convert 0 mkfs #number of devices to be mkfs btrfs label set unmounted 2 btrfs get label unmounted 2 This patch will: move out calling register_one_device with in btrfs_scan_lblkid() and so function setting the BTRFS_UPDATE_KERNEL to yes will call btrfs_register_all_devices() separately. introduce a global variable scan_done, which is set when scan is done succssfully per thread. So that following calls to this function will just return success. Further if any function needs to force scan after scan_done is set, then it can be done when there is such a requirement, but as of now there isn't any such requirement. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: introduce btrfs_register_all_device()Anand Jain2014-11-03
| | | | | | | | | | | | This function is to register all devices found after scanning the system. Before we had this functionality with in the btrfs_scan_lblkid(), however scanning and registering are two different distinct operation its better keep them separate. Also we want to optimize btrfs_scan_lblkid and avoid multiple system scans unless needed. As of now device scan uses this function. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: code optimize cmd_scan_dev() use btrfs_register_one_device()Anand Jain2014-11-03
| | | | | | | | cmd_scan_dev() has it own code to register device (calling ioctl BTRFS_IOC_SCAN_DEV), apparently it could use btrfs_register_one_device(). Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: check, ability to detect and fix outdated snapshot root itemsFilipe Manana2014-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds code to detect and fix the issue introduced in the kernel release 3.17, where creation of read-only snapshots lead to a corrupted filesystem if they were created at a moment when the source subvolume/snapshot had orphan items. The issue was that the on-disk root items became incorrect, referring to the pre orphan cleanup root node instead of the post orphan cleanup root node. A test filesystem can be generated with the test case recently submitted for xfstests/fstests, which is essencially the following (bash script): workout() { ops=$1 procs=$2 num_snapshots=$3 _scratch_mkfs >> $seqres.full 2>&1 _scratch_mount snapshot_cmd="$BTRFS_UTIL_PROG subvolume snapshot -r $SCRATCH_MNT" snapshot_cmd="$snapshot_cmd $SCRATCH_MNT/snap_\`date +'%H_%M_%S_%N'\`" run_check $FSSTRESS_PROG -p $procs \ -x "$snapshot_cmd" -X $num_snapshots -d $SCRATCH_MNT -n $ops } ops=10000 procs=4 snapshots=500 workout $ops $procs $snapshots Example of btrfsck's (btrfs check) behaviour against such filesystem: $ btrfsck /dev/loop0 root item for root 311, current bytenr 44630016, current gen 60, current level 1, new bytenr 44957696, new gen 61, new level 1 root item for root 1480, current bytenr 1003569152, current gen 1271, current level 1, new bytenr 1004175360, new gen 1272, new level 1 root item for root 1509, current bytenr 1037434880, current gen 1300, current level 1, new bytenr 1038467072, new gen 1301, new level 1 root item for root 1562, current bytenr 33636352, current gen 1354, current level 1, new bytenr 34455552, new gen 1355, new level 1 root item for root 3094, current bytenr 1011712000, current gen 2935, current level 1, new bytenr 1008484352, new gen 2936, new level 1 root item for root 3716, current bytenr 80805888, current gen 3578, current level 1, new bytenr 73515008, new gen 3579, new level 1 root item for root 4085, current bytenr 714031104, current gen 3958, current level 1, new bytenr 716816384, new gen 3959, new level 1 Found 7 roots with an outdated root item. Please run a filesystem check with the option --repair to fix them. $ echo $? 1 $ btrfsck --repair /dev/loop0 enabling repair mode fixing root item for root 311, current bytenr 44630016, current gen 60, current level 1, new bytenr 44957696, new gen 61, new level 1 fixing root item for root 1480, current bytenr 1003569152, current gen 1271, current level 1, new bytenr 1004175360, new gen 1272, new level 1 fixing root item for root 1509, current bytenr 1037434880, current gen 1300, current level 1, new bytenr 1038467072, new gen 1301, new level 1 fixing root item for root 1562, current bytenr 33636352, current gen 1354, current level 1, new bytenr 34455552, new gen 1355, new level 1 fixing root item for root 3094, current bytenr 1011712000, current gen 2935, current level 1, new bytenr 1008484352, new gen 2936, new level 1 fixing root item for root 3716, current bytenr 80805888, current gen 3578, current level 1, new bytenr 73515008, new gen 3579, new level 1 fixing root item for root 4085, current bytenr 714031104, current gen 3958, current level 1, new bytenr 716816384, new gen 3959, new level 1 Fixed 7 roots. Checking filesystem on /dev/loop0 UUID: 2186e9b9-c977-4a35-9c7b-69c6609d4620 checking extents checking free space cache cache and super generation don't match, space cache will be invalidated checking fs roots checking csums checking root refs found 618537000 bytes used err is 0 total csum bytes: 130824 total tree bytes: 601620480 total fs tree bytes: 580288512 total extent tree bytes: 18464768 btree space waste bytes: 136939144 file data blocks allocated: 34150318080 referenced 27815415808 Btrfs v3.17-rc3-2-gbbe1dd8 $ echo $? 0 Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: add options to tune units for fi df outputDavid Sterba2014-10-10
| | | | | | | | | | | | | The size unit format is a longstanding annoyance. This patch is based on the work of Nils and Alexandre and enhances the options. It's possible to select raw bytes, SI-based or IEC-based compact units (human frientdly) or a fixed base from kilobytes to terabytes. The default is compact human readable IEC-based, no change to current version. CC: Nils Steinger <nst@voidptr.de> CC: Alexandre Oliva <oliva@gnu.org> Reviewed-by: Hugo Mills <hugo@carfax.org.uk> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: extend pretty printers with unit modeDavid Sterba2014-10-10
| | | | | | | | The functionality of pretty unit printing was duplicated by df_pretty_sizes, merge it with pretty_size and enhance the interface with more suffix mode. Raw, binary or decimal. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: remove scan_for_btrfs()Anand Jain2014-10-10
| | | | | | | | With the changes as in the previous patch, now scan_for_btrfs() is an unused function. So delete it. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: remove BTRFS_SCAN_PROC scan methodAnand Jain2014-10-10
| | | | | | | | | | | The libblkid scan method which was introduced later, will also scan devices under /proc/partitions. So we don't have to do the explicit scan of the same. Remove the scan method BTRFS_SCAN_PROC. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: remove BTRFS_SCAN_DEV and btrfs_scan_one_dirEric Sandeen2014-10-10
| | | | | | | | | | After the previous 2 patches, nothing uses whole-dev-tree scanning, so remove the code which implemented that functionality. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: move test_isdir() to utils.cSatoru Takeuchi2014-08-22
| | | | | | | | | | | | Since test_isdir() is a utility function, it's better to move it to utils.c. In addition, "const char *" is more appropriate type as its "path" argument because this argument is not changed in this function. Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Cc: David Sterba <dsterba@suse.cz> Cc: Mike Fleetwood <mike.fleetwood@googlemail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: introduce test_issubvolname() for simplicitySatoru Takeuchi2014-08-22
| | | | | | | | | | | There are many duplicated codes to check if the given string is correct subvolume name. Introduce test_issubvolname() for this purpose for simplicity. Signed-off-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com> Cc: David Sterba <dsterba@suse.cz> Cc: Mike Fleetwood <mike.fleetwood@googlemail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: define BTRFS_MKFS_SMALL_VOLUME_SIZE for small volumeAnand Jain2014-08-22
| | | | | | | | mkfs cut of size '1024 * 1024 * 1024' to mark dev as small volume so to force mixed group. Use a define for that. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: move the check_argc_* functions into utils.cGui Hecheng2014-08-22
| | | | | | | | | | | | | | To let the independent tools(e.g. btrfs-image, btrfs-convert, etc.) share the convenience of check_argc_* functions, just move it into utils.c. Also add a new function "set_argv0" to set the correct tool name: *btrfs-image*: too few arguments The original btrfs* tools work as before. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> [moved argv0 and check_argc to utils.*] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Add minimum device size checkQu Wenruo2014-08-22
| | | | | | | | | | | | | | | | | | | Btrfs has global block reservation, so even mkfs.btrfs can execute without problem, there is still a possibility that the filesystem can't be mounted. For example when mkfs.btrfs on a 8M file on x86_64 platform, kernel will refuse to mount due to ENOSPC, since system block group takes 4M and mixed block group takes 4M, and global block reservation will takes all the 4M from mixed block group, which makes btrfs unable to create uuid tree. This patch will add minimum device size check before actually mkfs. The minimum size calculation uses a simplified one: minimum_size_for_each_dev = 2 * (system block group + global block rsv) and global block rsv = leafsize << 10 Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: canonicalize pathnames for device commandsJeff Mahoney2014-08-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mount(8) will canonicalize pathnames before passing them to the kernel. Links to e.g. /dev/sda will be resolved to /dev/sda. Links to /dev/dm-# will be resolved using the name of the device mapper table to /dev/mapper/<name>. Btrfs will use whatever name the user passes to it, regardless of whether it is canonical or not. That means that if a 'btrfs device ready' is issued on any device node pointing to the original device, it will adopt the new name instead of the name that was used during mount. Mounting using /dev/sdb2 will result in df: /dev/sdb2 209715200 39328 207577088 1% /mnt lrwxrwxrwx 1 root root 4 Jun 4 13:36 /dev/whatever-i-like -> sdb2 /dev/whatever-i-like 209715200 39328 207577088 1% /mnt Likewise, mounting with /dev/mapper/whatever and using /dev/dm-0 with a btrfs device command results in df showing /dev/dm-0. This can happen with multipath devices with friendly names enabled and doing something like 'partprobe' which (at least with our version) ends up issuing a 'change' uevent on the sysfs node. That *always* uses the dm-# name, and we get confused users. This patch does the same canonicalization of the paths that mount does so that we don't end up having inconsistent names reported by ->show_devices later. Signed-off-by: Jeff Mahoney <jeffm@suse.com> [use PATH_MAX in canonicalize_dm_name] Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: mkfs: allow UUID specification at mkfs timeEric Sandeen2014-08-22
| | | | | | | | | | | | | | | Allow the specification of the filesystem UUID at mkfs time. Non-unique unique IDs are rejected. This includes attempting to re-mkfs with the same UUID; if you really want to do that, you can mkfs with a new UUID, then re-mkfs with the one you wanted. (Implemented only for mkfs.btrfs, not btrfs-convert). Signed-off-by: Eric Sandeen <sandeen@redhat.com> [converted help to asciidoc] Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: allow compression property gets for read-only subvolumesFilipe David Borba Manana2014-05-02
| | | | | | | | | | | | Because the function open_file_or_dir() always opened the input file in read/write mode (O_RDWR), we were not able to due a compression property get against a file living in a read-only subvolume/snapshot. Fix this by opening the file with O_RDONLY mode if we're doing a property get. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Reviewed-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: Allow use of get_device_info()Goffredo Baroncelli2014-03-21
| | | | | | | | Allow the use of get_device_info() for different units. Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: new helper to parse string to u64 for btrfsWang Shilong2014-03-21
| | | | | | | | | | | | | | | | | | There are many places that need parse string to u64 for btrfs commands, in fact, we do such things *too casually*, using atoi/atol/atoll..is not right at all, and even we don't check whether it is a valid string. Let's do everything more gracefully, we introduce a new helper arg_strtou64() which will do all the necessary checks.If we fail to parse string to u64, we will output message and exit directly, this is something like what usage() is doing. It is ok to not return erro to it's caller, because this function should be called when parsing arg (just like usage!) Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: move find_mount_root to utils.[ch]Qu Wenruo2014-03-21
| | | | | | | | Move find_mount_root to utils.[ch] for general use. Signed-off-by: Qu Wenruo <quwenruo@cn.fuijitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: define BTRFS_UUID_UNPARSE_SIZE for uuid unparse buf sizeAnand Jain2014-01-31
| | | | | | | | | we use 37 as the allocation size to hold the uuid_unparse, here it defines BTRFS_UUID_UNPARSE_SIZE for the same. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: let get_label return the label instead of printing itFilipe David Borba Manana2014-01-31
| | | | | | | | | get_label prints the label at the moment. Change this so that the label is returned and printing is done by the caller. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: make pretty_sizes take u64 instead of a doubleJosef Bacik2013-10-24
| | | | | | | | | | | | | This got changed to a double but all the callers still use a u64, which causes us to segfault sometimes because of some weird C voodoo that I had to have explained to me. Apparently because we're using a double the compiler will use the floating point registers to hold our argument which ends up not being aligned properly if you don't actually give it a double so it will cause problems for other things, in our case it was screwing up str_bytes so it was larger than the actual size of the str. This patch fixes the segfault. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: filesystem show of specified mounted disk should workAnand Jain2013-10-24
| | | | | | | | | | Originally, thinking was user will use mount point if the disk is mounted. But thats not really true, actually user don't (or shouldn't) care to check if disk mounted, so whether disk is mounted/unmounted when disk path is specified it should work. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: make get_btrfs_mount callableAnand Jain2013-10-24
| | | | | | | | | get_btrfs_mount is reusable function but it is printing errors, this removes it. Here the parent function of open_path_or_dev_mnt does print error msg on error. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: use kernel for mounted disk for showAnand Jain2013-10-16
| | | | | | | | | | | | | As of now btrfs filesystem show reads directly from disks. So sometimes output can be stale, mainly when user wants to cross verify their operation like, label or device delete or add... etc. so this patch will read from the kernel ioctl if it finds that disk is mounted. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: make pretty_size_snprintf() return lenWang Shilong2013-10-16
| | | | | | | | Sometimes, we need to catch length of snprintf() in pretty_size_snprintf(). Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: create helper function to use lblkid to scan for btrfs disksAnand Jain2013-10-16
| | | | | | Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: look up the containing tree root idDavid Sterba2013-10-16
| | | | | | | | | | Find the tree id of the containing subvolume for a given file or directory. For subvolume return it's own id. $ btrfs inspect-internal rootid <path> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: move ask_user() to utils.cWang Shilong2013-10-16
| | | | | | Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: use better name for nodiscard variable and flip the logicDavid Sterba2013-10-16
| | | | | Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: make btrfs-corrupt-block compile againDavid Sterba2013-10-16
| | | | | | | Reexport csum_tree_block. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: mkfs should check for small vol well beforeAnand Jain2013-10-16
| | | | | | | | | | | | | | | | | | This fix the regression introduced by 830427d that it no more creates the FS if disk is small and if no mixed option is provided. This patch will bring it to the original design which will force mixed profile when disk is small and go ahead to create the FS. Which also means that before we open the device for the write we should also check if disk is small. v2: fixes the checkpatch.pl warnings Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: avoid write to the disk before sure to create fsAnand Jain2013-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | This patch provides fix for the following bug, When mkfs.btrfs fails the disks shouldn't be written. ------------ btrfs fi show /dev/sdb Label: none uuid: 60fb76f4-3b4d-4632-a7da-6a44dea5573d Total devices 1 FS bytes used 24.00KiB devid 1 size 2.00GiB used 20.00MiB path /dev/sdb mkfs.btrfs -dsingle -mraid1 /dev/sdb -f :: unable to create FS with metadata profile 16 (have 1 devices) btrfs fi show /dev/sdb Label: none uuid: 2da2179d-ecb1-4a4e-a44d-e7613a08c18d Total devices 1 FS bytes used 24.00KiB devid 1 size 2.00GiB used 20.00MiB path /dev/sdb ------------- Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: mkfs can now create fs with skinny extentsFilipe David Borba Manana2013-09-03
| | | | | | | | | | | Before this change, passing -O skinny-metadata to mkfs.btrfs would only set the skinny metadata incompat flag in the super block after the filesystem was created. This change makes mkfs.btrfs directly create a filesystem with only skinny extents for metadata. Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: mark static & remove unused from non-kernel codeEric Sandeen2013-09-03
| | | | | | | | Mark many functions as static, and remove any resulting dead code. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: drop unused parameter from btrfs_release_pathEric Sandeen2013-09-03
| | | | | | | | | | | | | | | Port of commit b3b4aa7 to userspace. parameter tree root it's not used since commit 5f39d397dfbe140a14edecd4e73c34ce23c4f9ee ("Btrfs: Create extent_buffer interface for large blocksizes") This gets userspace a tad closer to kernelspace by removing this unused parameter that was all over the codebase... Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: get_label_mounted to return label instead of printAnand Jain2013-08-09
| | | | | | | | This would help to reuse the function Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: congregate dev scanAnand Jain2013-08-09
| | | | | | | | | | | | | | | | the dev scan to find btrfs is performed at two locations all most the same way one at filesystem show and another at device scan. They both follow the same steps. This patch does not alter anything except that it brings these two same logic into the function scan_for_btrfs so that we can play tweaking it. the patch which recommends to use /dev/mapper will also need it Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: btrfs_scan_for_fsid doesn't need all the argumentsAnand Jain2013-08-09
| | | | | | | | | btrfs_scan_for_fsid uses only one argument run_ioctl out of 3 so remove the rest two of them Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>