path: root/mkfs.c
Commit message (Collapse)AuthorAge
* Mixed back reference (FORWARD ROLLING FORMAT CHANGE)Chris Mason2009-06-08
| | | | | | | | | | | | | | | | | This commit introduces a new kind of back reference for btrfs metadata. Once a filesystem has been mounted with this commit, IT WILL NO LONGER BE MOUNTABLE BY OLDER KERNELS. The new back ref provides information about pointer's key, level and in which tree the pointer lives. This information allow us to find the pointer by searching the tree. The shortcoming of the new back ref is that it only works for pointers in tree blocks referenced by their owner trees. This is mostly a problem for snapshots, where resolving one of these fuzzy back references would be O(number_of_snapshots) and quite slow. The solution used here is to use the fuzzy back references in the common case where a given tree block is only referenced by one root, and use the full back references when multiple roots have a reference
* Fix printf format casting errorsLuca Bruno2009-06-03
| | | | | | | | | | | | There are still some warnings of the form: format '%llu' expects type 'long long unsigned int' but argument has type 'u64' In conjunction with -Werror, this is causing some build failures. Now they're properly casted, avoiding compiler warnings. Signed-off-by: Luca Bruno <> Signed-off-by: Chris Mason <>
* Add -V|--version to mkfs.btrfs argument parserLuca Bruno2009-06-03
| | | | | | | | | | | | | | | mkfs.btrfs now prints its version when invoked with -V|--version and exits without error. All other mkfs.* tools provide this feature and follow this implicit argument naming convention, as it is commonly used to check for helper tools presence. The corrisponding manual already mentions this option, no need to touch it. Signed-off-by: Luca Bruno <> Signed-off-by: Chris Mason <>
* Fix mispatch of the experimental warningsChris Mason2009-01-11
| | | | Signed-off-by: Chris Mason <>
* Fix mkfs.btrfs usage help to match the current argsShen Feng2009-01-07
| | | | | Signed-off-by: Shen Feng <>
* Make the minimum filesystem size error message more clearShen Feng2009-01-07
| | | | | Signed-off-by: Shen Feng <>
* Btrfs: update converter for the new disk formatYan Zheng2008-12-17
| | | | | | | | | | | This patch updates the ext3 to btrfs converter for the new disk format. This mainly involves changing the convert's data relocation and free space management code. This patch also ports some functions from kernel module to btrfs-progs. Thank you, Signed-off-by: Yan Zheng <>
* superblock duplicationYan Zheng2008-12-05
| | | | | | | | | | This patch updates btrfs-progs for superblock duplication. Note: I didn't make this patch as complete as the one for kernel since updating the converter requires changing the code again. Thank you, Signed-off-by: Yan Zheng <>
* Btrfs: move data checksumming into a dedicated treeChris Mason2008-12-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Btrfs stores checksums for each data block. Until now, they have been stored in the subvolume trees, indexed by the inode that is referencing the data block. This means that when we read the inode, we've probably read in at least some checksums as well. But, this has a few problems: * The checksums are indexed by logical offset in the file. When compression is on, this means we have to do the expensive checksumming on the uncompressed data. It would be faster if we could checksum the compressed data instead. * If we implement encryption, we'll be checksumming the plain text and storing that on disk. This is significantly less secure. * For either compression or encryption, we have to get the plain text back before we can verify the checksum as correct. This makes the raid layer balancing and extent moving much more expensive. * It makes the front end caching code more complex, as we have touch the subvolume and inodes as we cache extents. * There is potentitally one copy of the checksum in each subvolume referencing an extent. The solution used here is to store the extent checksums in a dedicated tree. This allows us to index the checksums by phyiscal extent start and length. It means: * The checksum is against the data stored on disk, after any compression or encryption is done. * The checksum is stored in a central location, and can be verified without following back references, or reading inodes. This makes compression significantly faster by reducing the amount of data that needs to be checksummed. It will also allow much faster raid management code in general. The checksums are indexed by a key with a fixed objectid (a magic value in ctree.h) and offset set to the starting byte of the extent. This allows us to copy the checksum items into the fsync log tree directly (or any other tree), without having to invent a second format for them. Signed-off-by: Chris Mason <>
* Add root tree pointer transaction idsYan Zheng2008-10-29
| | | | | | | | | | This patch adds transaction IDs to root tree pointers. Transaction IDs in tree pointers are compared with the generation numbers in block headers when reading root blocks of trees. This can detect some types of IO errors. Signed-off-by: Yan Zheng <>
* update mkfs.btrfs for the new space balancing codeZheng Yan2008-09-26
| | | | | | | The new space balancing code needs a subvol to store the temporary inode for data extent relocation. Signed-off-by: Chris Mason <>
* Full back reference supportZheng Yan2008-09-23
| | | | | | | | This patch makes the back reference system to explicit record the location of parent node for all types of extents. The location of parent node is placed into the offset field of backref key. Every time a tree block is balanced, the back references for the affected lower level extents are updated.
* btrfs-progs new dir index supportJosef Bacik2008-07-24
* Print the version string in a few programsChris Mason2008-07-24
* Add a readonly flag open_ctree to force RO opensChris Mason2008-05-05
* Fix uninitialized variables, and use -O so gcc starts checking for themChris Mason2008-05-01
| | | | | | | | Gcc only sends warnings for uninitialized variables when you compile with -O, and there were a couple of bugs sprinkled in the code. The biggest was the alloc_start variable for mkfs, which can cause strange things to happen. (thanks to Gabor Micsko for helping to find this)
* Add btrfs-vol command to balance, add and (eventually) remove devicesChris Mason2008-04-28
* Add mkfs.btrfs -A offset to control allocation start on devicesChris Mason2008-04-25
| | | | | | This is a utility option for the resizer, it makes sure to allocate at offset bytes in the disk or higher. It ensures the resizer will have something to move when testing it.
* Update the Ext3 converterChris Mason2008-04-22
| | | | | | | | | | | The main changes in this patch are adding chunk handing and data relocation ability. In the last step of conversion, the converter relocates data in system chunk and move chunk tree into system chunk. In the rollback process, the converter remove chunk tree from system chunk and copy data back. Regards YZ ---
* Add a command to show all of the btrfs filesystems on the box (btrfs-show)Chris Mason2008-04-22
* Add checks to avoid adding the same device twice during mkfsChris Mason2008-04-18
* Use better chunk sizes for small and large filesystemsChris Mason2008-04-18
* Add support for filesystem labels via mkfs.btrfs -LChris Mason2008-04-18
* Add raid10 supportChris Mason2008-04-16
* Add chunk uuids and update multi-device back referencesChris Mason2008-04-15
| | | | | | | | | | | | | | | | | | Block headers now store the chunk tree uuid Chunk items records the device uuid for each stripes Device extent items record better back refs to the chunk tree Block groups record better back refs to the chunk tree The chunk tree format has also changed. The objectid of BTRFS_CHUNK_ITEM_KEY used to be the logical offset of the chunk. Now it is a chunk tree id, with the logical offset being stored in the offset field of the key. This allows a single chunk tree to record multiple logical address spaces, upping the number of bytes indexed by a chunk tree from 2^64 to 2^128.
* Use leafsize and nodesize == pagesize for nowChris Mason2008-04-09
* Recow all roots at the end of mkfsChris Mason2008-04-04
| | | | | | The mkfs code bootstraps the filesystem on a single device. Once the raid block groups are setup, it needs to recow all of the blocks so that each tree is properly allocated.
* Add mkfs options for data and metadata mirroring modesChris Mason2008-04-03
| | | | | | | | | | | | | | mkfs.btrfs --data {raid0,raid1,single} mkfs.btrfs --metadata {raid0,raid1,single} In single mode, no extra duplication or striping is done. In raid0 mode, blocks are spread across all of the available devices In raid1 mode, blocks are mirrored across two devices. For metadata, if raid1 is used and there is only one device, the metadata is duplicated on that single spindle. The defaults are raid0 for data and raid1 for metadata
* Add support for single single duplication of metadataChris Mason2008-04-03
* Add mirroring support across multiple drivesChris Mason2008-04-03
* Use getopt_long and introduce long mkfs options. -s now means --sectorsizeChris Mason2008-04-01
* check if partition is mounted before mkfsGoldwyn Rodrigues2008-04-01
| | | | | | | | This saves from the blunder of formatting a live mounted filesystem. This can be extended to get the mount flags of the filesystem mounted. Signed-off-by: Goldwyn Rodrigues <>
* Walk all block devices looking for btrfsChris Mason2008-03-24
* ioctls to scan for btrfs filesystemsChris Mason2008-03-24
* Add support for multiple devices per filesystemChris Mason2008-03-24
* mkfs: Zero 2MB at the start and end of the deviceChris Mason2008-02-15
| | | | But, on sparc, don't zero the first 1k.
* Update btrfs-progs to match kernel sourcesYan2008-01-04
* Add online resizing ioctlsChris Mason2007-12-21
| | | | btrfsctl -r size mount_point
* Reorder extent back refs to differentiate file data from btree blocksChris Mason2007-12-13
* Create macros to generation set/get funcs for on disk structuresChris Mason2007-12-12
* Add back pointers from extents to the file or btree referencing themChris Mason2007-12-11
* Add generation numbers to block pointersChris Mason2007-12-09
* Add simple stripe size parameterChris Mason2007-11-30
* Remove the last radix tree (block_group_cache)Chris Mason2007-10-17
* Switch to byte granular allocationsChris Mason2007-10-15
* Allow large blocksChris Mason2007-10-15
* btrfs-progs support for root block accountingJosef Bacik2007-08-29
| | | | | | This adds support for keeping track of the number of blocks used by root_item's. This makes it so that mkfs lays down the "default" subvol with the correct block accounting in place. Thank you,
* add defrag ioctlChris Mason2007-08-07
* i386 fixes from axboeChris Mason2007-06-12
* add GPLv2Chris Mason2007-06-12