Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dsync: Speed up timestamp and metadata updates
This change speeds up the last stage in dsync, i.e. updating timestamps on newly copied files. Before this change, the mfu_flist_file_sync_meta function has to walk through all files that have common existence in both source and destination to check for difference in metadata (uid, gid, perm, atime, and mtime), then update the destination to match the source accordingly. For large directory, metadata refresh spends a lot of cycle time for a second walk through all the files. As noted in dsync.c, this is not efficient, especially if only a very small number of files require metadata update. This change updates dsync to leverage on existing dsync_compare_metadata function do an earlier check on the metadata (uid, gid and perm, atime, mtime) right after the first walk, and include only those that show DCMPS_DIFFER state (in either of DCMPF_UID, DCMPF_GID, DCMPF_MTIME, DCMPF_ATIME or DCMPF_PERM field) to the metadata_refresh array. Thus, the mfu_flist_file_sync_meta function only needs to check and update as necessary on a subset of files, instead of all the files again. Signed-off-by: Honwai Leong <hleong@ddn.com>
- Loading branch information