Commit Graph

49 Commits

Author SHA1 Message Date
Chris Mason
8c43a9adf7 Add btrfsck option to select the super block copy
btrfsck -s 0 uses the defult 0, -s 1 uses copy #1 etc.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2010-10-04 15:41:10 -04:00
Yan Zheng
d44860cee5 Fix inode link count checks in btrfsck
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2010-09-23 20:26:50 -04:00
Yan Zheng
076de67f5b Remove superfluous WARN_ON in btrfsck
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2010-09-23 20:26:49 -04:00
Christian Hesse
34915ad27b add missing include for btrfsck.c
compiling btrfs-progs from current git I get an error in btrfsck.c about
undefined references. The attached patch adds an include for sys/stat.h
which fixes the problem for me.

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2010-09-23 20:26:49 -04:00
Andi Drebes
659d37c68d prevent btrfsck to run on mounted filesystems
As recently discussed on the list, btrfsck should only be run on
unmounted filesystems. This patch adds a short check for the mount
status at the beginning of btrfsck. If the FS is mounted, the
program aborts showing an error message.

Signed-off-by: Andi Drebes <lists-receive@programmierforen.de>
2010-09-23 20:26:49 -04:00
Yan, Zheng
6f3cf25a4e btrfsck: check root back/forward references
This patch adds semantic checks for links to snapshot/subvolume and
root back/forward references.

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-09-21 16:03:57 -04:00
Chris Mason
95d3f20b51 Mixed back reference (FORWARD ROLLING FORMAT CHANGE)
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
2009-06-08 13:30:36 -04:00
Luca Bruno
6fa19b04d9 Fix printf format casting errors
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 <lucab@debian.org>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-06-03 12:15:40 -04:00
Chris Mason
cc04d99e90 Add scan of the btrfs log tree to btrfs-debug-tree 2009-04-15 14:30:14 -04:00
Wang Cong
47e1a8f56a btrfsck.c: bit-fields should be unsigned
Signed-off-by: WANG Cong <wangcong@zeuux.org>
2009-01-21 13:22:49 -05:00
Thadeu Lima de Souza Cascardo
af250420ca btrfsck: Exit and print error message when not able to open a device
If btrfsck is not able to open a device, it segfaults. This fixes it and
prints an error message too.
2009-01-21 13:59:36 -05:00
Wang Cong
86179a0507 btrfs-progs: make several functions static
Make several functions static, and make one argument const.

Signed-off-by: WANG Cong <wangcong@zeuux.org>
2009-01-21 13:22:49 -05:00
Yan Zheng
4f0347004e Fix an accessing freed memory bug in btrfsck 2009-01-09 14:39:33 -05:00
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
95470dfaf1 Add fallocate support v2
This patch updates btrfs-progs for fallocate support.
 
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
2008-10-31 12:48:02 -04: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
9864c90760 Print the version string in a few programs 2008-07-24 12:13:30 -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
a62332eeb2 Add a readonly flag open_ctree to force RO opens 2008-05-05 09:45:26 -04:00
Chris Mason
9a73efb7d1 Fix compiler warning in volumes.c 2008-05-02 15:05:11 -04:00
Chris Mason
9462e711a7 Fix a few casts for 32 bit compile 2008-04-11 12:18:46 -04:00
Chris Mason
a6de0bd778 Add mirroring support across multiple drives 2008-04-03 16:35:48 -04:00
Chris Mason
1f3ba6a3f9 Btrfsck updates for multi-device filesystems 2008-03-24 15:04:37 -04:00
Kyle McMartin
d751af515b Fix btrfsck args checking
btrfsck fails to check if it actually received a dev argument though, so if you
don't pass a device, we get a nice segfault.
2008-01-22 11:32:09 -05:00
Yan
7777e63b42 Update btrfs-progs to match kernel sources 2008-01-04 10:38:22 -05:00
Chris Mason
c4603e35d7 Verify extent back references in btrfsck 2007-12-14 11:00:30 -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
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
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
Chris Mason
8454d619a7 extra stats for btrfsck, link count in print-tree.c 2007-09-14 09:19:19 -04:00
Terje Rosten
f9d0788521 Fix btrfsck build failure on FC7 2007-06-18 08:45:50 -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
b53a236c3e remove device tree 2007-06-09 09:22:37 -04:00
Chris Mason
9b25940b9d data vs metadata flag for block groups 2007-05-30 10:21:32 -04:00
Chris Mason
832427bdba cleanup warnings found with -O2 2007-05-22 10:07:10 -04:00
Chris Mason
723eafc647 reduce ram used by btrfsck 2007-05-22 09:17:08 -04:00
Chris Mason
2877f0919a btrfsck fixes and cleanups 2007-05-18 13:26:07 -04:00
Chris Mason
9d42320851 more stats from fsck 2007-05-09 20:13:48 -04:00
Chris Mason
7e8970c198 compile fix 2007-05-07 20:04:45 -04:00
Chris Mason
c2d777735c use node list for roots 2007-04-25 10:08:15 -04:00
Chris Mason
49bedc2cb4 subvolume and snapshot fsck support 2007-04-24 12:44:05 -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
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