The patchset introduce a new framework to do more comprehensive (if not the most) sanity check when reading out a leaf. The new sanity checker will include: 1) Key order Existing code 2) Item boundary Existing code with enhanced checker to ensure item pointer doesn't overlap with item itself. 3) Key type based sanity checker Only EXTENT_DATA checker is implemented yet. As each checker should go through review and tests, or it can easily make a valid btrfs failed to be mounted. So only one checker is implemented as an example. Existing checker like INODE_REF checker can be moved to this framework easily, and we can centralize all existing checkers, make the rest of codes more clean. Performance wise, it's just iterating a leaf. And it will only get triggered when read out a leaf, cached leaf will not go through such checker. So it won't be a performance breaker. I tested with the patchset applied on v4.13-rc6 with fstests, no regression is detected. Qu Wenruo (3): btrfs: Refactor check_leaf function for later expansion. btrfs: Check if item pointer overlap with item itself btrfs: Add sanity check for EXTENT_DATA when reading out leaf fs/btrfs/disk-io.c | 137 ++++++++++++++++++++++++++++++++++------ include/uapi/linux/btrfs_tree.h | 1 + 2 files changed, 119 insertions(+), 19 deletions(-) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
