Re: about TRIM/DISCARD support and barriers

David Woodhouse
2008-11-23T13:40:05Z

On Sun, 2008-11-23 at 05:35 -0700, Matthew Wilcox wrote:
> The current VFAT filesystem implements DISCARD.

As does btrfs. I think I posted ext2 patches a little while ago too? Or
someone else did. Did they get merged?

> Here's the patch I've
> been testing -- it's not right; it causes SSDs from two different vendors
> to hang. I'm waiting for a free slot on the SATA protocol analyser to
> figure out what's we're doing wrong.
>
> Note that the SCSI UNMAP command does not yet have an official number,
> so this patch cannot yet be applied (... how much longer until ATA is no
> longer part of SCSI?)
>
> We don't attempt to put non-contiguous ranges into a single TRIM yet.

We don't even merge contiguous ranges -- I still need to fix the
elevators to stop writes crossing writes, before we can stop discards
from also being barriers. (Discards are just writes, for the purpose of
that conversation).

> We currently assume all SCSI devices support UNMAP instead of checking
> the feature flag (because last time I looked, I couldn't tell what flag
> I was supposed to check). Once we do that, I need to set that flag in
> libata-scsi depending on the support for the TRIM bit in the identify
> command.

The code in drivers/ide does check the feature, although I'm not 100%
sure I got that part right.

--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation