Fam Zheng cd47d792d7 block: Use common write req handling in truncate
Truncation is the last to convert from open coded req handling to
reusing helpers. This time the permission check in prepare has to adapt
to the new caller: it checks a different permission bit, and doesn't
trigger the before write notifier.

Also, truncation should always trigger a bs->total_sectors update and in
turn call parent resize_cb. Update the condition in finish helper, too.

It's intended to do a duplicated bs->read_only check before calling
bdrv_co_write_req_prepare() so that we can be more informative with the
error message, as bdrv_co_write_req_prepare() doesn't have Error
parameter.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-07-10 16:46:22 +02:00
..
2018-07-10 16:01:52 +02:00
2018-07-10 16:01:52 +02:00
2018-07-10 16:01:52 +02:00
2018-07-10 16:01:52 +02:00
2018-07-05 10:29:19 +02:00
2018-07-10 16:01:52 +02:00
2018-07-10 13:04:25 +02:00
2018-07-05 10:29:19 +02:00
2018-06-29 14:20:56 +02:00
2018-07-10 16:01:52 +02:00
2018-07-10 16:01:52 +02:00
2018-07-02 14:45:23 +02:00
2018-06-29 14:20:56 +02:00