summaryrefslogtreecommitdiffstats
path: root/fs/ext4/ext4_extents.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@us.ibm.com>2012-04-29 18:37:10 -0400
committerTheodore Ts'o <tytso@mit.edu>2012-04-29 18:37:10 -0400
commit7ac5990d5a3e2e465162880819cc46c6427d3b6f (patch)
tree7ff0eafbf69010425c69bca61bddbc1c58adc89b /fs/ext4/ext4_extents.h
parentfa77dcfafeaa6bc73293c646bfc3d5192dcf0be2 (diff)
downloadlinux-7ac5990d5a3e2e465162880819cc46c6427d3b6f.tar.gz
linux-7ac5990d5a3e2e465162880819cc46c6427d3b6f.tar.bz2
linux-7ac5990d5a3e2e465162880819cc46c6427d3b6f.zip
ext4: verify and calculate checksums for extent tree blocks
Calculate and verify the checksum for each extent tree block. The checksum is located in the space immediately after the last possible ext4_extent in the block. The space is is typically the last 4-8 bytes in the block. Signed-off-by: Darrick J. Wong <djwong@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/ext4_extents.h')
-rw-r--r--fs/ext4/ext4_extents.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/ext4/ext4_extents.h b/fs/ext4/ext4_extents.h
index 94822e74ef73..cb1b2c919963 100644
--- a/fs/ext4/ext4_extents.h
+++ b/fs/ext4/ext4_extents.h
@@ -114,6 +114,17 @@ struct ext4_extent_header {
#define EXT4_EXT_MAGIC cpu_to_le16(0xf30a)
+#define EXT4_EXTENT_TAIL_OFFSET(hdr) \
+ (sizeof(struct ext4_extent_header) + \
+ (sizeof(struct ext4_extent) * le16_to_cpu((hdr)->eh_max)))
+
+static inline struct ext4_extent_tail *
+find_ext4_extent_tail(struct ext4_extent_header *eh)
+{
+ return (struct ext4_extent_tail *)(((void *)eh) +
+ EXT4_EXTENT_TAIL_OFFSET(eh));
+}
+
/*
* Array of ext4_ext_path contains path to some extent.
* Creation/lookup routines use it for traversal/splitting/etc.