On 05/06/2016 10:05 AM, Max Reitz wrote: > On 05.05.2016 05:42, Eric Blake wrote: >> Make it easier to test block drivers with BDRV_REQ_FUA in >> .supported_write_flags, by adding the '-f' flag to qemu-io to >> conditionally pass the flag through to specific writes ('write', >> 'write -z', 'writev', 'aio_write', 'aio_write -z'). You'll want >> to use 'qemu-io -t none' to actually make -f useful (as >> otherwise, the default writethrough mode automatically sets the >> FUA bit on every write). >> >> Signed-off-by: Eric Blake >> --- >> qemu-io-cmds.c | 57 +++++++++++++++++++++++++++++++++++++++++---------------- >> 1 file changed, 41 insertions(+), 16 deletions(-) >> >> diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c >> index 8bcf742..ba811fe 100644 >> --- a/qemu-io-cmds.c >> +++ b/qemu-io-cmds.c > > [...] > >> @@ -1010,6 +1018,11 @@ static int write_f(BlockBackend *blk, int argc, char **argv) >> return 0; >> } >> >> + if ((flags & BDRV_REQ_FUA) && (bflag + cflag)) { > > || would do the same job as +, except it looks nicer. Holdover from rebasing the s/int/bool/ change earlier in the series. Will fix. > > Although technically correct, I'm very hesitant to give an R-b for > boolean arithmetics. Well-defined by C doesn't mean well-understood :) I'm also more comfortable with boolean operators for boolean variables; and I even know of a recent patch to GNU coreutils due to gcc 7 starting to warn about constructs on bool that look fishy because of promotion-to-int when using non-bool operators. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org