summaryrefslogtreecommitdiff
path: root/mkfs.c
Commit message (Collapse)AuthorAge
* btrfs-progs: mkfs: remove experimental tagDavid Sterba2014-08-22
| | | | | | | Make it consistent with kernel status and documentation. Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.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: dont break the stringAnand Jain2014-08-22
| | | | | Signed-off-by: Anand Jain <anand.jain@oracle.com> 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: 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: fix mkfs.btrfs segfault with --features optionHolger Hoffstätte2014-05-02
| | | | | | | | | | The mkfs.btrfs --features long option takes an argument but does not declare it. Consequently getopt does not allocate an argument, which makes an unconditional strdup() crash during options parsing. Fix by declaring the argument in the options alias array. Signed-off-by: Holger Hoffstätte <holger.hoffstaette@googlemail.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: mkfs: remove ununsed parametersRakesh Pandit2014-05-02
| | | | | | | Remove ununsed parameters since 71d6bd3c in create_raid_groups. Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: mkfs: Remove 'zero_end =1' since it has been set to a valueLi Yang2014-05-02
| | | | | | | | | In utils.c, zero_end is used as a parameter, should not force it to 1. In mkfs.c, zero_end is set to 1 or 0(-b) at the beginning, should not force it to 1 unconditionally. Signed-off-by: Li Yang <liyang.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: skip erroneous free before initializationGui Hecheng2014-03-21
| | | | | | | | | If the list is not initialized, don't try to free it. Otherwise it will cause segmentfault. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: fix bug on mkfs with relative path specifiedGui Hecheng2014-03-21
| | | | | | | | | | | | | | | | The bug accurs when exec: # mkfs.btrfs -r <a relative path> <device> (note: the path should be 'valid' correspond to your `pwd`) error msg: $ scandir for <a relative path> failed: No such file... o Replace strdup() with realpath() to get the correct scan path. o fix memory leaks and adopt the "single return + goto out" pattern Reported-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: mkfs: make sure we can deal with hard links with -r optionWang Shilong2014-03-21
| | | | | | | | | | | | | | | | Steps to reproduce: # mkdir -p /tmp/test # touch /tmp/test/file # ln /tmp/test/file /tmp/test/hardlinks # mkfs.btrfs -f /dev/sda13 -r /tmp/test # btrfs check /dev/sda13 To deal with hard link, we must deal with inode with same inode id rather than increase inode id by ourselves. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: mkfs: don't create extent for an empty fileWang Shilong2014-03-21
| | | | | | | | | | | | | | Steps to reproduce: # mkdir -p /tmp/test # touch /tmp/test/file # mkfs.btrfs -f /dev/sda13 -r /tmp/test # btrfs check /dev/sda13 For an empty file, don't create extent data for it. Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: include <sys/xattr.h> instead of <attr/xattr.h>Christophe Vu-Brugier2014-03-21
| | | | | | | | | | | The `btrfs` and `mkfs.btrfs` binaries are not linked against libattr so the correct header to include is <sys/xattr.h>. This fixes the build when attr header files are not installed. Signed-off-by: Christophe Vu-Brugier <cvubrugier@yahoo.fr> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* Btrfs-progs: add support for the no holes incompat flagJosef Bacik2014-01-31
| | | | | | | | | | This adds the flag to ctree.h, adds the feature option to mkfs to turn it on and fixes fsck so it doesn't complain about missing hole extents in files when this flag is set. Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: handle error in the btrfs_prepare_deviceAnand Jain2014-01-31
| | | | | | | | | this patch will handle the strerror reporting of the error instead of printing errno, and also replaced the BUG_ON with the error handling 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: remove NULL-ptr judge before free for btrfs-progsGui Hecheng2014-01-31
| | | | | | | | | free(3) already checks the pointer for NULL, no need to do it on your own. This patch make the change globally. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: Turning ON incompat isn't an errorAnand Jain2014-01-31
| | | | | | 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: fix the mismatch of extent buffer's spaceLiu Bo2014-01-31
| | | | | | | | | | | | | | | | | | Now we set @refs to 2 on creating a new extent buffer, meanwhile we allocate the needed free space, but we don't give enough free_extent_buffer() to reduce the eb's references to zero so that the eb can finally be freed, so the problem is we has decrease the referene count of backrefs to zero, which ends up releasing the space occupied by the eb, and this space can be allocated again for something else(another eb or disk), usually a crash(core dump) will occur, I've hit a crash in rb_insert() because another eb re-use the space while the original one is floating around. We should do the same thing as the kernel code does, it's necessary to initialize @refs to 1 instead of 2, this helps us get rid of the above problem. Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
* btrfs-progs: for mixed group check opt before default raid profile is enforcedAnand Jain2013-11-15
| | | | | | | | | | | | This fixes the regression introduced with the patch btrfs-progs: avoid write to the disk before sure to create fs what happened with this patch is it missed the check to see if the user has the option set before pushing the defaults. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: mkfs: enable extended refs by defaultDavid Sterba2013-11-14
| | | | | | | | | | | The feature has been introduced in kernel 3.7 and enabling it by default is desired. All features enabled by default are marked as such in 'mkfs.btrfs -O list-all' output. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: mkfs: extend -O syntax to disable featuresDavid Sterba2013-11-14
| | | | | | | | A way of disabling features that are on by default in case it's not wanted, eg. due to lack of support in the used kernel. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* mkfs: change default metadata blocksize to 16KBChris Mason2013-11-08
| | | | | | | | | | | | | | | | 16KB is faster and leads to less metadata fragmentation in almost all workloads. It does slightly increase lock contention on the root nodes in some workloads, but that is best dealt with by adding more subvolumes (for now). This uses 16KB or the page size, whichever is bigger. If you're doing a mixed block group mkfs, it uses the sectorsize instead. Since the kernel refuses to mount a mixed block group FS where the metadata leaf size doesn't match the data sectorsize, this also adds a similar check during mkfs. Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: don't leak buffer on add_file_items() errorEric Sandeen2013-11-07
| | | | | | | | | add_file_items() leaked "buffer" on this error return. Free it first. Resolves-Coverity-CID: 1125937 Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: rework open_ctree to take flags, add a new one V2Josef Bacik2013-11-07
| | | | | | | | | | | So I needed to add a flag to not try to read block groups when doing --init-extent-tree since we could hang there, but that meant adding a whole other 0/1 type flag to open_ctree_fs_info. So instead I've converted it all over to using a flags setting and added the flag that I needed. This has been tested with xfstests and make test. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* mkfs: fix mkfs -r to properly allocate spaceChris Mason2013-10-16
| | | | | | | | | | | | | | | | mkfs -r wasn't creating chunks properly, making it very difficult to allocate space for anything except tiny filesystems. This changes it around to use more of the generic infrastructure, and to do actual logical->physical block number translation. It also allocates space to the files in smaller extents (max 1MB), which keeps the allocator from trying to allocate an extent bigger than a single chunk. It doesn't quite support multi-device mkfs -r yet, but is much closer. 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: fix -Wmissing-noreturnChris West (Faux)2013-10-16
| | | | | | Signed-off-by: "Chris West (Faux)" <git@goeswhere.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: error if device have no space to make primary chunksHidetoshi Seto2013-10-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous patch works fine if the size of specified volume to mkfs is less than 4MB. However usually btrfs requires more than 4MB to work, and the minimum preferred size is depending on the raid setting etc. This patch let mkfs print error message if it cannot allocate one of chunks should be there at first. [before] # truncate --size=4500K testfile # ./mkfs.btrfs -f testfile : SMALL VOLUME: forcing mixed metadata/data groups mkfs.btrfs: mkfs.c:84: make_root_dir: Assertion `!(ret)' failed. Aborted (core dumped) [After] # truncate --size=4500K testfile # ./mkfs.btrfs -f testfile : SMALL VOLUME: forcing mixed metadata/data groups no space to alloc data/metadata chunk failed to setup the root directory TBD is calculate minimum size for setting and put it in the error message to let user know how large amount of volume is required. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: error if device for mkfs is too smallHidetoshi Seto2013-10-16
| | | | | | | | | | | | | | | | | | | | Eric pointed out that mkfs abort if specified volume is too small: # truncate --size=2m testfile # ./mkfs.btrfs testfile : SMALL VOLUME: forcing mixed metadata/data groups mkfs.btrfs: volumes.c:852: btrfs_alloc_chunk: Assertion `!(ret)' failed. Aborted (core dumped) As the first step to fix problems around there, let mkfs to report error if the size of target volume is less than the size of the first system block group, BTRFS_MKFS_SYSTEM_GROUP_SIZE (= 4MB). Reported-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: local variable memory freedGui Hecheng2013-10-16
| | | | | | | | | The local probe variable in is_ssd() freed upon unsuccessful return; The local dir_head list in make_image() freed upon unsuccessful return. Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: fix compile warning in is_ssd()Wang Shilong2013-10-16
| | | | | | | | | | | mkfs.c: In function ‘is_ssd’: mkfs.c:1168:26: warning: ignoring return value of ‘blkid_devno_to_wholedisk’, declared with attribute warn_unused_result [-Wunused-result] blkid_devno_to_wholedisk(devno, wholedisk, sizeof(wholedisk), NULL); 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: 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: use NULL instead of 0Zach Brown2013-09-03
| | | | | | | | | These were mostly in option structs but there were a few gross string pointer arguments given as 0. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: don't use <linux/fs.h>Zach Brown2013-09-03
| | | | | | | | | | | | | | | sparse can freak out when <linux/fs.h> is included because it redefines approximately a gazillion symbols already found in <sys/mount.h>: /usr/include/linux/fs.h:203:9: warning: preprocessor token MS_RDONLY redefined /usr/include/sys/mount.h:37:9: this was the original definition Happily, we don't actually need to include the low-level <linux/fs.h> for anything. One assumes it was just carried over from kernel space. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: remove __CHECKER__ from main codeZach Brown2013-09-03
| | | | | | | | | | | | __CHECKER__ is only for the type juggling used to tell sparse which types need conversion between address spaces. It is not OK to use to change the code that gets checked to avoid bugs elsewhere in the build infrastructure. We want to check the code that builds when the checker isn't enabled. Signed-off-by: Zach Brown <zab@redhat.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: mkfs.btrfs documentation: clarify current restrictions of ↵Koen De Wit2013-09-03
| | | | | | | | | | | | | | | | sectorsize, nodesize and leafsize Commit 8d082fb727ac11930ea20bf1612e334ea7c2b697 (Btrfs: do not mount when we have a sectorsize unequal to PAGE_SIZE) requires the sectorsize to be equal to the pagesize for the filesystem to be mountable. The nodesize and leafsize should be equal, and not larger than 65536. Adding this information to the manpage and usage instructions of mkfs.btrfs. Signed-off-by: Koen De Wit <koen.de.wit@oracle.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: return error on write failure in make_btrfs()Filipe David Borba Manana2013-08-09
| | | | | | | | | | | Instead of aborting with a BUG_ON() statement, return a negated errno code. Also updated mkfs and convert tools to print a nicer error message when make_btrfs() returns an error. 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: per-thread, per-call pretty bufferZach Brown2013-08-09
| | | | | | | | | | | | | | | | | We don't need callers to manage string storage for each pretty_sizes() call. We can use a macro to have per-thread and per-call static storage so that pretty_sizes() can be used as many times as needed in printf() arguments without requiring a bunch of supporting variables. This lets us have a natural interface at the cost of requiring __thread and TLS from gcc and a small amount of static storage. This seems better than the current code or doing something with illegible format specifier macros. Signed-off-by: Zach Brown <zab@redhat.com> Acked-by: Wang Shilong <wangs.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: mkfs: add -O option to specify fs featuresDavid Sterba2013-08-09
| | | | | | | | Extend mkfs options to specify optional or potentially backwards incompatible features. Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* Btrfs-progs: fix missing recow roots when making btrfs filesystemWang Shilong2013-07-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When making btrfs filesystem. we firstly write root leaf to specified filed, and then we recow the root. If we don't recow, some trees are not in the correct block group. Steps to reproduce: dd if=/dev/zero of=test.img bs=1M count=100 mkfs.btrfs -f test.img btrfs-debug-tree test.img extent tree key (EXTENT_TREE ROOT_ITEM 0) leaf 4210688 items 10 free space 3349 generation 4 owner 2 fs uuid 2e08fd93-f24d-4f44-a226-e2116fcd544f chunk uuid dc482988-6246-46ce-9329-68bcf6d3683c item 0 key (0 BLOCK_GROUP_ITEM 4194304) itemoff 3971 itemsize 24 block group used 12288 chunk_objectid 256 flags 2 [..snip..] item 3 key (1138688 EXTENT_ITEM 4096) itemoff 3827 itemsize 42 extent refs 1 gen 1 flags 2 tree block key (0 UNKNOWN.0 0) level 0 item 4 key (1138688 TREE_BLOCK_REF 7) itemoff 3827 itemsize 0 tree block backref [..snip..] checksum tree key (CSUM_TREE ROOT_ITEM 0) leaf 1138688 items 0 free space 3995 generation 1 owner 7 fs uuid 2e08fd93-f24d-4f44-a226-e2116fcd544f chunk uuid dc482988-6246-46ce-9329-68bcf6d3683c For the above example, csum root leaf comes into system block group which is wrong,csum root leaf should be in metadata block group. Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com> Reviewed-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
* btrfs-progs: use clearer var names in is_ssd()Eric Sandeen2013-04-23
| | | | | | | | | | | | | | is_ssd() uses nondescript variable names; path - to what? disk - it's a dev_t not a disk name, unlike dev, which is a name not a dev_t! Rename some vars to make things hopefully clearer: wholedisk - the name of the node for the entire disk devno - the dev_t of the device we're mkfs'ing sysfs_path - the path in sysfs we ultimately check Signed-off-by: Eric Sandeen <sandeen@redhat.com>
* btrfs-progs: replace blkid_probe_get_wholedisk_devnoEric Sandeen2013-04-23
| | | | | | | | | | | | | | blkid_probe_get_wholedisk_devno() isn't available in some older versions of libblkid. It was used to work around an old bug in blkid_devno_to_wholedisk(), but that has been fixed since 5cd0823 libblkid: fix blkid_devno_to_wholedisk(), present in util-linux 2.17 and beyond. If we happen to be missing that fix, the worst that happens is that we'd fail to detect that a device is an ssd; the upside is that this code compiles on older systems. Signed-off-by: Eric Sandeen <sandeen@redhat.com>
* btrfs-progs: do not enable extended refs in mkfs by defaultDavid Sterba2013-04-23
| | | | | | | | | | | This extref feature (lifting the single file hardlink limitation) is new and not backward compatible with older kernels that are still in wide use. For now, use btrfstune to enable the feature, in the future it will be possible to turn it on within mkfs by -O option. Signed-off-by: David Sterba <dsterba@suse.cz>
* btrfs-progs: revert skinny extents changes from mkfsDavid Sterba2013-04-23
| | | | | | | We are going to unify enabling filesystem features via option -O. For now, use btrfstune to enable the features. Signed-off-by: David Sterba <dsterba@suse.cz>
* Btrfs-progs: add skinny metadata support to progs V3Josef Bacik2013-04-23
| | | | | | | | | This fixes up the progs to properly deal with skinny metadata. This adds the -x option to mkfs and btrfstune for enabling the skinny metadata option. This also makes changes to fsck so it can properly deal with the skinny metadata entries. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com>
* btrfs-progs: mkfs should first check all disks before writing to a diskAnand Jain2013-04-23
| | | | | | | | | | | | | | | | | | | | | | | | | | In the cases where one of the disk is not suitable for btrfs, then we would fail the mkfs, however we determine that after we have written btrfs to the preceding disks. At this time if user changes mind for not to use btrfs will left with no choice. So this patch will check if all the provided disks are suitable for the btrfs at once before proceeding to create btrfs on a disk. Further this patch also removed duplicate code to check device suitability for the btrfs. Next, there is an existing bug about the -r mkfs option, which this patch would carry forward most of it. Ref: [PATCH 2/2, RFC] btrfs-progs: overhaul mkfs.btrfs -r option Signed-off-by: Anand Jain <anand.jain@oracle.com> to merg prev Signed-off-by: Anand Jain <anand.jain@oracle.com>
* btrfs-progs: document force option in mkfs usage(); add long optEric Sandeen2013-03-14
| | | | | | | | | | I missed updating the mkfs.btrfs usage() when I added the option to force fs overwrite. Update that, and while we're at it add a long option, since all other commands have long counterparts. Signed-off-by: Eric Sandeen <sandeen@redhat.com>