diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-05-17 15:38:01 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-05-17 15:38:01 -0400 |
commit | 6fd058f7791087648c683eb8572edf3be3c4c23c (patch) | |
tree | 0d80791532d2d022c91f20013003716eaf0afb40 /fs/ext4/ext4.h | |
parent | 2ac3b6e00acb46406c993d57921f86a594aafe08 (diff) |
ext4: Add a comprehensive block validity check to ext4_get_blocks()
To catch filesystem bugs or corruption which could lead to the
filesystem getting severly damaged, this patch adds a facility for
tracking all of the filesystem metadata blocks by contiguous regions
in a red-black tree. This allows quick searching of the tree to
locate extents which might overlap with filesystem metadata blocks.
This facility is also used by the multi-block allocator to assure that
it is not allocating blocks out of the system zone, as well as by the
routines used when reading indirect blocks and extents information
from disk to make sure their contents are valid.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4.h')
-rw-r--r-- | fs/ext4/ext4.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index d164f1294e5f..4311cc85b534 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -696,6 +696,7 @@ struct ext4_inode_info { | |||
696 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ | 696 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ |
697 | #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */ | 697 | #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */ |
698 | #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */ | 698 | #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */ |
699 | #define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */ | ||
699 | 700 | ||
700 | /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ | 701 | /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ |
701 | #ifndef _LINUX_EXT2_FS_H | 702 | #ifndef _LINUX_EXT2_FS_H |
@@ -887,6 +888,7 @@ struct ext4_sb_info { | |||
887 | int s_jquota_fmt; /* Format of quota to use */ | 888 | int s_jquota_fmt; /* Format of quota to use */ |
888 | #endif | 889 | #endif |
889 | unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */ | 890 | unsigned int s_want_extra_isize; /* New inodes should reserve # bytes */ |
891 | struct rb_root system_blks; | ||
890 | 892 | ||
891 | #ifdef EXTENTS_STATS | 893 | #ifdef EXTENTS_STATS |
892 | /* ext4 extents stats */ | 894 | /* ext4 extents stats */ |
@@ -1618,6 +1620,15 @@ extern struct dentry *ext4_get_parent(struct dentry *child); | |||
1618 | extern const struct inode_operations ext4_symlink_inode_operations; | 1620 | extern const struct inode_operations ext4_symlink_inode_operations; |
1619 | extern const struct inode_operations ext4_fast_symlink_inode_operations; | 1621 | extern const struct inode_operations ext4_fast_symlink_inode_operations; |
1620 | 1622 | ||
1623 | /* block_validity */ | ||
1624 | extern void ext4_release_system_zone(struct super_block *sb); | ||
1625 | extern int ext4_setup_system_zone(struct super_block *sb); | ||
1626 | extern int __init init_ext4_system_zone(void); | ||
1627 | extern void exit_ext4_system_zone(void); | ||
1628 | extern int ext4_data_block_valid(struct ext4_sb_info *sbi, | ||
1629 | ext4_fsblk_t start_blk, | ||
1630 | unsigned int count); | ||
1631 | |||
1621 | /* extents.c */ | 1632 | /* extents.c */ |
1622 | extern int ext4_ext_tree_init(handle_t *handle, struct inode *); | 1633 | extern int ext4_ext_tree_init(handle_t *handle, struct inode *); |
1623 | extern int ext4_ext_writepage_trans_blocks(struct inode *, int); | 1634 | extern int ext4_ext_writepage_trans_blocks(struct inode *, int); |