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:
Zach Brown
2016-07-05 14:24:10 -07:00
parent ae748f0ebc
commit 3efec0c094
2 changed files with 8 additions and 3 deletions

View File

@@ -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);

View File

@@ -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);