Mike, On 2019/01/09 23:29, Mike Snitzer wrote: > On Tue, Jan 08 2019 at 8:03pm -0500, > Damien Le Moal <Damien.LeMoal@xxxxxxx> wrote: > >> You may want to check against the physical_block_size, and not the logical. SMR >> disks that are 512 e (512B logical and 4K physical) can handle reads in 512B >> units but writes have to be 4K. These are exceptions though and kind of breaking >> all LBA definitions known to men... This check on the physical_block_size can be >> limited to setups where the underlying disk is SMR. > > Damien, this sounds like a serious issue with SMR firmware. If the > 512e SMR drive cannot handle 512b writes then it has no business > advertising 512B logical. It should be advertising 4K logical. > > What am I missing? You are absolutely correct, and I am with you on this one ! 512e disks are an insanity for SMR and should not exist. But unfortunately, they do. The problem is not the disk firmware, but the specs. ZBC and ZAC clearly state that writes into sequential zones have to be aligned on physical sector boundaries. This constraint applies only to sequential zones. Conventional zones can and should handle any write request, even those not aligned on 4K boundaries on 512e disks. Form ZBC r05: "4.4.3.4.1 Writing in sequential write required zones [...] If the device server processes a write command with: a) the starting LBA in a sequential write required zone set to a value that is in the write required zone but that is not equal to the write pointer; or b) an ending LBA that is not equal to the last logical block within a physical block (see SBC-4), then the device server shall not write any data and shall terminate the command with CHECK CONDITION status, with the sense key set to ILLEGAL REQUEST, and the additional sense code set to UNALIGNED WRITE COMMAND." This kind of make sense considering that track shingling allows sectors to be written only once, but it seems that nobody in the standard committee clearly realized the implications of this on 512e disk models. And so we end up with this situation were everything is fine for 512n and 4Kn, but 512e is definitely broken. Disk FW implementation could handle partial 4K sector writes with some caching since only the physical sectors containing the LBA pointed by zone write pointers need caching. That is at most as many sectors as the number of sequential zones. But the specs are like this now, and the disk FW implementation has no choice but to follow the text. Note that we discussed in the past adding checks in the block stack or scsi stack for writes that are not 4K aligned on 512e SMR disks, but in the end decided against it. That does not buy us anything and so we let the drive fail these unaligned writes instead of failing the commands before dispatching. Luckily, all the in kernel software we have supporting SMR use 4K writes (f2fs, btrfs prototype and dm-zoned). So this problem never really triggers. Best regards. -- Damien Le Moal Western Digital Research -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel