@@ -29,6 +29,8 @@ import (
29
29
"k8s.io/klog/v2"
30
30
)
31
31
32
+ const defaultMaxResults = 256
33
+
32
34
func (hp * hostPath ) GetMetadataAllocated (req * csi.GetMetadataAllocatedRequest , stream csi.SnapshotMetadata_GetMetadataAllocatedServer ) error {
33
35
ctx := stream .Context ()
34
36
// Check arguments
@@ -54,13 +56,18 @@ func (hp *hostPath) GetMetadataAllocated(req *csi.GetMetadataAllocatedRequest, s
54
56
return status .Error (codes .InvalidArgument , "source volume does not have block mode access type" )
55
57
}
56
58
59
+ maxResults := req .MaxResults
60
+ if maxResults == 0 {
61
+ maxResults = defaultMaxResults
62
+ }
63
+
57
64
br , err := newFileBlockReader (
58
65
"" ,
59
66
hp .getSnapshotPath (snapID ),
60
67
req .StartingOffset ,
61
68
state .BlockSizeBytes ,
62
69
hp .config .SnapshotMetadataBlockType ,
63
- req . MaxResults ,
70
+ maxResults ,
64
71
)
65
72
if err != nil {
66
73
klog .Errorf ("failed initialize file block reader: %v" , err )
@@ -141,13 +148,18 @@ func (hp *hostPath) GetMetadataDelta(req *csi.GetMetadataDeltaRequest, stream cs
141
148
return status .Error (codes .InvalidArgument , "source volume does not have block mode access type" )
142
149
}
143
150
151
+ maxResults := req .MaxResults
152
+ if maxResults == 0 {
153
+ maxResults = defaultMaxResults
154
+ }
155
+
144
156
br , err := newFileBlockReader (
145
157
hp .getSnapshotPath (baseSnapID ),
146
158
hp .getSnapshotPath (targetSnapID ),
147
159
req .StartingOffset ,
148
160
state .BlockSizeBytes ,
149
161
hp .config .SnapshotMetadataBlockType ,
150
- req . MaxResults ,
162
+ maxResults ,
151
163
)
152
164
if err != nil {
153
165
klog .Errorf ("failed initialize file block reader: %v" , err )
0 commit comments