mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
tmpfs: minor clarifications/fixes for nr_inodes
Removes debug warnings when ENOSPC is encountered upon filesystem creation. Documents that maxInodes == 0 means no limit in the code. For consistency, uses maxInodes == 0 (as in, no limit) rather than math.MaxInt64 for SB_KERNMOUNT mounts. PiperOrigin-RevId: 917259013
This commit is contained in:
committed by
gVisor bot
parent
1cca15f64f
commit
7ff7a33171
@@ -104,6 +104,7 @@ type filesystem struct {
|
||||
maxSizeInPages uint64
|
||||
|
||||
// maxInodes is the maximum permissible number of inodes for the tmpfs.
|
||||
// If maxInodes == 0, there is no limit on the number of inodes.
|
||||
// This field is immutable.
|
||||
maxInodes uint64
|
||||
|
||||
@@ -204,7 +205,7 @@ func getDefaultSizeLimit(disable bool) uint64 {
|
||||
|
||||
func getDefaultInodeLimit(disable bool) uint64 {
|
||||
if disable {
|
||||
return math.MaxInt64
|
||||
return 0
|
||||
}
|
||||
|
||||
return totalHostMem / hostarch.PageSize / 2
|
||||
@@ -388,21 +389,18 @@ func (fstype FilesystemType) GetFilesystem(ctx context.Context, vfsObj *vfs.Virt
|
||||
case linux.S_IFREG:
|
||||
inode, err := fs.newRegularFile(rootKUID, rootKGID, rootMode, nil /* parentDir */)
|
||||
if err != nil {
|
||||
ctx.Warningf("failed to create tmpfs root file: %v", err)
|
||||
return nil, nil, err
|
||||
}
|
||||
root = fs.newDentry(inode)
|
||||
case linux.S_IFLNK:
|
||||
inode, err := fs.newSymlink(rootKUID, rootKGID, rootMode, tmpfsOpts.RootSymlinkTarget, nil /* parentDir */)
|
||||
if err != nil {
|
||||
ctx.Warningf("failed to create tmpfs root symlink: %v", err)
|
||||
return nil, nil, err
|
||||
}
|
||||
root = fs.newDentry(inode)
|
||||
case linux.S_IFDIR:
|
||||
dirInode, err := fs.newDirectory(rootKUID, rootKGID, rootMode, nil /* parentDir */)
|
||||
if err != nil {
|
||||
ctx.Warningf("failed to create tmpfs root directory: %v", err)
|
||||
return nil, nil, err
|
||||
}
|
||||
root = &dirInode.dentry
|
||||
|
||||
Reference in New Issue
Block a user