There was a comparison of roots in uniq_fs_source_cmp(). As we care only on device names, comparing roots makes only a little sense, and it breaks on btrfs. As a result, FITRIM ioctl() is called for each subvolume. But by design, only one TRIM is needed for the whole btrfs volume. Remove it to be able to de-duplicate btrfs subvolumes. Fixes opensuse #1020077. Signed-off-by: Stanislav Brabec <sbrabec@xxxxxxx> --- sys-utils/fstrim.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/sys-utils/fstrim.c b/sys-utils/fstrim.c index e92a822f0..f252edba0 100644 --- a/sys-utils/fstrim.c +++ b/sys-utils/fstrim.c @@ -158,23 +158,11 @@ static int uniq_fs_source_cmp( struct libmnt_fs *a, struct libmnt_fs *b) { - int eq; - if (mnt_fs_is_pseudofs(a) || mnt_fs_is_netfs(a) || mnt_fs_is_pseudofs(b) || mnt_fs_is_netfs(b)) return 1; - eq = mnt_fs_streq_srcpath(a, mnt_fs_get_srcpath(b)); - if (eq) { - const char *aroot = mnt_fs_get_root(a), - *broot = mnt_fs_get_root(b); - if (!aroot || !broot) - eq = 0; - else if (strcmp(aroot, broot) != 0) - eq = 0; - } - - return !eq; + return !mnt_fs_streq_srcpath(a, mnt_fs_get_srcpath(b)); } /* -- 2.11.0 -- Best Regards / S pozdravem, Stanislav Brabec software developer --------------------------------------------------------------------- SUSE LINUX, s. r. o. e-mail: sbrabec@xxxxxxxx Křižíkova 148/34 (Corso IIa) tel: +49 911 7405384547 186 00 Praha 8-Karlín fax: +420 284 084 001 Czech Republic http://www.suse.cz/ PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76 -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html