From patchwork Wed Jul 14 13:38:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brunner X-Patchwork-Id: 111987 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6EDcNkY005585 for ; Wed, 14 Jul 2010 13:38:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753827Ab0GNNiX (ORCPT ); Wed, 14 Jul 2010 09:38:23 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:61141 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752786Ab0GNNiW (ORCPT ); Wed, 14 Jul 2010 09:38:22 -0400 Received: by bwz1 with SMTP id 1so927519bwz.19 for ; Wed, 14 Jul 2010 06:38:21 -0700 (PDT) Received: by 10.204.51.77 with SMTP id c13mr13472698bkg.98.1279114701177; Wed, 14 Jul 2010 06:38:21 -0700 (PDT) Received: from bambus (p5498DDD2.dip.t-dialin.net [84.152.221.210]) by mx.google.com with ESMTPS id y2sm32942389bkx.20.2010.07.14.06.38.19 (version=SSLv3 cipher=RC4-MD5); Wed, 14 Jul 2010 06:38:20 -0700 (PDT) Date: Wed, 14 Jul 2010 15:38:13 +0200 From: Christian Brunner To: ceph-devel@vger.kernel.org Subject: [PATCH] qemu-kvm/rbd: avoid opening eventfd twice and close it on exit Message-ID: <20100714133812.GB21617@bambus> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-12-10) Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 14 Jul 2010 13:38:24 +0000 (UTC) diff --git a/block/rbd.c b/block/rbd.c index 7a77072..9339dab 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -513,15 +513,6 @@ static int rbd_open(BlockDriverState *bs, const char *filename, int flags) qemu_free(hbuf); - s->efd = eventfd(0, 0); - if (s->efd < 0) { - error_report("error opening eventfd"); - goto failed; - } - fcntl(s->efd, F_SETFL, O_NONBLOCK); - qemu_aio_set_fd_handler(s->efd, rbd_aio_completion_cb, NULL, - rbd_aio_flush_cb, NULL, s); - return 0; failed: @@ -538,6 +529,9 @@ static void rbd_close(BlockDriverState *bs) { BDRVRBDState *s = bs->opaque; + close(s->efd); + qemu_aio_set_fd_handler(s->efd, NULL , NULL, NULL, NULL, NULL); + // The following do not exist in qemu: // qemu_cond_destroy(s->queue_threshold); // qemu_mutex_destroy(s->queue_mutex);