From 5954947ff30e295a022f856127b0ee0baf5264bd Mon Sep 17 00:00:00 2001
Message-Id: <5954947ff30e295a022f856127b0ee0baf5264bd.1350493760.git.minovotn@redhat.com>
In-Reply-To: <c93188b6c6973932d2adaa52e6a4920db13b4e62.1350493760.git.minovotn@redhat.com>
References: <c93188b6c6973932d2adaa52e6a4920db13b4e62.1350493760.git.minovotn@redhat.com>
From: Jeffrey Cody <jcody@redhat.com>
Date: Wed, 17 Oct 2012 05:59:29 +0200
Subject: [PATCH 16/35] block: purge s->aligned_buf and s->aligned_buf_size
 from raw-posix.c

RH-Author: Jeffrey Cody <jcody@redhat.com>
Message-id: <bfb26bf23aabed4252c4e3a6aeb64488220ed59a.1350447475.git.jcody@redhat.com>
Patchwork-id: 43274
O-Subject: [RHEL6.4 qemu-kvm PATCH v4 16/35] block: purge s->aligned_buf and s->aligned_buf_size from raw-posix.c
Bugzilla: 767233
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Eric Blake <eblake@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>

The aligned_buf pointer and aligned_buf size are no longer used in
raw_posix.c, so remove all references to them.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 3d1807ac6707773526b193f296e72c6c86969bf7)

Conflicts:
	block/raw-posix.c
---
 block/raw-posix.c | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 block/raw-posix.c | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 331513e..ec1c602 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -125,8 +125,6 @@ typedef struct BDRVRawState {
     int use_aio;
     void *aio_ctx;
 #endif
-    uint8_t *aligned_buf;
-    unsigned aligned_buf_size;
     bool force_linearize;
 #ifdef CONFIG_XFS
     bool is_xfs : 1;
@@ -244,24 +242,11 @@ static int raw_open_common(BlockDriverState *bs, const char *filename,
         return ret;
     }
     s->fd = fd;
-    s->aligned_buf = NULL;
     s->force_linearize = is_vectored_io_slow(fd, bdrv_flags);
 
-    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
@@ -278,8 +263,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;
@@ -399,8 +382,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.11.7