diff options
author | Darrick J. Wong <djwong@kernel.org> | 2023-12-15 21:03:39 +0300 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2023-12-15 21:03:39 +0300 |
commit | 8f71bede8efd820627ac05c19eac2758214bc896 (patch) | |
tree | e4d9e6e6bc22da842aefeb090f1fca5e3ed43ebb /fs/xfs/libxfs/xfs_btree_staging.c | |
parent | 66da11280f7ecd77abd999c469efc0dd643f26f5 (diff) | |
download | linux-8f71bede8efd820627ac05c19eac2758214bc896.tar.xz |
xfs: repair inode fork block mapping data structures
Use the reverse-mapping btree information to rebuild an inode block map.
Update the btree bulk loading code as necessary to support inode rooted
btrees and fix some bitrot problems.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/xfs/libxfs/xfs_btree_staging.c')
-rw-r--r-- | fs/xfs/libxfs/xfs_btree_staging.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/xfs/libxfs/xfs_btree_staging.c b/fs/xfs/libxfs/xfs_btree_staging.c index 0c978a31e284..e276eba87cb1 100644 --- a/fs/xfs/libxfs/xfs_btree_staging.c +++ b/fs/xfs/libxfs/xfs_btree_staging.c @@ -405,7 +405,7 @@ xfs_btree_bload_prep_block( ASSERT(*bpp == NULL); /* Allocate a new incore btree root block. */ - new_size = bbl->iroot_size(cur, nr_this_block, priv); + new_size = bbl->iroot_size(cur, level, nr_this_block, priv); ifp->if_broot = kmem_zalloc(new_size, 0); ifp->if_broot_bytes = (int)new_size; @@ -596,7 +596,14 @@ xfs_btree_bload_level_geometry( unsigned int desired_npb; unsigned int maxnr; - maxnr = cur->bc_ops->get_maxrecs(cur, level); + /* + * Compute the absolute maximum number of records that we can store in + * the ondisk block or inode root. + */ + if (cur->bc_ops->get_dmaxrecs) + maxnr = cur->bc_ops->get_dmaxrecs(cur, level); + else + maxnr = cur->bc_ops->get_maxrecs(cur, level); /* * Compute the number of blocks we need to fill each block with the |