* Re: [f2fs-dev] [PATCH 1/1] fsck.f2fs: check total_segments from devices in raw_super
[not found] <20190923042459.39377-1-sunqiuyang@huawei.com>
@ 2019-09-23 7:06 ` Chao Yu
0 siblings, 0 replies; only message in thread
From: Chao Yu @ 2019-09-23 7:06 UTC (permalink / raw)
To: sunqiuyang; +Cc: jaegeuk, linux-f2fs-devel
+Cc f2fs mailing list
On 2019/9/23 12:24, sunqiuyang wrote:
> From: Qiuyang Sun <sunqiuyang@huawei.com>
>
> For multi-device F2FS, we should check if the sum of total_segments from
> all devices matches segment_count.
>
> Signed-off-by: Qiuyang Sun <sunqiuyang@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Thanks,
> ---
> fsck/mount.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/fsck/mount.c b/fsck/mount.c
> index 4814dfe..7d268e3 100644
> --- a/fsck/mount.c
> +++ b/fsck/mount.c
> @@ -782,6 +782,21 @@ int sanity_check_raw_super(struct f2fs_super_block *sb, enum SB_ADDR sb_addr)
> return 1;
> }
>
> + if (sb->devs[0].path[0]) {
> + unsigned int dev_segs = le32_to_cpu(sb->devs[0].total_segments);
> + int i = 1;
> +
> + while (i < MAX_DEVICES && sb->devs[i].path[0]) {
> + dev_segs += le32_to_cpu(sb->devs[i].total_segments);
> + i++;
> + }
> + if (segment_count != dev_segs) {
> + MSG(0, "Segment count (%u) mismatch with total segments from devices (%u)",
> + segment_count, dev_segs);
> + return 1;
> + }
> + }
> +
> if (secs_per_zone > total_sections || !secs_per_zone) {
> MSG(0, "Wrong secs_per_zone / total_sections (%u, %u)\n",
> secs_per_zone, total_sections);
>
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-09-23 7:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20190923042459.39377-1-sunqiuyang@huawei.com>
2019-09-23 7:06 ` [f2fs-dev] [PATCH 1/1] fsck.f2fs: check total_segments from devices in raw_super Chao Yu
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).