Re: [PATCH v3 1/2] btrfs: defrag: bring back the old file extent search behavior

Qu Wenruo
2022-02-22T00:05:15Z

On 2022/2/22 01:22, David Sterba wrote:
> On Tue, Feb 15, 2022 at 08:02:35AM +0800, Qu Wenruo wrote:
>>
>>
>> On 2022/2/15 00:15, David Sterba wrote:
>>> On Fri, Feb 11, 2022 at 02:46:12PM +0800, Qu Wenruo wrote:
>>>> @@ -1216,7 +1367,8 @@ static int defrag_collect_targets(struct btrfs_inode *inode,
>>>> u64 range_len;
>>>>
>>>> last_is_target = false;
>>>> - em = defrag_lookup_extent(&inode->vfs_inode, cur, locked);
>>>> + em = defrag_lookup_extent(&inode->vfs_inode, cur,
>>>> + ctrl->newer_than, locked);
>>>
>>> This uses the ctrl structure, if this is also supposed to go to 5.16
>>> please provide a version that applies, thanks.
>>>
>>
>> The conflicts are already smaller enough for this patchset and later
>> autodefrag work.
>>
>> I can easily do a manual backport for v5.16.
>
> So the change is to use newer_than instead of ctrl->newer_then, right?
> I'll use that so it does not depend on the ctrl patches.

Yes. But please keep in mind that there are some special hacks used in
the original btrfs_ioctl_defrag_range_args uses its @start as
btrfs_defrag_ctrl::last_scanned.

Which sometimes can be confusing for autodefrag fixes.

Thanks,
Qu