From: Eric Sandeen Date: Tue, 17 Nov 2009 21:49:03 +0000 (-0600) Subject: mke2fs: open device writable for trim/discard X-Git-Tag: v1.41.10~20 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=f3befe3e6b74f8ab33d619d2213bbd130cd5b191;p=tools%2Fe2fsprogs.git mke2fs: open device writable for trim/discard Sorry about that, the discard ioctl doesn't actually work unless you open the file with write capabilities... Signed-off-by: Eric Sandeen Signed-off-by: Theodore Ts'o --- diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 02cd1b7..80b9c0b 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -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