From f3befe3e6b74f8ab33d619d2213bbd130cd5b191 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Tue, 17 Nov 2009 15:49:03 -0600 Subject: [PATCH] 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 --- misc/mke2fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 1.8.3.1