xfs
[Top] [All Lists]

[PATCH] xfsprogs: make log/size consistent for mkfs's -s option

To: xfsprogs <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfsprogs: make log/size consistent for mkfs's -s option
From: Li Zhong <zhong@xxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Sep 2013 17:09:33 +0800
Delivered-to: xfs@xxxxxxxxxxx
It seems using -s log is not able to set the sectsz correctly. Because slflag
is set but ignored by later codes, so the advertised sector size of the device
is used instead.

$ mkfs.xfs -f -s size=4096 /dev/sdd
meta-data=/dev/sdd               isize=256    agcount=2, agsize=4096 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         ......

$ mkfs.xfs -f -s log=12 /dev/sdd
meta-data=/dev/sdd               isize=256    agcount=2, agsize=4096 blks
         =                       sectsz=2048  attr=2, projid32bit=1
         ......

Signed-off-by: Li Zhong <zhong@xxxxxxxxxxxxxxxxxx>
---
 mkfs/xfs_mkfs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index eafbed3..9243044 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -1693,7 +1693,7 @@ main(
                 * ft.sectoralign will never be set.
                 */
                sectorsize = blocksize;
-       } else if (!ssflag) {
+       } else if (!ssflag && !slflag) {
                /*
                 * Unless specified manually on the command line use the
                 * advertised sector size of the device.  We use the physical
@@ -1721,7 +1721,7 @@ _("switching to logical sector size %d\n"),
                }
        }
 
-       if (ft.sectoralign || !ssflag) {
+       if (ft.sectoralign || !ssflag || !slflag) {
                sectorlog = libxfs_highbit32(sectorsize);
                if (loginternal) {
                        lsectorsize = sectorsize;
@@ -1731,7 +1731,7 @@ _("switching to logical sector size %d\n"),
 
        if (sectorsize < XFS_MIN_SECTORSIZE ||
            sectorsize > XFS_MAX_SECTORSIZE || sectorsize > blocksize) {
-               if (ssflag)
+               if (ssflag || slflag)
                        fprintf(stderr, _("illegal sector size %d\n"), 
sectorsize);
                else
                        fprintf(stderr,
-- 
1.8.1.4



<Prev in Thread] Current Thread [Next in Thread>