[PATCH v2 0/3] block: drop BlockDriverState::read_only

Vladimir Sementsov-Ogievskiy posted 3 patches 2 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/next-importer-push tags/patchew/20210527154056.70294-1-vsementsov@virtuozzo.com
Maintainers: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>, Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Max Reitz <mreitz@redhat.com>, John Snow <jsnow@redhat.com>, Markus Armbruster <armbru@redhat.com>, Fam Zheng <fam@euphon.net>, Jeff Cody <codyprime@gmail.com>
include/block/block_int.h        |  2 --
block.c                          | 16 +++++++---------
block/block-backend.c            | 10 ++--------
block/commit.c                   |  2 +-
block/io.c                       |  4 ++--
block/qapi.c                     |  2 +-
block/qcow2-snapshot.c           |  2 +-
block/qcow2.c                    |  5 ++---
block/snapshot.c                 |  2 +-
block/vhdx-log.c                 |  2 +-
blockdev.c                       |  3 +--
tests/unit/test-block-iothread.c |  6 ------
12 files changed, 19 insertions(+), 37 deletions(-)
[PATCH v2 0/3] block: drop BlockDriverState::read_only
Posted by Vladimir Sementsov-Ogievskiy 2 years, 11 months ago
Hi all!

The field duplicates information in .open_flags. We have to carefully
sync these two fields everywhere. It's simple to introduce a bug by
forgetting it.

Let's drop the field, and fix users to call bdrv_is_read_only() and
bdrv_is_writable() instead.

v2:
01: write "update_header =\n..." in one line
03: only change BlockBackendRootState, don't touch side logic

Vladimir Sementsov-Ogievskiy (3):
  block: consistently use bdrv_is_read_only()
  block: drop BlockDriverState::read_only
  block: drop BlockBackendRootState::read_only

 include/block/block_int.h        |  2 --
 block.c                          | 16 +++++++---------
 block/block-backend.c            | 10 ++--------
 block/commit.c                   |  2 +-
 block/io.c                       |  4 ++--
 block/qapi.c                     |  2 +-
 block/qcow2-snapshot.c           |  2 +-
 block/qcow2.c                    |  5 ++---
 block/snapshot.c                 |  2 +-
 block/vhdx-log.c                 |  2 +-
 blockdev.c                       |  3 +--
 tests/unit/test-block-iothread.c |  6 ------
 12 files changed, 19 insertions(+), 37 deletions(-)

-- 
2.29.2