On 6/1/24 14:33, Christoph Hellwig wrote: > On Fri, May 31, 2024 at 10:29:13PM -0700, Christoph Hellwig wrote: >> On Fri, May 31, 2024 at 03:26:06PM -0400, Benjamin Marzinski wrote: >>> Does this mean that if a dm device was made up of two linear targets, >>> one of which mapped an entire zoned device, and one of which mapped a >>> single zone of another zoned device, the max active zone limit of the >>> entire dm device would be 1? That seems wrong. >> >> In this particular case it is a bit supoptimal as the limit could be >> 2, but as soon as you add more than a single zone of the second >> device anything more would be wrong. > > Actually even for this case it's the only valid one, sorry. Not really. I think that Benjamin has a very valid point here. Image target 1 mapping an entire SMR HDD with MOZ1=128 max open limit and target 2 being one zone of another drive with MOZ2=whatever max open zones limit. For such mapped device, the user can simultaneously write at most 128 zones and these zones can be: 1) all in target 1 -> then the mapped device max open zone limit of 1 is silly. 128 would work just fine. 2) 127 zones in target 1 and the 1 zone of target 2: then again the mapped device max open zone limit of 1 is overkill and 128 limit is still OK. Now if MOZ2 is say 16 and we map more than 16 zones from target 2, THEN we need to cap the mapped device max open zone limit to 16 as we can potentially have the user trying to simultaneously write more than 16 zones belonging to target 2. So the cap on the number of zones of the target I have is not correct. What I need to not blindly do a min_not_zero() of the limits and look at the number of zones being mapped. That is, something like: if (target_nr_zones > target_moz) moz = target_moz; else moz = 0; mapped_dev_moz = min_not_zero(mapped_dev_moz, moz); And same for max active limit. And we still need a cap of the limits on the number of zones mapped at the end, when setting the mapped device limits. Let me cook a V2 of this patch, with *lots* of comments to clarify this. Note: I am also writing some blktests cases to test all this. I will add more setups with challenges like this to ensure that the right limits are set. -- Damien Le Moal Western Digital Research