From 347fd0ec702fd5f98c283127cfda43352d1c567c Mon Sep 17 00:00:00 2001 From: jiefenghuang Date: Fri, 27 Sep 2024 14:58:46 +0800 Subject: [PATCH] cap Signed-off-by: jiefenghuang --- pkg/meta/sql.go | 2 +- pkg/meta/tkv.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/meta/sql.go b/pkg/meta/sql.go index 9941a3906601..6c539ef504db 100644 --- a/pkg/meta/sql.go +++ b/pkg/meta/sql.go @@ -4486,7 +4486,7 @@ func (m *dbMeta) newDirStream(inode Ino, plus bool, entries []*Entry) DirStream func (m *dbMeta) getDirFetcher() dirFetcher { return func(ctx Context, inode Ino, cursor interface{}, offset, limit int, plus bool) (interface{}, []*Entry, error) { - var entries []*Entry + entries := make([]*Entry, 0, limit) err := m.roTxn(func(s *xorm.Session) error { iCursor := offset if cursor != nil { diff --git a/pkg/meta/tkv.go b/pkg/meta/tkv.go index 8f051d4ae6ee..c93862aec6c3 100644 --- a/pkg/meta/tkv.go +++ b/pkg/meta/tkv.go @@ -3828,7 +3828,7 @@ func (m *kvMeta) getDirFetcher() dirFetcher { } prefix := len(m.entryKey(inode, "")) - var entries []*Entry + entries := make([]*Entry, 0, len(keys)) var name []byte var typ uint8 var ino Ino