xfs
[Top] [All Lists]

[PATCH v2] xfs_mkfs: Do not discard if '-N' is provided

To: xfs@xxxxxxxxxxx
Subject: [PATCH v2] xfs_mkfs: Do not discard if '-N' is provided
From: Lukas Czerner <lczerner@xxxxxxxxxx>
Date: Tue, 12 Feb 2013 16:44:30 +0100
Cc: Lukas Czerner <lczerner@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
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@xxxxxxxxxx>
---
v2: Rebase to the up-to-date repository

 mkfs/xfs_mkfs.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 3cfab06..c84448e 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -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);
-- 
1.7.7.6

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