zfs: generalize dry send information for normal sends and with resume token
This is in preparation for resumable send & recv, thus we just don't use the ResumeToken field for the time being.
This commit is contained in:
@@ -79,16 +79,17 @@ func (p *Sender) Send(ctx context.Context, r *pdu.SendReq) (*pdu.SendRes, io.Rea
|
||||
}
|
||||
|
||||
if r.DryRun {
|
||||
size, err := zfs.ZFSSendDry(r.Filesystem, r.From, r.To)
|
||||
if err == zfs.BookmarkSizeEstimationNotSupported {
|
||||
return &pdu.SendRes{ExpectedSize: 0}, nil, nil
|
||||
}
|
||||
si, err := zfs.ZFSSendDry(r.Filesystem, r.From, r.To, "")
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
return &pdu.SendRes{ExpectedSize: size}, nil, nil
|
||||
var expSize int64 = 0 // protocol says 0 means no estimate
|
||||
if si.SizeEstimate != -1 { // but si returns -1 for no size estimate
|
||||
expSize = si.SizeEstimate
|
||||
}
|
||||
return &pdu.SendRes{ExpectedSize: expSize}, nil, nil
|
||||
} else {
|
||||
stream, err := zfs.ZFSSend(r.Filesystem, r.From, r.To)
|
||||
stream, err := zfs.ZFSSend(r.Filesystem, r.From, r.To, "")
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user