Commit Graph

71 Commits

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
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
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
8057a6c3e7 Don't empty the middle buffer in push_nodes_for_insert 2008-04-24 10:54:32 -04:00
Chris Mason
d8ecd9205a Keep more pointers free in the nodes for double splits 2008-04-24 10:18:25 -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
1b74adf90b Change btrfs_map_block to return a structure with mappings for all stripes 2008-04-09 16:28:12 -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
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
ad67cd73b7 Update struct btrfs_header flags, and use it to indicate buffers are written 2008-04-01 10:20:06 -04:00
Chris Mason
510be29677 Add support for multiple devices per filesystem 2008-03-24 15:03:18 -04:00
Yan
ece29db279 Call btrfs_cow_block while lowering tree level.
When freeing root block of a tree,  btrfs_free_extent' parameter
'ref_generation' is from root block itseft.  When freeing non-root
block,  'ref_generation' is from its parent. so when converting a
non-root block to root block, we must guarantee its generation is
equal to its parent's generation.
2008-02-01 14:58:07 -05:00
Chris Mason
45391b1a98 Copy correct tree when inserting into slot 0 2008-01-30 11:43:54 -05:00
Chris Mason
aa69dec31c Add inode item and backref in one insert, reducing cpu usage 2008-01-29 15:15:18 -05:00
Chris Mason
cbf87cad07 During deletes and truncate, remove many items at once from the tree 2008-01-29 15:11:36 -05:00
Yan
281c171293 Remove kernel-space header in btrfs-progs
When porting ctree.c in btrfs kernel module to btrfs-progs, I forgot
to remove a kernel-space header.  This may cause compile error on some
system.
2008-01-17 12:23:34 -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
38f79f9077 Switch to byte granular allocations 2007-10-15 16:25:14 -04:00
Chris Mason
f12d799856 Allow large blocks 2007-10-15 16:24:39 -04:00
Chris Mason
d9f1317c7d add GPLv2 2007-06-12 09:07:11 -04:00
Chris Mason
5856b7e124 start of block group code 2007-04-26 16:46:06 -04:00
Chris Mason
d7260c060c faster btrfsck 2007-04-23 15:56:27 -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
07eb5008f3 bring back the inode number directory index 2007-04-19 15:41:24 -04:00
Chris Mason
8d1d13c786 rework csum and extent item ordering 2007-04-17 15:40:34 -04:00
Chris Mason
e52d2e2fa1 drop owner and parentid 2007-04-10 12:36:58 -04:00
Chris Mason
b21892315c csum data struct changes 2007-03-29 15:15:49 -04:00
Chris Mason
03b3655fb4 add generation to file extents 2007-03-27 09:15:24 -04:00
Chris Mason
6fb67c4e82 minor comments 2007-03-17 14:29:23 -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
80fabe2ee0 add a name_len to dir items, reorder key 2007-03-16 08:46:49 -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
6a332a71ba merge leaves before split 2007-03-13 11:17:52 -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
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
4c4eac1f03 get rid of add recursion 2007-03-07 11:50:24 -05:00