summaryrefslogtreecommitdiff
path: root/mkfs/common.h
Commit message (Collapse)AuthorAge
* btrfs-progs: mkfs: Enhance minimal device size calculation to fix mkfs ↵Qu Wenruo2018-01-03
| | | | | | | | | | | | | | | | | | | | | | failure on small file Since commit c11e36a29e84 ("Btrfs-progs: Do not force mixed block group creation unless '-M' option is specified"), mkfs no longer use mixed block group unless specified manually. This breaks the minimal device size calculation, which only considered mixed block group use case. This patch enhances minimal device size calculation for mkfs, by using different minimal stripe length (calculated from code) for different profiles, and use them to calculate minimal device size. Reported-by: Wesley Aptekar-Cassels <W.Aptekar@gmail.com> Fixes: c11e36a29e84 ("Btrfs-progs: Do not force mixed block group creation unless '-M' option is specified") Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> [ updated comments ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: check the status of file at mkfsMisono, Tomohiro2018-01-03
| | | | | | | | | | | | | Currently, only the status of block devices is checked at mkfs, but we should also check for regular files whether they are already formatted or mounted to prevent overwrite accidentally. Device status is checked by test_dev_for_mkfs(). The part which is not related to block device is split from this and used for both block device and regular file. Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: refactor test_minimum_size to use the calculated minimal sizeQu Wenruo2017-11-14
| | | | | | | | | | | | | | test_minimum_size() function is only called to check if provided device is large enough. However the minimal device size only needs to be calculated once, and can be reused everywhere. Refactor that function to make later modification easier. Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: Replace number with enumGu Jinxiang2017-09-08
| | | | | | | | | For code maintainability and scalability, replace hardcoded constant with a meaningful enum. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> [ add MKFS_ prefix ] Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: use const char for labelDavid Sterba2017-03-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: make make_cfg::blocks an internal memberDavid Sterba2017-03-08
| | | | | | | The caller of make_btrfs does not need to set it, it's for internal use and can be read after mkfs ends. Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: mkfs: describe fields of btrfs_mkfs_configDavid Sterba2017-03-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: move more mkfs declarations to the common headerDavid Sterba2017-03-08
| | | | Signed-off-by: David Sterba <dsterba@suse.com>
* btrfs-progs: move mkfs definitions to own headerDavid Sterba2017-03-08
Create a header for filesystem creation API, the config and the main entry function. Signed-off-by: David Sterba <dsterba@suse.com>