@@ -254,6 +254,18 @@ struct ext2_dx_countlimit {
#define EXT2_DIND_BLOCK (EXT2_IND_BLOCK + 1)
#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
+/*
+ * Snapshot files have larger indirection mapping that can map up to 2^32
+ * logical blocks, so they can cover the filesystem block address space.
+ * Next3 must use either 4K or 8K blocks (depending on PAGE_SIZE).
+ * With 8K blocks, 1 triple indirect block maps 2^33 logical blocks.
+ * With 4K blocks (the system default), each triple indirect block maps 2^30
+ * logical blocks, so 3 extra triple indirect blocks are needed to map the
+ * entire filesystem.
+ */
+#define EXT2_EXTRA_TIND_BLOCKS 3
+#define EXT2_SNAPFILE_BLOCKS (EXT2_N_BLOCKS + EXT2_EXTRA_TIND_BLOCKS)
+
/*
* Inode flags
@@ -430,6 +442,8 @@ struct ext2_inode_large {
__u32 i_crtime; /* File creation time */
__u32 i_crtime_extra; /* extra File creation time (nsec << 2
| epoch)*/
__u32 i_version_hi; /* high 32 bits for 64-bit version */
+ __u32 i_block_extra[EXT2_EXTRA_TIND_BLOCKS]; /* extra
Pointers to blocks
+ (snapshot file offset
4TB..16TB) */