lkml.org 
[lkml]   [2014]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: Update of file offset on write() etc. is non-atomic with I/O
Ouch! I've just seen that trimming the CC on this reply took me out of
a large part of the subsequent conversation. PLEASE don't trim CCs,
and especially not the address of the OP!!

On Mon, Mar 3, 2014 at 10:03 PM, George Spelvin <linux@horizon.com> wrote:
>> struct fd {
>> struct file *file;
>> - int need_put;
>> + unsigned need_put:1, need_pos_unlock:1;
>> };
>
> Since we're rounding up to 2*sizeof(struct file *) anyway, is this a case
> where wasting space on a couple of char (or bool) flags would generate
> better code than a bitfield?
>
> In particular, the code to set need_pos_unlock (which will be executed
> each read/write for most files) is messy in the bitfield case.
> A byte store is much cleaner.
>
> (If you want to use bits, why not use the two lsbits of the file pointer
> for the purpose? That would save a lot of space.)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html



--
Michael Kerrisk Linux man-pages maintainer;
http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface", http://blog.man7.org/


\
 
 \ /
  Last update: 2014-05-04 09:41    [W:0.094 / U:0.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site