From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:52531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RqT2m-0004HM-JY for qemu-devel@nongnu.org; Thu, 26 Jan 2012 12:23:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RqT2g-0003Ng-C4 for qemu-devel@nongnu.org; Thu, 26 Jan 2012 12:23:28 -0500 Received: from mail-gx0-f173.google.com ([209.85.161.173]:46582) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RqT2g-0003NH-6R for qemu-devel@nongnu.org; Thu, 26 Jan 2012 12:23:22 -0500 Received: by ggnh1 with SMTP id h1so470435ggn.4 for ; Thu, 26 Jan 2012 09:23:18 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Thu, 26 Jan 2012 18:22:38 +0100 Message-Id: <1327598569-5199-8-git-send-email-pbonzini@redhat.com> In-Reply-To: <1327598569-5199-1-git-send-email-pbonzini@redhat.com> References: <1327598569-5199-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH v2 07/18] raw: remove the aligned_buf List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com Signed-off-by: Paolo Bonzini --- block/raw-posix.c | 25 +++---------------------- 1 files changed, 3 insertions(+), 22 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index 2ee5d69..007d1d3 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -129,8 +129,6 @@ typedef struct BDRVRawState { int use_aio; void *aio_ctx; #endif - uint8_t *aligned_buf; - unsigned aligned_buf_size; #ifdef CONFIG_XFS bool is_xfs : 1; #endif @@ -216,23 +214,10 @@ static int raw_open_common(BlockDriverState *bs, const char *filename, return ret; } s->fd = fd; - s->aligned_buf = NULL; - - if ((bdrv_flags & BDRV_O_NOCACHE)) { - /* - * Allocate a buffer for read/modify/write cycles. Chose the size - * pessimistically as we don't know the block size yet. - */ - s->aligned_buf_size = 32 * MAX_BLOCKSIZE; - s->aligned_buf = qemu_memalign(MAX_BLOCKSIZE, s->aligned_buf_size); - if (s->aligned_buf == NULL) { - goto out_close; - } - } /* We're falling back to POSIX AIO in some cases so init always */ if (paio_init() < 0) { - goto out_free_buf; + goto out_close; } #ifdef CONFIG_LINUX_AIO @@ -245,7 +230,7 @@ static int raw_open_common(BlockDriverState *bs, const char *filename, s->aio_ctx = laio_init(); if (!s->aio_ctx) { - goto out_free_buf; + goto out_close; } s->use_aio = 1; } else @@ -264,8 +249,6 @@ static int raw_open_common(BlockDriverState *bs, const char *filename, return 0; -out_free_buf: - qemu_vfree(s->aligned_buf); out_close: close(fd); return -errno; @@ -326,7 +309,7 @@ static BlockDriverAIOCB *raw_aio_submit(BlockDriverState *bs, * boundary. Check if this is the case or tell the low-level * driver that it needs to copy the buffer. */ - if (s->aligned_buf) { + if ((bs->open_flags & BDRV_O_NOCACHE)) { if (!qiov_is_aligned(bs, qiov)) { type |= QEMU_AIO_MISALIGNED; #ifdef CONFIG_LINUX_AIO @@ -374,8 +357,6 @@ static void raw_close(BlockDriverState *bs) if (s->fd >= 0) { close(s->fd); s->fd = -1; - if (s->aligned_buf != NULL) - qemu_vfree(s->aligned_buf); } } -- 1.7.7.6