In f2fs_migrate_blocks(), when traversing blocks in last section,
blkofs_end should be (start_blk + blkcnt - 1) % blk_per_sec, fix it.
Signed-off-by: Chao Yu <[email protected]>
---
fs/f2fs/data.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index c21b92f18463..0c728e82d936 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -3841,13 +3841,14 @@ static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk,
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
unsigned int blkofs;
unsigned int blk_per_sec = BLKS_PER_SEC(sbi);
+ unsigned int end_blk = start_blk + blkcnt - 1;
unsigned int secidx = start_blk / blk_per_sec;
unsigned int end_sec;
int ret = 0;
if (!blkcnt)
return 0;
- end_sec = secidx + (blkcnt - 1) / blk_per_sec;
+ end_sec = end_blk / blk_per_sec;
f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
filemap_invalidate_lock(inode->i_mapping);
@@ -3857,7 +3858,7 @@ static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk,
for (; secidx <= end_sec; secidx++) {
unsigned int blkofs_end = secidx == end_sec ?
- (blkcnt - 1) % blk_per_sec : blk_per_sec - 1;
+ end_blk % blk_per_sec : blk_per_sec - 1;
f2fs_down_write(&sbi->pin_sem);
--
2.40.1
This patch exchangs position of f2fs_precache_extents() and
filemap_fdatawrite(), so that f2fs_precache_extents() can load
extent info after physical addresses of all data are fixed.
Signed-off-by: Chao Yu <[email protected]>
---
fs/f2fs/data.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 0c728e82d936..bd8674bf1d84 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -4045,12 +4045,12 @@ static int f2fs_swap_activate(struct swap_info_struct *sis, struct file *file,
if (!f2fs_disable_compressed_file(inode))
return -EINVAL;
- f2fs_precache_extents(inode);
-
ret = filemap_fdatawrite(inode->i_mapping);
if (ret < 0)
return ret;
+ f2fs_precache_extents(inode);
+
ret = check_swap_activate(sis, file, span);
if (ret < 0)
return ret;
--
2.40.1
Move f2fs_valid_pinned_area() check logic from new_curseg() to
get_new_segment(), it can avoid calling __set_free() if it fails
to find free segment in conventional zone for pinned file.
Signed-off-by: Chao Yu <[email protected]>
---
fs/f2fs/segment.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 847fe0b7f29f..c159b0985596 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2715,12 +2715,19 @@ static int get_new_segment(struct f2fs_sb_info *sbi,
got_it:
/* set it as dirty segment in free segmap */
f2fs_bug_on(sbi, test_bit(segno, free_i->free_segmap));
+
+ /* no free section in conventional zone */
+ if (new_sec && pinning &&
+ !f2fs_valid_pinned_area(sbi, START_BLOCK(sbi, segno))) {
+ ret = -EAGAIN;
+ goto out_unlock;
+ }
__set_inuse(sbi, segno);
*newseg = segno;
out_unlock:
spin_unlock(&free_i->segmap_lock);
- if (ret) {
+ if (ret == -ENOSPC) {
f2fs_stop_checkpoint(sbi, false, STOP_CP_REASON_NO_SEGMENT);
f2fs_bug_on(sbi, 1);
}
@@ -2796,19 +2803,17 @@ static int new_curseg(struct f2fs_sb_info *sbi, int type, bool new_sec)
struct curseg_info *curseg = CURSEG_I(sbi, type);
unsigned int segno = curseg->segno;
bool pinning = type == CURSEG_COLD_DATA_PINNED;
+ int ret;
if (curseg->inited)
write_sum_page(sbi, curseg->sum_blk, GET_SUM_BLOCK(sbi, segno));
segno = __get_next_segno(sbi, type);
- if (get_new_segment(sbi, &segno, new_sec, pinning)) {
- curseg->segno = NULL_SEGNO;
- return -ENOSPC;
- }
- if (new_sec && pinning &&
- !f2fs_valid_pinned_area(sbi, START_BLOCK(sbi, segno))) {
- __set_free(sbi, segno);
- return -EAGAIN;
+ ret = get_new_segment(sbi, &segno, new_sec, pinning);
+ if (ret) {
+ if (ret == -ENOSPC)
+ curseg->segno = NULL_SEGNO;
+ return ret;
}
curseg->next_segno = segno;
--
2.40.1
In f2fs_allocate_data_block(), before skip allocating new segment
for DATA_PINNED log header, it needs to tag log header as unloaded
one to avoid skipping logic in locate_dirty_segment() and
__f2fs_save_inmem_curseg().
Signed-off-by: Chao Yu <[email protected]>
---
fs/f2fs/segment.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index c159b0985596..5e45afd69f3f 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -3101,12 +3101,16 @@ static int __allocate_new_segment(struct f2fs_sb_info *sbi, int type,
struct curseg_info *curseg = CURSEG_I(sbi, type);
unsigned int old_segno;
+ if (type == CURSEG_COLD_DATA_PINNED && !curseg->inited)
+ goto allocate;
+
if (!force && curseg->inited &&
!curseg->next_blkoff &&
!get_valid_blocks(sbi, curseg->segno, new_sec) &&
!get_ckpt_valid_blocks(sbi, curseg->segno, new_sec))
return 0;
+allocate:
old_segno = curseg->segno;
if (new_curseg(sbi, type, true))
return -EAGAIN;
@@ -3451,6 +3455,13 @@ static void f2fs_randomize_chunk(struct f2fs_sb_info *sbi,
get_random_u32_inclusive(1, sbi->max_fragment_hole);
}
+static void reset_curseg_fields(struct curseg_info *curseg)
+{
+ curseg->inited = false;
+ curseg->segno = NULL_SEGNO;
+ curseg->next_segno = 0;
+}
+
int f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
block_t old_blkaddr, block_t *new_blkaddr,
struct f2fs_summary *sum, int type,
@@ -3516,8 +3527,10 @@ int f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
*/
if (segment_full) {
if (type == CURSEG_COLD_DATA_PINNED &&
- !((curseg->segno + 1) % sbi->segs_per_sec))
+ !((curseg->segno + 1) % sbi->segs_per_sec)) {
+ reset_curseg_fields(curseg);
goto skip_new_segment;
+ }
if (from_gc) {
get_atssr_segment(sbi, type, se->type,
@@ -4595,9 +4608,7 @@ static int build_curseg(struct f2fs_sb_info *sbi)
array[i].seg_type = CURSEG_COLD_DATA;
else if (i == CURSEG_ALL_DATA_ATGC)
array[i].seg_type = CURSEG_COLD_DATA;
- array[i].segno = NULL_SEGNO;
- array[i].next_blkoff = 0;
- array[i].inited = false;
+ reset_curseg_fields(&array[i]);
}
return restore_curseg_summaries(sbi);
}
--
2.40.1
Jaegeuk, Daeho,
Any comments on this serials?
Thanks,
On 2024/2/26 9:32, Chao Yu wrote:
> In f2fs_migrate_blocks(), when traversing blocks in last section,
> blkofs_end should be (start_blk + blkcnt - 1) % blk_per_sec, fix it.
>
> Signed-off-by: Chao Yu <[email protected]>
> ---
> fs/f2fs/data.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index c21b92f18463..0c728e82d936 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -3841,13 +3841,14 @@ static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk,
> struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> unsigned int blkofs;
> unsigned int blk_per_sec = BLKS_PER_SEC(sbi);
> + unsigned int end_blk = start_blk + blkcnt - 1;
> unsigned int secidx = start_blk / blk_per_sec;
> unsigned int end_sec;
> int ret = 0;
>
> if (!blkcnt)
> return 0;
> - end_sec = secidx + (blkcnt - 1) / blk_per_sec;
> + end_sec = end_blk / blk_per_sec;
>
> f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
> filemap_invalidate_lock(inode->i_mapping);
> @@ -3857,7 +3858,7 @@ static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk,
>
> for (; secidx <= end_sec; secidx++) {
> unsigned int blkofs_end = secidx == end_sec ?
> - (blkcnt - 1) % blk_per_sec : blk_per_sec - 1;
> + end_blk % blk_per_sec : blk_per_sec - 1;
>
> f2fs_down_write(&sbi->pin_sem);
>
Reviewed-by: Daeho Jeong <[email protected]>
Thanks,
On Sun, Feb 25, 2024 at 5:33 PM Chao Yu <[email protected]> wrote:
>
> This patch exchangs position of f2fs_precache_extents() and
> filemap_fdatawrite(), so that f2fs_precache_extents() can load
> extent info after physical addresses of all data are fixed.
>
> Signed-off-by: Chao Yu <[email protected]>
> ---
> fs/f2fs/data.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 0c728e82d936..bd8674bf1d84 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -4045,12 +4045,12 @@ static int f2fs_swap_activate(struct swap_info_struct *sis, struct file *file,
> if (!f2fs_disable_compressed_file(inode))
> return -EINVAL;
>
> - f2fs_precache_extents(inode);
> -
> ret = filemap_fdatawrite(inode->i_mapping);
> if (ret < 0)
> return ret;
>
> + f2fs_precache_extents(inode);
> +
> ret = check_swap_activate(sis, file, span);
> if (ret < 0)
> return ret;
> --
> 2.40.1
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
On Thu, Feb 29, 2024 at 2:11 AM Chao Yu <[email protected]> wrote:
>
> Jaegeuk, Daeho,
>
> Any comments on this serials?
>
> Thanks,
No functional difference here, since start_blk is always aligned with
the section address.
However, this is more clear in itself.
Reviewed-by: Daeho Jeong <[email protected]>
Thanks,
>
> On 2024/2/26 9:32, Chao Yu wrote:
> > In f2fs_migrate_blocks(), when traversing blocks in last section,
> > blkofs_end should be (start_blk + blkcnt - 1) % blk_per_sec, fix it.
> >
> > Signed-off-by: Chao Yu <[email protected]>
> > ---
> > fs/f2fs/data.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index c21b92f18463..0c728e82d936 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -3841,13 +3841,14 @@ static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk,
> > struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> > unsigned int blkofs;
> > unsigned int blk_per_sec = BLKS_PER_SEC(sbi);
> > + unsigned int end_blk = start_blk + blkcnt - 1;
> > unsigned int secidx = start_blk / blk_per_sec;
> > unsigned int end_sec;
> > int ret = 0;
> >
> > if (!blkcnt)
> > return 0;
> > - end_sec = secidx + (blkcnt - 1) / blk_per_sec;
> > + end_sec = end_blk / blk_per_sec;
> >
> > f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
> > filemap_invalidate_lock(inode->i_mapping);
> > @@ -3857,7 +3858,7 @@ static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk,
> >
> > for (; secidx <= end_sec; secidx++) {
> > unsigned int blkofs_end = secidx == end_sec ?
> > - (blkcnt - 1) % blk_per_sec : blk_per_sec - 1;
> > + end_blk % blk_per_sec : blk_per_sec - 1;
> >
> > f2fs_down_write(&sbi->pin_sem);
> >
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Reviewed-by: Daeho Jeong <[email protected]>
Thanks,
On Sun, Feb 25, 2024 at 5:33 PM Chao Yu <[email protected]> wrote:
>
> In f2fs_allocate_data_block(), before skip allocating new segment
> for DATA_PINNED log header, it needs to tag log header as unloaded
> one to avoid skipping logic in locate_dirty_segment() and
> __f2fs_save_inmem_curseg().
>
> Signed-off-by: Chao Yu <[email protected]>
> ---
> fs/f2fs/segment.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index c159b0985596..5e45afd69f3f 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -3101,12 +3101,16 @@ static int __allocate_new_segment(struct f2fs_sb_info *sbi, int type,
> struct curseg_info *curseg = CURSEG_I(sbi, type);
> unsigned int old_segno;
>
> + if (type == CURSEG_COLD_DATA_PINNED && !curseg->inited)
> + goto allocate;
> +
> if (!force && curseg->inited &&
> !curseg->next_blkoff &&
> !get_valid_blocks(sbi, curseg->segno, new_sec) &&
> !get_ckpt_valid_blocks(sbi, curseg->segno, new_sec))
> return 0;
>
> +allocate:
> old_segno = curseg->segno;
> if (new_curseg(sbi, type, true))
> return -EAGAIN;
> @@ -3451,6 +3455,13 @@ static void f2fs_randomize_chunk(struct f2fs_sb_info *sbi,
> get_random_u32_inclusive(1, sbi->max_fragment_hole);
> }
>
> +static void reset_curseg_fields(struct curseg_info *curseg)
> +{
> + curseg->inited = false;
> + curseg->segno = NULL_SEGNO;
> + curseg->next_segno = 0;
> +}
> +
> int f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
> block_t old_blkaddr, block_t *new_blkaddr,
> struct f2fs_summary *sum, int type,
> @@ -3516,8 +3527,10 @@ int f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
> */
> if (segment_full) {
> if (type == CURSEG_COLD_DATA_PINNED &&
> - !((curseg->segno + 1) % sbi->segs_per_sec))
> + !((curseg->segno + 1) % sbi->segs_per_sec)) {
> + reset_curseg_fields(curseg);
> goto skip_new_segment;
> + }
>
> if (from_gc) {
> get_atssr_segment(sbi, type, se->type,
> @@ -4595,9 +4608,7 @@ static int build_curseg(struct f2fs_sb_info *sbi)
> array[i].seg_type = CURSEG_COLD_DATA;
> else if (i == CURSEG_ALL_DATA_ATGC)
> array[i].seg_type = CURSEG_COLD_DATA;
> - array[i].segno = NULL_SEGNO;
> - array[i].next_blkoff = 0;
> - array[i].inited = false;
> + reset_curseg_fields(&array[i]);
> }
> return restore_curseg_summaries(sbi);
> }
> --
> 2.40.1
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Reviewed-by: Daeho Jeong <[email protected]>
Thanks,
On Sun, Feb 25, 2024 at 5:33 PM Chao Yu <[email protected]> wrote:
>
> Move f2fs_valid_pinned_area() check logic from new_curseg() to
> get_new_segment(), it can avoid calling __set_free() if it fails
> to find free segment in conventional zone for pinned file.
>
> Signed-off-by: Chao Yu <[email protected]>
> ---
> fs/f2fs/segment.c | 23 ++++++++++++++---------
> 1 file changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 847fe0b7f29f..c159b0985596 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -2715,12 +2715,19 @@ static int get_new_segment(struct f2fs_sb_info *sbi,
> got_it:
> /* set it as dirty segment in free segmap */
> f2fs_bug_on(sbi, test_bit(segno, free_i->free_segmap));
> +
> + /* no free section in conventional zone */
> + if (new_sec && pinning &&
> + !f2fs_valid_pinned_area(sbi, START_BLOCK(sbi, segno))) {
> + ret = -EAGAIN;
> + goto out_unlock;
> + }
> __set_inuse(sbi, segno);
> *newseg = segno;
> out_unlock:
> spin_unlock(&free_i->segmap_lock);
>
> - if (ret) {
> + if (ret == -ENOSPC) {
> f2fs_stop_checkpoint(sbi, false, STOP_CP_REASON_NO_SEGMENT);
> f2fs_bug_on(sbi, 1);
> }
> @@ -2796,19 +2803,17 @@ static int new_curseg(struct f2fs_sb_info *sbi, int type, bool new_sec)
> struct curseg_info *curseg = CURSEG_I(sbi, type);
> unsigned int segno = curseg->segno;
> bool pinning = type == CURSEG_COLD_DATA_PINNED;
> + int ret;
>
> if (curseg->inited)
> write_sum_page(sbi, curseg->sum_blk, GET_SUM_BLOCK(sbi, segno));
>
> segno = __get_next_segno(sbi, type);
> - if (get_new_segment(sbi, &segno, new_sec, pinning)) {
> - curseg->segno = NULL_SEGNO;
> - return -ENOSPC;
> - }
> - if (new_sec && pinning &&
> - !f2fs_valid_pinned_area(sbi, START_BLOCK(sbi, segno))) {
> - __set_free(sbi, segno);
> - return -EAGAIN;
> + ret = get_new_segment(sbi, &segno, new_sec, pinning);
> + if (ret) {
> + if (ret == -ENOSPC)
> + curseg->segno = NULL_SEGNO;
> + return ret;
> }
>
> curseg->next_segno = segno;
> --
> 2.40.1
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
On 2024/3/1 1:41, Daeho Jeong wrote:
> On Thu, Feb 29, 2024 at 2:11 AM Chao Yu <[email protected]> wrote:
>>
>> Jaegeuk, Daeho,
>>
>> Any comments on this serials?
>>
>> Thanks,
>
> No functional difference here, since start_blk is always aligned with
> the section address.
You're right.
> However, this is more clear in itself.
Thanks for the review!
One more thing is, I found that fallocate() on pinned file will preallocate
aligned w/ section-size which is about several hundred megabyte for ZUFS case,
since commit e1175f022911 ("f2fs: fix to align to section for fallocate() on
pinned file").
It looks not make sense, especially for logcat case which actually want to
preallocate 2MB space, so, what about reverting commit e1175f022911 and
looking for other solution to avoid GCing on fragmented pinned file.
What do you think?
Thanks,
>
> Reviewed-by: Daeho Jeong <[email protected]>
>
> Thanks,
>
>>
>> On 2024/2/26 9:32, Chao Yu wrote:
>>> In f2fs_migrate_blocks(), when traversing blocks in last section,
>>> blkofs_end should be (start_blk + blkcnt - 1) % blk_per_sec, fix it.
>>>
>>> Signed-off-by: Chao Yu <[email protected]>
>>> ---
>>> fs/f2fs/data.c | 5 +++--
>>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>>> index c21b92f18463..0c728e82d936 100644
>>> --- a/fs/f2fs/data.c
>>> +++ b/fs/f2fs/data.c
>>> @@ -3841,13 +3841,14 @@ static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk,
>>> struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
>>> unsigned int blkofs;
>>> unsigned int blk_per_sec = BLKS_PER_SEC(sbi);
>>> + unsigned int end_blk = start_blk + blkcnt - 1;
>>> unsigned int secidx = start_blk / blk_per_sec;
>>> unsigned int end_sec;
>>> int ret = 0;
>>>
>>> if (!blkcnt)
>>> return 0;
>>> - end_sec = secidx + (blkcnt - 1) / blk_per_sec;
>>> + end_sec = end_blk / blk_per_sec;
>>>
>>> f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
>>> filemap_invalidate_lock(inode->i_mapping);
>>> @@ -3857,7 +3858,7 @@ static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk,
>>>
>>> for (; secidx <= end_sec; secidx++) {
>>> unsigned int blkofs_end = secidx == end_sec ?
>>> - (blkcnt - 1) % blk_per_sec : blk_per_sec - 1;
>>> + end_blk % blk_per_sec : blk_per_sec - 1;
>>>
>>> f2fs_down_write(&sbi->pin_sem);
>>>
>>
>>
>> _______________________________________________
>> Linux-f2fs-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
On 03/01, Chao Yu wrote:
> On 2024/3/1 1:41, Daeho Jeong wrote:
> > On Thu, Feb 29, 2024 at 2:11 AM Chao Yu <[email protected]> wrote:
> > >
> > > Jaegeuk, Daeho,
> > >
> > > Any comments on this serials?
> > >
> > > Thanks,
> >
> > No functional difference here, since start_blk is always aligned with
> > the section address.
>
> You're right.
>
> > However, this is more clear in itself.
>
> Thanks for the review!
>
> One more thing is, I found that fallocate() on pinned file will preallocate
> aligned w/ section-size which is about several hundred megabyte for ZUFS case,
> since commit e1175f022911 ("f2fs: fix to align to section for fallocate() on
> pinned file").
>
> It looks not make sense, especially for logcat case which actually want to
> preallocate 2MB space, so, what about reverting commit e1175f022911 and
> looking for other solution to avoid GCing on fragmented pinned file.
I remember we removed the logcat case.
>
> What do you think?
>
> Thanks,
>
> >
> > Reviewed-by: Daeho Jeong <[email protected]>
> >
> > Thanks,
> >
> > >
> > > On 2024/2/26 9:32, Chao Yu wrote:
> > > > In f2fs_migrate_blocks(), when traversing blocks in last section,
> > > > blkofs_end should be (start_blk + blkcnt - 1) % blk_per_sec, fix it.
> > > >
> > > > Signed-off-by: Chao Yu <[email protected]>
> > > > ---
> > > > fs/f2fs/data.c | 5 +++--
> > > > 1 file changed, 3 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > > > index c21b92f18463..0c728e82d936 100644
> > > > --- a/fs/f2fs/data.c
> > > > +++ b/fs/f2fs/data.c
> > > > @@ -3841,13 +3841,14 @@ static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk,
> > > > struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
> > > > unsigned int blkofs;
> > > > unsigned int blk_per_sec = BLKS_PER_SEC(sbi);
> > > > + unsigned int end_blk = start_blk + blkcnt - 1;
> > > > unsigned int secidx = start_blk / blk_per_sec;
> > > > unsigned int end_sec;
> > > > int ret = 0;
> > > >
> > > > if (!blkcnt)
> > > > return 0;
> > > > - end_sec = secidx + (blkcnt - 1) / blk_per_sec;
> > > > + end_sec = end_blk / blk_per_sec;
> > > >
> > > > f2fs_down_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
> > > > filemap_invalidate_lock(inode->i_mapping);
> > > > @@ -3857,7 +3858,7 @@ static int f2fs_migrate_blocks(struct inode *inode, block_t start_blk,
> > > >
> > > > for (; secidx <= end_sec; secidx++) {
> > > > unsigned int blkofs_end = secidx == end_sec ?
> > > > - (blkcnt - 1) % blk_per_sec : blk_per_sec - 1;
> > > > + end_blk % blk_per_sec : blk_per_sec - 1;
> > > >
> > > > f2fs_down_write(&sbi->pin_sem);
> > > >
> > >
> > >
> > > _______________________________________________
> > > Linux-f2fs-devel mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Hello:
This series was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:
On Mon, 26 Feb 2024 09:32:05 +0800 you wrote:
> In f2fs_migrate_blocks(), when traversing blocks in last section,
> blkofs_end should be (start_blk + blkcnt - 1) % blk_per_sec, fix it.
>
> Signed-off-by: Chao Yu <[email protected]>
> ---
> fs/f2fs/data.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Here is the summary with links:
- [f2fs-dev,1/4] f2fs: fix blkofs_end correctly in f2fs_migrate_blocks()
https://git.kernel.org/jaegeuk/f2fs/c/8249aac1b05c
- [f2fs-dev,2/4] f2fs: relocate f2fs_precache_extents() in f2fs_swap_activate()
https://git.kernel.org/jaegeuk/f2fs/c/f1e7646a8cd4
- [f2fs-dev,3/4] f2fs: clean up new_curseg()
https://git.kernel.org/jaegeuk/f2fs/c/1081b5121b27
- [f2fs-dev,4/4] f2fs: fix to reset fields for unloaded curseg
https://git.kernel.org/jaegeuk/f2fs/c/42a80aacb76b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html