4 ms·
Can Java be used to access the FIEMAP or at least inode information to apply this technique in Java software?
by eMGm4D0zgUAVXc7 6y ago
Can Java be used to access the FIEMAP or at least inode information to apply this technique in Java software?
- the8472 6y agoYou can get the inode number with java SE APIs, but not in the way that's necessary to gain performance. On linux you want it during directory iteration from the getdents syscall because that doesn't require opening the file or even grabbing its metadata, just reading the directory entries is enough. If you obtain the inode number by fetching the metadata you're already accessing the inode, defeating a part of the optimization. Maybe there are libraries that will do that. Or if not, project panama will make it easier to just call the relevant libc function.
- pkolaczk 6y ago> If you obtain the inode number by fetching the metadata you're already accessing the inode, defeating a part of the optimization Actually this is what fclones does, because it needs other metadata of the file as well (e.g. its length). I've found fetching metadata is lot faster than reading anything from a file, so most of the gains of this optimization are still there.
- the8472 6y agoThen this should work in java long ino = (Long)Files.getAttribute(file, "unix:ino");
- eMGm4D0zgUAVXc7 6y agoThanks! :) Will use it!