[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] [PATCH] Don't error on NBD_FLAG_CMD_FUA on non-writes



On Wed, Apr 06, 2016 at 07:54:04PM +0100, Alex Bligh wrote:
> 
> On 6 Apr 2016, at 19:39, Wouter Verhelst <w@...112...> wrote:
> 
> > On Wed, Apr 06, 2016 at 04:37:23PM +0100, Alex Bligh wrote:
> >> Note Eric's also fixed another bug. The line should
> >> previously have only tested the FUA bit, rather than do
> >> a word comparison.
> > 
> > How so?
> 
> The old code had:
> 
>   if(flags != 0 && (type != NBD_CMD_WRITE || flags != NBD_CMD_FLAG_FUA)) {
>       ... cause an error ...
>   }
> 
> I was thinking the 'flags != NBD_CMD_FLAG_FUA' should have been
> '!(flags & NBD_CMD_FLAG_FUA)' and 'flags != 0' should have been
> '(flags & ~NBD_CMD_FLAG_FUA)' etc. but it probably makes no difference
> as the reference implementation currently only supports one command
> flag I think.

In other words, it's not a bug (i.e., the code didn't behave
incorrectly), it's just a style issue ;-P

(yeah, it's probably an improvement; I was just confused, because I
couldn't see how that code would've worked differently)

-- 
< ron> I mean, the main *practical* problem with C++, is there's like a dozen
       people in the world who think they really understand all of its rules,
       and pretty much all of them are just lying to themselves too.
 -- #debian-devel, OFTC, 2016-02-12



Reply to: