]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/scsi/megasas: skip automatic zero-init of large arrays
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 10 Jun 2025 12:37:06 +0000 (13:37 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Thu, 12 Jun 2025 17:40:16 +0000 (13:40 -0400)
commitca0559e2350c618048f7caf80cb79c1259e7cfd2
tree35c7f7bb952ec7810b1c2753702435aa767ca547
parent55243edf42ee87bce9f36ca251f3ab9cda1563e4
hw/scsi/megasas: skip automatic zero-init of large arrays

The 'megasas_dcmd_pd_get_list' and 'megasas_dcmd_get_properties'
methods have 4k structs used for copying data from the device.
Skip the automatic zero-init of this array to eliminate the
performance overhead in the I/O hot path.

The 'info' structs are manually initialized with memset(). The
compiler ought to be intelligent enough to turn the memset()
into a static initialization operation, and thus not duplicate
the automatic zero-init. Replacing memset() with '{}' makes it
unambiguous that the arrays are statically initialized.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Klaus Jensen <k.jensen@samsung.com>
Reviewed-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Message-id: 20250610123709.835102-29-berrange@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
hw/scsi/megasas.c