diff --git a/kmod/src/btree.c b/kmod/src/btree.c index 23878451..4cfe1feb 100644 --- a/kmod/src/btree.c +++ b/kmod/src/btree.c @@ -414,9 +414,9 @@ static struct scoutfs_block *try_split(struct super_block *sb, /* only grow the tree once we have the split neighbour */ if (par_bl) { - struct scoutfs_key ones; - memset(&ones, 0xff, sizeof(ones)); - create_parent_item(parent, right, &ones); + struct scoutfs_key maximal; + scoutfs_set_max_key(&maximal); + create_parent_item(parent, right, &maximal); } move_items(left, right, false, used_total(right) / 2); diff --git a/kmod/src/key.h b/kmod/src/key.h index b61967d0..11a7c721 100644 --- a/kmod/src/key.h +++ b/kmod/src/key.h @@ -62,6 +62,11 @@ static inline void scoutfs_set_key(struct scoutfs_key *key, u64 inode, u8 type, key->offset = cpu_to_le64(offset); } +static inline void scoutfs_set_max_key(struct scoutfs_key *key) +{ + scoutfs_set_key(key, ~0ULL, ~0, ~0ULL); +} + static inline void scoutfs_inc_key(struct scoutfs_key *key) { le64_add_cpu(&key->offset, 1);