btrfs: always pass readahead state to defrag
authorDavid Sterba <dsterba@suse.com>
Tue, 27 Aug 2024 02:26:51 +0000 (04:26 +0200)
committerDavid Sterba <dsterba@suse.com>
Tue, 10 Sep 2024 14:51:20 +0000 (16:51 +0200)
commitdf2825e98507d10cb037a308087ecd7cb3f6688d
tree31c3fc60e3e44b7f9f5941dfca85fd520c303096
parent11e3107d47cb266a284169f36c2293af3f397fdb
btrfs: always pass readahead state to defrag

Defrag ioctl passes readahead from the file, but autodefrag does not
have a file so the readahead state is allocated when needed.

The autodefrag loop in cleaner thread iterates over inodes so we can
simply provide an on-stack readahead state and will not need to allocate
it in btrfs_defrag_file(). The size is 32 bytes which is acceptable.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/defrag.c