Re: [PATCH 5.11 070/104] f2fs: handle unallocated section and zone on pinned/atgc

From: Pavel Machek
Date: Fri Mar 05 2021 - 07:56:41 EST


Hi!

> [ Upstream commit 632faca72938f9f63049e48a8c438913828ac7a9 ]
>
> If we have large section/zone, unallocated segment makes them corrupted.
>
> E.g.,
>
> - Pinned file: -1 119304647 119304647
> - ATGC data: -1 119304647 119304647

Ok.

> +++ b/fs/f2fs/segment.h
> @@ -101,11 +101,11 @@ static inline void sanity_check_seg_type(struct f2fs_sb_info *sbi,
> #define BLKS_PER_SEC(sbi) \
> ((sbi)->segs_per_sec * (sbi)->blocks_per_seg)
> #define GET_SEC_FROM_SEG(sbi, segno) \
> - ((segno) / (sbi)->segs_per_sec)
> + (((segno) == -1) ? -1: (segno) / (sbi)->segs_per_sec)

But now we have macro that evaluates its argument two times, and we
have users passing non-trivial arguments to it. Should these become
inline functions?

fs/f2fs/segment.h: return GET_SEC_FROM_SEG(sbi, (unsigned int)reserved_segments(sbi));

Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Attachment: signature.asc
Description: Digital signature