> I doubt that only a rename happens, even more I am sure that not.

What happens when you write a file in-place:

- write the *whole* file data again at the same place as the old one[^1]

When happens if you write to a temp file (like GIO does)

- create a new file (which is allocating a new directory entry)
- write the whole file data at this new place
- (optionally) copy over file attributes form the old file
- move the new file in place of the new one (dump the old entry, update the new 
one with the old name -- or the other way around, I'm nto entirely sure but 
that's the same)

Yes, it's more complicated, but the only extra writes are meta-data about the 
file, it is *not* written twice. It's not "write to temp then write again to 
original", and it's not a backup either (although a backup is not more greedy 
in writes either, it's almost the exact same thing but the backup is not 
deleted).

Yes, this requires twice the amount of free space during the write operation, 
because you do not remove the old data before the new one is fully written, but 
when the operation is finished it uses the same amount -- and again, doesn't 
write twice.

[^1]: actually with SSDs it's highly unlikely it'll be written at the same 
place, but the visible behavior is the same.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/discussions/3697#discussioncomment-7623269
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/repo-discussions/3697/comments/[email protected]>

Reply via email to