On Sun, Jul 03, 2016 at 04:15:02PM +0200, Henk Slager wrote: > >> Provided that Dropbox is running in the system, does it mean that it > >> cannot be defagmented? > > > > That is probably true. Files that are mapped into memory (like running > > executables) cannot be changed on disk. You could make a copy of that > > file, remove the original, and rename the new into place. As long as > > the executable is running it will stay on disk but you can now > > defragment the file and next time dropbox is started it will use the > > new one. > > I get: > ERROR: cannot open ./dropbox: Text file busy > > when I run: > btrfs fi defrag -v ./dropbox > > This is with kernel 4.6.2 and progs 4.6.1, dropbox running and mount > option compress=lzo
This is the same thing as with dedupe: the kernel requires you to have the file opened for writing despite there being no direct reasons for this. Defragging is not a write operation in POSIX sense: it doesn't alter the file's contents in any way. I think it'd be good to relax this requirement to check whether the user _could_ open the file for writing (ie, cap or w permissions). -- An imaginary friend squared is a real enemy. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html