@@ -508,6 +508,7 @@ block_copy_do_copy(BlockCopyState *s, int64_t offset, int64_t bytes,
trace_block_copy_copy_range_fail(s, offset, ret);
*method = COPY_READ_WRITE;
/* Fall through to read+write with allocated buffer */
+ fallthrough;
case COPY_READ_WRITE_CLUSTER:
case COPY_READ_WRITE:
@@ -1013,6 +1013,7 @@ static int raw_handle_perm_lock(BlockDriverState *bs,
bs->filename);
}
/* fall through to unlock bytes. */
+ fallthrough;
case RAW_PL_ABORT:
raw_apply_lock_bytes(s, s->fd, s->perm, ~s->shared_perm,
true, &local_err);
@@ -2034,6 +2034,7 @@ bdrv_co_write_req_finish(BdrvChild *child, int64_t offset, int64_t bytes,
case BDRV_TRACKED_WRITE:
stat64_max(&bs->wr_highest_offset, offset + bytes);
/* fall through, to set dirty bits */
+ fallthrough;
case BDRV_TRACKED_DISCARD:
bdrv_set_dirty(bs, offset, bytes);
break;
@@ -1461,6 +1461,7 @@ static void iscsi_readcapacity_sync(IscsiLun *iscsilun, Error **errp)
break;
}
/* Fall through and try READ CAPACITY(10) instead. */
+ fallthrough;
case TYPE_ROM:
task = iscsi_readcapacity10_sync(iscsilun->iscsi, iscsilun->lun, 0, 0);
if (task != NULL && task->status == SCSI_STATUS_GOOD) {
@@ -1333,13 +1333,16 @@ static bool cluster_needs_new_alloc(BlockDriverState *bs, uint64_t l2_entry)
{
switch (qcow2_get_cluster_type(bs, l2_entry)) {
case QCOW2_CLUSTER_NORMAL:
+ fallthrough;
case QCOW2_CLUSTER_ZERO_ALLOC:
if (l2_entry & QCOW_OFLAG_COPIED) {
return false;
}
- /* fallthrough */
+ fallthrough;
case QCOW2_CLUSTER_UNALLOCATED:
+ fallthrough;
case QCOW2_CLUSTER_COMPRESSED:
+ fallthrough;
case QCOW2_CLUSTER_ZERO_PLAIN:
return true;
default:
@@ -1201,10 +1201,14 @@ vhdx_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
/* check the payload block state */
switch (s->bat[sinfo.bat_idx] & VHDX_BAT_STATE_BIT_MASK) {
- case PAYLOAD_BLOCK_NOT_PRESENT: /* fall through */
+ case PAYLOAD_BLOCK_NOT_PRESENT:
+ fallthrough;
case PAYLOAD_BLOCK_UNDEFINED:
+ fallthrough;
case PAYLOAD_BLOCK_UNMAPPED:
+ fallthrough;
case PAYLOAD_BLOCK_UNMAPPED_v095:
+ fallthrough;
case PAYLOAD_BLOCK_ZERO:
/* return zero */
qemu_iovec_memset(&hd_qiov, 0, 0, sinfo.bytes_avail);
@@ -1222,6 +1226,7 @@ vhdx_co_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
case PAYLOAD_BLOCK_PARTIALLY_PRESENT:
/* we don't yet support difference files, fall through
* to error */
+ fallthrough;
default:
ret = -EIO;
goto exit;
@@ -1373,10 +1378,13 @@ vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
* data that is not part of this write, so we must pad
* the rest of the buffer to zeroes */
use_zero_buffers = true;
- /* fall through */
- case PAYLOAD_BLOCK_NOT_PRESENT: /* fall through */
+ fallthrough;
+ case PAYLOAD_BLOCK_NOT_PRESENT:
+ fallthrough;
case PAYLOAD_BLOCK_UNMAPPED:
+ fallthrough;
case PAYLOAD_BLOCK_UNMAPPED_v095:
+ fallthrough;
case PAYLOAD_BLOCK_UNDEFINED:
bat_prior_offset = sinfo.file_offset;
ret = vhdx_allocate_block(bs, s, &sinfo.file_offset,
@@ -1431,7 +1439,7 @@ vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
}
}
- /* fall through */
+ fallthrough;
case PAYLOAD_BLOCK_FULLY_PRESENT:
/* if the file offset address is in the header zone,
* there is a problem */
@@ -1457,6 +1465,7 @@ vhdx_co_writev(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
case PAYLOAD_BLOCK_PARTIALLY_PRESENT:
/* we don't yet support difference files, fall through
* to error */
+ fallthrough;
default:
ret = -EIO;
goto exit;
In preparation of raising -Wimplicit-fallthrough to 5, replace all fall-through comments with the fallthrough attribute pseudo-keyword. Signed-off-by: Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org> --- block/block-copy.c | 1 + block/file-posix.c | 1 + block/io.c | 1 + block/iscsi.c | 1 + block/qcow2-cluster.c | 5 ++++- block/vhdx.c | 17 +++++++++++++---- 6 files changed, 21 insertions(+), 5 deletions(-)