diff options
author | Stefan Behrens <sbehrens@giantdisaster.de> | 2013-08-15 17:11:23 +0200 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-09-01 08:15:58 -0400 |
commit | 70f801754728017ebc909d603c69255dc1e6f06f (patch) | |
tree | f4af464776a17b130686cb85a98adbeb6083d43c /fs/btrfs/ctree.h | |
parent | 26432799c902b76e87f68f5c88f2146a78ba84af (diff) | |
download | op-kernel-dev-70f801754728017ebc909d603c69255dc1e6f06f.zip op-kernel-dev-70f801754728017ebc909d603c69255dc1e6f06f.tar.gz |
Btrfs: check UUID tree during mount if required
If the filesystem was mounted with an old kernel that was not
aware of the UUID tree, this is detected by looking at the
uuid_tree_generation field of the superblock (similar to how
the free space cache is doing it). If a mismatch is detected
at mount time, a thread is started that does two things:
1. Iterate through the UUID tree, check each entry, delete those
entries that are not valid anymore (i.e., the subvol does not
exist anymore or the value changed).
2. Iterate through the root tree, for each found subvolume, add
the UUID tree entries for the subvolume (if they are not
already there).
This mechanism is also used to handle and repair errors that
happened during the initial creation and filling of the tree.
The update of the uuid_tree_generation field (which indicates
that the state of the UUID tree is up to date) is blocked until
all create and repair operations are successfully completed.
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 02b1cef..8c95476 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1658,6 +1658,7 @@ struct btrfs_fs_info { atomic_t mutually_exclusive_operation_running; struct semaphore uuid_tree_rescan_sem; + unsigned int update_uuid_tree_gen:1; }; /* @@ -3511,6 +3512,9 @@ int btrfs_uuid_tree_add(struct btrfs_trans_handle *trans, int btrfs_uuid_tree_rem(struct btrfs_trans_handle *trans, struct btrfs_root *uuid_root, u8 *uuid, u8 type, u64 subid); +int btrfs_uuid_tree_iterate(struct btrfs_fs_info *fs_info, + int (*check_func)(struct btrfs_fs_info *, u8 *, u8, + u64)); /* dir-item.c */ int btrfs_check_dir_item_collision(struct btrfs_root *root, u64 dir, |