* [PATCH] ext4: Free data blocks directly for ordered journal
@ 2023-06-24 15:52 Wang Jianjian
2023-08-17 19:54 ` Theodore Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Wang Jianjian @ 2023-06-24 15:52 UTC (permalink / raw)
To: linux-ext4; +Cc: wangjianjian0
---
fs/ext4/mballoc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 7b2e36d103cb..41fdc2f8c061 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -6206,7 +6206,7 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode,
* consistency guarantees.
*/
if (ext4_handle_valid(handle) &&
- ((flags & EXT4_FREE_BLOCKS_METADATA) ||
+ ((ext4_should_order_data(inode) && (flags & EXT4_FREE_BLOCKS_METADATA)) ||
!ext4_should_writeback_data(inode))) {
struct ext4_free_data *new_entry;
/*
--
2.34.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ext4: Free data blocks directly for ordered journal
2023-06-24 15:52 [PATCH] ext4: Free data blocks directly for ordered journal Wang Jianjian
@ 2023-08-17 19:54 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2023-08-17 19:54 UTC (permalink / raw)
To: Wang Jianjian; +Cc: linux-ext4
On Sat, Jun 24, 2023 at 11:52:59PM +0800, Wang Jianjian wrote:
> ---
> fs/ext4/mballoc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 7b2e36d103cb..41fdc2f8c061 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -6206,7 +6206,7 @@ static void ext4_mb_clear_bb(handle_t *handle, struct inode *inode,
> * consistency guarantees.
> */
> if (ext4_handle_valid(handle) &&
> - ((flags & EXT4_FREE_BLOCKS_METADATA) ||
> + ((ext4_should_order_data(inode) && (flags & EXT4_FREE_BLOCKS_METADATA)) ||
> !ext4_should_writeback_data(inode))) {
> struct ext4_free_data *new_entry;
> /*
This is not a safe thing to do, so I have to reject this patch. As
stated in the comment immediately above this code:
/*
* We need to make sure we don't reuse the freed block until after the
* transaction is committed. We make an exception if the inode is to be
* written in writeback mode since writeback mode has weak data
* consistency guarantees.
*/
In ordered mode, we *do* care that if a file is deleted, and then the
block gets reallocated and used for some new file --- and then we
crash before a transaction commits, then the not-actually-deleted file
would have its data blocks corrupted.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-17 19:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-24 15:52 [PATCH] ext4: Free data blocks directly for ordered journal Wang Jianjian
2023-08-17 19:54 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).