Qu Wenruo 26fbac2517 btrfs: autodefrag: only scan one inode once
Although we have btrfs_requeue_inode_defrag(), for autodefrag we are
still just exhausting all inode_defrag items in the tree.

This means, it doesn't make much difference to requeue an inode_defrag,
other than scan the inode from the beginning till its end.

Change the behaviour to always scan from offset 0 of an inode, and till
the end.

By this we get the following benefit:

- Straight-forward code

- No more re-queue related check

- Fewer members in inode_defrag

We still keep the same btrfs_get_fs_root() and btrfs_iget() check for
each loop, and added extra should_auto_defrag() check per-loop.

Note: the patch needs to be backported and is intentionally written
to minimize the diff size, code will be cleaned up later.

CC: stable@vger.kernel.org # 5.16
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2022-02-23 17:55:01 +01:00
..
2021-09-02 09:21:27 -07:00
2022-01-07 14:18:26 +01:00
2022-01-07 14:18:23 +01:00
2021-06-22 14:11:57 +02:00
2021-06-22 14:11:57 +02:00
2022-01-07 14:18:26 +01:00
2022-01-07 14:18:23 +01:00
2022-02-09 18:53:26 +01:00
2021-10-29 12:38:43 +02:00
2022-01-07 14:18:26 +01:00
2022-01-07 14:18:26 +01:00
2022-01-07 14:18:26 +01:00
2021-11-08 16:55:21 -08:00