Skip to content

Commit bbe5c84

Browse files
Christoph Hellwigaxboe
authored andcommitted
virtio_blk: remove virtblk_update_cache_mode
virtblk_update_cache_mode boils down to a single call to blk_queue_write_cache. Remove it in preparation for moving the cache control flags into the queue_limits. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Reviewed-by: Damien Le Moal <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 97dd4a4 commit bbe5c84

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

drivers/block/virtio_blk.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,14 +1089,6 @@ static int virtblk_get_cache_mode(struct virtio_device *vdev)
10891089
return writeback;
10901090
}
10911091

1092-
static void virtblk_update_cache_mode(struct virtio_device *vdev)
1093-
{
1094-
u8 writeback = virtblk_get_cache_mode(vdev);
1095-
struct virtio_blk *vblk = vdev->priv;
1096-
1097-
blk_queue_write_cache(vblk->disk->queue, writeback, false);
1098-
}
1099-
11001092
static const char *const virtblk_cache_types[] = {
11011093
"write through", "write back"
11021094
};
@@ -1116,7 +1108,7 @@ cache_type_store(struct device *dev, struct device_attribute *attr,
11161108
return i;
11171109

11181110
virtio_cwrite8(vdev, offsetof(struct virtio_blk_config, wce), i);
1119-
virtblk_update_cache_mode(vdev);
1111+
blk_queue_write_cache(disk->queue, virtblk_get_cache_mode(vdev), false);
11201112
return count;
11211113
}
11221114

@@ -1528,7 +1520,8 @@ static int virtblk_probe(struct virtio_device *vdev)
15281520
vblk->index = index;
15291521

15301522
/* configure queue flush support */
1531-
virtblk_update_cache_mode(vdev);
1523+
blk_queue_write_cache(vblk->disk->queue, virtblk_get_cache_mode(vdev),
1524+
false);
15321525

15331526
/* If disk is read-only in the host, the guest should obey */
15341527
if (virtio_has_feature(vdev, VIRTIO_BLK_F_RO))

0 commit comments

Comments
 (0)