lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4BBD5D90.4090203@redhat.com>
Date:	Wed, 07 Apr 2010 23:37:36 -0500
From:	Eric Sandeen <sandeen@...hat.com>
To:	Nebojsa Trpkovic <trx.lists@...il.com>
CC:	linux-ext4@...r.kernel.org
Subject: Re: "data=writeback" and TRIM don't get along

Eric Sandeen wrote:
> I'll have to think about the right way to do this... it seems pretty
> convoluted to me right now.
>   
Something like this probably works, but I really REALLY would not test
it on an important filesystem.   :)

I'm not sure it's a good idea to discard it before returning it
to the prealloc pool, because it may well get re-used again
quickly.... not sure if that's helpful.

Just a note, I think eventually we may move to more of a batch discard
in the background, because these little discards are actually quite
inefficient on the hardware we've tested so far.

-Eric

p.s. really.  Don't test this with important data.  I haven't tested
it at all yet.

Index: linux-2.6/fs/ext4/mballoc.c
===================================================================
--- linux-2.6.orig/fs/ext4/mballoc.c
+++ linux-2.6/fs/ext4/mballoc.c
@@ -4602,6 +4606,8 @@ do_more:
 		mb_clear_bits(bitmap_bh->b_data, bit, count);
 		ext4_mb_free_metadata(handle, &e4b, new_entry);
 	} else {
+		ext4_fsblk_t discard_block;
+
 		/* need to update group_info->bb_free and bitmap
 		 * with group lock held. generate_buddy look at
 		 * them with group lock_held
@@ -4609,6 +4615,11 @@ do_more:
 		ext4_lock_group(sb, block_group);
 		mb_clear_bits(bitmap_bh->b_data, bit, count);
 		mb_free_blocks(inode, &e4b, bit, count);
+		discard_block = bit +
+				ext4_group_first_block_no(sb, block_group);
+		trace_ext4_discard_blocks(sb,
+				(unsigned long long)discard_block, count);
+		sb_issue_discard(sb, discard_block, count);
 		ext4_mb_return_to_preallocation(inode, &e4b, block, count);
 	}
 

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ