linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] jbd2: Fix checkpoint list cleanup
@ 2015-10-05 13:59 Jan Kara
  2015-10-18  2:42 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kara @ 2015-10-05 13:59 UTC (permalink / raw)
  To: Ted Tso; +Cc: linux-ext4, Jan Kara

Unlike comments and expectation of callers journal_clean_one_cp_list()
returned 1 not only if it freed the transaction but also if it freed
some buffers in the transaction. That could make
__jbd2_journal_clean_checkpoint_list() skip processing
t_checkpoint_io_list and continue with processing the next transaction.
This is mostly a cosmetic issue since the only result is we can
sometimes free less memory than we could. But it's still worth fixing.
Fix journal_clean_one_cp_list() to return 1 only if the transaction was
really freed.

Fixes: 50849db32a9f529235a84bcc84a6b8e631b1d0ec
Signed-off-by: Jan Kara <jack@suse.com>
---
 fs/jbd2/checkpoint.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/jbd2/checkpoint.c b/fs/jbd2/checkpoint.c
index 8c44654ce274..684996c8a3a4 100644
--- a/fs/jbd2/checkpoint.c
+++ b/fs/jbd2/checkpoint.c
@@ -427,7 +427,6 @@ static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy)
 	struct journal_head *last_jh;
 	struct journal_head *next_jh = jh;
 	int ret;
-	int freed = 0;
 
 	if (!jh)
 		return 0;
@@ -441,10 +440,9 @@ static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy)
 		else
 			ret = __jbd2_journal_remove_checkpoint(jh) + 1;
 		if (!ret)
-			return freed;
+			return 0;
 		if (ret == 2)
 			return 1;
-		freed = 1;
 		/*
 		 * This function only frees up some memory
 		 * if possible so we dont have an obligation
@@ -452,10 +450,10 @@ static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy)
 		 * requested:
 		 */
 		if (need_resched())
-			return freed;
+			return 0;
 	} while (jh != last_jh);
 
-	return freed;
+	return 0;
 }
 
 /*
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] jbd2: Fix checkpoint list cleanup
  2015-10-05 13:59 [PATCH] jbd2: Fix checkpoint list cleanup Jan Kara
@ 2015-10-18  2:42 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2015-10-18  2:42 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-ext4

On Mon, Oct 05, 2015 at 03:59:32PM +0200, Jan Kara wrote:
> Unlike comments and expectation of callers journal_clean_one_cp_list()
> returned 1 not only if it freed the transaction but also if it freed
> some buffers in the transaction. That could make
> __jbd2_journal_clean_checkpoint_list() skip processing
> t_checkpoint_io_list and continue with processing the next transaction.
> This is mostly a cosmetic issue since the only result is we can
> sometimes free less memory than we could. But it's still worth fixing.
> Fix journal_clean_one_cp_list() to return 1 only if the transaction was
> really freed.
> 
> Fixes: 50849db32a9f529235a84bcc84a6b8e631b1d0ec
> Signed-off-by: Jan Kara <jack@suse.com>

Applied, thanks.

					- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-18  2:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-05 13:59 [PATCH] jbd2: Fix checkpoint list cleanup Jan Kara
2015-10-18  2:42 ` 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).