path: root/disk-io.c
Commit message (Collapse)AuthorAge
* btrfs-progs: cast u64 to long long to avoid printf warningsAnton Blanchard2011-10-25
| | | | | | | | | | | | When building on ppc64 I hit a number of warnings in printf: btrfs-map-logical.c:69: error: format ‘%Lu’ expects type ‘long long unsigned int’, but argument 4 has type ‘u64’ Fix them. Signed-off-by: Anton Blanchard <> Signed-off-by: Hugo Mills <>
* Fix unused-but-set errors in gcc-4.6Chris Ball2011-10-25
| | | | | | | | | | | | | | | | gcc-4.6 (as shipped in Fedora) turns on -Wunused-but-set-variable by default, which breaks the build when combined with -Wall, e.g.: debug-tree.c: In function ‘print_extent_leaf’: debug-tree.c:45:13: error: variable ‘last_len’ set but not used [-Werror=unused-but-set-variable] debug-tree.c:44:13: error: variable ‘last’ set but not used [-Werror=unused-but-set-variable] debug-tree.c:41:21: error: variable ‘item’ set but not used [-Werror=unused-but-set-variable] cc1: all warnings being treated as errors This patch fixes the errors by removing the unused variables. Signed-off-by: Chris Ball <> Signed-off-by: Hugo Mills <>
* Btrfs-progs: add a btrfs-select-super command to overwrite the superChris Mason2011-10-25
| | | | | | | | | | | | Btrfs stores multiple copies of the superblock, and for common power-failure crashes where barriers were not in use, one of the super copies is often valid while the first copy is not. This adds a btrfs-select-super -s N /dev/xxx command, which can overwrite all the super blocks with a copy that you have already determined is valid with btrfsck -s Signed-off-by: Chris Mason <>
* Fill missing devices so degraded filesystems can be readChris Mason2011-04-22
| | | | | | | | When a device is missing, the btrfs tools need to be able to read alternate copies from the remaining devices. This creates placeholder devices that always return -EIO so the tools can limp along. Signed-off-by: Chris Mason <>
* Fix use after free in close_ctreeJeff Mahoney2010-09-23
| | | | | | | | | | | | | | | After the roots are closed, root is freed. Yet close_ctree continues to use it. It works generally because no new memory is allocated in the interim, but with glibc malloc perturbing enabled, it crashes every time. This is because root->fs_info points to garbage. This patch uses the already-cached fs_info variable for the rest of the accesses and fixes the crash. This issue was reported at: Signed-off-by: Jeff Mahoney <>
* Make csum_tree_block_size complain about the right thing.Zhu Yanhai2010-09-23
| | | | | | It dereferenced a wrong pointer before. Signed-off-by: Zhu Yanhai <>
* Update converter for the new formatYan Zheng2009-06-08
| | | | | Signed-off-by: Yan Zheng <> Signed-off-by: Chris Mason <>
* 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 spelling mistake when running 'btrfsck' when argument doesn't exist.nick d2009-06-03
| | | | Signed-off-by: Chris Mason <>
* Add scan of the btrfs log tree to btrfs-debug-treeChris Mason2009-04-15
* btrfsck: Exit and print error message when not able to open a deviceThadeu Lima de Souza Cascardo2009-01-21
| | | | | | If btrfsck is not able to open a device, it segfaults. This fixes it and prints an error message too.
* 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-progs: support for different csum algorithimsJosef Bacik2008-12-02
| | | | | | | | | | | | | This is the btrfs-progs version of the patch to add the ability to have different csum algorithims. Note I didn't change the image maker since it seemed a bit more complicated than just changing some stuff around so I will let Yan take care of that. Everything else was converted and for now a mkfs just sets the type to be BTRFS_CSUM_TYPE_CRC32. Signed-off-by: Josef Bacik <>
* Btrfs image toolYan Zheng2008-11-20
| | | | | | | | | This patch adds btrfs image tool. The image tool is a debugging tool that creates/restores btrfs metadump image. Signed-off-by: Yan Zheng <>
* update btrfs-progs for seed device supportYan Zheng2008-11-18
| | | | | | | | | | | | This patch does the following: 1) Update device management code to match the kernel code. 2) Allocator fixes. 3) Add a program called btrfstune to set/clear the SEEDING super block flags.
* Avoid tree of tree root cow when committing a clean FSChris Mason2008-10-30
| | | | | | | | | | | | | The root node generation number code made commit_tree_root look like the kernel code. It forces a cow of the tree of tree roots even when the FS hasn't changed. This causes errors during fsck and other readonly operations. This adds a check to see if commit_tree_root is going to trigger writes to the tree of tree roots, and bails if none are pending. 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 <>
* Verify parent generation number on btree readsChris Mason2008-05-13
* Pass down the expected generation number when reading tree blocksChris Mason2008-05-12
* Add a readonly flag open_ctree to force RO opensChris Mason2008-05-05
* 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 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.
* Write all super blocks during commitChris Mason2008-04-10
* Retry metadata reads in the face of checksum failuresChris Mason2008-04-09
* Change btrfs_map_block to return a structure with mappings for all stripesChris 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 mirroring support across multiple drivesChris Mason2008-04-03
* btrfs-progs: Fix printf format casting errorsAlex Chiang2008-04-01
| | | | | | | | | | | We get lots of warnings of the flavor: utils.c:441: warning: format '%Lu' expects type 'long long unsigned int' but argument 2 has type 'u64' And thanks to -Werror, the build fails. Clean up these printfs by properly casting the arg to the format specified. Signed-off-by: Alex Chiang <>
* Update struct btrfs_header flags, and use it to indicate buffers are writtenChris Mason2008-04-01
* Walk all block devices looking for btrfsChris Mason2008-03-24
* Btrfsck updates for multi-device filesystemsChris Mason2008-03-24
* Dynamic chunk allocationChris Mason2008-03-24
* Add support for multiple devices per filesystemChris Mason2008-03-24
* Rename the extent_map code to extent_ioChris Mason2008-03-04
| | | | This mirrors the changes in the kernel code.
* Add rollback support for the converterYan2008-01-08
| | | | | | This patch adds rollback support for the converter, the converter can roll back a conversion if the image file haven't been modified. In addition, I rearrange some codes in convert.c and add a few comments.
* Update find_free_extent for the ext3 conversion toolYan2008-01-04
| | | | | This patch adds customized find_free_extent support to btrfs-progs, the conversion program requires this.
* Update btrfs-progs to match kernel sourcesYan2008-01-04
* Verify extent back references in btrfsckChris Mason2007-12-14
* Update btrfs-progs to better match the kernelYan2007-12-05
* Add simple stripe size parameterChris Mason2007-11-30
* Remove the last radix tree (block_group_cache)Chris Mason2007-10-17
* Make the crc32c code match what the kernel modules are currently doingChris Mason2007-10-15
* Create a slightly more generic extent-caching structureChris Mason2007-10-15
* Switch to byte granular allocationsChris Mason2007-10-15
* Stop using radix trees to record pending allocationsChris Mason2007-10-15
* Allow large blocksChris Mason2007-10-15
* calculate checksums during IOJosef Bacik2007-06-28
* add GPLv2Chris Mason2007-06-12