On Thu, 6 Jun 2002, Robert Brockway wrote: > > On Thu, Jun 06, 2002 at 01:30:46AM -0400, S. Alexander Jacobson wrote: > > > I just joined this list. Two question: > > > 1. Can reiserfs detect that I have two copies of > > > the same file on disk and store tham as one file > > > > Hm, you mean, each time you create a file, reiserfs should scan all > > other files and see if there is exactly a file like you just wrote? > > Hm, even something more complicated as you are writing to a file in > > 4k chunks. > > Definitely no. > > And besides, how could it even know whether you even want them to be the > same or not. I keen plenty of identical files around (online backups, > etc) and I'd be mighty upset if the filesystem started hard linking them > together :)
That is why I said lazy copy on write. One implementation would be for the file system to keep a ref count of how many different files the user intended. When an applicatiion writes to a file, the file system checks the ref count. If the ref count is greater than 1, the file system copies the file, decrements the ref-count, and gives the writing application a pointer to the new copy. I'm sure there are smarter implementations, but the point is that the file system can certainly differentiate in theory between user hard links and actual hard links. -Alex- ___________________________________________________________________ S. Alexander Jacobson i2x Media 1-212-787-1914 voice 1-603-288-1280 fax