[pnfs] [PATCH 08/10] pnfs_use_rpc allows the common pnfs code to

Benny Halevy bhalevy at panasas.com
Wed Jul 9 03:51:14 EDT 2008


On Jul. 09, 2008, 0:54 +0300, Dean Hildebrand <seattleplus at gmail.com> wrote:
> Currently this is needed to determine
> that non-rpc layout drivers do not wait
> on direct I/O requests using
> nfs_direct_wait.
> 
> Signed-off-by: Dean Hildebrand <dhildeb at us.ibm.com>
> ---
>  fs/nfs/pnfs.c |    2 +-
>  fs/nfs/pnfs.h |   14 ++++++++++++++
>  2 files changed, 15 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index 8d2ed6f..d0dc2d5 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -1401,7 +1401,7 @@ pnfs_set_ds_iosize(struct nfs_server *server)
>  }
>  
>  /* Should the full nfs rpc cleanup code be used after io */
> -static int pnfs_use_rpc_code(struct pnfs_layoutdriver_type *ld)
> +int pnfs_use_rpc_code(struct pnfs_layoutdriver_type *ld)
>  {
>  	if (ld->ld_policy_ops->use_rpc_code)
>  		return ld->ld_policy_ops->use_rpc_code();
> diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
> index ffd7153..2d9ade1 100644
> --- a/fs/nfs/pnfs.h
> +++ b/fs/nfs/pnfs.h
> @@ -77,6 +77,7 @@ void _pnfs_modify_new_write_request(struct nfs_page *req,
>  void _pnfs_direct_init_io(struct inode *inode, struct nfs_open_context *ctx,
>  			  size_t count, loff_t loff, int iswrite,
>  			  size_t *rwsize, size_t *remaining);
> +int pnfs_use_rpc_code(struct pnfs_layoutdriver_type *ld);
>  
>  #define PNFS_EXISTS_LDIO_OP(srv, opname) ((srv)->pnfs_curr_ld &&	\
>  				     (srv)->pnfs_curr_ld->ld_io_ops &&	\
> @@ -225,6 +226,14 @@ static inline void pnfs_direct_init_io(struct inode *inode,
>  	return;
>  }
>  
> +static inline int pnfs_use_rpc(struct nfs_server *nfss)
> +{
> +	if (pnfs_enabled_sb(nfss))
> +		return pnfs_use_rpc_code(nfss->pnfs_curr_ld);

why not just make pnfs_use_rpc_code static inline in the header?

static inline int pnfs_use_rpc(struct nfs_server *nfss)
{
	struct pnfs_layoutdriver_type *ld = nfss->pnfs_curr_ld;

	if (!ld)
		return 1;
	if (PNFS_EXISTS_LDPOLICY_OP(nfss, use_rpc_code))
		return ld->ld_policy_ops->use_rpc_code();
	else
		return 0;
}

> +
> +	return 1;
> +}
> +
>  #else  /* CONFIG_PNFS */
>  
>  static inline int pnfs_try_to_read_data(struct nfs_read_data *data,
> @@ -286,6 +295,11 @@ static inline void pnfs_direct_init_io(struct inode *inode,
>  {
>  }
>  
> +static inline int pnfs_use_rpc(struct nfs_server *nfss)
> +{
> +	return 1;
> +}
> +
>  #endif /* CONFIG_PNFS */
>  
>  #endif /* FS_NFS_PNFS_H */



More information about the pNFS mailing list