[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.1.2 16/45] file-posix: Simplify raw_co_prw's 'out' zone code
From: |
Michael Tokarev |
Subject: |
[Stable-8.1.2 16/45] file-posix: Simplify raw_co_prw's 'out' zone code |
Date: |
Wed, 4 Oct 2023 11:01:37 +0300 |
From: Hanna Czenczek <hreitz@redhat.com>
We duplicate the same condition three times here, pull it out to the top
level.
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-Id: <20230824155345.109765-5-hreitz@redhat.com>
Reviewed-by: Sam Li <faithilikerun@gmail.com>
(cherry picked from commit d31b50a15dd25a560749b25fc40b6484fd1a57b7)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/block/file-posix.c b/block/file-posix.c
index a050682e97..aa89789737 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -2506,11 +2506,10 @@ static int coroutine_fn raw_co_prw(BlockDriverState
*bs, uint64_t offset,
out:
#if defined(CONFIG_BLKZONED)
-{
- BlockZoneWps *wps = bs->wps;
- if (ret == 0) {
- if ((type & (QEMU_AIO_WRITE | QEMU_AIO_ZONE_APPEND)) &&
- bs->bl.zoned != BLK_Z_NONE) {
+ if ((type & (QEMU_AIO_WRITE | QEMU_AIO_ZONE_APPEND)) &&
+ bs->bl.zoned != BLK_Z_NONE) {
+ BlockZoneWps *wps = bs->wps;
+ if (ret == 0) {
uint64_t *wp = &wps->wp[offset / bs->bl.zone_size];
if (!BDRV_ZT_IS_CONV(*wp)) {
if (type & QEMU_AIO_ZONE_APPEND) {
@@ -2523,19 +2522,12 @@ out:
*wp = offset + bytes;
}
}
- }
- } else {
- if ((type & (QEMU_AIO_WRITE | QEMU_AIO_ZONE_APPEND)) &&
- bs->bl.zoned != BLK_Z_NONE) {
+ } else {
update_zones_wp(bs, s->fd, 0, 1);
}
- }
- if ((type & (QEMU_AIO_WRITE | QEMU_AIO_ZONE_APPEND)) &&
- bs->blk.zoned != BLK_Z_NONE) {
qemu_co_mutex_unlock(&wps->colock);
}
-}
#endif
return ret;
}
--
2.39.2
- [Stable-8.1.2 00/45] Patch Round-up for stable 8.1.2, freeze on 2023-10-14, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 01/45] hw/ppc: Introduce functions for conversion between timebase and nanoseconds, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 03/45] hw/ppc: Round up the decrementer interval when converting to ns, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 02/45] host-utils: Add muldiv64_round_up, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 08/45] hw/ppc: Read time only once to perform decrementer write, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 11/45] hw/cxl: Fix CFMW config memory leak, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 04/45] hw/ppc: Avoid decrementer rounding errors, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 13/45] file-posix: Clear bs->bl.zoned on error, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 16/45] file-posix: Simplify raw_co_prw's 'out' zone code,
Michael Tokarev <=
- [Stable-8.1.2 07/45] hw/ppc: Reset timebase facilities on machine reset, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 10/45] linux-user/hppa: lock both words of function descriptor, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 15/45] file-posix: Fix zone update in I/O error path, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 14/45] file-posix: Check bs->bl.zoned for zone info, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 12/45] hw/cxl: Fix out of bound array access, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 09/45] linux-user/hppa: clear the PSW 'N' bit when delivering signals, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 05/45] target/ppc: Sign-extend large decrementer to 64-bits, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 06/45] hw/ppc: Always store the decrementer value, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 24/45] ui/vnc: fix debug output for invalid audio message, Michael Tokarev, 2023/10/04
- [Stable-8.1.2 27/45] migration: Fix possible race when setting rp_state.error, Michael Tokarev, 2023/10/04