Message ID | 20181203101429.88735-4-anton.nefedov@virtuozzo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | qcow2: cluster space preallocation | expand |
On Mon 03 Dec 2018 11:14:55 AM CET, Anton Nefedov wrote: > Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> > --- > block/quorum.c | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/block/quorum.c b/block/quorum.c > index 16b3c8067c..d21a6a3b8e 100644 > --- a/block/quorum.c > +++ b/block/quorum.c > @@ -857,6 +857,19 @@ static QemuOptsList quorum_runtime_opts = { > }, > }; > > +static void quorum_set_supported_flags(BlockDriverState *bs) > +{ > + BDRVQuorumState *s = bs->opaque; > + int i; > + > + bs->supported_write_flags = BDRV_REQ_FUA; > + for (i = 0; i < s->num_children; i++) { > + bs->supported_write_flags &= s->children[i]->bs->supported_write_flags; > + } > + > + bs->supported_write_flags |= BDRV_REQ_WRITE_UNCHANGED; > +} You don't set supported_zero_flags here anymore ? Berto
On 7/12/2018 5:33 PM, Alberto Garcia wrote: > On Mon 03 Dec 2018 11:14:55 AM CET, Anton Nefedov wrote: >> Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> >> --- >> block/quorum.c | 19 ++++++++++++++++++- >> 1 file changed, 18 insertions(+), 1 deletion(-) >> >> diff --git a/block/quorum.c b/block/quorum.c >> index 16b3c8067c..d21a6a3b8e 100644 >> --- a/block/quorum.c >> +++ b/block/quorum.c >> @@ -857,6 +857,19 @@ static QemuOptsList quorum_runtime_opts = { >> }, >> }; >> >> +static void quorum_set_supported_flags(BlockDriverState *bs) >> +{ >> + BDRVQuorumState *s = bs->opaque; >> + int i; >> + >> + bs->supported_write_flags = BDRV_REQ_FUA; >> + for (i = 0; i < s->num_children; i++) { >> + bs->supported_write_flags &= s->children[i]->bs->supported_write_flags; >> + } >> + >> + bs->supported_write_flags |= BDRV_REQ_WRITE_UNCHANGED; >> +} > > You don't set supported_zero_flags here anymore ? > > Berto > Yes, I noticed (that late) that quorum doesn't actually implement write_zeroes(). bdrv_co_do_pwrite_zeroes() specifically checks that there must be no supported flags set in such case.
On Fri 07 Dec 2018 03:46:13 PM CET, Anton Nefedov wrote: >>> +static void quorum_set_supported_flags(BlockDriverState *bs) >>> +{ >>> + BDRVQuorumState *s = bs->opaque; >>> + int i; >>> + >>> + bs->supported_write_flags = BDRV_REQ_FUA; >>> + for (i = 0; i < s->num_children; i++) { >>> + bs->supported_write_flags &= s->children[i]->bs->supported_write_flags; >>> + } >>> + >>> + bs->supported_write_flags |= BDRV_REQ_WRITE_UNCHANGED; >>> +} >> >> You don't set supported_zero_flags here anymore ? > > Yes, I noticed (that late) that quorum doesn't actually implement > write_zeroes(). bdrv_co_do_pwrite_zeroes() specifically checks that > there must be no supported flags set in such case. Oh, I see. Reviewed-by: Alberto Garcia <berto@igalia.com> Berto
03.12.2018 13:14, Anton Nefedov wrote: > Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
diff --git a/block/quorum.c b/block/quorum.c index 16b3c8067c..d21a6a3b8e 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -857,6 +857,19 @@ static QemuOptsList quorum_runtime_opts = { }, }; +static void quorum_set_supported_flags(BlockDriverState *bs) +{ + BDRVQuorumState *s = bs->opaque; + int i; + + bs->supported_write_flags = BDRV_REQ_FUA; + for (i = 0; i < s->num_children; i++) { + bs->supported_write_flags &= s->children[i]->bs->supported_write_flags; + } + + bs->supported_write_flags |= BDRV_REQ_WRITE_UNCHANGED; +} + static int quorum_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { @@ -950,7 +963,7 @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags, } s->next_child_index = s->num_children; - bs->supported_write_flags = BDRV_REQ_WRITE_UNCHANGED; + quorum_set_supported_flags(bs); g_free(opened); goto exit; @@ -1025,6 +1038,8 @@ static void quorum_add_child(BlockDriverState *bs, BlockDriverState *child_bs, s->children = g_renew(BdrvChild *, s->children, s->num_children + 1); s->children[s->num_children++] = child; + quorum_set_supported_flags(bs); + out: bdrv_drained_end(bs); } @@ -1063,6 +1078,8 @@ static void quorum_del_child(BlockDriverState *bs, BdrvChild *child, bdrv_unref_child(bs, child); bdrv_drained_end(bs); + + quorum_set_supported_flags(bs); } static void quorum_refresh_filename(BlockDriverState *bs, QDict *options)
Signed-off-by: Anton Nefedov <anton.nefedov@virtuozzo.com> --- block/quorum.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)