On 03/25, John wrote:
> On Tue, Mar 24, 2020 at 9:01 PM Chao Yu <yuch...@huawei.com> wrote:
> > I guess ssd should support discard, however I saw sdb was wrapped with 
> > device
> > mapper, which may have different character, just want to check that whether
> > device mapper disable the discard.
> >
> > If backup/restore is hard for you, how about let me add some logs on fstrim
> > interface? then we could retry fstrim to see where we actually fail.
> 
> I have an older totally different SSD for testing that seems to support 
> discard:
> # hdparm -I /dev/sdc | grep TRIM
>    * Data Set Management TRIM supported (limit 8 blocks)
>    * Deterministic read ZEROs after TRIM
> 
> As I test, I created two f2fs partitions on this different SSD:
> 1) /dev/sdc2 normal F2FS
> 2) /dev/sdc3 encrypted with LUKS (dm-crypt) then formatted to F2FS
> 
> Results:
> 1) Regular F2FS
> # fstrim -v /regular
> /regular: 0 B (0 bytes) trimmed

This is normal.

> 
> 2) Encrypted F2FS
> # fstrim -v /encrypted
> fstrim: /encrypted: the discard operation is not supported

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;


> 
> Can we conclude that the device mapper is some how spoofing fstrim
> into thinking the device doesn't support trim?  Happy to hear your
> thoughts.
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to