Linux内核 - "放置"inode是什么意思?

Mar*_*tin 7 linux kernel inode linux-kernel

我在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.
 */
Run Code Online (Sandbox Code Playgroud)

对我而言,这听起来不是"放"任何东西,而是"放弃"它.我知道这个drop_inode函数iput在某些情况下被调用,因此术语"put"的使用在这里更加令人困惑.

Joh*_*ica 6

put是内核代码中用于递减对象引用计数的常用术语.它是补充get,增加了引用计数.您可以找到很多地方,而不仅仅是inode.

引用计数用于防止共享对象在被使用时被销毁.代码使用对象get的对象,使用它,然后使用put它来释放它.