diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-02-27 20:09:54 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-02-27 20:09:54 -0500 |
commit | aa07cb79b0a38d9d8407c5631624ef8534bdde3f (patch) | |
tree | 887450721a1fa0309daac0c929f1f929103dbcb1 /misc/mke2fs.c | |
parent | 829d9994880394e48c883510799b1536812d6efb (diff) | |
download | e2fsprogs-aa07cb79b0a38d9d8407c5631624ef8534bdde3f.tar.gz |
mke2fs: If the device supports discard, don't print an error message
Check to see if the device supports discard before starting the
progress bar, and then printing an error about inappropriate ioctl for
device (when creating a file system image to a file, for example).
Also, add a function signature in the ext2_io.h header file for
io_channel_discard() and fix an extra, uneeded argument in mke2fs's
call to that function.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'misc/mke2fs.c')
-rw-r--r-- | misc/mke2fs.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 7866c2c1..9798b888 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -2015,6 +2015,10 @@ static int mke2fs_discard_device(ext2_filsys fs) blk64_t cur = 0; int retval = 0; + retval = io_channel_discard(fs->io, 0, 0); + if (retval) + return retval; + count *= (1024 * 1024); count /= fs->blocksize; @@ -2027,7 +2031,7 @@ static int mke2fs_discard_device(ext2_filsys fs) if (cur + count > blocks) count = blocks - cur; - retval = io_channel_discard(fs->io, cur, count, fs->blocksize); + retval = io_channel_discard(fs->io, cur, count); if (retval) break; cur += count; |