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 Sep 6, 2024
1 parent c082797 commit afbfb7d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tuned/plugins/plugin_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,15 @@ def _is_hdparm_apm_supported(self, device):
self._hdparm_apm_device_support[device] = True
return True

@staticmethod
def _is_loop_device(device):
LOOP_DEVICE_MAJOR = 7
return os.major(device.device_number) == LOOP_DEVICE_MAJOR

@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 afbfb7d

Please sign in to comment.