Messages in this thread | | | Date | Mon, 3 Mar 2014 14:55:25 -0800 | Subject | Re: Update of file offset on write() etc. is non-atomic with I/O | From | Linus Torvalds <> |
| |
On Mon, Mar 3, 2014 at 1:52 PM, Linus Torvalds <torvalds@linux-foundation.org> wrote: >> >> Most of the cases have it kept separately in registers, actually - there's >> a reason why fdget() and friends are inlined. > > Yes. And bit test and set ops on registers are actually cheaper than > playing around with bytes.
Ugh. gcc gets this *horribly* wrong when it's a bitfield in a union.
The
f.need_pos_unlock = 1;
thing *should* be just a simple "orl $2,reg", but bitfields seem to generate really crappy code, and it actually does some insane shifting and masking crud with the constant "1".
gcc has had problems with bitfields before.
I think I'll respin this with the compat readv/writev case fixed and with the bitfield replaced with an "unsigned int" that we just do bitops by hand on. Because that code generation makes me feel slightly ill.
Linus
| |