On 2020/04/08 2:05, Christoph Hellwig wrote: [...] >> + /* Only zone reset and zone finish need zone write locking */ >> + if (op != ZO_RESET_WRITE_POINTER && op != ZO_FINISH_ZONE) >> + return BLK_STS_OK; >> + >> + if (all) { >> + /* We do not write lock all zones for an all zone reset */ >> + if (op == ZO_RESET_WRITE_POINTER) >> + return BLK_STS_OK; >> + >> + /* Finishing all zones is not supported */ >> + return BLK_STS_IOERR; > > I still find different locking rules for the all vs individual zone > operations weird. > This is to avoid taking the zone write lock for 10s of thousands of zones, one at a time. That would be too heavy. As we discussed before, if the user is not well behaving and issuing writes and zone reset/finish simultaneously for the same zone, errors will likely happen with or without the zone write locking being used on the reset/finish side. So I think we can safely remove the zone locking for reset and finish of a single zone. If an error happens, the error recovery report zone will update the wp offset. All we need is the spinlock for the wp_ofst update. So we can clean this up further and have this locking difference you point out going away. -- Damien Le Moal Western Digital Research