Commit Graph

230 Commits (c04bcdcaccc7f831fe635f31edf957bff6623ed0)

Author SHA1 Message Date
Yan Zheng 9a6930e9be Add semantic checks to btrfsck for files and directories
This patch makes btrfsck check more things, including
directory items, file extents, checksumming, inode link
counts etc.

The code for these checks is similar to the code verifies
extent back references. The main difference is that
shared tree blocks are treated specially. The partial
checking results(unresolved references and/or errors)
of shared sub-trees are cached. This avoids scanning
the shared blocks several times. Thank you,

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2009-01-07 14:57:12 -05:00
Yan Zheng 0d53b212d8 Btrfs: update converter for the new disk format
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 <zheng.yan@oracle.com>
2008-12-17 16:10:07 -05:00
Yan Zheng 5ccd1715fa superblock duplication
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 <zheng.yan@oracle.com>
2008-12-05 12:21:31 -05:00
Yan Zheng 4d1d3a59d6 update btrfs-progs for seed device support
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.
2008-11-18 10:40:06 -05:00
Yan Zheng 5986faaf47 Remove offset field from struct btrfs_extent_ref
The offset field in struct btrfs_extent_ref records the position
inside file that file extent is referenced by. In the new back
reference system, tree leaves holding reference to file extent
are recorded explicitly. We can quickly scan these tree leaves, so the
offset field is not required.

This patch also makes the back reference system check the objectid
when extents are being deleted

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2008-10-09 11:55:30 -04:00
Zheng Yan 428b7fa630 Full back reference support
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.
2008-09-23 12:29:10 -04:00
Chris Mason 351d17fca2 Verify parent generation number on btree reads 2008-05-13 13:48:58 -04:00
Chris Mason 9a9bdd6047 Pass down the expected generation number when reading tree blocks 2008-05-12 13:51:24 -04:00
Yan Zheng 4415143185 Speed improvement and bug fixes for ext3 converter
This patch improves converter's allocator and fixes a bug in data relocation
function. The new allocator caches free blocks as Btrfs's default allocator.
In testing here, the user CPU time reduced to half of the original when
checksum and small file packing was disabled. This patch also enlarges the
size of block groups created by the converter.
2008-04-24 14:57:50 -04:00
Chris Mason 309ce6768b Fix balance_level to free the middle block if there is room in the left one
balance level starts by trying to empty the middle block, and then
pushes from the right to the middle.  This might empty the right block
and leave a small number of pointers in the middle.
2008-04-24 14:46:15 -04:00
Chris Mason 8bfbb6b6f8 Update the Ext3 converter
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
---
2008-04-22 14:06:56 -04:00
Chris Mason 951fd7371c Add chunk uuids and update multi-device back references
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.
2008-04-15 15:42:08 -04:00
Chris Mason 97864fa126 Don't allow written blocks from this transaction to be reallocated
When a block is freed, it can be immediately reused if it is from
the current transaction.  But, an extra check is required to make sure
the block had not been written yet.  If it were reused after being written,
the transid in the block header might match the transid of the
next time the block was allocated.

The parent node records the transaction ID of the block it is pointing to,
and this is used as part of validating the block on reads.  So, there
can only be one version of a block per transaction.
2008-04-04 15:40:00 -04:00
Chris Mason a37e1e7204 Recow all roots at the end of mkfs
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.
2008-04-04 15:42:17 -04:00
Chris Mason c7be130df7 Add support for single single duplication of metadata 2008-04-03 16:35:48 -04:00
Chris Mason a6de0bd778 Add mirroring support across multiple drives 2008-04-03 16:35:48 -04:00
Alex Chiang 857e9a2a63 btrfs-progs: Fix printf format casting errors
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 <achiang@hp.com>
2008-04-01 10:52:22 -04:00
Chris Mason e9e3422f85 Implement raid0 when multiple devices are present
This defaults to striping across all devices
2008-03-25 16:50:20 -04:00
Chris Mason 0dcfa3b827 Walk all block devices looking for btrfs 2008-03-24 15:05:44 -04:00
Chris Mason d12d4c7203 Dynamic chunk allocation 2008-03-24 15:03:58 -04:00
Chris Mason 510be29677 Add support for multiple devices per filesystem 2008-03-24 15:03:18 -04:00
Chris Mason 00eb6ff656 Remove extent back refs in batches, and avoid duplicate searches 2008-03-04 13:07:22 -05:00
Chris Mason f3f156de82 Add debugging for block group update failure 2008-02-04 10:10:13 -05:00
Chris Mason d2255c7c2f Insert extent record and the first backref in a single balance 2008-03-04 11:35:36 -05:00
Chris Mason 84696d75db Tune readahead during defrag to avoid reading too much at once 2008-01-24 16:13:14 -05:00
Chris Mason 80791984f6 Rename the extent_map code to extent_io
This mirrors the changes in the kernel code.
2008-03-04 11:16:54 -05:00
Chris Mason 633ddb9a90 Hash in the owner and offset for file extent backref keys 2008-02-01 14:55:03 -05:00
Yan b86a827172 A few update for btrfs-progs
Hello,

This patch adds inode flags definition to btrfs-progs and updates
extent-tree.c to match the kernel.
2008-01-08 15:55:08 -05:00
Yan 84b99666be Update find_free_extent for the ext3 conversion tool
This patch adds customized find_free_extent support to btrfs-progs,
the conversion program requires this.
2008-01-04 10:41:19 -05:00
Yan 7777e63b42 Update btrfs-progs to match kernel sources 2008-01-04 10:38:22 -05:00
Chris Mason 4122e65cb2 Add back pointers from extents to the file or btree referencing them 2007-12-11 09:21:42 -05:00
Chris Mason 73372dcf8f Add generation numbers to block pointers 2007-12-09 13:46:24 -05:00
Yan 07a4f1b81d Update btrfs-progs to better match the kernel 2007-12-05 10:41:38 -05:00
Chris Mason 1883251686 Add simple stripe size parameter 2007-11-30 11:30:24 -05:00
Chris Mason 268ca701ab properly init block group cache structs 2007-10-19 10:38:08 -04:00
Chris Mason 678af9b3a4 Remove the last radix tree (block_group_cache) 2007-10-17 09:58:56 -04:00
Chris Mason 28de03cb0a Create a slightly more generic extent-caching structure 2007-10-15 16:25:41 -04:00
Chris Mason 38f79f9077 Switch to byte granular allocations 2007-10-15 16:25:14 -04:00
Chris Mason 08c66b7738 Stop using radix trees to record pending allocations 2007-10-15 16:25:04 -04:00
Chris Mason f12d799856 Allow large blocks 2007-10-15 16:24:39 -04:00
Jan Engelhardt ddcaa0171a Make btrfs-progs compile with -fstrict-aliasing (included in -O2) again.
This is done by doing a two-step conversion (rather than a one-step).
First, the variable goes from type * to void *, and then to
implicitly to void **.
(Not sure if this is "good practice", but it shuts up the compiler,
so it seems the compiler takes into account that we are actually punning
it this way.)
2007-09-14 10:31:06 -04:00
Josef Bacik ffaff17911 btrfs-progs support for root block accounting
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,
2007-08-29 15:56:44 -04:00
Chris Mason d9f1317c7d add GPLv2 2007-06-12 09:07:11 -04:00
Chris Mason 38ef945266 printf cleanups 2007-06-12 08:08:04 -04:00
Chris Mason f8d7bbd1fa 32 bit compile fixes 2007-06-08 08:44:41 -04:00
Chris Mason 832427bdba cleanup warnings found with -O2 2007-05-22 10:07:10 -04:00
Chris Mason 5856b7e124 start of block group code 2007-04-26 16:46:06 -04:00
Chris Mason 10d06538f1 get rid of the extent_item type field 2007-04-24 12:09:01 -04:00
Chris Mason 885f275a68 fsck checks against extent map, small fixes 2007-04-23 17:00:26 -04:00
Chris Mason 2f2264fc2d add owner and type fields to the extents aand block headers 2007-04-20 20:23:29 -04:00
Chris Mason e52d2e2fa1 drop owner and parentid 2007-04-10 12:36:58 -04:00
Chris Mason d785b7d058 uuids 2007-04-05 14:29:12 -04:00
Chris Mason 132db51b1f generations on headers 2007-03-26 11:24:42 -04:00
Chris Mason b55672a2a1 Better block record keeping, real mkfs 2007-03-20 20:35:03 -04:00
Chris Mason 099f1ae6e4 Add inode map, and the start of file extent items 2007-03-20 14:38:32 -04:00
Chris Mason f247156e4f transaction handles everywhere 2007-03-16 16:20:31 -04:00
Chris Mason 3d8c87f4f7 pin freed blocks from the FS tree too 2007-03-16 08:56:18 -04:00
Chris Mason da99898c78 Use a chunk of the key flags to record the item type.
Add (untested and simple) directory item code
Fix comp_keys to use the new key ordering
Add btrfs_insert_empty_item
2007-03-15 12:56:47 -04:00
Chris Mason 7a0a809b4c variable block size support 2007-03-14 14:14:43 -04:00
Chris Mason 942050de0e add leaf data casting helper 2007-03-14 10:31:29 -04:00
Chris Mason 0975c87bce properly reset block cache on free 2007-03-14 09:20:39 -04:00
Chris Mason d9c9960f8d Change the super to point to a tree of trees to enable persistent snapshots 2007-03-13 16:47:54 -04:00
Chris Mason 2c4257a341 make some funcs static 2007-03-13 11:09:37 -04:00
Chris Mason aa60202f13 rename funcs and structs to btrfs 2007-03-13 10:46:10 -04:00
Chris Mason 56042e6ad4 struct extent_item endian 2007-03-13 09:49:06 -04:00
Chris Mason 3192451f58 node->blockptrs endian fixes 2007-03-13 09:28:32 -04:00
Chris Mason f6a88938c6 struct item endian fixes 2007-03-12 20:12:07 -04:00
Chris Mason b2e2afd7b4 struct key endian fixes 2007-03-12 16:22:34 -04:00
Chris Mason 8e17fab249 get/set for struct header fields 2007-03-12 12:01:18 -04:00
Chris Mason 2db1ff3570 fix leak in btrfs_drop_snapshot 2007-03-12 09:03:27 -04:00
Chris Mason 84084892fb recursion free-first pass 2007-03-10 06:35:47 -05:00
Chris Mason 2adfc44778 Fixup last found extent caching 2007-03-07 16:15:30 -05:00
Chris Mason 4c4eac1f03 get rid of add recursion 2007-03-07 11:50:24 -05:00
Chris Mason 79b90e3fdf Fixup reference counting on cows 2007-03-06 20:08:01 -05:00
Chris Mason 7da449a2f6 early reference counting 2007-03-02 16:08:05 -05:00
Chris Mason 11bc1cd2a5 Fix extent code to use merge during delete
Remove implicit commit in del_item and insert_item
Add implicit commit to close()
Add commit op in random-test
2007-03-02 09:47:58 -05:00
Chris Mason 157a0bc7ce more return code checking 2007-02-28 16:46:22 -05:00
Chris Mason 92ce8be120 return code checking 2007-02-28 16:35:06 -05:00
Chris Mason 46db63cb16 u64 cleanups 2007-02-26 10:55:01 -05:00
Chris Mason 8f3b86bae3 Add fsx-style randomized tree tester
Add debug-tree command to print the tree
Add extent-tree.c to the repo
Comment ctree.h
2007-02-26 10:40:21 -05:00