Skip to content

Commit db929e5

Browse files
Add count
1 parent 37ce30b commit db929e5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/meta/utils.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,9 @@ func (m *baseMeta) emptyDir(ctx Context, inode Ino, skipCheckTrash bool, count *
320320
m.updateUserGroupQuota(ctx, quota.Uid, quota.Gid, -quota.Space, -quota.Inodes)
321321
}
322322
}
323+
if count != nil && len(nonDirEntries) > 0 {
324+
atomic.AddUint64(count, uint64(len(nonDirEntries)))
325+
}
323326
} else if st == syscall.ENOTSUP {
324327
for _, e := range entries {
325328
if e.Attr.Typ == TypeDirectory {
@@ -331,6 +334,9 @@ func (m *baseMeta) emptyDir(ctx Context, inode Ino, skipCheckTrash bool, count *
331334
if st := m.Unlink(ctx, inode, string(e.Name), skipCheckTrash); st != 0 && st != syscall.ENOENT {
332335
return st
333336
}
337+
if count != nil {
338+
atomic.AddUint64(count, 1)
339+
}
334340
}
335341
} else if st != 0 {
336342
return st

0 commit comments

Comments
 (0)