block: Use bdrv_inherited_options()
commit00ff7ffd67c50fe45a1e313765d416d082541128
authorMax Reitz <mreitz@redhat.com>
Wed, 13 May 2020 11:05:21 +0000 (13 13:05 +0200)
committerKevin Wolf <kwolf@redhat.com>
Mon, 18 May 2020 17:05:25 +0000 (18 19:05 +0200)
tree4022e5bd953b723c335af4a06edb40543c9d4e17
parentfae8bd3904642dd7ff582f4ad4e5e63b0cacbe6f
block: Use bdrv_inherited_options()

Let child_file's, child_format's, and child_backing's .inherit_options()
implementations fall back to bdrv_inherited_options() to show that it
would really work for all of these cases, if only the parents passed the
appropriate BdrvChildRole and parent_is_format values.

(Also, make bdrv_open_inherit(), the only place to explicitly call
bdrv_backing_options(), call bdrv_inherited_options() instead.)

This patch should incur only two visible changes, both for child_format
children, both of which are effectively bug fixes:

First, they no longer have discard=unmap set by default.  This reason it
was set is because bdrv_inherited_fmt_options() fell through to
bdrv_protocol_options(), and that set it because "format drivers take
care to send flushes and respect unmap policy".  None of the drivers
that use child_format for their children (quorum and blkverify) are
format drivers, though, so this reasoning does not apply here.

Second, they no longer have BDRV_O_NO_IO force-cleared.  child_format
was used solely for children that do not store any metadata and as such
will not be accessed by their parents as long as those parents do not
receive I/O themselves.  Thus, such children should inherit
BDRV_O_NO_IO.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200513110544.176672-12-mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c