How is fseek() implemented in the filesystem?

Posted by pajton on Stack Overflow See other posts from Stack Overflow or by pajton
Published on 2010-03-13T15:52:50Z Indexed on 2010/03/13 15:55 UTC
Read the original article Hit count: 190

This is not a pure programming question, however it impacts the performance of programs using fseek(), hence it is important to know how it works. A little disclaimer so that it doesn't get closed.

I am wondering how efficient it is to insert data in the middle of the file. Supposing I have a file with 1MB data and then I insert something at the 512KB offset. How efficient would that be compared to appending my data at the end of the file? Just to make the example complete lets say I want to insert 16KB of data.

I understand the answer varies depending on the filesystem, however I assume that the techniques used in common filesystems are quite similar and I just want to get the right notion of it.

© Stack Overflow or respective owner

Related posts about fseek

Related posts about filesystems