Re: [RFC] Draft Linux kernel interfaces for ZBC drives

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 31, 2014 at 12:38:22AM -0500, Theodore Ts'o wrote:
> /*
>  * Note: this structure is 24 bytes.  Using 256 MB zones, an 8TB drive
>  * will have 32,768 zones.   That means if we tried to use a contiguous
>  * array we would need to allocate 768k of contiguous, non-swappable
>  * kernel memory.  (Boo, hiss.) 
>  *
>  * This large enough that it would be painful to hang an array off the
>  * block_device structure.  So we will define a function
>  * blkdev_query_zones() to selectively return information for some
>  * number of zones.
>  */
> struct zone_status {
>        sector_t	z_start;
>        __u32	z_length;
>        __u32	z_write_ptr_offset;  /* offset */
>        __u32	z_checkpoint_offset; /* offset */
>        __u32	z_flags;	     /* full, ro, offline, reset_requested */
> };
> 
> /*
>  * Query the block_device bdev for information about the zones
>  * starting at start_sector that match the criteria specified by
>  * free_sectors_criteria.  Zone status information for at most
>  * max_zones will be placed into the memory array ret_zones.  The
>  * return value contains the number of zones actually returned.
>  *
>  * If free_sectors_criteria is positive, then return zones that have
>  * at least that many sectors available to be written.  If it is zero,
>  * then match all zones.  If free_sectors_criteria is negative, then
>  * return the zones that match the following criteria:
>  *
>  *      -1     Return all read-only zones
>  *      -2     Return all offline zones
>  *      -3     Return all zones where the write ptr != the checkpoint ptr
>  */
> 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.
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.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
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




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux