mirror of
https://github.com/versity/scoutfs.git
synced 2026-09-26 18:04:40 +00:00
Add readdir items
Restore readdir functionality by adding readdir items. The readdir items are keyed by an increasing position in the parent dir's inode. We track it in our inode info. To delete the readdir items we restore the dentry_info and put the pos in the dentry so unlink can build the readdir item key. And finally we put the pos in the lookup dirent so that it can populate the dentry info on lookup. Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
@@ -125,6 +125,7 @@ static void load_inode(struct inode *inode, struct scoutfs_inode *cinode)
|
||||
ci->salt = le32_to_cpu(cinode->salt);
|
||||
atomic64_set(&ci->link_counter, le64_to_cpu(cinode->link_counter));
|
||||
ci->data_version = le64_to_cpu(cinode->data_version);
|
||||
ci->next_readdir_pos = le64_to_cpu(cinode->next_readdir_pos);
|
||||
}
|
||||
|
||||
static void init_inode_key(struct scoutfs_key_buf *key,
|
||||
@@ -245,6 +246,7 @@ static void store_inode(struct scoutfs_inode *cinode, struct inode *inode)
|
||||
cinode->salt = cpu_to_le32(ci->salt);
|
||||
cinode->link_counter = cpu_to_le64(atomic64_read(&ci->link_counter));
|
||||
cinode->data_version = cpu_to_le64(ci->data_version);
|
||||
cinode->next_readdir_pos = cpu_to_le64(ci->next_readdir_pos);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -407,6 +409,7 @@ struct inode *scoutfs_new_inode(struct super_block *sb, struct inode *dir,
|
||||
ci->ino = ino;
|
||||
seqcount_init(&ci->seqcount);
|
||||
ci->data_version = 0;
|
||||
ci->next_readdir_pos = SCOUTFS_DIRENT_FIRST_POS;
|
||||
ci->staging = false;
|
||||
get_random_bytes(&ci->salt, sizeof(ci->salt));
|
||||
atomic64_set(&ci->link_counter, 0);
|
||||
|
||||
Reference in New Issue
Block a user