[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8f8e4695-4062-60c4-0f91-2a1f6a5b0a11@kernel.org>
Date: Sat, 4 Sep 2021 11:33:20 +0800
From: Chao Yu <chao@...nel.org>
To: Daeho Jeong <daeho43@...il.com>
Cc: linux-kernel@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net, kernel-team@...roid.com,
Daeho Jeong <daehojeong@...gle.com>
Subject: Re: [f2fs-dev] [PATCH v4] f2fs: introduce fragment allocation mode
mount option
On 2021/9/4 4:33, Daeho Jeong wrote:
>> if (f2fs_need_seq_seg(sbi))
>> return 0;
>>
>> static inline bool f2fs_need_seq_seg(struct f2fs_sb_info *sbi)
>> {
>> return F2FS_OPTION(sbi).fs_mode == FS_MODE_FRAGMENT_FIXED_BLK;
>> }
>>
>
> Do you need this in select_policy(), either?
IMO, for this mode, I prefer to disable background GC and just use newly
written userdata to fragment image, so I think it's fine to keep it as it is
here.
> Like,
> if (f2fs_need_rand_seg(sbi))
> p->offset = prandom_u32() % (MAIN_SECS(sbi) *
> sbi->segs_per_sec);
> else if (f2fs_need_seq_seg(sbi))
> p->offset = 0;
>
>> One more concern... we'd better to save fragment_remained_hole as well
>> as fragment_remained_chunk, otherwise, if fragment_chunk_size +
>> fragment_hole_size > 512, fragment hole will be truncated to 512 -
>> fragment_chunk_size due to we won't create hole with enough size as
>> seg->next_blkoff has crossed end of current segment.
>>
>
> Sorry, I don't get it. You mean making fragment_remained_hole as a
> global variable?
As a per curseg field.
> Maybe, we run into the same race condition issue you told before for
> fragment_remained_chunk.
> Could you clarify this more?
e.g.
F2FS_OPTION(sbi).fs_mode = FS_MODE_FRAGMENT_FIXED_BLK
fragment_chunk_size = 384
fragment_hole_size = 384
When creating hole:
- f2fs_allocate_data_block
- __refresh_next_blkoff
chunk locates in [0, 383] of current segment
seg->next_blkoff = 384
sbi->fragment_remained_chunk = 0
then we will reset sbi->fragment_remained_chunk to 384
and move seg->next_blkoff forward to 768 (384 + 384)
- __has_curseg_space() returns false
- allocate_segment() allocates new current segment
So, for such case that hole may cross two segments, hole size may be truncated
to left size of previous segment.
Thanks,
>
> Thanks,
>
Powered by blists - more mailing lists