An asynchronous implementation of DISCARD is presented for Btrfs

For btrfs file system represented asynchronous implementation of the DISCARD operation (marking released blocks that no longer need to be physically stored), implemented by Facebook engineers.

The essence of the problem: in the original implementation, DISCARD is executed synchronously with other operations, which in some cases leads to performance problems, since the drives have to wait for the corresponding commands to complete, which requires additional time. This can be a problem if the drive's DISCARD implementation is slow.

With an asynchronous implementation, there is no need to wait for the drive to complete DISCARD during normal FS operation, which eliminates the problem by transferring this operation to the background. The presented implementation also performs some optimizations. For example, it waits some time out of concern that the block may soon be used in such a way that there is no point in executing the DISCARD procedure at all, and it also tries to merge regions before actually executing the DISCARD in order to reduce the total number of operations.

Source: opennet.ru

Add a comment