mirror of
https://github.com/versity/scoutfs.git
synced 2026-04-22 22:40:31 +00:00
scoutfs: add scoutfs_set_max_key()
It's nice to have a helper that sets the max possible key instead of messing around with memset or ~0 manually. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user