]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: send: keep the current inode open while processing it
authorFilipe Manana <fdmanana@suse.com>
Thu, 5 May 2022 17:16:14 +0000 (18:16 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 16 May 2022 15:17:33 +0000 (17:17 +0200)
commit26baf71cac95933c44ea870a9ffe6cf5f16ff528
tree969c9ea9f5ca59ca6432145427fa97387259b2f6
parent37b562d495cf0c3e32c708713529cb5e731a4f08
btrfs: send: keep the current inode open while processing it

Every time we send a write command, we open the inode, read some data to
a buffer and then close the inode. The amount of data we read for each
write command is at most 48K, returned by max_send_read_size(), and that
corresponds to: BTRFS_SEND_BUF_SIZE - 16K = 48K. In practice this does
not add any significant overhead, because the time elapsed between every
close (iput()) and open (btrfs_iget()) is very short, so the inode is kept
in the VFS's cache after the iput() and it's still there by the time we
do the next btrfs_iget().

As between processing extents of the current inode we don't do anything
else, it makes sense to keep the inode open after we process its first
extent that needs to be sent and keep it open until we start processing
the next inode. This serves to facilitate the next change, which aims
to avoid having send operations trash the page cache with data extents.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/send.c