]> asedeno.scripts.mit.edu Git - linux.git/commit
f2fs: Check write pointer consistency of non-open zones
authorShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Mon, 9 Dec 2019 10:44:45 +0000 (19:44 +0900)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 15 Jan 2020 21:43:48 +0000 (13:43 -0800)
commitd508c94e45fcd3421e64f556abb1cf145ccc0e8f
treefd694392563641e8b11e23eb17a3f29ceb9f3778
parentc426d99127b1ab797f4cc355b18d77288978b2f2
f2fs: Check write pointer consistency of non-open zones

To catch f2fs bugs in write pointer handling code for zoned block
devices, check write pointers of non-open zones that current segments do
not point to. Do this check at mount time, after the fsync data recovery
and current segments' write pointer consistency fix. Or when fsync data
recovery is disabled by mount option, do the check when there is no fsync
data.

Check two items comparing write pointers with valid block maps in SIT.
The first item is check for zones with no valid blocks. When there is no
valid blocks in a zone, the write pointer should be at the start of the
zone. If not, next write operation to the zone will cause unaligned write
error. If write pointer is not at the zone start, reset the write pointer
to place at the zone start.

The second item is check between the write pointer position and the last
valid block in the zone. It is unexpected that the last valid block
position is beyond the write pointer. In such a case, report as a bug.
Fix is not required for such zone, because the zone is not selected for
next write operation until the zone get discarded.

Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/segment.c
fs/f2fs/super.c