This is an experimental patchset which adds new ioctl commands for finding differences between two checkpoints (snapshots) efficiently. One of the commands is NILFS_IOCTL_COMPARE_CHECKPOINTS and another is NILFS_IOCTL_INO_LOOKUP. The NILFS_IOCTL_COMPARE_CHECKPOINT command enumerates changed inodes between two checkpoints. It compares two versions of b-trees managing blocks of "ifile" instead of traversing namespace and comparing all pairs of inodes. It gathers up inode numbers of changed inodes, but it's not efficient to find a pathname of inode at userspace from its inode number. So, the NILFS_IOCTL_INO_LOOKUP command is included to make it faster and easier -- it makes up a pathname of an inode in the past filesystem tree searching directories bottom up. With this api, users or tools can know which inodes were changed, created, or deleted and how they were modified. This is intended to be used for online backup, realtime remote replication, or quickly rebuilding search index against numerous versions of a filesystem provided by nilfs. Kernel already has some notification mechanisms for these purposes, but they don't suit for extract changes later on. A utility program for examining these ioctl commands is available on "diff" branch of the following git tree: http://git.nilfs.org/nilfs2-utils-devel.git It experimentally adds "nilfs-diff" program to nilfs-utils. The usage of this program is as follows: # nilfs-diff [option] [device] cno1..cno2 "nilfs-diff" displays appended files or directories as below: + /aaa/bbb + /aaa/bbb/ccc Deleted files are displayed like: - /aaa/xxx Modified or moved files are: M /aaa/bbb/file-000.txt R /aaa/bbb/file-123.txt -> /aaa/file-123.txt Unfortunately, the NILFS_IOCTL_INO_LOOKUP command needs disk format change since it has to keep parent inode numbers for each on-disk inode. This patchset uses an unused pad field in disk inode, so this feature is only available for new filesystems created with updated mkfs.nilfs2 tool. In addition, this patchset has a few important limitations and does not suit for practical use. First, hard links are not supported (only one parent inode number is recorded in an inode). And, inode number of parent inodes are truncated to 32-bit width from the original 64-bit value when being stored to disk. So, this is very experimetal, and I have no plan to send them upstream at this moment. To make it practical, parent inode number should be recorded in disk more nicely. I guess a disk format change would be necessary for that. If anyone have comments, please let me know. Thanks, Ryusuke Konishi -- Ryusuke Konishi (9): nilfs2: add separable lookup routines to direct/btree mappings nilfs2: add comparison function of two block mappings nilfs2: add helper functions to get type of blocks on ifile nilfs2: add ifile method to find and get modified inodes nilfs2: add ioctl to compare two checkpoints and get their changes nilfs2: store parent inode number in disk inode nilfs2: add routine to find directory entry from inode number nilfs2: add pathname lookup routine from inode number nilfs2: add ioctl to lookup pathname of inode fs/nilfs2/alloc.c | 35 ++++++++- fs/nilfs2/alloc.h | 10 +++ fs/nilfs2/bmap.c | 154 +++++++++++++++++++++++++++++++++++++ fs/nilfs2/bmap.h | 20 +++++ fs/nilfs2/btree.c | 134 ++++++++++++++++++++++++++++++++ fs/nilfs2/dir.c | 60 +++++++++++++++ fs/nilfs2/direct.c | 49 ++++++++++++ fs/nilfs2/ifile.c | 184 +++++++++++++++++++++++++++++++++++++++++++++ fs/nilfs2/ifile.h | 20 +++++ fs/nilfs2/inode.c | 131 +++++++++++++++++++++++++++++++- fs/nilfs2/ioctl.c | 135 +++++++++++++++++++++++++++++++++ fs/nilfs2/namei.c | 97 ++++++++++++++++++++++++ fs/nilfs2/nilfs.h | 14 ++++ fs/nilfs2/super.c | 49 ++++++++++++ include/linux/nilfs2_fs.h | 64 +++++++++++++++- 15 files changed, 1148 insertions(+), 8 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html