On 2019/08/16 16:48, Anand Jain wrote: [...] >>> How many zones do we see in a disk? Not many I presume. >> >> A 15 TB SMR drive with 256 MB zones (which is a failry common value for products >> out there) has over 55,000 zones. "Not many" is subjective... I personally >> consider 55000 a large number and that one should take care to write appropriate >> code to manage that many objects. > > Agree that's pretty large. > >>> Here the allocation for %zones is inconsistent for each zone, unless >>> there is substantial performance benefits, a consistent flow of >>> alloc/free is fine as it makes the code easy to read and verify. >> >> I do not understand your comment here. btrfs_get_dev_zones() will allocate and >> fill the zones array with at most BTRFS_REPORT_NR_ZONES zones descriptors on the >> first call. On subsequent calls, the same array is reused until information on >> all zones of the disk is obtained. "the allocation for %zones is inconsistent >> for each zone" does not makes much sense. What exactly do you mean ? > > btrfs_get_dev_zones() allocates the memory for %zones_ret, and expects > its parent function btrfs_get_dev_zone_info() to free, instead can we > have alloc and free in the parent function btrfs_get_dev_zone_info(). Got it. Yes, we can change that. Thanks. > > Thanks, Anand -- Damien Le Moal Western Digital Research