Re: VFS locking: f_pos thread-safe ?

Matthias Urlichs
2004-02-06T10:40:58Z

Hi, Andrew Morton wrote:
>> touché :) but still we should do what we can.. want me to make a patch?
>
> Not unless we can think of a way in which it actually matters, thanks.
>
I've written one of those... a migration program from an old
fixed-record-size database to SQL. Somebody had the brilliant idea to let
two threads read the file concurrently, postprocess the thing (which took
a variable amount of time depending on what was in the record) and then
feed it to the database (ditto).

When that idea didn't work, I used a separate reader thread and
coordinated buffer usage with semaphores or whatever, making the thing a
whole lot more complicated in the process. :-/

So count me as one of those people who think that it does matter -- if N
threads read a file of M bytes, they should collectively get M bytes from
it (possibly out of order, of course, but that's a different problem).
Anything else would be inconsistent.

Same thing goes for writing (in append mode as well as otherwise).

--
Matthias Urlichs