Skip to content

Commit

Permalink
use mount config instead of flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ashmeenkaur committed Apr 24, 2024
1 parent 5f6087d commit 82c2290
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions internal/fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ type ServerConfig struct {
// File chunk size to read from GCS in one call. Specified in MB.
SequentialReadSizeMb int32

// Allows ignoring interrupts.
IgnoreInterrupts bool

// MountConfig has all the config specified by the user using configFile flag.
MountConfig *config.MountConfig
}
Expand Down Expand Up @@ -179,7 +176,6 @@ func NewFileSystem(
inodeAttributeCacheTTL: cfg.InodeAttributeCacheTTL,
dirTypeCacheTTL: cfg.DirTypeCacheTTL,
renameDirLimit: cfg.RenameDirLimit,
ignoreInterrupts: cfg.IgnoreInterrupts,
sequentialReadSizeMb: cfg.SequentialReadSizeMb,
uid: cfg.Uid,
gid: cfg.Gid,
Expand Down Expand Up @@ -346,7 +342,6 @@ type fileSystem struct {
inodeAttributeCacheTTL time.Duration
dirTypeCacheTTL time.Duration
renameDirLimit int64
ignoreInterrupts bool
sequentialReadSizeMb int32

// The user and group owning everything in the file system.
Expand Down Expand Up @@ -1315,7 +1310,7 @@ func (fs *fileSystem) StatFS(
}

func (fs *fileSystem) ignoreInterruptsIfFlagIsSet(ctx context.Context) context.Context {
if fs.ignoreInterrupts {
if fs.mountConfig.FileSystemConfig.IgnoreInterrupts {
return context.WithoutCancel(ctx)
}
return ctx
Expand Down
3 changes: 2 additions & 1 deletion internal/fs/interrupt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"context"
"testing"

"github.com/googlecloudplatform/gcsfuse/v2/internal/config"
"github.com/jacobsa/ogletest"
)

Expand All @@ -37,7 +38,7 @@ var ignoreInterruptsTest = []struct {
func TestIgnoreInterruptsIfFlagIsSet(t *testing.T) {
for _, tt := range ignoreInterruptsTest {
t.Run(tt.testName, func(t *testing.T) {
fs := &fileSystem{ignoreInterrupts: tt.ignoreInterrupts}
fs := &fileSystem{mountConfig: &config.MountConfig{FileSystemConfig: config.FileSystemConfig{IgnoreInterrupts: tt.ignoreInterrupts}}}
ctx, cancel := context.WithCancel(context.Background())

// Call the method and cancel the context
Expand Down
1 change: 0 additions & 1 deletion mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ be interacting with the file system.`)
FilePerms: os.FileMode(flags.FileMode),
DirPerms: os.FileMode(flags.DirMode),
RenameDirLimit: flags.RenameDirLimit,
IgnoreInterrupts: flags.IgnoreInterrupts,
SequentialReadSizeMb: flags.SequentialReadSizeMb,
EnableNonexistentTypeCache: flags.EnableNonexistentTypeCache,
MountConfig: mountConfig,
Expand Down

0 comments on commit 82c2290

Please sign in to comment.