On Feb 11, 2014, at 12:53 PM, Theodore Ts'o wrote: > On Tue, Feb 11, 2014 at 12:04:12PM -0700, Andreas Dilger wrote: >> >> Should ZBCRESETZONE take a length or number of zones to reset? > > I was assuming that we would reset one zone at a time, which I think > is the main way this would be used. > > Thinking about this some more, one other way we could do is to reuse > BLKDISCARD, with the restriction that the starting LBA (offset) must > be the first LBA for a zone, and offset + length - 1 must be last LBA > for a zone. If either of these restrictions are violated, then > BLKDISCARD would return EINVAL --- or maybe some other error code, > since EINVAL can also mean an invalid ioctl code. > > Hmm... ERANGE would be good, but the strerror(ERANGE) returns "Math > result not representable", which would be highly confusing, although > it falls within the grand tradition of confusing Unix error messages, > such as "not a typewriter". :-) > > Any other suggestions? What about FITRIM? I'm not sure of the exact semantics of ZBCRESETZONE, but at first glance it seems similar to resetting an erase block on an SSD. That might also be beneficial if the SMR drives have directly addressible on-board flash that is mapped to a Z_FLAG_TYPE_RANDOM zone type (I wish...) and it would pass the FITRIM straight through. For non-SSD "trim" it would just reset the SMR zone but not return zeroes. Cheers, Andreas