On Wed, Mar 25, 2020 at 11:29 AM Jaegeuk Kim <jaeg...@kernel.org> wrote:
> It seems dm-crypt has discard-related support, ie., "allow_discards", in ctrl.
> But, FWIW, the target simply doesn't support discard at all.
> # grep discards_supported drivers/md/*
> drivers/md/dm-cache-target.c:   ti->discards_supported = true;
> drivers/md/dm-clone-target.c:   ti->discards_supported = true;
> drivers/md/dm-log-writes.c:     ti->discards_supported = true;
> drivers/md/dm-table.c:  if (!tgt->num_discard_bios && tgt->discards_supported)
> drivers/md/dm-table.c:          DMWARN("%s: %s: ignoring discards_supported 
> because num_discard_bios is zero.",
> drivers/md/dm-table.c:           * 'discards_supported') or it relies on 
> _all_ data devices having
> drivers/md/dm-table.c:          if (!ti->discards_supported &&
> drivers/md/dm-thin.c:            * Setting 'discards_supported' circumvents 
> the normal
> drivers/md/dm-thin.c:           ti->discards_supported = true;
> drivers/md/dm-thin.c:           ti->discards_supported = true;
> drivers/md/dm-zoned-target.c:   ti->discards_supported = true;

I can confirm that it is true with an encrypted ext4 partition.  I get
the same error, "fstrim: /mnt/test: the discard operation is not
supported" when I try it there on the same device.  Unless there is a
good reason for it, not having discard on LUKS encrypted partitions
seems like a pretty serious omission.  Perhaps it is intentional.

Linux-f2fs-devel mailing list

Reply via email to