1000000000007 ff9f207ac14057ff febeffdfffefffff fffffffffffffffe ˆÁË ƒmÐ9Ê¿ÈJa Á]›iÃã@srddlmZddlmZddlTddlmZmZddlZ ddl m Z ddl Z e j  ¡Ze ƒZGdd„dejƒZdS) éNé)Úbase)Ú*)ÚPopenÚPIPE)Úcommandsc@steZdZdZedd„ƒZdd„Zedd„ƒZdd „Zd d „Z d d „Z dd„Z dd„Z dd„Z eddd�dd„ƒZdS)Ú MountsPlugina= Enables or disables barriers for mounts according to the value of the boolean option [option]`disable_barriers`. The option additionally allows the special value `force`, which disables barriers even on mountpoints with write back caches. NOTE: Only extended file systems (ext) are supported by this plug-in. c Csòi}d}tgd¢ttddd� ¡\}}dd„| ¡DƒD]®}t|ƒdkrJq8|dd…\}}}t|ƒdkrp|dnd} t|ƒdkrˆ|dnd} |d krš|}q8|d ks8|d vr¬q8| dus8| d kr¾q8| | tƒ|| d œ¡|| d |¡q8||_dS)zÁ Gets the information about disks, partitions and mountpoints. Stores information about used filesystem and creates a list of all underlying devices (in case of LVM) for each mountpoint. N)Zlsblkz-rnozTYPE,RM,KNAME,FSTYPE,MOUNTPOINTT)ÚstdoutÚstderrZ close_fdsZuniversal_newlinescSsg|] }| ¡‘qS©)Úsplit)Ú.0Úliner r ú?/usr/lib/python3.9/site-packages/tuned/plugins/plugin_mounts.pyÚ #óz>MountsPlugin._generate_mountpoint_topology..ééZdiskÚ1)ÚpartZlvmz[SWAP])ÚdisksÚ device_nameÚ filesystemr) rrZ communicateÚ splitlinesÚlenÚ setdefaultÚsetÚaddÚ_mountpoint_topology) ÚclsZmountpoint_topologyZ current_diskr r ÚcolumnsZ device_typeZdevice_removablerrÚ mountpointr r rÚ_generate_mountpoint_topologys,ý z*MountsPlugin._generate_mountpoint_topologycCs*| ¡d|_t|j ¡ƒ|_tƒ|_dS)NT)r"Z_devices_supportedrrÚkeysZ _free_devicesZ_assigned_devices©Úselfr r rÚ _init_devices:szMountsPlugin._init_devicescCsddiS)NÚdisable_barriersr r$r r rÚ_get_config_options@sÿz MountsPlugin._get_config_optionscCsd|_d|_dS)NFT)Z_has_dynamic_tuningZ_has_static_tuning©r%Úinstancer r rÚ_instance_initFszMountsPlugin._instance_initcCsdS)Nr r)r r rÚ_instance_cleanupJszMountsPlugin._instance_cleanupcCs,t d|¡}|D]}t |¡ ¡SdS)zV Get device cache type. This will work only for devices on SCSI kernel subsystem. z+/sys/block/%s/device/scsi_disk/*/cache_typeN)ÚglobÚcmdZ read_fileÚstrip)r%ÚdeviceZsource_filenamesZsource_filenamer r rÚ_get_device_cache_typeMsz#MountsPlugin._get_device_cache_typecCs,|j|dD]}| |¡dkrdSqdS)zr Checks if the device has 'write back' cache. If the cache type cannot be determined, asume some other cache. rz write backTF)rr1)r%r!r0r r rÚ_mountpoint_has_writeback_cacheVsz,MountsPlugin._mountpoint_has_writeback_cachec CsÈtdƒ�\}|D]6}| ¡}|dddkr,q|d|kr|d}qVqWdƒdSWdƒn1sj0Y| d¡}|D]@}| d¡\}} } |d ks®|d kr´| d kr´d S|d kr‚d Sq‚d S)zP Checks if a given mountpoint is mounted with barriers enabled or disabled. z /proc/mountsrú/rrNú,ú=Z nobarrierZbarrierÚ0FT)Úopenr Ú partition) r%r!Z mounts_filerr Z option_listÚoptionsÚoptionÚnameÚsepÚvaluer r rÚ_mountpoint_has_barriers_s"  . z%MountsPlugin._mountpoint_has_barrierscCsd|dd|