[PATCH 1/2] vfs_ceph: use 'file descriptor' version xattr functions when possible

Michael Adam obnox at samba.org
Wed Apr 1 04:16:11 MDT 2015


Hi,

Where do the definitions of LIBCEPHFS_VERSION and
LIBCEPHFS_VERSION_CODE come from? At least I don't
see that in our configure system, and these
defines don't show up in our config.h  and I also
dont see them in my libcephfs.h.
But maybe it is just too old (0.80 on my fedora21).
Will these macros appear if the libcephfs.h is new
enough?

Apart from that question, the patch looks good to me.

Michael

On 2015-03-31 at 21:02 +0800, Yan, Zheng wrote:
> libcephfs version 0.94 adds 'file descriptor' version xattr functions.
> This patch makes corresponding samba VFS callbacks use these new
> functions.
> 
> Signed-off-by: Yan, Zheng <zyan at redhat.com>
> ---
>  source3/modules/vfs_ceph.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
> index b3e334e..3b165d1 100644
> --- a/source3/modules/vfs_ceph.c
> +++ b/source3/modules/vfs_ceph.c
> @@ -1071,7 +1071,11 @@ static ssize_t cephwrap_fgetxattr(struct vfs_handle_struct *handle, struct files
>  {
>  	int ret;
>  	DEBUG(10, ("[CEPH] fgetxattr(%p, %p, %s, %p, %llu)\n", handle, fsp, name, value, llu(size)));
> +#if defined(LIBCEPHFS_VERSION) && LIBCEPHFS_VERSION_CODE >= LIBCEPHFS_VERSION(0, 94, 0)
> +	ret = ceph_fgetxattr(handle->data, fsp->fh->fd, name, value, size);
> +#else
>  	ret = ceph_getxattr(handle->data, fsp->fsp_name->base_name, name, value, size);
> +#endif
>  	DEBUG(10, ("[CEPH] fgetxattr(...) = %d\n", ret));
>  	if (ret < 0) {
>  		WRAP_RETURN(ret);
> @@ -1112,7 +1116,11 @@ static ssize_t cephwrap_flistxattr(struct vfs_handle_struct *handle, struct file
>  {
>  	int ret;
>  	DEBUG(10, ("[CEPH] flistxattr(%p, %p, %s, %llu)\n", handle, fsp, list, llu(size)));
> +#if defined(LIBCEPHFS_VERSION) && LIBCEPHFS_VERSION_CODE >= LIBCEPHFS_VERSION(0, 94, 0)
> +	ret = ceph_flistxattr(handle->data, fsp->fh->fd, list, size);
> +#else
>  	ret = ceph_listxattr(handle->data, fsp->fsp_name->base_name, list, size);
> +#endif
>  	DEBUG(10, ("[CEPH] flistxattr(...) = %d\n", ret));
>  	if (ret < 0) {
>  		WRAP_RETURN(ret);
> @@ -1134,7 +1142,11 @@ static int cephwrap_fremovexattr(struct vfs_handle_struct *handle, struct files_
>  {
>  	int ret;
>  	DEBUG(10, ("[CEPH] fremovexattr(%p, %p, %s)\n", handle, fsp, name));
> +#if defined(LIBCEPHFS_VERSION) && LIBCEPHFS_VERSION_CODE >= LIBCEPHFS_VERSION(0, 94, 0)
> +	ret = ceph_fremovexattr(handle->data, fsp->fh->fd, name);
> +#else
>  	ret = ceph_removexattr(handle->data, fsp->fsp_name->base_name, name);
> +#endif
>  	DEBUG(10, ("[CEPH] fremovexattr(...) = %d\n", ret));
>  	WRAP_RETURN(ret);
>  }
> @@ -1152,7 +1164,11 @@ static int cephwrap_fsetxattr(struct vfs_handle_struct *handle, struct files_str
>  {
>  	int ret;
>  	DEBUG(10, ("[CEPH] fsetxattr(%p, %p, %s, %p, %llu, %d)\n", handle, fsp, name, value, llu(size), flags));
> +#if defined(LIBCEPHFS_VERSION) && LIBCEPHFS_VERSION_CODE >= LIBCEPHFS_VERSION(0, 94, 0)
> +	ret = ceph_fsetxattr(handle->data, fsp->fh->fd, name, value, size, flags);
> +#else
>  	ret = ceph_setxattr(handle->data, fsp->fsp_name->base_name, name, value, size, flags);
> +#endif
>  	DEBUG(10, ("[CEPH] fsetxattr(...) = %d\n", ret));
>  	WRAP_RETURN(ret);
>  }
> -- 
> 1.9.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150401/33b63e3f/attachment.pgp>


More information about the samba-technical mailing list