cleanup: passing pointers to larger type

Log:
internal/rbd/rbd_attach.go:424:2: hugeParam: dArgs is heavy (88 bytes);
consider passing it by pointer (gocritic)

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
This commit is contained in:
Prasanna Kumar Kalever 2021-09-02 01:03:12 +05:30 committed by mergify[bot]
parent ad2c6d2851
commit 10bbb049f7
2 changed files with 4 additions and 4 deletions

View File

@ -847,7 +847,7 @@ func (ns *NodeServer) NodeUnstageVolume(
unmapOptions: imgInfo.UnmapOptions,
logDir: imgInfo.LogDir,
}
if err = detachRBDImageOrDeviceSpec(ctx, dArgs); err != nil {
if err = detachRBDImageOrDeviceSpec(ctx, &dArgs); err != nil {
log.ErrorLog(
ctx,
"error unmapping volume (%s) from staging path (%s): (%v)",

View File

@ -384,7 +384,7 @@ func createPath(ctx context.Context, volOpt *rbdVolume, device string, cr *util.
unmapOptions: volOpt.UnmapOptions,
logDir: volOpt.LogDir,
}
detErr := detachRBDImageOrDeviceSpec(ctx, dArgs)
detErr := detachRBDImageOrDeviceSpec(ctx, &dArgs)
if detErr != nil {
log.WarningLog(ctx, "rbd: %s unmap error %v", imagePath, detErr)
}
@ -436,14 +436,14 @@ func detachRBDDevice(ctx context.Context, devicePath, volumeID, unmapOptions str
unmapOptions: unmapOptions,
}
return detachRBDImageOrDeviceSpec(ctx, dArgs)
return detachRBDImageOrDeviceSpec(ctx, &dArgs)
}
// detachRBDImageOrDeviceSpec detaches an rbd imageSpec or devicePath, with additional checking
// when imageSpec is used to decide if image is already unmapped.
func detachRBDImageOrDeviceSpec(
ctx context.Context,
dArgs detachRBDImageArgs) error {
dArgs *detachRBDImageArgs) error {
if dArgs.encrypted {
mapperFile, mapperPath := util.VolumeMapper(dArgs.volumeID)
mappedDevice, mapper, err := util.DeviceEncryptionStatus(ctx, mapperPath)