Message ID | 20230208212502.339427-1-jaegeuk@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [f2fs-dev] mkfs.f2fs: trim all the devices except the first one | expand |
On 2023/2/9 5:25, Jaegeuk Kim wrote: > We need to check the first disk only, and trim the other disks. I'm confused, why we don't need to trim first disk? Thanks, > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> > --- > mkfs/f2fs_format_utils.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/mkfs/f2fs_format_utils.c b/mkfs/f2fs_format_utils.c > index 597c2b3a7b1c..448fbaa8866e 100644 > --- a/mkfs/f2fs_format_utils.c > +++ b/mkfs/f2fs_format_utils.c > @@ -129,6 +129,10 @@ static bool is_wiped_device(int i) > int nblocks = 4096; /* 16MB size */ > int j; > > + /* let's trim the other devices except the first device */ > + if (i > 0) > + return false; > + > buf = malloc(F2FS_BLKSIZE); > if (buf == NULL) { > MSG(1, "\tError: Malloc Failed for buf!!!\n");
On 02/13, Chao Yu wrote: > On 2023/2/9 5:25, Jaegeuk Kim wrote: > > We need to check the first disk only, and trim the other disks. > > I'm confused, why we don't need to trim first disk? dd9c372646ed ("mkfs.f2fs: check zeros in first 16MB for Android") - We actually don't need to issue trim on entire disk by checking first blocks having zeros. This is what Android checks when to decide format as we expect the first disk was supposed to have a written superblock. That's not for secondary disk and so on. > > Thanks, > > > > > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> > > --- > > mkfs/f2fs_format_utils.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/mkfs/f2fs_format_utils.c b/mkfs/f2fs_format_utils.c > > index 597c2b3a7b1c..448fbaa8866e 100644 > > --- a/mkfs/f2fs_format_utils.c > > +++ b/mkfs/f2fs_format_utils.c > > @@ -129,6 +129,10 @@ static bool is_wiped_device(int i) > > int nblocks = 4096; /* 16MB size */ > > int j; > > + /* let's trim the other devices except the first device */ > > + if (i > 0) > > + return false; > > + > > buf = malloc(F2FS_BLKSIZE); > > if (buf == NULL) { > > MSG(1, "\tError: Malloc Failed for buf!!!\n");
diff --git a/mkfs/f2fs_format_utils.c b/mkfs/f2fs_format_utils.c index 597c2b3a7b1c..448fbaa8866e 100644 --- a/mkfs/f2fs_format_utils.c +++ b/mkfs/f2fs_format_utils.c @@ -129,6 +129,10 @@ static bool is_wiped_device(int i) int nblocks = 4096; /* 16MB size */ int j; + /* let's trim the other devices except the first device */ + if (i > 0) + return false; + buf = malloc(F2FS_BLKSIZE); if (buf == NULL) { MSG(1, "\tError: Malloc Failed for buf!!!\n");
We need to check the first disk only, and trim the other disks. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> --- mkfs/f2fs_format_utils.c | 4 ++++ 1 file changed, 4 insertions(+)