Skip to content

Commit

Permalink
linstor: enable discard for Linstor storage pools
Browse files Browse the repository at this point in the history
All Linstor storage backends support discard, so it can be safely enabled.
  • Loading branch information
rp- committed Oct 4, 2024
1 parent e246e7e commit ba39217
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3128,6 +3128,9 @@ public int compare(final DiskTO arg0, final DiskTO arg1) {
else {
disk.defBlockBasedDisk(physicalDisk.getPath(), devId, diskBusType);
}
if (pool.getType() == StoragePoolType.Linstor) {
disk.setDiscard(DiscardType.UNMAP);
}
} else {
if (volume.getType() == Volume.Type.DATADISK && !(isWindowsTemplate && isUefiEnabled)) {
disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusTypeData, DiskDef.DiskFmtType.QCOW2);
Expand Down Expand Up @@ -3474,6 +3477,9 @@ public synchronized String attachOrDetachDisk(final Connect conn,
diskdef.defFileBasedDisk(attachingDisk.getPath(), devId, busT, DiskDef.DiskFmtType.QCOW2);
} else if (attachingDisk.getFormat() == PhysicalDiskFormat.RAW) {
diskdef.defBlockBasedDisk(attachingDisk.getPath(), devId, busT);
if (attachingPool.getType() == StoragePoolType.Linstor) {
diskdef.setDiscard(DiscardType.UNMAP);
}
}
if (bytesReadRate != null && bytesReadRate > 0) {
diskdef.setBytesReadRate(bytesReadRate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1444,6 +1444,9 @@ protected synchronized void attachOrDetachDisk(final Connect conn, final boolean
diskdef.defFileBasedDisk(attachingDisk.getPath(), devId, busT, DiskDef.DiskFmtType.QCOW2);
} else if (attachingDisk.getFormat() == PhysicalDiskFormat.RAW) {
diskdef.defBlockBasedDisk(attachingDisk.getPath(), devId, busT);
if (attachingPool.getType() == StoragePoolType.Linstor) {
diskdef.setDiscard(DiscardType.UNMAP);
}
}

if (encryptDetails != null) {
Expand Down

0 comments on commit ba39217

Please sign in to comment.