[dfs v2] fix dentry hash lookup bug; update dentry dump msh cmd; (#7655)

Signed-off-by: yangfasheng <yangfasheng@live.com>
This commit is contained in:
yangfasheng 2023-06-11 18:07:06 +08:00 committed by GitHub
parent cd3f0f9c8a
commit e36b97ff94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -151,14 +151,13 @@ static struct dfs_dentry *_dentry_hash_lookup(struct dfs_mnt *mnt, const char *p
{
rt_err_t ret = RT_EOK;
struct dfs_dentry *entry = RT_NULL;
int path_len = strlen(path);
ret = dfs_file_lock();
if (ret == RT_EOK)
{
rt_list_for_each_entry(entry, &hash_head.head[_dentry_hash(mnt, path)], hashlist)
{
if (entry->mnt == mnt && !strncmp(entry->pathname, path, path_len))
if (entry->mnt == mnt && !strcmp(entry->pathname, path))
{
dfs_dentry_ref(entry);
dfs_file_unlock();
@ -358,7 +357,7 @@ int dfs_dentry_dump(int argc, char** argv)
{
rt_list_for_each_entry(entry, &hash_head.head[index], hashlist)
{
printf("dentry:%s @ %p, ref_count = %zd\n", entry->pathname, entry, (size_t)rt_atomic_load(&entry->ref_count));
printf("dentry: %s%s @ %p, ref_count = %zd\n", entry->mnt->fullpath, entry->pathname, entry, (size_t)rt_atomic_load(&entry->ref_count));
}
}
dfs_unlock();