Skip to content

Commit

Permalink
disk plugin: ignore loop devices
Browse files Browse the repository at this point in the history
It doesn't make sense to apply tuning parameters to loop devices, since they
point at files that live in other block devices, also subject to tuning.

Signed-off-by: Andreas Hasenack <[email protected]>
  • Loading branch information
panlinux committed Aug 21, 2024
1 parent c082797 commit 63a36f4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tuned/plugins/plugin_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,19 @@ def _is_hdparm_apm_supported(self, device):
self._hdparm_apm_device_support[device] = True
return True

def _is_loop_device(device):
dev = device.attributes.get("dev", None)
if dev:
try:
major = int(dev.decode("utf-8").split(":")[0])
except:
major = None
return major == 7

@classmethod
def _device_is_supported(cls, device):
return device.device_type == "disk" and \
not cls._is_loop_device(device) and \
device.attributes.get("removable", None) == b"0" and \
(device.parent is None or \
device.parent.subsystem in ["scsi", "virtio", "xen", "nvme"])
Expand Down

0 comments on commit 63a36f4

Please sign in to comment.