From 9fa3c8382b0dab0c2eaed27dc9c4dbe84a3642cf Mon Sep 17 00:00:00 2001 From: Prasanna Kumar Kalever Date: Thu, 16 Jun 2022 16:28:31 +0530 Subject: [PATCH] cleanup: reduce struct padding internal/rbd/rbd_util.go:89:15: struct of size 312 bytes could be of size 304 bytes: `` struct{ RbdImageName string, ImageID string, VolID string, Monitors string, JournalPool string, Pool string, RadosNamespace string, ClusterID string, RequestName string, NamePrefix string, ParentName string, ParentPool string, ClusterName string, Owner string, VolSize int64, StripeCount uint64, StripeUnit uint64, ObjectSize uint64, ImageFeatureSet github.com/ceph/go-ceph/rbd.FeatureSet, encryption *github.com/ceph/ceph-csi/internal/util.VolumeEncryption, CreatedAt *google.golang.org/protobuf/types/known/timestamppb.Timestamp, conn *github.com/ceph/ceph-csi/internal/util.ClusterConnection, ioctx *github.com/ceph/go-ceph/rados.IOContext, Primary bool, EnableMetadata bool, } `` (maligned) type rbdImage struct { ^}` make: *** [Makefile:118: go-lint] Error 1 Signed-off-by: Prasanna Kumar Kalever --- internal/rbd/rbd_util.go | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/internal/rbd/rbd_util.go b/internal/rbd/rbd_util.go index 59c26f187..e5ece5658 100644 --- a/internal/rbd/rbd_util.go +++ b/internal/rbd/rbd_util.go @@ -95,16 +95,7 @@ type rbdImage struct { ImageID string // VolID is the volume ID that is exchanged with CSI drivers, // identifying this rbd image - VolID string `json:"volID"` - - // VolSize is the size of the RBD image backing this rbdImage. - VolSize int64 - - // image striping configurations. - StripeCount uint64 - StripeUnit uint64 - ObjectSize uint64 - + VolID string `json:"volID"` Monitors string // JournalPool is the ceph pool in which the CSI Journal/CSI snapshot Journal is // stored @@ -121,31 +112,36 @@ type rbdImage struct { // config maps in v1.0.0 RequestName string NamePrefix string - // ParentName represents the parent image name of the image. ParentName string // Parent Pool is the pool that contains the parent image. - ParentPool string - ImageFeatureSet librbd.FeatureSet - // Primary represent if the image is primary or not. - Primary bool - + ParentPool string // Cluster name ClusterName string - // Set metadata on volume - EnableMetadata bool - - // encryption provides access to optional VolumeEncryption functions - encryption *util.VolumeEncryption // Owner is the creator (tenant, Kubernetes Namespace) of the volume Owner string - CreatedAt *timestamp.Timestamp + // VolSize is the size of the RBD image backing this rbdImage. + VolSize int64 + // image striping configurations. + StripeCount uint64 + StripeUnit uint64 + ObjectSize uint64 + + ImageFeatureSet librbd.FeatureSet + // encryption provides access to optional VolumeEncryption functions + encryption *util.VolumeEncryption + CreatedAt *timestamp.Timestamp // conn is a connection to the Ceph cluster obtained from a ConnPool conn *util.ClusterConnection // an opened IOContext, call .openIoctx() before using ioctx *rados.IOContext + + // Primary represent if the image is primary or not. + Primary bool + // Set metadata on volume + EnableMetadata bool } // rbdVolume represents a CSI volume and its RBD image specifics.