diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2020-12-23 22:44:25 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-07 14:18:59 +0300 |
commit | 7416ec5526b5af5e495f224299ba291ce09407f2 (patch) | |
tree | b1a2fb2713a764df7950446d4865edf9a4031aae | |
parent | b4759a52b8940dbbfc565c918a3893ecaeb5b134 (diff) | |
download | linux-7416ec5526b5af5e495f224299ba291ce09407f2.tar.xz |
f2fs: handle unallocated section and zone on pinned/atgc
[ 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
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | fs/f2fs/segment.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 9c2a55ad61bc..1f5db4cbc499 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -91,11 +91,11 @@ #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) #define GET_SEG_FROM_SEC(sbi, secno) \ ((secno) * (sbi)->segs_per_sec) #define GET_ZONE_FROM_SEC(sbi, secno) \ - ((secno) / (sbi)->secs_per_zone) + (((secno) == -1) ? -1: (secno) / (sbi)->secs_per_zone) #define GET_ZONE_FROM_SEG(sbi, segno) \ GET_ZONE_FROM_SEC(sbi, GET_SEC_FROM_SEG(sbi, segno)) |