Linux内核 – “放置”inode是什么意思?
发布时间:2020-12-13 18:47:38 所属栏目:Linux 来源:网络整理
导读:我在iput函数上面看到了以下注释: /** * iput - put an inode * @inode: inode to put * * Puts an inode,dropping its usage count. If the inode use count hits * zero,the inode is then freed and may also be destroyed. * * Consequently,iput() can
我在iput函数上面看到了以下注释:
/** * iput - put an inode * @inode: inode to put * * Puts an inode,dropping its usage count. If the inode use count hits * zero,the inode is then freed and may also be destroyed. * * Consequently,iput() can sleep. */ 对我而言,这听起来不是“放”任何东西,而是“放弃”它.我知道drop_inode函数,在某些情况下会从iput调用,因此术语“put”的使用在这里更加令人困惑. 解决方法
put是内核代码中的通用术语,用于递减对象的引用计数.它是get的补充,增加了引用计数.您可以找到很多地方,而不仅仅是inode.
引用计数用于防止共享对象在被使用时被销毁.使用对象的代码获取对象,使用它,然后将其释放. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |