gluster.c (372835fbc3f288671cfc926c9e438a4659c9125f) | gluster.c (f2e5dca46b5ba4588c0756c5f272123585cbbf23) |
---|---|
1/* 2 * GlusterFS backend for QEMU 3 * 4 * Copyright (C) 2012 Bharata B Rao <bharata@linux.vnet.ibm.com> 5 * 6 * Pipe handling mechanism in AIO implementation is derived from 7 * block/rbd.c. Hence, 8 * --- 325 unchanged lines hidden (view full) --- 334 335 ret = qemu_pipe(s->fds); 336 if (ret < 0) { 337 ret = -errno; 338 goto out; 339 } 340 fcntl(s->fds[GLUSTER_FD_READ], F_SETFL, O_NONBLOCK); 341 qemu_aio_set_fd_handler(s->fds[GLUSTER_FD_READ], | 1/* 2 * GlusterFS backend for QEMU 3 * 4 * Copyright (C) 2012 Bharata B Rao <bharata@linux.vnet.ibm.com> 5 * 6 * Pipe handling mechanism in AIO implementation is derived from 7 * block/rbd.c. Hence, 8 * --- 325 unchanged lines hidden (view full) --- 334 335 ret = qemu_pipe(s->fds); 336 if (ret < 0) { 337 ret = -errno; 338 goto out; 339 } 340 fcntl(s->fds[GLUSTER_FD_READ], F_SETFL, O_NONBLOCK); 341 qemu_aio_set_fd_handler(s->fds[GLUSTER_FD_READ], |
342 qemu_gluster_aio_event_reader, NULL, NULL, s); | 342 qemu_gluster_aio_event_reader, NULL, s); |
343 344out: 345 qemu_opts_del(opts); 346 qemu_gluster_gconf_free(gconf); 347 if (!ret) { 348 return ret; 349 } 350 if (s->fd) { --- 82 unchanged lines hidden (view full) --- 433 */ 434 error_report("Gluster failed to notify QEMU about IO completion"); 435 436 qemu_mutex_lock_iothread(); /* We are in gluster thread context */ 437 acb->common.cb(acb->common.opaque, -EIO); 438 qemu_aio_release(acb); 439 close(s->fds[GLUSTER_FD_READ]); 440 close(s->fds[GLUSTER_FD_WRITE]); | 343 344out: 345 qemu_opts_del(opts); 346 qemu_gluster_gconf_free(gconf); 347 if (!ret) { 348 return ret; 349 } 350 if (s->fd) { --- 82 unchanged lines hidden (view full) --- 433 */ 434 error_report("Gluster failed to notify QEMU about IO completion"); 435 436 qemu_mutex_lock_iothread(); /* We are in gluster thread context */ 437 acb->common.cb(acb->common.opaque, -EIO); 438 qemu_aio_release(acb); 439 close(s->fds[GLUSTER_FD_READ]); 440 close(s->fds[GLUSTER_FD_WRITE]); |
441 qemu_aio_set_fd_handler(s->fds[GLUSTER_FD_READ], NULL, NULL, NULL, 442 NULL); | 441 qemu_aio_set_fd_handler(s->fds[GLUSTER_FD_READ], NULL, NULL, NULL); |
443 bs->drv = NULL; /* Make the disk inaccessible */ 444 qemu_mutex_unlock_iothread(); 445 } 446} 447 448static BlockDriverAIOCB *qemu_gluster_aio_rw(BlockDriverState *bs, 449 int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, 450 BlockDriverCompletionFunc *cb, void *opaque, int write) --- 139 unchanged lines hidden (view full) --- 590} 591 592static void qemu_gluster_close(BlockDriverState *bs) 593{ 594 BDRVGlusterState *s = bs->opaque; 595 596 close(s->fds[GLUSTER_FD_READ]); 597 close(s->fds[GLUSTER_FD_WRITE]); | 442 bs->drv = NULL; /* Make the disk inaccessible */ 443 qemu_mutex_unlock_iothread(); 444 } 445} 446 447static BlockDriverAIOCB *qemu_gluster_aio_rw(BlockDriverState *bs, 448 int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, 449 BlockDriverCompletionFunc *cb, void *opaque, int write) --- 139 unchanged lines hidden (view full) --- 589} 590 591static void qemu_gluster_close(BlockDriverState *bs) 592{ 593 BDRVGlusterState *s = bs->opaque; 594 595 close(s->fds[GLUSTER_FD_READ]); 596 close(s->fds[GLUSTER_FD_WRITE]); |
598 qemu_aio_set_fd_handler(s->fds[GLUSTER_FD_READ], NULL, NULL, NULL, NULL); | 597 qemu_aio_set_fd_handler(s->fds[GLUSTER_FD_READ], NULL, NULL, NULL); |
599 600 if (s->fd) { 601 glfs_close(s->fd); 602 s->fd = NULL; 603 } 604 glfs_fini(s->glfs); 605} 606 --- 104 unchanged lines hidden --- | 598 599 if (s->fd) { 600 glfs_close(s->fd); 601 s->fd = NULL; 602 } 603 glfs_fini(s->glfs); 604} 605 --- 104 unchanged lines hidden --- |