[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [Qemu-block] [PATCH for-2.7 v2 06/17] gluster: Implemen
From: |
Niels de Vos |
Subject: |
Re: [Qemu-devel] [Qemu-block] [PATCH for-2.7 v2 06/17] gluster: Implement .bdrv_lockf |
Date: |
Fri, 15 Apr 2016 14:24:12 +0200 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Fri, Apr 15, 2016 at 11:27:56AM +0800, Fam Zheng wrote:
> Signed-off-by: Fam Zheng <address@hidden>
> ---
> block/gluster.c | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
The Gluster changes look good to me.
Reviewed-by: Niels de Vos <address@hidden>
>
> diff --git a/block/gluster.c b/block/gluster.c
> index 51e154c..c23e944 100644
> --- a/block/gluster.c
> +++ b/block/gluster.c
> @@ -672,6 +672,32 @@ static void qemu_gluster_close(BlockDriverState *bs)
> glfs_fini(s->glfs);
> }
>
> +static int qemu_gluster_lockf(BlockDriverState *bs, BdrvLockfCmd cmd)
> +{
> + BDRVGlusterState *s = bs->opaque;
> + int ret;
> + struct flock fl = (struct flock) {
> + .l_start = 0,
> + .l_whence = SEEK_SET,
> + .l_len = 0,
> + };
> + switch (cmd) {
> + case BDRV_LOCKF_RWLOCK:
> + fl.l_type = F_WRLCK;
> + break;
> + case BDRV_LOCKF_ROLOCK:
> + fl.l_type = F_RDLCK;
> + break;
> + case BDRV_LOCKF_UNLOCK:
> + fl.l_type = F_UNLCK;
> + break;
> + default:
> + abort();
> + }
> + ret = glfs_posix_lock(s->fd, F_SETLK, &fl);
> + return ret == -1 ? -errno : 0;
> +}
> +
> static int qemu_gluster_has_zero_init(BlockDriverState *bs)
> {
> /* GlusterFS volume could be backed by a block device */
> @@ -713,6 +739,7 @@ static BlockDriver bdrv_gluster = {
> .bdrv_co_readv = qemu_gluster_co_readv,
> .bdrv_co_writev = qemu_gluster_co_writev,
> .bdrv_co_flush_to_disk = qemu_gluster_co_flush_to_disk,
> + .bdrv_lockf = qemu_gluster_lockf,
> .bdrv_has_zero_init = qemu_gluster_has_zero_init,
> #ifdef CONFIG_GLUSTERFS_DISCARD
> .bdrv_co_discard = qemu_gluster_co_discard,
> @@ -740,6 +767,7 @@ static BlockDriver bdrv_gluster_tcp = {
> .bdrv_co_readv = qemu_gluster_co_readv,
> .bdrv_co_writev = qemu_gluster_co_writev,
> .bdrv_co_flush_to_disk = qemu_gluster_co_flush_to_disk,
> + .bdrv_lockf = qemu_gluster_lockf,
> .bdrv_has_zero_init = qemu_gluster_has_zero_init,
> #ifdef CONFIG_GLUSTERFS_DISCARD
> .bdrv_co_discard = qemu_gluster_co_discard,
> @@ -767,6 +795,7 @@ static BlockDriver bdrv_gluster_unix = {
> .bdrv_co_readv = qemu_gluster_co_readv,
> .bdrv_co_writev = qemu_gluster_co_writev,
> .bdrv_co_flush_to_disk = qemu_gluster_co_flush_to_disk,
> + .bdrv_lockf = qemu_gluster_lockf,
> .bdrv_has_zero_init = qemu_gluster_has_zero_init,
> #ifdef CONFIG_GLUSTERFS_DISCARD
> .bdrv_co_discard = qemu_gluster_co_discard,
> @@ -794,6 +823,7 @@ static BlockDriver bdrv_gluster_rdma = {
> .bdrv_co_readv = qemu_gluster_co_readv,
> .bdrv_co_writev = qemu_gluster_co_writev,
> .bdrv_co_flush_to_disk = qemu_gluster_co_flush_to_disk,
> + .bdrv_lockf = qemu_gluster_lockf,
> .bdrv_has_zero_init = qemu_gluster_has_zero_init,
> #ifdef CONFIG_GLUSTERFS_DISCARD
> .bdrv_co_discard = qemu_gluster_co_discard,
> --
> 2.8.0
>
>
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, (continued)
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Fam Zheng, 2016/04/17
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Richard W.M. Jones, 2016/04/18
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Fam Zheng, 2016/04/19
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Richard W.M. Jones, 2016/04/19
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Fam Zheng, 2016/04/19
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Richard W.M. Jones, 2016/04/19
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Daniel P. Berrange, 2016/04/19
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Daniel P. Berrange, 2016/04/19
- Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf, Richard W.M. Jones, 2016/04/19
[Qemu-devel] [PATCH for-2.7 v2 06/17] gluster: Implement .bdrv_lockf, Fam Zheng, 2016/04/14
- Re: [Qemu-devel] [Qemu-block] [PATCH for-2.7 v2 06/17] gluster: Implement .bdrv_lockf,
Niels de Vos <=
[Qemu-devel] [PATCH for-2.7 v2 07/17] rbd: Implement image locking, Fam Zheng, 2016/04/14
- Re: [Qemu-devel] [PATCH for-2.7 v2 07/17] rbd: Implement image locking, Jason Dillaman, 2016/04/22
- Re: [Qemu-devel] [PATCH for-2.7 v2 07/17] rbd: Implement image locking, Fam Zheng, 2016/04/24
- Re: [Qemu-devel] [PATCH for-2.7 v2 07/17] rbd: Implement image locking, Jason Dillaman, 2016/04/26
- Re: [Qemu-devel] [PATCH for-2.7 v2 07/17] rbd: Implement image locking, Fam Zheng, 2016/04/26
- Re: [Qemu-devel] [PATCH for-2.7 v2 07/17] rbd: Implement image locking, Jason Dillaman, 2016/04/27
- Re: [Qemu-devel] [PATCH for-2.7 v2 07/17] rbd: Implement image locking, Fam Zheng, 2016/04/27
[Qemu-devel] [PATCH for-2.7 v2 08/17] qemu-io: Add "-L" option for BDRV_O_NO_LOCK, Fam Zheng, 2016/04/14