aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-06-22 14:16:25 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-06-22 14:16:25 -0400
commit5eda7b5e9b0bed864dd18284c7df9b3c8207dad7 (patch)
tree9efe48de46e77f2b7b97a2ce3ee93c9da6451671 /fs/btrfs/ctree.h
parent54aa1f4dfdacd60a19c4471220b24e581be6f774 (diff)
Btrfs: Add the ability to find and remove dead roots after a crash.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 77071f273977..fb6fffb71dd0 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -122,12 +122,12 @@ struct btrfs_super_block {
122 u8 fsid[16]; /* FS specific uuid */ 122 u8 fsid[16]; /* FS specific uuid */
123 __le64 blocknr; /* this block number */ 123 __le64 blocknr; /* this block number */
124 __le64 magic; 124 __le64 magic;
125 __le32 blocksize;
126 __le64 generation; 125 __le64 generation;
127 __le64 root; 126 __le64 root;
128 __le64 total_blocks; 127 __le64 total_blocks;
129 __le64 blocks_used; 128 __le64 blocks_used;
130 __le64 root_dir_objectid; 129 __le64 root_dir_objectid;
130 __le32 blocksize;
131} __attribute__ ((__packed__)); 131} __attribute__ ((__packed__));
132 132
133/* 133/*
@@ -226,10 +226,12 @@ struct btrfs_root_item {
226 struct btrfs_inode_item inode; 226 struct btrfs_inode_item inode;
227 __le64 root_dirid; 227 __le64 root_dirid;
228 __le64 blocknr; 228 __le64 blocknr;
229 __le32 flags;
230 __le64 block_limit; 229 __le64 block_limit;
231 __le64 blocks_used; 230 __le64 blocks_used;
231 __le32 flags;
232 __le32 refs; 232 __le32 refs;
233 struct btrfs_disk_key drop_progress;
234 u8 drop_level;
233} __attribute__ ((__packed__)); 235} __attribute__ ((__packed__));
234 236
235#define BTRFS_FILE_EXTENT_REG 0 237#define BTRFS_FILE_EXTENT_REG 0
@@ -800,6 +802,16 @@ static inline void btrfs_set_root_refs(struct btrfs_root_item *item, u32 val)
800 item->refs = cpu_to_le32(val); 802 item->refs = cpu_to_le32(val);
801} 803}
802 804
805static inline u32 btrfs_root_flags(struct btrfs_root_item *item)
806{
807 return le32_to_cpu(item->flags);
808}
809
810static inline void btrfs_set_root_flags(struct btrfs_root_item *item, u32 val)
811{
812 item->flags = cpu_to_le32(val);
813}
814
803static inline u64 btrfs_super_blocknr(struct btrfs_super_block *s) 815static inline u64 btrfs_super_blocknr(struct btrfs_super_block *s)
804{ 816{
805 return le64_to_cpu(s->blocknr); 817 return le64_to_cpu(s->blocknr);
@@ -1076,6 +1088,7 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root
1076 *item); 1088 *item);
1077int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, struct 1089int btrfs_find_last_root(struct btrfs_root *root, u64 objectid, struct
1078 btrfs_root_item *item, struct btrfs_key *key); 1090 btrfs_root_item *item, struct btrfs_key *key);
1091int btrfs_find_dead_roots(struct btrfs_root *root);
1079/* dir-item.c */ 1092/* dir-item.c */
1080int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root 1093int btrfs_insert_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root
1081 *root, const char *name, int name_len, u64 dir, 1094 *root, const char *name, int name_len, u64 dir,