From: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <yuchao0@huawei.com>,
linux-f2fs-devel@lists.sourceforge.net
Cc: Damien Le Moal <Damien.LeMoal@wdc.com>
Subject: [f2fs-dev] [PATCH v6 0/8] fsck: Check write pointers of zoned block devices
Date: Mon, 28 Oct 2019 15:55:04 +0900 [thread overview]
Message-ID: <20191028065512.27876-1-shinichiro.kawasaki@wdc.com> (raw)
On sudden f2fs shutdown, zoned block device status and f2fs meta data can be
inconsistent. When f2fs shutdown happens during write operations, write pointers
on the device go forward but the f2fs meta data does not reflect the write
pointer progress. This inconsistency will eventually cause "Unaligned write
command" error when restarting write operation after the next mount.
This error is observed with xfstests test case generic/388, which enforces
sudden shutdown during write operation and checks the file system recovery.
This patch series adds a feature to fsck.f2fs to check and fix the
inconsistency. Per discussion on the list, implement two checks. The first check
is for open zones that current segments point to. Check write pointer
consistency with current segment positions recorded in CP, and if they are
inconsistent, assign a new zone to the current segment. The second check is for
non-open zones that current segments do not point to. Check write pointer
consistency with valid block maps recorded in SIT.
Reflect fsync data blocks in these checks. If fsync data exists and current
segments point to zones with fsync data, keep the fsync data and the current
segments untouched so that kernel can recover the fsync data. Another patch
series for kernel is being posted to check and fix write pointer consistency
after fsync data recovery.
Have fsck check and fix the consistency twice. The first fix is at the beginning
of fsck so that write by fsck for fix do not fail with unaligned write command
error. The second fix is at the end of the fsck to reflect SIT valid block maps
updates by fsck.
The first three patches add three helper functions to call report zone and reset
zone commands to zoned block devices. Next three patches modify existing fsck
functions to meet zoned block devices' requirements. The last two patches add
the two checks for write pointer consistency.
Thank goes to Chao Yu for the detailed discussion on the list.
Changes from v5:
* 1st-3rd patch: Reflected review comments on helper functions
* 8th patch: Ensure zones are in main segments and removed errno print
Changes from v4:
* Renewed the series based on design discussion on the list
Changes from v3:
* Set curseg position at a new zone start when its write pointer is at zone end
Changes from v2:
* Reflected review comments by Chao Yu
* Dropped 4th patch and 2nd patch (2nd patch was required for the 4th patch)
Changes from v1:
* Fixed build failure on dev branch
Shin'ichiro Kawasaki (8):
libf2fs_zoned: Introduce f2fs_report_zones() helper function
libf2fs_zoned: Introduce f2fs_report_zone() helper function
libf2fs_zoned: Introduce f2fs_reset_zone() helper function
fsck: Find free zones instead of blocks to assign to current segments
fsck: Introduce move_one_curseg_info() function
fsck: Check fsync data always for zoned block devices
fsck: Check write pointer consistency of open zones
fsck: Check write pointer consistency of non-open zones
fsck/defrag.c | 2 +-
fsck/f2fs.h | 5 +
fsck/fsck.c | 273 ++++++++++++++++++++++++++++++++++++++++++++
fsck/fsck.h | 11 +-
fsck/main.c | 2 +
fsck/mount.c | 137 +++++++++++++++-------
fsck/segment.c | 4 +-
include/f2fs_fs.h | 7 ++
lib/libf2fs_zoned.c | 124 +++++++++++++++++++-
9 files changed, 519 insertions(+), 46 deletions(-)
--
2.21.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next reply other threads:[~2019-10-28 7:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-28 6:55 Shin'ichiro Kawasaki [this message]
2019-10-28 6:55 ` [f2fs-dev] [PATCH v6 1/8] libf2fs_zoned: Introduce f2fs_report_zones() helper function Shin'ichiro Kawasaki
2019-10-28 6:55 ` [f2fs-dev] [PATCH v6 2/8] libf2fs_zoned: Introduce f2fs_report_zone() " Shin'ichiro Kawasaki
2019-10-28 6:55 ` [f2fs-dev] [PATCH v6 3/8] libf2fs_zoned: Introduce f2fs_reset_zone() " Shin'ichiro Kawasaki
2019-10-28 6:55 ` [f2fs-dev] [PATCH v6 4/8] fsck: Find free zones instead of blocks to assign to current segments Shin'ichiro Kawasaki
2019-10-28 6:55 ` [f2fs-dev] [PATCH v6 5/8] fsck: Introduce move_one_curseg_info() function Shin'ichiro Kawasaki
2019-10-28 6:55 ` [f2fs-dev] [PATCH v6 6/8] fsck: Check fsync data always for zoned block devices Shin'ichiro Kawasaki
2019-10-28 6:55 ` [f2fs-dev] [PATCH v6 7/8] fsck: Check write pointer consistency of open zones Shin'ichiro Kawasaki
2019-11-05 11:06 ` Chao Yu
2019-11-06 9:45 ` Shinichiro Kawasaki
2019-11-11 3:14 ` Chao Yu
2019-11-13 1:44 ` Shinichiro Kawasaki
2019-10-28 6:55 ` [f2fs-dev] [PATCH v6 8/8] fsck: Check write pointer consistency of non-open zones Shin'ichiro Kawasaki
2019-11-05 11:32 ` Chao Yu
2019-11-06 9:49 ` Shinichiro Kawasaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191028065512.27876-1-shinichiro.kawasaki@wdc.com \
--to=shinichiro.kawasaki@wdc.com \
--cc=Damien.LeMoal@wdc.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=yuchao0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).