本文整理汇总了Golang中github.com/googlecloudplatform/gcsfuse/internal/fs/inode.Inode.Destroy方法的典型用法代码示例。如果您正苦于以下问题:Golang Inode.Destroy方法的具体用法?Golang Inode.Destroy怎么用?Golang Inode.Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/googlecloudplatform/gcsfuse/internal/fs/inode.Inode
的用法示例。
在下文中一共展示了Inode.Destroy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: unlockAndDecrementLookupCount
// Decrement the supplied inode's lookup count, destroying it if the inode says
// that it has hit zero.
//
// We require the file system lock to exclude concurrent lookups, which might
// otherwise find an inode whose lookup count has gone to zero.
//
// UNLOCK_FUNCTION(fs.mu)
// UNLOCK_FUNCTION(in)
func (fs *fileSystem) unlockAndDecrementLookupCount(
in inode.Inode,
N uint64) {
name := in.Name()
// Decrement the lookup count.
shouldDestroy := in.DecrementLookupCount(N)
// Update file system state, orphaning the inode if we're going to destroy it
// below.
if shouldDestroy {
delete(fs.inodes, in.ID())
// Update indexes if necessary.
if fs.generationBackedInodes[name] == in {
delete(fs.generationBackedInodes, name)
}
if fs.implicitDirInodes[name] == in {
delete(fs.implicitDirInodes, name)
}
}
// We are done with the file system.
fs.mu.Unlock()
// Now we can destroy the inode if necessary.
if shouldDestroy {
destroyErr := in.Destroy()
if destroyErr != nil {
log.Printf("Error destroying inode %q: %v", name, destroyErr)
}
}
in.Unlock()
}