Skip to content

Commit e36b97f

Browse files
authored
[dfs v2] fix dentry hash lookup bug; update dentry dump msh cmd; (#7655)
Signed-off-by: yangfasheng <[email protected]>
1 parent cd3f0f9 commit e36b97f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

components/dfs/dfs_v2/src/dfs_dentry.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,14 +151,13 @@ static struct dfs_dentry *_dentry_hash_lookup(struct dfs_mnt *mnt, const char *p
151151
{
152152
rt_err_t ret = RT_EOK;
153153
struct dfs_dentry *entry = RT_NULL;
154-
int path_len = strlen(path);
155154

156155
ret = dfs_file_lock();
157156
if (ret == RT_EOK)
158157
{
159158
rt_list_for_each_entry(entry, &hash_head.head[_dentry_hash(mnt, path)], hashlist)
160159
{
161-
if (entry->mnt == mnt && !strncmp(entry->pathname, path, path_len))
160+
if (entry->mnt == mnt && !strcmp(entry->pathname, path))
162161
{
163162
dfs_dentry_ref(entry);
164163
dfs_file_unlock();
@@ -358,7 +357,7 @@ int dfs_dentry_dump(int argc, char** argv)
358357
{
359358
rt_list_for_each_entry(entry, &hash_head.head[index], hashlist)
360359
{
361-
printf("dentry:%s @ %p, ref_count = %zd\n", entry->pathname, entry, (size_t)rt_atomic_load(&entry->ref_count));
360+
printf("dentry: %s%s @ %p, ref_count = %zd\n", entry->mnt->fullpath, entry->pathname, entry, (size_t)rt_atomic_load(&entry->ref_count));
362361
}
363362
}
364363
dfs_unlock();

0 commit comments

Comments
 (0)