block.c (1e97be915697fff198e9922321066cf9b44ef4b9) | block.c (c057960c4e33becb22d4741156203a4b0d4a3088) |
---|---|
1/* 2 * QEMU System Emulator block driver 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * Copyright (c) 2020 Virtuozzo International GmbH. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to deal --- 1021 unchanged lines hidden (view full) --- 1030 *pdrv = drv; 1031 return 0; 1032} 1033 1034/** 1035 * Set the current 'total_sectors' value 1036 * Return 0 on success, -errno on error. 1037 */ | 1/* 2 * QEMU System Emulator block driver 3 * 4 * Copyright (c) 2003 Fabrice Bellard 5 * Copyright (c) 2020 Virtuozzo International GmbH. 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to deal --- 1021 unchanged lines hidden (view full) --- 1030 *pdrv = drv; 1031 return 0; 1032} 1033 1034/** 1035 * Set the current 'total_sectors' value 1036 * Return 0 on success, -errno on error. 1037 */ |
1038int refresh_total_sectors(BlockDriverState *bs, int64_t hint) | 1038int bdrv_refresh_total_sectors(BlockDriverState *bs, int64_t hint) |
1039{ 1040 BlockDriver *drv = bs->drv; 1041 IO_CODE(); 1042 1043 if (!drv) { 1044 return -ENOMEDIUM; 1045 } 1046 --- 600 unchanged lines hidden (view full) --- 1647 * declaring support explicitly. 1648 * 1649 * Drivers must not propagate this flag accidentally when they initiate I/O 1650 * to a bounce buffer. That case should be rare though. 1651 */ 1652 bs->supported_read_flags |= BDRV_REQ_REGISTERED_BUF; 1653 bs->supported_write_flags |= BDRV_REQ_REGISTERED_BUF; 1654 | 1039{ 1040 BlockDriver *drv = bs->drv; 1041 IO_CODE(); 1042 1043 if (!drv) { 1044 return -ENOMEDIUM; 1045 } 1046 --- 600 unchanged lines hidden (view full) --- 1647 * declaring support explicitly. 1648 * 1649 * Drivers must not propagate this flag accidentally when they initiate I/O 1650 * to a bounce buffer. That case should be rare though. 1651 */ 1652 bs->supported_read_flags |= BDRV_REQ_REGISTERED_BUF; 1653 bs->supported_write_flags |= BDRV_REQ_REGISTERED_BUF; 1654 |
1655 ret = refresh_total_sectors(bs, bs->total_sectors); | 1655 ret = bdrv_refresh_total_sectors(bs, bs->total_sectors); |
1656 if (ret < 0) { 1657 error_setg_errno(errp, -ret, "Could not refresh total sector count"); 1658 return ret; 1659 } 1660 1661 bdrv_refresh_limits(bs, NULL, &local_err); 1662 if (local_err) { 1663 error_propagate(errp, local_err); --- 4140 unchanged lines hidden (view full) --- 5804{ 5805 BlockDriver *drv = bs->drv; 5806 IO_CODE(); 5807 5808 if (!drv) 5809 return -ENOMEDIUM; 5810 5811 if (drv->has_variable_length) { | 1656 if (ret < 0) { 1657 error_setg_errno(errp, -ret, "Could not refresh total sector count"); 1658 return ret; 1659 } 1660 1661 bdrv_refresh_limits(bs, NULL, &local_err); 1662 if (local_err) { 1663 error_propagate(errp, local_err); --- 4140 unchanged lines hidden (view full) --- 5804{ 5805 BlockDriver *drv = bs->drv; 5806 IO_CODE(); 5807 5808 if (!drv) 5809 return -ENOMEDIUM; 5810 5811 if (drv->has_variable_length) { |
5812 int ret = refresh_total_sectors(bs, bs->total_sectors); | 5812 int ret = bdrv_refresh_total_sectors(bs, bs->total_sectors); |
5813 if (ret < 0) { 5814 return ret; 5815 } 5816 } 5817 return bs->total_sectors; 5818} 5819 5820/** --- 765 unchanged lines hidden (view full) --- 6586 bs->open_flags |= BDRV_O_INACTIVE; 6587 return ret; 6588 } 6589 6590 FOR_EACH_DIRTY_BITMAP(bs, bm) { 6591 bdrv_dirty_bitmap_skip_store(bm, false); 6592 } 6593 | 5813 if (ret < 0) { 5814 return ret; 5815 } 5816 } 5817 return bs->total_sectors; 5818} 5819 5820/** --- 765 unchanged lines hidden (view full) --- 6586 bs->open_flags |= BDRV_O_INACTIVE; 6587 return ret; 6588 } 6589 6590 FOR_EACH_DIRTY_BITMAP(bs, bm) { 6591 bdrv_dirty_bitmap_skip_store(bm, false); 6592 } 6593 |
6594 ret = refresh_total_sectors(bs, bs->total_sectors); | 6594 ret = bdrv_refresh_total_sectors(bs, bs->total_sectors); |
6595 if (ret < 0) { 6596 bs->open_flags |= BDRV_O_INACTIVE; 6597 error_setg_errno(errp, -ret, "Could not refresh total sector count"); 6598 return ret; 6599 } 6600 } 6601 6602 QLIST_FOREACH(parent, &bs->parents, next_parent) { --- 1602 unchanged lines hidden --- | 6595 if (ret < 0) { 6596 bs->open_flags |= BDRV_O_INACTIVE; 6597 error_setg_errno(errp, -ret, "Could not refresh total sector count"); 6598 return ret; 6599 } 6600 } 6601 6602 QLIST_FOREACH(parent, &bs->parents, next_parent) { --- 1602 unchanged lines hidden --- |