summaryrefslogtreecommitdiff
path: root/ctree.h
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2014-12-09 16:27:32 +0800
committerDavid Sterba <dsterba@suse.cz>2014-12-10 13:52:28 +0100
commit55fea7186ca8aa7faf442d3117478d44a4ec0eb4 (patch)
tree5eba64960231ad05bd71ca70ea8f77fb0a35c791 /ctree.h
parent1581d7e5db9278a3aef5ff88301a9866b57cd5ad (diff)
downloadbtrfs-progs-55fea7186ca8aa7faf442d3117478d44a4ec0eb4.tar.gz
btrfs-progs: Add inode item rebuild function.
Add a basic inode item rebuild function for I_ERR_NO_INODE_ITEM. The main use case is to repair btrfs which fs root has corrupted leaf, but it is already working for case if the corrupteed fs root leaf/node contains no inode extent_data. The repair needs 3 elements for inode rebuild: 1. inode number This is quite easy, existing inode_record codes will detect it quite well. 2. inode type This is the trick part. The only reliable method is to recovery it from parent's dir_index/item. The remaining method will search for regular file extent for FILE type or child's backref for DIR(todo). Fallback will be FILE. Inode name(inode_ref) will be recoverd by nlink repair function. This is just a fundamental implement, some advanced recovery can be improved later with btrfs-progs infrastructure change. Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'ctree.h')
-rw-r--r--ctree.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/ctree.h b/ctree.h
index eadae76..7861940 100644
--- a/ctree.h
+++ b/ctree.h
@@ -2445,6 +2445,8 @@ static inline int is_fstree(u64 rootid)
/* inode.c */
int check_dir_conflict(struct btrfs_root *root, char *name, int namelen,
u64 dir, u64 index);
+int btrfs_new_inode(struct btrfs_trans_handle *trans, struct btrfs_root *root,
+ u64 ino, u32 mode);
int btrfs_add_link(struct btrfs_trans_handle *trans, struct btrfs_root *root,
u64 ino, u64 parent_ino, char *name, int namelen,
u8 type, u64 *index, int add_backref);