lkml.org 
[lkml]   [2014]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: Update of file offset on write() etc. is non-atomic with I/O
From
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


\
 
 \ /
  Last update: 2014-03-04 01:01    [W:0.175 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site