mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(client): update FuseServeThreads default value to 0 and enhance request handling logic. #1000451308
- Changed default value of FuseServeThreads to 0 in mount options. - Added logic to handle requests in a loop when FuseServeThreads is less than or equal to 0, allowing for concurrent request processing with timeout handling. Signed-off-by: Victor1319 <zengxuewei@oppo.com>
This commit is contained in:
parent
a45ba8a82a
commit
268e113f7b
@ -926,6 +926,40 @@ func (s *Server) Serve(fs FS, opt *proto.MountOptions) error {
|
||||
return fmt.Errorf("restore fail: %v", err)
|
||||
}
|
||||
|
||||
if opt != nil && opt.FuseServeThreads <= 0 {
|
||||
for {
|
||||
if s.TrySuspend(fs) {
|
||||
break
|
||||
}
|
||||
|
||||
req, err := s.conn.ReadRequest()
|
||||
if err != nil {
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
switch req.(type) {
|
||||
case *fuse.ForgetRequest:
|
||||
ctx := context.Background()
|
||||
ForgetServeLimit.Wait(ctx)
|
||||
default:
|
||||
}
|
||||
|
||||
s.wg.Add(1)
|
||||
go func() {
|
||||
defer s.wg.Done()
|
||||
if opt != nil && opt.RequestTimeout > 0 {
|
||||
s.serveWithTimeOut(req, opt.RequestTimeout)
|
||||
} else {
|
||||
s.serve(req)
|
||||
}
|
||||
}()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
fn := func() error {
|
||||
defer s.wg.Done()
|
||||
|
||||
@ -949,16 +983,6 @@ func (s *Server) Serve(fs FS, opt *proto.MountOptions) error {
|
||||
default:
|
||||
}
|
||||
|
||||
// s.wg.Add(1)
|
||||
// go func() {
|
||||
// defer s.wg.Done()
|
||||
// if opt != nil && opt.RequestTimeout > 0 {
|
||||
// s.serveWithTimeOut(req, opt.RequestTimeout)
|
||||
// } else {
|
||||
// s.serve(req)
|
||||
// }
|
||||
// }()
|
||||
|
||||
if opt != nil && opt.RequestTimeout > 0 {
|
||||
s.serveWithTimeOut(req, opt.RequestTimeout)
|
||||
} else {
|
||||
|
||||
@ -205,7 +205,7 @@ func InitMountOptions(opts []MountOption) {
|
||||
opts[MetaCacheAcceleration] = MountOption{"metaCacheAcceleration", "keep meta cache and get inode/extents in one go", "", false}
|
||||
opts[MinimumNlinkReadDir] = MountOption{"minimumNlinkReadDir", "the minimum Nlink value of the directory that actively triggers the ReadDir operation", "", int64(10000)}
|
||||
opts[InodeLruLimit] = MountOption{"inodeLruLimit", "capacity for inode lru", "", int64(10000000)}
|
||||
opts[FuseServeThreads] = MountOption{"fuseServeThreads", "Fuse Serve Threads", "", int64(64)}
|
||||
opts[FuseServeThreads] = MountOption{"fuseServeThreads", "Fuse Serve Threads", "", int64(0)}
|
||||
for i := 0; i < MaxMountOption; i++ {
|
||||
flag.StringVar(&opts[i].cmdlineValue, opts[i].keyword, "", opts[i].description)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user