Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP4:Update
util-linux.26136
util-linux-fstrim-implement-X-fstrim.notrim.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File util-linux-fstrim-implement-X-fstrim.notrim.patch of Package util-linux.26136
Backport with adoc fix. From 582eb71d737b6c23dd5ec19db0e9aa1d4d7abee9 Mon Sep 17 00:00:00 2001 From: Stanislav Brabec <sbrabec@suse.cz> Date: Mon, 31 Jan 2022 10:53:20 +0100 Subject: [PATCH] fstrim: Add fstab option X-fstrim.notrim Sometimes it makes sense to skip fstrim for selected file mounts, but still be able to use fstrim.service. Add a possibility to specify "X-fstrim.notrim" in fstab. Do not use "notrim", as it collides with the kernel rbd driver. [kzak@redhat.com: - rename x-fstrim to X-fstrim] Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com> --- sys-utils/fstrim.8.adoc | 2 +- sys-utils/fstrim.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) Index: util-linux-2.37.2/sys-utils/fstrim.8.adoc =================================================================== --- util-linux-2.37.2.orig/sys-utils/fstrim.8.adoc +++ util-linux-2.37.2/sys-utils/fstrim.8.adoc @@ -29,7 +29,7 @@ Running *fstrim* frequently, or even usi The _offset_, _length_, and _minimum-size_ arguments may be followed by the multiplicative suffixes KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning as "KiB") or the suffixes KB (=1000), MB (=1000*1000), and so on for GB, TB, PB, EB, ZB and YB. *-A, --fstab*:: -Trim all mounted filesystems mentioned in _/etc/fstab_ on devices that support the discard operation. The root filesystem is determined from kernel command line if missing in the file. The other supplied options, like *--offset*, *--length* and *--minimum*, are applied to all these devices. Errors from filesystems that do not support the discard operation, read-only devices and read-only filesystems are silently ignored. +Trim all mounted filesystems mentioned in _/etc/fstab_ on devices that support the discard operation. The root filesystem is determined from kernel command line if missing in the file. The other supplied options, like *--offset*, *--length* and *--minimum*, are applied to all these devices. Errors from filesystems that do not support the discard operation, read-only devices and read-only filesystems are silently ignored. Filesystems with "X-fstrim.notrim" mount option are skipped. *-a, --all*:: Trim all mounted filesystems on devices that support the discard operation. The other supplied options, like *--offset*, *--length* and *--minimum*, are applied to all these devices. Errors from filesystems that do not support the discard operation, read-only devices and read-only filesystems are silently ignored. @@ -47,6 +47,8 @@ The number of bytes (after the starting Specifies a colon-separated list of files in fstab or kernel mountinfo format. All missing or empty files are silently ignored. The evaluation of the _list_ stops after first non-empty file. For example: + *--listed-in /etc/fstab:/proc/self/mountinfo*. ++ +Filesystems with "X-fstrim.notrim" mount option are skipped. *-m, --minimum* _minimum-size_:: Minimum contiguous free range to discard, in bytes. (This value is internally rounded up to a multiple of the filesystem block size.) Free ranges smaller than this will be ignored and fstrim will adjust the minimum if it's smaller than the device's minimum, and report that (fstrim_range.minlen) back to userspace. By increasing this value, the fstrim operation will complete more quickly for filesystems with badly fragmented freespace, although not all blocks will be discarded. The default value is zero, discarding every free block. Index: util-linux-2.37.2/sys-utils/fstrim.c =================================================================== --- util-linux-2.37.2.orig/sys-utils/fstrim.c +++ util-linux-2.37.2/sys-utils/fstrim.c @@ -292,7 +292,8 @@ static int fstrim_all_from_file(struct f const char *src = mnt_fs_get_srcpath(fs), *tgt = mnt_fs_get_target(fs); - if (!tgt || mnt_fs_is_pseudofs(fs) || mnt_fs_is_netfs(fs)) { + if (!tgt || mnt_fs_is_pseudofs(fs) || mnt_fs_is_netfs(fs) || + mnt_fs_match_options(fs, "+X-fstrim.notrim")) { mnt_table_remove_fs(tab, fs); continue; }
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor