Re: [PATCH v5 05/11] btrfs: defrag: introduce a new helper to collect target file extents
From: David Sterba <hidden>
Date: 2021-08-23 19:11:55
From: David Sterba <hidden>
Date: 2021-08-23 19:11:55
On Fri, Aug 06, 2021 at 04:12:36PM +0800, Qu Wenruo wrote:
Introduce a new helper, defrag_collect_targets(), to collect all possible targets to be defragged. This function will not consider things like max_sectors_to_defrag, thus caller should be responsible to ensure we don't exceed the limit. This function will be the first stage of later defrag rework. Signed-off-by: Qu Wenruo <redacted> --- fs/btrfs/ioctl.c | 120 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+)diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index c0639780f99c..043c44daa5ae 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c@@ -1427,6 +1427,126 @@ static int cluster_pages_for_defrag(struct inode *inode, } +struct defrag_target_range { + struct list_head list; + u64 start; + u64 len; +}; + +/* + * Helper to collect all valid target extents.
Please use wording like "Collect all the valid ...", ie. drop any "This function does ..." or "Helper to do ..."