Btrfs and COW


Recommended Posts

Hi all,

 

I'm trying to understand something about Btrfs and how it tracks its multiple copies of files.  I have a couple scenarios and I'm tryting to understand how COW resolves with them:

  1. A file is put onto the file system by User A.  User B updates the file.  What differentiates User A from User B?  How is data chosen (original vs updated) to present to User A or B?  What about User C, who has seen neither original nor updated variant?
  2. A library, or video game, or even a git repo is put onto the file system.  That library / game / repo receives an update 2 weeks later.  Large amounts of edits may be made, so does this rapidly consume storage?
  3. A file is updated/deleted by User A.  How does that file get updated/deleted in the original, so that User B either sees the new version or no file at all?

I'd appreciate if someone could explain to me some of these items or point me in a direction that helps to explain.  I've been over wikipedia a couple times, and devouring stackoverflow, but I'm still not seeing clear answers to my questions, likely out of not understanding the answers.

Link to comment

I figured it out.  I had expected CoW to be a lot more intensive than it actually is.  It's not.  Copies of files are implicitly made only when a file is copied and then one of those copies is modified upon.  I expected some copy-in-place transactional craziness that versioned files as they were modified, and didn't care if a copy was made previously.  I'm confident I'm not explaining my original point of view well, but that's because it was pretty stupid to begin with.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.