Re: [f2fs-dev] [RFC PATCH] mkfs.f2fs: use 512B as the sector size criterion

2018-03-28 Thread Jaegeuk Kim
On 03/29, Junling Zheng wrote:
> Hi Jaegeuk,
> 
> On 2018/3/29 4:30, Jaegeuk Kim wrote:
> > Hi Junling,
> > 
> > On Wed, Mar 28, 2018 at 2:04 AM, Junling Zheng  > > wrote:
> > 
> > Use 512 bytes as the sector size criterion while specifying the
> > amount of sectors passed to mkfs.
> > 
> > Signed-off-by: Junling Zheng  > >
> > ---
> >  lib/libf2fs.c   | 11 ---
> >  mkfs/f2fs_format_main.c |  2 +-
> >  2 files changed, 9 insertions(+), 4 deletions(-)
> > 
> > diff --git a/lib/libf2fs.c b/lib/libf2fs.c
> > index 5f11796..5fdcdde 100644
> > --- a/lib/libf2fs.c
> > +++ b/lib/libf2fs.c
> > @@ -1002,9 +1002,14 @@ int f2fs_get_device_info(void)
> > if (get_device_info(i))
> > return -1;
> > 
> > -   if (c.wanted_total_sectors < c.total_sectors) {
> > -   MSG(0, "Info: total device sectors = %"PRIu64" (in %u 
> > bytes)\n",
> > -   c.total_sectors, c.sector_size);
> > +   if (c.wanted_total_sectors > c.total_sectors)
> > +   MSG(0, "Warning: total sectors = %"PRIu64", "
> > +   "wanted sectors = %"PRIu64", in %u bytes\n",
> > +   c.total_sectors, c.wanted_total_sectors, 
> > c.sector_size);
> > 
> > 
> > This seems not warning message. IMO, it'd be enough to inform just
> > wanted size over device size?
> 
> This warning will not break mkfs, just a warning to inform user, and mkfs 
> will use c.total_sectors
> to format device :)

"Warning:" is warning. :P

> 
> >  
> > 
> > +   else {
> > +   MSG(0, "Info: total sectors = %"PRIu64", "
> > +   "wanted sectors = %"PRIu64", in %u bytes\n",
> > +   c.total_sectors, c.wanted_total_sectors, 
> > c.sector_size);
> > c.total_sectors = c.wanted_total_sectors;
> > c.devices[0].total_sectors = c.total_sectors;
> > }
> > diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
> > index f23fd84..71fd7c2 100644
> > --- a/mkfs/f2fs_format_main.c
> > +++ b/mkfs/f2fs_format_main.c
> > @@ -57,7 +57,7 @@ static void mkfs_usage()
> > MSG(0, "  -S sparse mode\n");
> > MSG(0, "  -t 0: nodiscard, 1: discard [default:1]\n");
> > MSG(0, "  -z # of sections per zone [default:1]\n");
> > -   MSG(0, "sectors: number of sectors. [default: determined by 
> > device size]\n");
> > +   MSG(0, "sectors: number of sectors (in 512 bytes). [default: 
> > determined by device size]\n");
> > 
> > 
> > We also need to specify this in man page.
> 
> OK, I'll add it.
> 
> >  
> > 
> > exit(1);
> >  }
> > 
> > --
> > 2.16.2
> > 
> > 
> > 
> > 
> > -- 
> > Jaegeuk Kim
> 
> 
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


Re: [f2fs-dev] [RFC PATCH] mkfs.f2fs: use 512B as the sector size criterion

2018-03-28 Thread Junling Zheng
Hi Jaegeuk,

On 2018/3/29 4:30, Jaegeuk Kim wrote:
> Hi Junling,
> 
> On Wed, Mar 28, 2018 at 2:04 AM, Junling Zheng  > wrote:
> 
> Use 512 bytes as the sector size criterion while specifying the
> amount of sectors passed to mkfs.
> 
> Signed-off-by: Junling Zheng  >
> ---
>  lib/libf2fs.c   | 11 ---
>  mkfs/f2fs_format_main.c |  2 +-
>  2 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/libf2fs.c b/lib/libf2fs.c
> index 5f11796..5fdcdde 100644
> --- a/lib/libf2fs.c
> +++ b/lib/libf2fs.c
> @@ -1002,9 +1002,14 @@ int f2fs_get_device_info(void)
> if (get_device_info(i))
> return -1;
> 
> -   if (c.wanted_total_sectors < c.total_sectors) {
> -   MSG(0, "Info: total device sectors = %"PRIu64" (in %u 
> bytes)\n",
> -   c.total_sectors, c.sector_size);
> +   if (c.wanted_total_sectors > c.total_sectors)
> +   MSG(0, "Warning: total sectors = %"PRIu64", "
> +   "wanted sectors = %"PRIu64", in %u bytes\n",
> +   c.total_sectors, c.wanted_total_sectors, 
> c.sector_size);
> 
> 
> This seems not warning message. IMO, it'd be enough to inform just
> wanted size over device size?

This warning will not break mkfs, just a warning to inform user, and mkfs will 
use c.total_sectors
to format device :)

>  
> 
> +   else {
> +   MSG(0, "Info: total sectors = %"PRIu64", "
> +   "wanted sectors = %"PRIu64", in %u bytes\n",
> +   c.total_sectors, c.wanted_total_sectors, 
> c.sector_size);
> c.total_sectors = c.wanted_total_sectors;
> c.devices[0].total_sectors = c.total_sectors;
> }
> diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
> index f23fd84..71fd7c2 100644
> --- a/mkfs/f2fs_format_main.c
> +++ b/mkfs/f2fs_format_main.c
> @@ -57,7 +57,7 @@ static void mkfs_usage()
> MSG(0, "  -S sparse mode\n");
> MSG(0, "  -t 0: nodiscard, 1: discard [default:1]\n");
> MSG(0, "  -z # of sections per zone [default:1]\n");
> -   MSG(0, "sectors: number of sectors. [default: determined by 
> device size]\n");
> +   MSG(0, "sectors: number of sectors (in 512 bytes). [default: 
> determined by device size]\n");
> 
> 
> We also need to specify this in man page.

OK, I'll add it.

>  
> 
> exit(1);
>  }
> 
> --
> 2.16.2
> 
> 
> 
> 
> -- 
> Jaegeuk Kim



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


[f2fs-dev] [RFC PATCH] mkfs.f2fs: use 512B as the sector size criterion

2018-03-28 Thread Junling Zheng
Use 512 bytes as the sector size criterion while specifying the
amount of sectors passed to mkfs.

Signed-off-by: Junling Zheng 
---
 lib/libf2fs.c   | 11 ---
 mkfs/f2fs_format_main.c |  2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 5f11796..5fdcdde 100644
--- a/lib/libf2fs.c
+++ b/lib/libf2fs.c
@@ -1002,9 +1002,14 @@ int f2fs_get_device_info(void)
if (get_device_info(i))
return -1;
 
-   if (c.wanted_total_sectors < c.total_sectors) {
-   MSG(0, "Info: total device sectors = %"PRIu64" (in %u bytes)\n",
-   c.total_sectors, c.sector_size);
+   if (c.wanted_total_sectors > c.total_sectors)
+   MSG(0, "Warning: total sectors = %"PRIu64", "
+   "wanted sectors = %"PRIu64", in %u bytes\n",
+   c.total_sectors, c.wanted_total_sectors, c.sector_size);
+   else {
+   MSG(0, "Info: total sectors = %"PRIu64", "
+   "wanted sectors = %"PRIu64", in %u bytes\n",
+   c.total_sectors, c.wanted_total_sectors, c.sector_size);
c.total_sectors = c.wanted_total_sectors;
c.devices[0].total_sectors = c.total_sectors;
}
diff --git a/mkfs/f2fs_format_main.c b/mkfs/f2fs_format_main.c
index f23fd84..71fd7c2 100644
--- a/mkfs/f2fs_format_main.c
+++ b/mkfs/f2fs_format_main.c
@@ -57,7 +57,7 @@ static void mkfs_usage()
MSG(0, "  -S sparse mode\n");
MSG(0, "  -t 0: nodiscard, 1: discard [default:1]\n");
MSG(0, "  -z # of sections per zone [default:1]\n");
-   MSG(0, "sectors: number of sectors. [default: determined by device 
size]\n");
+   MSG(0, "sectors: number of sectors (in 512 bytes). [default: determined 
by device size]\n");
exit(1);
 }
 
-- 
2.16.2


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel