xfs: during btree split, save new block key & ptr for future insertion
When a btree block has to be split, we pass the new block's ptr from xfs_btree_split() back to xfs_btree_insert() via a pointer parameter; however, we pass the block's key through the cursor's record. It is a little weird to "initialize" a record from a key since the non-key attributes will have garbage values. When we go to add support for interval queries, we have to be able to pass the lowest and highest keys accessible via a pointer. There's no clean way to pass this back through the cursor's record field. Therefore, pass the key directly back to xfs_btree_insert() the same way that we pass the btree_ptr. As a bonus, we no longer need init_rec_from_key and can drop it from the codebase. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:

committed by
Dave Chinner

parent
0d309791bd
commit
e5821e57af
@@ -599,17 +599,6 @@ xfs_bmbt_init_key_from_rec(
|
||||
cpu_to_be64(xfs_bmbt_disk_get_startoff(&rec->bmbt));
|
||||
}
|
||||
|
||||
STATIC void
|
||||
xfs_bmbt_init_rec_from_key(
|
||||
union xfs_btree_key *key,
|
||||
union xfs_btree_rec *rec)
|
||||
{
|
||||
ASSERT(key->bmbt.br_startoff != 0);
|
||||
|
||||
xfs_bmbt_disk_set_allf(&rec->bmbt, be64_to_cpu(key->bmbt.br_startoff),
|
||||
0, 0, XFS_EXT_NORM);
|
||||
}
|
||||
|
||||
STATIC void
|
||||
xfs_bmbt_init_rec_from_cur(
|
||||
struct xfs_btree_cur *cur,
|
||||
@@ -760,7 +749,6 @@ static const struct xfs_btree_ops xfs_bmbt_ops = {
|
||||
.get_minrecs = xfs_bmbt_get_minrecs,
|
||||
.get_dmaxrecs = xfs_bmbt_get_dmaxrecs,
|
||||
.init_key_from_rec = xfs_bmbt_init_key_from_rec,
|
||||
.init_rec_from_key = xfs_bmbt_init_rec_from_key,
|
||||
.init_rec_from_cur = xfs_bmbt_init_rec_from_cur,
|
||||
.init_ptr_from_cur = xfs_bmbt_init_ptr_from_cur,
|
||||
.key_diff = xfs_bmbt_key_diff,
|
||||
|
Reference in New Issue
Block a user