Whamcloud - gitweb
mke2fs: open device writable for trim/discard
authorEric Sandeen <sandeen@redhat.com>
Tue, 17 Nov 2009 21:49:03 +0000 (15:49 -0600)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 25 Nov 2009 12:05:37 +0000 (07:05 -0500)
Sorry about that, the discard ioctl doesn't actually work
unless you open the file with write capabilities...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/mke2fs.c

index 02cd1b7..80b9c0b 100644 (file)
@@ -1929,7 +1929,7 @@ static void mke2fs_discard_blocks(ext2_filsys fs)
        range[0] = 0;
        range[1] = blocks * blocksize;
 
-       fd = open64(fs->device_name, O_RDONLY);
+       fd = open64(fs->device_name, O_RDWR);
 
        /*
         * We don't care about whether the ioctl succeeds; it's only an