io.c (880953493386a69416d2e1cdc063c670585a03ac) io.c (9a5a1c621ed72161abcf461d46c7b7b7f97938bf)
1/*
2 * Block layer I/O functions
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 2957 unchanged lines hidden (view full) ---

2966 int64_t bytes)
2967{
2968 BdrvTrackedRequest req;
2969 int ret;
2970 int64_t max_pdiscard;
2971 int head, tail, align;
2972 BlockDriverState *bs = child->bs;
2973 IO_CODE();
1/*
2 * Block layer I/O functions
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 2957 unchanged lines hidden (view full) ---

2966 int64_t bytes)
2967{
2968 BdrvTrackedRequest req;
2969 int ret;
2970 int64_t max_pdiscard;
2971 int head, tail, align;
2972 BlockDriverState *bs = child->bs;
2973 IO_CODE();
2974 assert_bdrv_graph_readable();
2974
2975 if (!bs || !bs->drv || !bdrv_co_is_inserted(bs)) {
2976 return -ENOMEDIUM;
2977 }
2978
2979 if (bdrv_has_readonly_bitmaps(bs)) {
2980 return -EPERM;
2981 }

--- 590 unchanged lines hidden (view full) ---

3572}
3573
3574int coroutine_fn
3575bdrv_co_pdiscard_snapshot(BlockDriverState *bs, int64_t offset, int64_t bytes)
3576{
3577 BlockDriver *drv = bs->drv;
3578 int ret;
3579 IO_CODE();
2975
2976 if (!bs || !bs->drv || !bdrv_co_is_inserted(bs)) {
2977 return -ENOMEDIUM;
2978 }
2979
2980 if (bdrv_has_readonly_bitmaps(bs)) {
2981 return -EPERM;
2982 }

--- 590 unchanged lines hidden (view full) ---

3573}
3574
3575int coroutine_fn
3576bdrv_co_pdiscard_snapshot(BlockDriverState *bs, int64_t offset, int64_t bytes)
3577{
3578 BlockDriver *drv = bs->drv;
3579 int ret;
3580 IO_CODE();
3581 assert_bdrv_graph_readable();
3580
3581 if (!drv) {
3582 return -ENOMEDIUM;
3583 }
3584
3585 if (!drv->bdrv_co_pdiscard_snapshot) {
3586 return -ENOTSUP;
3587 }
3588
3589 bdrv_inc_in_flight(bs);
3590 ret = drv->bdrv_co_pdiscard_snapshot(bs, offset, bytes);
3591 bdrv_dec_in_flight(bs);
3592
3593 return ret;
3594}
3582
3583 if (!drv) {
3584 return -ENOMEDIUM;
3585 }
3586
3587 if (!drv->bdrv_co_pdiscard_snapshot) {
3588 return -ENOTSUP;
3589 }
3590
3591 bdrv_inc_in_flight(bs);
3592 ret = drv->bdrv_co_pdiscard_snapshot(bs, offset, bytes);
3593 bdrv_dec_in_flight(bs);
3594
3595 return ret;
3596}