From patchwork Mon Apr 29 18:42:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 1092783 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="C5LAPP+I"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tD8J6VgQz9s9y for ; Tue, 30 Apr 2019 04:43:57 +1000 (AEST) Received: from localhost ([127.0.0.1]:33685 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLBFp-0003IK-9J for incoming@patchwork.ozlabs.org; Mon, 29 Apr 2019 14:43:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLBF2-0003Hh-6G for qemu-devel@nongnu.org; Mon, 29 Apr 2019 14:43:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLBF1-0002R2-68 for qemu-devel@nongnu.org; Mon, 29 Apr 2019 14:43:03 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:54755) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLBF0-0002Pb-TA; Mon, 29 Apr 2019 14:43:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=ewSLV48hoUTk5bwPLhqgyOC8xegkUkvaV7q8eMrrfkw=; b=C5LAPP+I6VxpVwkmSs92sv7+41O2du5DOgNaIb8FvBK25UhTuwBvzhFf3jWyZ1y0LbZ2Z/YzsbaCQKm7qDvm1bpM3dN0WW6o5A7phJGUBlEJ2+bhx6Rfq6HqI6RWsjrB9Q3VV1hQZl6ELoewumeQZ8rvQRUHB0gt0tUnoTBQPoLW7JdCsrlOADPMpYQPmhhwoEDSdugA1jnAXRoBD2uPdgr+gq8y1dGHu+5qYBAK+rNpsnzpcz/3xmO/cWiQvesuumUAduJafJRMD+VPsNYCzunI87vHxJpey4sjfOK0H8BdoXR+nj8zL3vLHrjzYFMOj/vgAEHsexOkH5dqTBa4nA==; Received: from static-191-95-145-212.ipcom.comunitel.net ([212.145.95.191] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1hLBEx-0006XE-It; Mon, 29 Apr 2019 20:42:59 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1hLBEl-0002ZL-0q; Mon, 29 Apr 2019 21:42:47 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Mon, 29 Apr 2019 20:42:36 +0200 Message-Id: <74e443f4cd78fb5afa8d184af5be19de3691af38.1556562150.git.berto@igalia.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH 1/5] qcow2: Replace bdrv_write() with bdrv_pwrite() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" There's only one bdrv_write() call left in the qcow2 code, and it can be trivially replaced with the byte-based bdrv_pwrite(). Signed-off-by: Alberto Garcia --- block/qcow2-refcount.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c index e0fe322500..83f66eed7a 100644 --- a/block/qcow2-refcount.c +++ b/block/qcow2-refcount.c @@ -2409,8 +2409,8 @@ write_refblocks: on_disk_refblock = (void *)((char *) *refcount_table + refblock_index * s->cluster_size); - ret = bdrv_write(bs->file, refblock_offset / BDRV_SECTOR_SIZE, - on_disk_refblock, s->cluster_sectors); + ret = bdrv_pwrite(bs->file, refblock_offset, on_disk_refblock, + s->cluster_size); if (ret < 0) { fprintf(stderr, "ERROR writing refblock: %s\n", strerror(-ret)); goto fail; From patchwork Mon Apr 29 18:42:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 1092785 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="rUGhH5aB"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tDCG08tGz9s9y for ; Tue, 30 Apr 2019 04:46:34 +1000 (AEST) Received: from localhost ([127.0.0.1]:33749 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLBIO-0005SK-0e for incoming@patchwork.ozlabs.org; Mon, 29 Apr 2019 14:46:32 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56762) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLBF1-0003Hc-Om for qemu-devel@nongnu.org; Mon, 29 Apr 2019 14:43:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLBF0-0002Qa-QX for qemu-devel@nongnu.org; Mon, 29 Apr 2019 14:43:03 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:54751) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLBF0-0002Pa-8l; Mon, 29 Apr 2019 14:43:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=qPSLlGkl+4wX47R8brHXCYj560PZNri44VYQ96nZux4=; b=rUGhH5aBf1WaCUoEjvQwM0uDYSFgpkM08IKZOXSwlq3/teR/c032IDFtKxrQ6Ax8/5alASLtcZlMh/itWU5CYTgx/nj3stQq9Q5WoPb4AG+r2vbrf23VNGvGpexxoGX9olSgJIA/XbCH1E+Woio/Y29Z95vq8Z/bMxDu4qd00lj/WnYbfEW+rbRj5vzmYSr769Rg96S2YGoOiomzHGDEAn4rGRFQWWey1BpkVaPp5tW59tNOWSkxwFQy/3gGRs2WbxMlLZZhGcIk2DLnY9xGI4FpR9+0ziD4f5XnzrZZ1qaXyjZKyVjhxn+VKWcMpisFKcggkkgsQGCacALdTdBZbg==; Received: from static-191-95-145-212.ipcom.comunitel.net ([212.145.95.191] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1hLBEx-0006XG-Jk; Mon, 29 Apr 2019 20:42:59 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1hLBEl-0002ZN-3P; Mon, 29 Apr 2019 21:42:47 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Mon, 29 Apr 2019 20:42:37 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH 2/5] vdi: Replace bdrv_{read, write}() with bdrv_{pread, pwrite}() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" There's only a couple of bdrv_read() and bdrv_write() calls left in the vdi code, and they can be trivially replaced with the byte-based bdrv_pread() and bdrv_pwrite(). Signed-off-by: Alberto Garcia --- block/vdi.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/block/vdi.c b/block/vdi.c index e1c42ad732..8d849b2754 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -384,7 +384,7 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, logout("\n"); - ret = bdrv_read(bs->file, 0, (uint8_t *)&header, 1); + ret = bdrv_pread(bs->file, 0, (uint8_t *)&header, sizeof(header)); if (ret < 0) { goto fail; } @@ -484,8 +484,8 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, goto fail; } - ret = bdrv_read(bs->file, s->bmap_sector, (uint8_t *)s->bmap, - bmap_size); + ret = bdrv_pread(bs->file, header.offset_bmap, (uint8_t *)s->bmap, + bmap_size * SECTOR_SIZE); if (ret < 0) { goto fail_free_bmap; } @@ -704,7 +704,7 @@ nonallocating_write: assert(VDI_IS_ALLOCATED(bmap_first)); *header = s->header; vdi_header_to_le(header); - ret = bdrv_write(bs->file, 0, block, 1); + ret = bdrv_pwrite(bs->file, 0, block, sizeof(*block)); g_free(block); block = NULL; @@ -722,7 +722,8 @@ nonallocating_write: base = ((uint8_t *)&s->bmap[0]) + bmap_first * SECTOR_SIZE; logout("will write %u block map sectors starting from entry %u\n", n_sectors, bmap_first); - ret = bdrv_write(bs->file, offset, base, n_sectors); + ret = bdrv_pwrite(bs->file, offset * SECTOR_SIZE, base, + n_sectors * SECTOR_SIZE); } return ret; From patchwork Mon Apr 29 18:42:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 1092782 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="TWdWK56h"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tD8L4d35z9sB3 for ; Tue, 30 Apr 2019 04:44:02 +1000 (AEST) Received: from localhost ([127.0.0.1]:33693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLBFw-0003L7-Iz for incoming@patchwork.ozlabs.org; Mon, 29 Apr 2019 14:44:00 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLBF2-0003Hj-89 for qemu-devel@nongnu.org; Mon, 29 Apr 2019 14:43:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLBF1-0002Qm-0a for qemu-devel@nongnu.org; Mon, 29 Apr 2019 14:43:04 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:54756) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLBF0-0002Pg-Nx; Mon, 29 Apr 2019 14:43:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=5hlDL+SlzXFcKk1w5AWpFGHs9i0tIxFXhQcbdcq/eUc=; b=TWdWK56h0zWgVBidKJ87DOAgy77Fe38anPxzetala46g4JehY5TCSU6/0WxOuyM8D+5jTymGgFY7mL86PD4ZXD0z+35YLY9LdThIJaKviiGT6OVCRQ3X72JRnP7KyxueWxST2NrJ4ByX7nLi+3ziabiMq/4pXe2XFFLOnjQE5u/mBlVDM6PVQFYXpxD6offCEqG8RnI2uyf4+Ik0Ews9HMygPa3xHuBxFbis83tK81e8DewuucvUuQ3j3BUi0VB70XCngUMbMHz4fjTq+s6mxYzaBU6xGkdi0wLtwHDLboLx9mMyYhTLR2qEfP1Z3NAGbkpiSWLOH+50ZvD6/l4Sgw==; Received: from static-191-95-145-212.ipcom.comunitel.net ([212.145.95.191] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1hLBEx-0006XL-NH; Mon, 29 Apr 2019 20:42:59 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1hLBEl-0002ZP-5w; Mon, 29 Apr 2019 21:42:47 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Mon, 29 Apr 2019 20:42:38 +0200 Message-Id: <08ed89d9905a7143201743ec8003058a083c7b72.1556562150.git.berto@igalia.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH 3/5] vvfat: Replace bdrv_{read, write}() with bdrv_{pread, pwrite}() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" There's only a couple of bdrv_read() and bdrv_write() calls left in the vvfat code, and they can be trivially replaced with the byte-based bdrv_pread() and bdrv_pwrite(). Signed-off-by: Alberto Garcia --- block/vvfat.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/block/vvfat.c b/block/vvfat.c index 5f66787890..35c7e2761f 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -1494,8 +1494,8 @@ static int vvfat_read(BlockDriverState *bs, int64_t sector_num, DLOG(fprintf(stderr, "sectors %" PRId64 "+%" PRId64 " allocated\n", sector_num, n >> BDRV_SECTOR_BITS)); - if (bdrv_read(s->qcow, sector_num, buf + i * 0x200, - n >> BDRV_SECTOR_BITS)) { + if (bdrv_pread(s->qcow, sector_num * BDRV_SECTOR_SIZE, + buf + i * 0x200, n)) { return -1; } i += (n >> BDRV_SECTOR_BITS) - 1; @@ -1983,7 +1983,8 @@ static uint32_t get_cluster_count_for_direntry(BDRVVVFATState* s, if (res) { return -1; } - res = bdrv_write(s->qcow, offset, s->cluster_buffer, 1); + res = bdrv_pwrite(s->qcow, offset * BDRV_SECTOR_SIZE, + s->cluster_buffer, BDRV_SECTOR_SIZE); if (res) { return -2; } @@ -3050,7 +3051,8 @@ DLOG(checkpoint()); * Use qcow backend. Commit later. */ DLOG(fprintf(stderr, "Write to qcow backend: %d + %d\n", (int)sector_num, nb_sectors)); - ret = bdrv_write(s->qcow, sector_num, buf, nb_sectors); + ret = bdrv_pwrite(s->qcow, sector_num * BDRV_SECTOR_SIZE, buf, + nb_sectors * BDRV_SECTOR_SIZE); if (ret < 0) { fprintf(stderr, "Error writing to qcow backend\n"); return ret; From patchwork Mon Apr 29 18:42:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 1092781 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="gPuqG02R"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tD8J6CC9z9s9T for ; Tue, 30 Apr 2019 04:43:56 +1000 (AEST) Received: from localhost ([127.0.0.1]:33687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLBFp-0003IO-Ea for incoming@patchwork.ozlabs.org; Mon, 29 Apr 2019 14:43:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLBF2-0003Hf-18 for qemu-devel@nongnu.org; Mon, 29 Apr 2019 14:43:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLBF0-0002Qg-Th for qemu-devel@nongnu.org; Mon, 29 Apr 2019 14:43:03 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:54752) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLBF0-0002Pd-IN; Mon, 29 Apr 2019 14:43:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=DSgYzoTxyKoJ5zGTX00jdWTyzuRuzs/sQOg2O0JISzQ=; b=gPuqG02RLH23nNeWN2QQB0IglKKnbfRIkr+y/aYbwjnVDKpIIC5YDYNTWobA0eejIpZ4AdxTM408HPmZtpfAfci29gsn5SQMN+ronAICUPiAArsgmn4xUNh6sJp8eA9ZkKlDXYqlWhY//YrZh6DPHJhFamuoWLUfhVLtVibEGqgJgr3tNjugEUoAVaxxsKNggRPZwhbAgMwDadMCoxROogAmSktUJoc3NUj8C/mEZd0Uo4S3DUrunmNEShhp6+RXFAdWi80p6ptK/6VqqTUz/tBVB9l3qVcIn1aEBxIRWq7cTifk+8t43GvERP2mZml/lNKzdi7z4wCyH4wheN6Nnw==; Received: from static-191-95-145-212.ipcom.comunitel.net ([212.145.95.191] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1hLBEx-0006XM-Ov; Mon, 29 Apr 2019 20:42:59 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1hLBEl-0002ZU-8R; Mon, 29 Apr 2019 21:42:47 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Mon, 29 Apr 2019 20:42:39 +0200 Message-Id: <1e84aa54bf7ac50636308384ac13ee89c4a1c850.1556562150.git.berto@igalia.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH 4/5] block: Remove bdrv_read() and bdrv_write() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" No one is using these functions anymore, all callers have switched to the byte-based bdrv_pread() and bdrv_pwrite() Signed-off-by: Alberto Garcia --- block/io.c | 36 ------------------------------------ include/block/block.h | 4 ---- 2 files changed, 40 deletions(-) diff --git a/block/io.c b/block/io.c index dfc153b8d8..adf759171a 100644 --- a/block/io.c +++ b/block/io.c @@ -837,42 +837,6 @@ static int bdrv_prwv_co(BdrvChild *child, int64_t offset, return rwco.ret; } -/* - * Process a synchronous request using coroutines - */ -static int bdrv_rw_co(BdrvChild *child, int64_t sector_num, uint8_t *buf, - int nb_sectors, bool is_write, BdrvRequestFlags flags) -{ - QEMUIOVector qiov = QEMU_IOVEC_INIT_BUF(qiov, buf, - nb_sectors * BDRV_SECTOR_SIZE); - - if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) { - return -EINVAL; - } - - return bdrv_prwv_co(child, sector_num << BDRV_SECTOR_BITS, - &qiov, is_write, flags); -} - -/* return < 0 if error. See bdrv_write() for the return codes */ -int bdrv_read(BdrvChild *child, int64_t sector_num, - uint8_t *buf, int nb_sectors) -{ - return bdrv_rw_co(child, sector_num, buf, nb_sectors, false, 0); -} - -/* Return < 0 if error. Important errors are: - -EIO generic I/O error (may happen for all errors) - -ENOMEDIUM No media inserted. - -EINVAL Invalid sector number or nb_sectors - -EACCES Trying to write a read-only device -*/ -int bdrv_write(BdrvChild *child, int64_t sector_num, - const uint8_t *buf, int nb_sectors) -{ - return bdrv_rw_co(child, sector_num, (uint8_t *)buf, nb_sectors, true, 0); -} - int bdrv_pwrite_zeroes(BdrvChild *child, int64_t offset, int bytes, BdrvRequestFlags flags) { diff --git a/include/block/block.h b/include/block/block.h index c7a26199aa..5e2b98b0ee 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -316,10 +316,6 @@ int bdrv_reopen_prepare(BDRVReopenState *reopen_state, BlockReopenQueue *queue, Error **errp); void bdrv_reopen_commit(BDRVReopenState *reopen_state); void bdrv_reopen_abort(BDRVReopenState *reopen_state); -int bdrv_read(BdrvChild *child, int64_t sector_num, - uint8_t *buf, int nb_sectors); -int bdrv_write(BdrvChild *child, int64_t sector_num, - const uint8_t *buf, int nb_sectors); int bdrv_pwrite_zeroes(BdrvChild *child, int64_t offset, int bytes, BdrvRequestFlags flags); int bdrv_make_zero(BdrvChild *child, BdrvRequestFlags flags); From patchwork Mon Apr 29 18:42:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 1092784 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="bFZ5AH9H"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44tDCF48YDz9s9T for ; Tue, 30 Apr 2019 04:46:33 +1000 (AEST) Received: from localhost ([127.0.0.1]:33747 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLBIN-0005Rp-Jc for incoming@patchwork.ozlabs.org; Mon, 29 Apr 2019 14:46:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:56808) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLBF4-0003Ig-OR for qemu-devel@nongnu.org; Mon, 29 Apr 2019 14:43:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLBF0-0002QU-Od for qemu-devel@nongnu.org; Mon, 29 Apr 2019 14:43:06 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:54753) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLBF0-0002Pe-5t; Mon, 29 Apr 2019 14:43:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=N9Ijrdys9rcn5uS4tPdtWX/PEwV61+M0Lnq/0LHPSa4=; b=bFZ5AH9H+7FNi5Bx/jXnw/r89Hqs+y9rSbVehFhSif8nojjtW0xrVF95poZUWJb+djIatNocG0i1wwd83BSpPISnBjP/2Wtw1XXc9l11wiqbGG9GHecO+cKeuWGufDPw2XgVH9qcot8YX1jaqPcgm9kX2Jij9065bNRfAvBnLhQlMNlb/Jr2dyhtwMsX9/Ssav1trYYGI7fpZbd5slBqMdlK5DVB+oRc1g0oGwrYVN3jvmD+sRcbGnPVRKvrsNl0jilIPI50F6/CY+E2vpNQbtAjtkbSAGsLFgHhea7QdlD+JUTAXkxPPmgO5oNyOJAOSHXwYfslsMHtiMSA7D+/kA==; Received: from static-191-95-145-212.ipcom.comunitel.net ([212.145.95.191] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1hLBEx-0006XN-Rd; Mon, 29 Apr 2019 20:42:59 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1hLBEl-0002ZX-Ax; Mon, 29 Apr 2019 21:42:47 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Mon, 29 Apr 2019 20:42:40 +0200 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH 5/5] qcow2: Remove BDRVQcow2State.cluster_sectors X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The last user of this field disappeared when we replace the sector-based bdrv_write() with the byte-based bdrv_pwrite(). Signed-off-by: Alberto Garcia --- block/qcow2.c | 1 - block/qcow2.h | 1 - 2 files changed, 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 3ace3b2209..3a3240fcca 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1259,7 +1259,6 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, s->cluster_bits = header.cluster_bits; s->cluster_size = 1 << s->cluster_bits; - s->cluster_sectors = 1 << (s->cluster_bits - BDRV_SECTOR_BITS); /* Initialise version 3 header fields */ if (header.version == 2) { diff --git a/block/qcow2.h b/block/qcow2.h index fdee297f33..e62508d1ce 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -266,7 +266,6 @@ typedef struct Qcow2BitmapHeaderExt { typedef struct BDRVQcow2State { int cluster_bits; int cluster_size; - int cluster_sectors; int l2_slice_size; int l2_bits; int l2_size;