diff --git a/api/common/config.go b/api/common/config.go index e4f23ad5..2e533609 100644 --- a/api/common/config.go +++ b/api/common/config.go @@ -55,6 +55,9 @@ type FlagStorage struct { DebugFuse bool DebugS3 bool Foreground bool + + // MPU + MPUPartSize uint64 } func (flags *FlagStorage) GetMimeType(fileName string) (retMime *string) { diff --git a/internal/file.go b/internal/file.go index a2ccbaa7..4a6df8aa 100644 --- a/internal/file.go +++ b/internal/file.go @@ -187,11 +187,11 @@ func (fh *FileHandle) partSize() uint64 { var size uint64 if fh.lastPartId < 1000 { - size = 5 * 1024 * 1024 + size = fh.inode.fs.flags.MPUPartSize } else if fh.lastPartId < 2000 { - size = 25 * 1024 * 1024 + size = 5 * fh.inode.fs.flags.MPUPartSize } else { - size = 125 * 1024 * 1024 + size = 5 * 5 * fh.inode.fs.flags.MPUPartSize } maxPartSize := fh.cloud.Capabilities().MaxMultipartSize diff --git a/internal/flags.go b/internal/flags.go index f18633a8..fd53a81a 100644 --- a/internal/flags.go +++ b/internal/flags.go @@ -138,6 +138,11 @@ func NewApp() (app *cli.App) { Usage: "GID owner of all inodes.", }, + cli.IntFlag{ + Name: "MPUPartSize", + Value: 5 * 1024 * 1024, + Usage: "MPU part size.", + }, ///////////////////////// // S3 ///////////////////////// @@ -341,6 +346,9 @@ func PopulateFlags(c *cli.Context) (ret *FlagStorage) { DebugFuse: c.Bool("debug_fuse"), DebugS3: c.Bool("debug_s3"), Foreground: c.Bool("f"), + + // MPU + MPUPartSize: uint64(c.Int("MPUPartSize")), } // S3