Re: [PATCH 4/7] O_NONBLOCK flag for readv2/preadv2
From: Jeff Moyer
Date: Tue Sep 16 2014 - 15:54:43 EST
Milosz Tanski <milosz@xxxxxxxxx> writes:
>> Why did you put the wouldblock label inside the loop? That should be
>> pushed down to just above out, and then you can get rid of the goto.
>
> When I put the code outside the loop it actually looked worse (imo):
>
> }
>
> goto out;
>
> would_block:
> error = -EAGAIN;
>
> out:
> ...
>
We don't exit the loop without a return or a goto, so you wouldn't need
that 'goto out' just below the end of the loop. It would look like:
}
would_block:
error = -EAGAIN;
out:
...
> Point taken and I can fix this for the next version further up the
> stack. A longer term question is how the flags the file is open with
> interact with the read/write flags ... since I imagine folks will want
> to add other flags (like force a SYNC write).
I think we'll have to address those one at a time. I do like the idea
of the SYNC flag for a write, though you'll probably have several
variants of that (equivalents of SYNC and DSYNC at least). Another fun
write flag to consider is O_ATOMIC. :)
Cheers,
Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/