Skip to content

Commit

Permalink
Add inode.Initialized() for checking if an inode has been initialized…
Browse files Browse the repository at this point in the history
… or not.
  • Loading branch information
iain-macdonald authored and ktock committed Jun 11, 2024
1 parent fc0fdbf commit f59a74e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fs/inode.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@ func unlockNodes(ns ...*Inode) {
}
}

// Initialized returns true if this inode has been initialized and added to the
// filesystem tree.
func (n *Inode) Initialized() bool {
n.mu.Lock()
defer n.mu.Unlock()
return n.changeCounter > 0
}

// Forgotten returns true if the kernel holds no references to this
// inode. This can be used for background cleanup tasks, since the
// kernel has no way of reviving forgotten nodes by its own
Expand Down

0 comments on commit f59a74e

Please sign in to comment.