From: zhaowuyun via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: 'Chao Yu' <yuchao0@huawei.com>, linux-f2fs-devel@lists.sourceforge.net
Cc: jaegeuk@kernel.org
Subject: 答复: [PATCH v4 2/2] sload.f2fs: introduce f2fs_sparse_initialize_meta()
Date: Tue, 14 May 2019 20:17:41 +0800 [thread overview]
Message-ID: <000101d50a4f$071ec990$155c5cb0$@wingtech.com> (raw)
In-Reply-To: <20190506085806.62874-1-yuchao0@huawei.com>
Hi Chao,
using the same steps,
make the userdata partition dirty and fastboot-flash userdata.img to see the mount is successful or not
to test the patch, confirm that issue is fixed by this patch.
Hope to see it accepted.
Best Wishes,
Zac (zhaowuyun@wingtech.com)
>
> This patch fixes to initialize NAT/SIT/CP.payload region in sparse file mode for
> sload.
>
> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> ---
> - move initialize_meta() before do_umount().
> fsck/fsck.h | 1 +
> fsck/main.c | 4 +++
> fsck/mount.c | 70
> ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 75 insertions(+)
>
> diff --git a/fsck/fsck.h b/fsck/fsck.h
> index dd831de..4db14af 100644
> --- a/fsck/fsck.h
> +++ b/fsck/fsck.h
> @@ -181,6 +181,7 @@ extern int fsck_verify(struct f2fs_sb_info *); extern
> void fsck_free(struct f2fs_sb_info *); extern int f2fs_do_mount(struct
> f2fs_sb_info *); extern void f2fs_do_umount(struct f2fs_sb_info *);
> +extern int f2fs_sparse_initialize_meta(struct f2fs_sb_info *);
>
> extern void flush_journal_entries(struct f2fs_sb_info *); extern void
> zero_journal_entries(struct f2fs_sb_info *); diff --git a/fsck/main.c
> b/fsck/main.c index afdfec9..d844820 100644
> --- a/fsck/main.c
> +++ b/fsck/main.c
> @@ -813,6 +813,10 @@ fsck_again:
> if (do_sload(sbi))
> goto out_err;
>
> + ret = f2fs_sparse_initialize_meta(sbi);
> + if (ret < 0)
> + goto out_err;
> +
> f2fs_do_umount(sbi);
>
> /* fsck to fix missing quota */
> diff --git a/fsck/mount.c b/fsck/mount.c index 843742e..230f330 100644
> --- a/fsck/mount.c
> +++ b/fsck/mount.c
> @@ -2721,3 +2721,73 @@ void f2fs_do_umount(struct f2fs_sb_info *sbi)
> free(sbi->ckpt);
> free(sbi->raw_super);
> }
> +
> +#ifdef WITH_ANDROID
> +int f2fs_sparse_initialize_meta(struct f2fs_sb_info *sbi) {
> + struct f2fs_super_block *sb = sbi->raw_super;
> + u_int32_t sit_seg_count, sit_size;
> + u_int32_t nat_seg_count, nat_size;
> + u_int64_t sit_seg_addr, nat_seg_addr, payload_addr;
> + u_int32_t seg_size = 1 << get_sb(log_blocks_per_seg);
> + int ret;
> +
> + if (!c.sparse_mode)
> + return 0;
> +
> + sit_seg_addr = get_sb(sit_blkaddr);
> + sit_seg_count = get_sb(segment_count_sit);
> + sit_size = sit_seg_count * seg_size;
> +
> + DBG(1, "\tSparse: filling sit area at block offset: 0x%08"PRIx64"
> len: %u\n",
> + sit_seg_addr,
> sit_size);
> + ret = dev_fill(NULL, sit_seg_addr * F2FS_BLKSIZE,
> + sit_size * F2FS_BLKSIZE);
> + if (ret) {
> + MSG(1, "\tError: While zeroing out the sit area "
> + "on disk!!!\n");
> + return -1;
> + }
> +
> + nat_seg_addr = get_sb(nat_blkaddr);
> + nat_seg_count = get_sb(segment_count_nat);
> + nat_size = nat_seg_count * seg_size;
> +
> + DBG(1, "\tSparse: filling nat area at block offset 0x%08"PRIx64"
> len: %u\n",
> + nat_seg_addr,
> nat_size);
> + ret = dev_fill(NULL, nat_seg_addr * F2FS_BLKSIZE,
> + nat_size * F2FS_BLKSIZE);
> + if (ret) {
> + MSG(1, "\tError: While zeroing out the nat area "
> + "on disk!!!\n");
> + return -1;
> + }
> +
> + payload_addr = get_sb(segment0_blkaddr) + 1;
> +
> + DBG(1, "\tSparse: filling bitmap area at block offset 0x%08"PRIx64"
> len: %u\n",
> + payload_addr, get_sb(cp_payload));
> + ret = dev_fill(NULL, payload_addr * F2FS_BLKSIZE,
> + get_sb(cp_payload) * F2FS_BLKSIZE);
> + if (ret) {
> + MSG(1, "\tError: While zeroing out the nat/sit bitmap area "
> + "on disk!!!\n");
> + return -1;
> + }
> +
> + payload_addr += seg_size;
> +
> + DBG(1, "\tSparse: filling bitmap area at block offset 0x%08"PRIx64"
> len: %u\n",
> + payload_addr, get_sb(cp_payload));
> + ret = dev_fill(NULL, payload_addr * F2FS_BLKSIZE,
> + get_sb(cp_payload) * F2FS_BLKSIZE);
> + if (ret) {
> + MSG(1, "\tError: While zeroing out the nat/sit bitmap area "
> + "on disk!!!\n");
> + return -1;
> + }
> + return 0;
> +}
> +#else
> +int f2fs_sparse_initialize_meta(struct f2fs_sb_info *sbi) { return 0; }
> +#endif
> --
> 2.18.0.rc1
prev parent reply other threads:[~2019-05-14 12:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-06 8:58 [PATCH v4 2/2] sload.f2fs: introduce f2fs_sparse_initialize_meta() Chao Yu
2019-05-14 12:17 ` zhaowuyun via Linux-f2fs-devel [this message]
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='000101d50a4f$071ec990$155c5cb0$@wingtech.com' \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=jaegeuk@kernel.org \
--cc=yuchao0@huawei.com \
--cc=zhaowuyun@wingtech.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).