[linux-lvm] LVM & fstrim behaviour (Fedora 19)

Lukáš Czerner lczerner at redhat.com
Wed Sep 25 08:39:04 UTC 2013


On Tue, 24 Sep 2013, Jorge Fábregas wrote:

> Date: Tue, 24 Sep 2013 14:03:12 -0400
> From: Jorge Fábregas <jorge.fabregas at gmail.com>
> To: linux-lvm at redhat.com
> Cc: Lukáš Czerner <lczerner at redhat.com>
> Subject: Re: [linux-lvm] LVM & fstrim behaviour (Fedora 19)
> 
> ok Lukáš I think I found where the problem is. I just realized that I
> created that filesystem without journaling (in order to increase perform
> for the VM disks).  I created it with:
> 
> mkfs.ext4 -O ^has_journal /dev/vgthin1/lvol2
> 
> I went back and created the filesystem again (on a thin lvol) with
> default options and indeed fstrim works as expected.  I created ANOTHER
> thinvol (without journaling) and fstrim doesn't work.
> 
> Is this a bug or does fstrim requires ext4 with journal by design?

Oh that's useful information :) Yes, it is a bug and here is
untested fix.


diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index a41e3ba..4d113ef 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -4794,8 +4794,8 @@ do_more:
 					 " group:%d block:%d count:%lu failed"
 					 " with %d", block_group, bit, count,
 					 err);
-		}
-
+		} else
+			EXT4_MB_GRP_CLEAR_TRIMMED(e4b.bd_info);
 
 		ext4_lock_group(sb, block_group);
 		mb_clear_bits(bitmap_bh->b_data, bit, count_clusters);

> 
> My apologies for not stating this since the beginning!

No problem, important is that we've got to the bottom of this.
Thanks for reporting it!

-Lukas

> 
> 


More information about the linux-lvm mailing list