On Fri, Jan 31, 2014 at 06:07:54AM -0700, Matthew Wilcox wrote: > > extern int blkdev_query_zones(struct block_device *bdev, > > sector_t start_sector, > > int free_sectors_criteria, > > struct zone_status *ret_zones, > > int max_zones); > > So the caller does: > > zones = kmalloc(max * sizeof *zones, GFP_KERNEL); > blkdev_query_zones(bdev, sector, fsc, zones, max); > ... > kfree(zones); > > Just want to be sure I understand the lifetime rules on the memory used. Yes. Or the caller is looking a single zone which has at least 256 sectors, the structure might be allocated on the stack: { struct zone_status zs; zones = kmalloc(bdev, 0, 256, zs, 1); if (zones == 0) return -ENOSPC; .... } > I imagine the block layer will have some kind of compressed representation, > probably a tree of some kind, then expand that representation into the > zone_status. Yes. Zones which are off-line, full, or empty don't require storage of the write pointer or checkpoint LBA, for example. So if the vast majority of the zones are either full, or empty, it wouldn't take that much space to store the zone information. One of the reasons why I think we should have a interface using a function is so we can change the underyling compressed representation without changing all of the users of the zone status information. Cheers, - Ted -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html