btrfs: incremental send, improve rmdir performance for large directory
authorRobbie Ko <robbieko@synology.com>
Tue, 8 May 2018 10:11:38 +0000 (18:11 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 28 May 2018 16:07:32 +0000 (18:07 +0200)
commit0f96f517dcaa58346c32be094aecd610b7d3c008
treeb36856eb17e341312279dd093edc79eb3c5425ef
parent35c8eda12fc69e8a3f67c4615050ca4e76adec32
btrfs: incremental send, improve rmdir performance for large directory

Currently when checking if a directory can be deleted, we always check
if all its children have been processed.

Example: A directory with 2,000,000 files was deleted

original: 1994m57.071s
patch:       1m38.554s

[FIX]
Instead of checking all children on all calls to can_rmdir(), we keep
track of the directory index offset of the child last checked in the
last call to can_rmdir(), and then use it as the starting point for
future calls to can_rmdir().

Signed-off-by: Robbie Ko <robbieko@synology.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
[ update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/send.c