]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_mkfs: Do not discard if '-N' is provided
authorLukas Czerner <lczerner@redhat.com>
Tue, 12 Feb 2013 15:44:30 +0000 (16:44 +0100)
committerBen Myers <bpm@sgi.com>
Thu, 14 Feb 2013 22:06:12 +0000 (16:06 -0600)
When '-N' is specified we really should not write anything to the
device, neither we should attempt to discard the device.

This commit fixes xfs_mkfs to not attempt to discard the device in the
case user specified '-N' flag.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
mkfs/xfs_mkfs.c

index 3cfab0649abc93259dd9383ad6da5e1d0d626a33..c84448ecbe16a68993182bc774f938d333af31e4 100644 (file)
@@ -1950,7 +1950,7 @@ _("block size %d cannot be smaller than logical sector size %d\n"),
                }
        }
 
-       if (discard) {
+       if (discard && !Nflag) {
                discard_blocks(xi.ddev, xi.dsize);
                if (xi.rtdev)
                        discard_blocks(xi.rtdev, xi.rtsize);