mirror of
https://github.com/versity/scoutfs.git
synced 2026-06-09 21:22:36 +00:00
scoutfs: add scoutfs_inc_key()
Add a quick inline function for incrementing a key value across the inode>type>offset sorted key space. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -61,4 +61,13 @@ static inline void scoutfs_set_key(struct scoutfs_key *key, u64 inode, u8 type,
|
||||
key->offset = cpu_to_le64(offset);
|
||||
}
|
||||
|
||||
static inline void scoutfs_inc_key(struct scoutfs_key *key)
|
||||
{
|
||||
le64_add_cpu(&key->offset, 1);
|
||||
if (!key->offset) {
|
||||
if (++key->type == 0)
|
||||
le64_add_cpu(&key->inode, 1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user