From: zhaoyanbai Date: Fri, 4 Dec 2026 05:21:56 +0000 (+0800) Subject: 暂时清除dentry_get和dentry_put X-Git-Url: http://repos.zhaoyanbai.com/sitemap.xml?a=commitdiff_plain;h=5ee4966237702d627316c07ff04e40ad13989ba1;p=kernel.git 暂时清除dentry_get和dentry_put --- diff --git a/fs/dentry.c b/fs/dentry.c index acd0c38..8d0f094 100644 --- a/fs/dentry.c +++ b/fs/dentry.c @@ -168,7 +168,6 @@ int dentry_cached_lookup(dentry_t* parent, qstr_t* s, dentry_t** dentry) { continue; } - dentry_get_locked(*dentry); mutex_unlock(&dhe->mutex); return 0; @@ -211,12 +210,13 @@ int dentry_real_lookup(dentry_t* parent, qstr_t* s, dentry_t** dentry) { if (*dentry == NULL) { *dentry = new_dentry; } else { - dentry_put(new_dentry); + // } + // if (ret == 0) { // 返回0才代表成功 // *dentry = new_dentry; // } else { - // dentry_put(new_dentry); + // // } } @@ -238,20 +238,6 @@ void dentry_cache_init() { } } -dentry_t* dentry_get(dentry_t* dentry) { - assert(dentry != NULL); - atomic_inc(&dentry->d_count); - return dentry; -} - -void dentry_get_locked(dentry_t* dentry) { - // -} - -void dentry_put(dentry_t* dentry) { - // -} - // static __inline__ struct dentry * dget(struct dentry *dentry) // { // if (dentry) { diff --git a/fs/fssysc.c b/fs/fssysc.c index 521814c..afb754a 100644 --- a/fs/fssysc.c +++ b/fs/fssysc.c @@ -31,7 +31,6 @@ __attribute__((regparm(0))) long sysc_mkdir(const char* path, int mode) { if (0 == ret && dentry != NULL) { assert(dentry != NULL); ret = vfs_mkdir(ni.path.dentry->d_inode, dentry, mode); - dentry_put(dentry); } else { assert(dentry == NULL); } diff --git a/fs/path.c b/fs/path.c index 9cb87c1..54de1b1 100644 --- a/fs/path.c +++ b/fs/path.c @@ -128,8 +128,8 @@ int follow_down(dentry_t** dentry, mount_t** vfsmnt) { // *vfsmnt = vfsmnt_get(tmp_mnt); // vfsmnt_put(tmp_mnt->mnt_parent); - // dentry_put(*dentry); - // *dentry = dentry_get(tmp_mnt->mnt_root); + // + // *dentry = *(tmp_mnt->mnt_root); // } // } return 0; @@ -237,7 +237,6 @@ int path_walk(const char* path, namei_t* ni) { // TODO 判断 symlink // ... - dentry_put(ni->path.dentry); ni->path.dentry = dentry; assert(inode->i_ops->lookup != NULL); @@ -303,7 +302,6 @@ int path_walk(const char* path, namei_t* ni) { // TODO 判断 symlink // ... - dentry_put(dentry); ni->path.dentry = dentry; ret = -ENOENT; @@ -326,7 +324,7 @@ int path_walk(const char* path, namei_t* ni) { } out_dput_entry: - dentry_put(dentry); + // end: return ret; } @@ -351,7 +349,7 @@ int path_lookup_hash(dentry_t* base, qstr_t* name, dentry_t** dentry) { if (*dentry == NULL) { // 返回 lookup 没有再分配一个dentry *dentry = dentry_new; } else { // 否则就释放dentry_new使用lookup返回的dentry - dentry_put(dentry_new); + // } return ret; @@ -417,7 +415,7 @@ int path_open_namei(const char* path, int flags, int mode, namei_t* ni) { if (NULL == dentry->d_inode) { ret = vfs_create(dir->d_inode, dentry, mode, ni); semaphore_up(&dir->d_inode->i_sem); - dentry_put(ni->path.dentry); + // ni->path.dentry = dentry; if (0 != ret) { goto end; diff --git a/fs/ramfs.c b/fs/ramfs.c index 1f8ad2a..c3144fd 100644 --- a/fs/ramfs.c +++ b/fs/ramfs.c @@ -74,8 +74,6 @@ static int ramfs_mknod(inode_t* dir, dentry_t* dentry, umode_t mode) { dentry_attach_inode(dentry, inode); - dentry_get(dentry); - return ret; } diff --git a/fs/super.c b/fs/super.c index e6b633a..780623d 100644 --- a/fs/super.c +++ b/fs/super.c @@ -57,7 +57,7 @@ int read_super_for_nodev(fs_type_t* type, int flags, void* data, fill_super_cb_t } mnt->mnt_sb = s; - mnt->mnt_root = dentry_get(s->sb_root); + mnt->mnt_root = s->sb_root; return err; } diff --git a/fs/vfs.h b/fs/vfs.h index 824c695..97a2beb 100644 --- a/fs/vfs.h +++ b/fs/vfs.h @@ -313,11 +313,6 @@ void dentry_attach_inode(dentry_t* dentry, inode_t* inode); mount_t* vfsmnt_get(mount_t* m); void vfsmnt_put(mount_t* m); -dentry_t* dentry_get(dentry_t* dentry); -void dentry_get_locked(dentry_t* dentry); - -void dentry_put(dentry_t* dentry); - // bool path_init(const char* path, unsigned int flags, namei_t* ni); int path_walk(const char* path, namei_t* ni);