blkio.c (09d9fc97f8b0bf30f3c55a5ae3a20f799fd3e5f2) | blkio.c (c86422c5549c0983b4b4525b8f56a1c69dd67aa1) |
---|---|
1/* SPDX-License-Identifier: LGPL-2.1-or-later */ 2/* 3 * libblkio BlockDriver 4 * 5 * Copyright Red Hat, Inc. 6 * 7 * Author: 8 * Stefan Hajnoczi <stefanha@redhat.com> --- 825 unchanged lines hidden (view full) --- 834 blkio_detach_aio_context(bs); 835 blkio_destroy(&s->blkio); 836 837 if (s->may_pin_mem_regions) { 838 ram_block_discard_disable(false); 839 } 840} 841 | 1/* SPDX-License-Identifier: LGPL-2.1-or-later */ 2/* 3 * libblkio BlockDriver 4 * 5 * Copyright Red Hat, Inc. 6 * 7 * Author: 8 * Stefan Hajnoczi <stefanha@redhat.com> --- 825 unchanged lines hidden (view full) --- 834 blkio_detach_aio_context(bs); 835 blkio_destroy(&s->blkio); 836 837 if (s->may_pin_mem_regions) { 838 ram_block_discard_disable(false); 839 } 840} 841 |
842static int64_t blkio_getlength(BlockDriverState *bs) | 842static int64_t coroutine_fn blkio_co_getlength(BlockDriverState *bs) |
843{ 844 BDRVBlkioState *s = bs->opaque; 845 uint64_t capacity; 846 int ret; 847 848 WITH_QEMU_LOCK_GUARD(&s->blkio_lock) { 849 ret = blkio_get_uint64(s->blkio, "capacity", &capacity); 850 } --- 11 unchanged lines hidden (view full) --- 862 int64_t current_length; 863 864 if (prealloc != PREALLOC_MODE_OFF) { 865 error_setg(errp, "Unsupported preallocation mode '%s'", 866 PreallocMode_str(prealloc)); 867 return -ENOTSUP; 868 } 869 | 843{ 844 BDRVBlkioState *s = bs->opaque; 845 uint64_t capacity; 846 int ret; 847 848 WITH_QEMU_LOCK_GUARD(&s->blkio_lock) { 849 ret = blkio_get_uint64(s->blkio, "capacity", &capacity); 850 } --- 11 unchanged lines hidden (view full) --- 862 int64_t current_length; 863 864 if (prealloc != PREALLOC_MODE_OFF) { 865 error_setg(errp, "Unsupported preallocation mode '%s'", 866 PreallocMode_str(prealloc)); 867 return -ENOTSUP; 868 } 869 |
870 current_length = blkio_getlength(bs); | 870 current_length = blkio_co_getlength(bs); |
871 872 if (offset > current_length) { 873 error_setg(errp, "Cannot grow device"); 874 return -EINVAL; 875 } else if (exact && offset != current_length) { 876 error_setg(errp, "Cannot resize device"); 877 return -ENOTSUP; 878 } --- 114 unchanged lines hidden (view full) --- 993 994#define BLKIO_DRIVER(name, ...) \ 995 { \ 996 .format_name = name, \ 997 .protocol_name = name, \ 998 .instance_size = sizeof(BDRVBlkioState), \ 999 .bdrv_file_open = blkio_file_open, \ 1000 .bdrv_close = blkio_close, \ | 871 872 if (offset > current_length) { 873 error_setg(errp, "Cannot grow device"); 874 return -EINVAL; 875 } else if (exact && offset != current_length) { 876 error_setg(errp, "Cannot resize device"); 877 return -ENOTSUP; 878 } --- 114 unchanged lines hidden (view full) --- 993 994#define BLKIO_DRIVER(name, ...) \ 995 { \ 996 .format_name = name, \ 997 .protocol_name = name, \ 998 .instance_size = sizeof(BDRVBlkioState), \ 999 .bdrv_file_open = blkio_file_open, \ 1000 .bdrv_close = blkio_close, \ |
1001 .bdrv_getlength = blkio_getlength, \ | 1001 .bdrv_co_getlength = blkio_co_getlength, \ |
1002 .bdrv_co_truncate = blkio_truncate, \ 1003 .bdrv_get_info = blkio_get_info, \ 1004 .bdrv_attach_aio_context = blkio_attach_aio_context, \ 1005 .bdrv_detach_aio_context = blkio_detach_aio_context, \ 1006 .bdrv_co_pdiscard = blkio_co_pdiscard, \ 1007 .bdrv_co_preadv = blkio_co_preadv, \ 1008 .bdrv_co_pwritev = blkio_co_pwritev, \ 1009 .bdrv_co_flush_to_disk = blkio_co_flush, \ --- 39 unchanged lines hidden --- | 1002 .bdrv_co_truncate = blkio_truncate, \ 1003 .bdrv_get_info = blkio_get_info, \ 1004 .bdrv_attach_aio_context = blkio_attach_aio_context, \ 1005 .bdrv_detach_aio_context = blkio_detach_aio_context, \ 1006 .bdrv_co_pdiscard = blkio_co_pdiscard, \ 1007 .bdrv_co_preadv = blkio_co_preadv, \ 1008 .bdrv_co_pwritev = blkio_co_pwritev, \ 1009 .bdrv_co_flush_to_disk = blkio_co_flush, \ --- 39 unchanged lines hidden --- |