[pnfs] [PATCH 17/38] [v1] pnfs: require layout driver {alloc, free}_layout

Dean Hildebrand seattleplus at gmail.com
Mon Jan 7 17:09:56 EST 2008


Should we also require set_layout?

Dean

Benny Halevy wrote:
> mandate implementation of the layout driver's
> alloc_layout and free_layout methods
>
> Signed-off-by: Benny Halevy <bhalevy at panasas.com>
> ---
>  fs/nfs/pnfs.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index d4500e0..cfd20d1 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -258,12 +258,19 @@ struct pnfs_client_operations*
>  pnfs_register_layoutdriver(struct pnfs_layoutdriver_type *ld_type)
>  {
>  	struct pnfs_module *pnfs_mod;
> +	struct layoutdriver_io_operations *io_ops = ld_type->ld_io_ops;
>  
>  	if (!pnfs_initialized) {
>  		printk(KERN_ERR "%s Registration failure.  pNFS not initialized.\n", __FUNCTION__);
>  		return NULL;
>  	}
>  
> +	if (!io_ops || !io_ops->alloc_layout || !io_ops->free_layout) {
> +		printk(KERN_ERR "%s Layout driver must provide "
> +		       "alloc_layout and free_layout.\n", __FUNCTION__);
> +		return NULL;
> +	}
> +
>  	pnfs_mod = kmalloc(sizeof(struct pnfs_module), GFP_KERNEL);
>  	if (pnfs_mod != NULL) {
>  		dprintk("%s Registering id:%u name:%s\n",
>   


More information about the pNFS mailing list