On Tue, Jun 23, 2020 at 12:14 PM Sid Spry <s...@aeam.us> wrote:
>
> So if I'm understanding properly most drive firmware won't let you
> operate the device in an append-only mode?

So, there are several types of SMR drives.

There are host-managed, drive-managed, and then hybrid devices that
default to drive-managed for compatibility reasons but the host can
send them a command to take full control so that it is the same as
host-managed.

A host-managed drive just does what the host tells it to.  If the host
tells it to do a write that obliterates some other data on the disk,
the drive just does it, and it is the job of the host
OS/filesystem/application to make sure that they protect any data they
care about.  At the drive level these perform identically to CMR
because they just seek and write like any other drive.  At the
application level these could perform differently since the
application might end up having to work around the drive.  However,
these drives are generally chosen for applications where this is not a
big problem or where the problems can be efficiently mitigated.

A drive-managed drive just looks like a regular drive to the host, and
it ends up having to do a lot of read-before-rewrite operations
because the host is treating it like it is CMR but the drive has to
guarantee that nothing gets lost.  A drive-managed disk has no way to
operate in "append-only" mode.  I'm not an expert in ATA but I believe
disks are just given an LBA and a set of data to write.  Without
support for TRIM the drive has no way to know if it is safe to
overwrite nearby cylinders, which means it has to preserve them.

The biggest problem is that the vendors were trying to conceal the
nature of the drives.  If they advertised TRIM support it would be
pretty obvious they were SMR.

> If any do I suspect
> NILFS (https://en.wikipedia.org/wiki/NILFS) may be a good choice:
>
> "NILFS is a log-structured filesystem, in that the storage medium is treated
> like a circular buffer and new blocks are always written to the end. [...]"
>

On a host-managed disk this would perform the same as on a CMR disk,
with the possible exception of any fixed metadata (I haven't read the
gory details on the filesystem).  If it has no fixed metadata (without
surrounding unused tracks) then it would have no issues at all on SMR.
F2FS takes a similar approach for SSDs, though it didn't really take
off because ext4's support is good enough and I suspect that modern
SSDs are fast enough at erasing.

As I mentioned SSDs have the same issue as SMR, just the scale of the
problem is much smaller.  The erase blocks are much smaller so less
data needs to be read/rewritten following an erase, and then the
operations are all just vastly faster.  Taking 3x longer on a 1us
operation is far different from taking 100x longer on a 100ms
operation.

-- 
Rich

Reply via email to