提交 e3543819 编写于 作者: D Dave Chinner 提交者: Dave Chinner

xfs: bmapbt checking on debug kernels too expensive

For large sparse or fragmented files, checking every single entry in
the bmapbt on every operation is prohibitively expensive. Especially
as such checks rarely discover problems during normal operations on
high extent coutn files. Our regression tests don't tend to exercise
files with hundreds of thousands to millions of extents, so mostly
this isn't noticed.

However, trying to run things like xfs_mdrestore of large filesystem
dumps on a debug kernel quickly becomes impossible as the CPU is
completely burnt up repeatedly walking the sparse file bmapbt that
is generated for every allocation that is made.

Hence, if the file has more than 10,000 extents, just don't bother
with walking the tree to check it exhaustively. The btree code has
checks that ensure that the newly inserted/removed/modified record
is correctly ordered, so the entrie tree walk in thses cases has
limited additional value.
Signed-off-by: NDave Chinner <dchinner@redhat.com>
Reviewed-by: NBrian Foster <bfoster@redhat.com>
Signed-off-by: NDave Chinner <david@fromorbit.com>
上级 121e213e
...@@ -325,9 +325,11 @@ xfs_check_block( ...@@ -325,9 +325,11 @@ xfs_check_block(
/* /*
* Check that the extents for the inode ip are in the right order in all * Check that the extents for the inode ip are in the right order in all
* btree leaves. * btree leaves. THis becomes prohibitively expensive for large extent count
* files, so don't bother with inodes that have more than 10,000 extents in
* them. The btree record ordering checks will still be done, so for such large
* bmapbt constructs that is going to catch most corruptions.
*/ */
STATIC void STATIC void
xfs_bmap_check_leaf_extents( xfs_bmap_check_leaf_extents(
xfs_btree_cur_t *cur, /* btree cursor or null */ xfs_btree_cur_t *cur, /* btree cursor or null */
...@@ -352,6 +354,10 @@ xfs_bmap_check_leaf_extents( ...@@ -352,6 +354,10 @@ xfs_bmap_check_leaf_extents(
return; return;
} }
/* skip large extent count inodes */
if (ip->i_d.di_nextents > 10000)
return;
bno = NULLFSBLOCK; bno = NULLFSBLOCK;
mp = ip->i_mount; mp = ip->i_mount;
ifp = XFS_IFORK_PTR(ip, whichfork); ifp = XFS_IFORK_PTR(ip, whichfork);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册