@@ -29,6 +29,8 @@ import (
2929 "k8s.io/klog/v2"
3030)
3131
32+ const defaultMaxResults = 256
33+
3234func (hp * hostPath ) GetMetadataAllocated (req * csi.GetMetadataAllocatedRequest , stream csi.SnapshotMetadata_GetMetadataAllocatedServer ) error {
3335 ctx := stream .Context ()
3436 // Check arguments
@@ -54,13 +56,18 @@ func (hp *hostPath) GetMetadataAllocated(req *csi.GetMetadataAllocatedRequest, s
5456 return status .Error (codes .InvalidArgument , "source volume does not have block mode access type" )
5557 }
5658
59+ maxResults := req .MaxResults
60+ if maxResults == 0 {
61+ maxResults = defaultMaxResults
62+ }
63+
5764 br , err := newFileBlockReader (
5865 "" ,
5966 hp .getSnapshotPath (snapID ),
6067 req .StartingOffset ,
6168 state .BlockSizeBytes ,
6269 hp .config .SnapshotMetadataBlockType ,
63- req . MaxResults ,
70+ maxResults ,
6471 )
6572 if err != nil {
6673 klog .Errorf ("failed initialize file block reader: %v" , err )
@@ -141,13 +148,18 @@ func (hp *hostPath) GetMetadataDelta(req *csi.GetMetadataDeltaRequest, stream cs
141148 return status .Error (codes .InvalidArgument , "source volume does not have block mode access type" )
142149 }
143150
151+ maxResults := req .MaxResults
152+ if maxResults == 0 {
153+ maxResults = defaultMaxResults
154+ }
155+
144156 br , err := newFileBlockReader (
145157 hp .getSnapshotPath (baseSnapID ),
146158 hp .getSnapshotPath (targetSnapID ),
147159 req .StartingOffset ,
148160 state .BlockSizeBytes ,
149161 hp .config .SnapshotMetadataBlockType ,
150- req . MaxResults ,
162+ maxResults ,
151163 )
152164 if err != nil {
153165 klog .Errorf ("failed initialize file block reader: %v" , err )
0 commit comments