All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] jbd2: modify assert condition in __journal_remove_journal_head
@ 2020-01-22  7:05 Shijie Luo
  2020-01-22  8:50 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: Shijie Luo @ 2020-01-22  7:05 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, jack, luoshijie1

Only when jh->b_jcount = 0 in jbd2_journal_put_journal_head, we are allowed
to call __journal_remove_journal_head.

Signed-off-by: Shijie Luo <luoshijie1@huawei.com>
---
 fs/jbd2/journal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 5e408ee24a1a..4f417a7f1ae0 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -2556,7 +2556,7 @@ static void __journal_remove_journal_head(struct buffer_head *bh)
 {
 	struct journal_head *jh = bh2jh(bh);
 
-	J_ASSERT_JH(jh, jh->b_jcount >= 0);
+	J_ASSERT_JH(jh, jh->b_jcount == 0);
 	J_ASSERT_JH(jh, jh->b_transaction == NULL);
 	J_ASSERT_JH(jh, jh->b_next_transaction == NULL);
 	J_ASSERT_JH(jh, jh->b_cp_transaction == NULL);
-- 
2.19.1


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

* Re: [PATCH] jbd2: modify assert condition in __journal_remove_journal_head
  2020-01-22  7:05 [PATCH] jbd2: modify assert condition in __journal_remove_journal_head Shijie Luo
@ 2020-01-22  8:50 ` Jan Kara
  2020-01-23  6:26   ` Shijie Luo
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kara @ 2020-01-22  8:50 UTC (permalink / raw)
  To: Shijie Luo; +Cc: linux-ext4, tytso, jack

On Wed 22-01-20 02:05:48, Shijie Luo wrote:
> Only when jh->b_jcount = 0 in jbd2_journal_put_journal_head, we are allowed
> to call __journal_remove_journal_head.
> 
> Signed-off-by: Shijie Luo <luoshijie1@huawei.com>

Thanks for the patch. You're right but given that
__journal_remove_journal_head() has exactly one caller and that checks for
jh->b_jcount == 0 just before calling __journal_remove_journal_head(), I
think the assertion is pretty pointless. So I'd rather just remove it
completely.

								Honza

> ---
>  fs/jbd2/journal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> index 5e408ee24a1a..4f417a7f1ae0 100644
> --- a/fs/jbd2/journal.c
> +++ b/fs/jbd2/journal.c
> @@ -2556,7 +2556,7 @@ static void __journal_remove_journal_head(struct buffer_head *bh)
>  {
>  	struct journal_head *jh = bh2jh(bh);
>  
> -	J_ASSERT_JH(jh, jh->b_jcount >= 0);
> +	J_ASSERT_JH(jh, jh->b_jcount == 0);
>  	J_ASSERT_JH(jh, jh->b_transaction == NULL);
>  	J_ASSERT_JH(jh, jh->b_next_transaction == NULL);
>  	J_ASSERT_JH(jh, jh->b_cp_transaction == NULL);
> -- 
> 2.19.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

* Re: [PATCH] jbd2: modify assert condition in __journal_remove_journal_head
  2020-01-22  8:50 ` Jan Kara
@ 2020-01-23  6:26   ` Shijie Luo
  0 siblings, 0 replies; 3+ messages in thread
From: Shijie Luo @ 2020-01-23  6:26 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-ext4, tytso


On 2020/1/22 16:50, Jan Kara wrote:
> On Wed 22-01-20 02:05:48, Shijie Luo wrote:
>> Only when jh->b_jcount = 0 in jbd2_journal_put_journal_head, we are allowed
>> to call __journal_remove_journal_head.
>>
>> Signed-off-by: Shijie Luo <luoshijie1@huawei.com>
> Thanks for the patch. You're right but given that
> __journal_remove_journal_head() has exactly one caller and that checks for
> jh->b_jcount == 0 just before calling __journal_remove_journal_head(), I
> think the assertion is pretty pointless. So I'd rather just remove it
> completely.
>
> 								Honza
Thanks for your review. It 's much better to remove the assertion.
>> ---
>>   fs/jbd2/journal.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
>> index 5e408ee24a1a..4f417a7f1ae0 100644
>> --- a/fs/jbd2/journal.c
>> +++ b/fs/jbd2/journal.c
>> @@ -2556,7 +2556,7 @@ static void __journal_remove_journal_head(struct buffer_head *bh)
>>   {
>>   	struct journal_head *jh = bh2jh(bh);
>>   
>> -	J_ASSERT_JH(jh, jh->b_jcount >= 0);
>> +	J_ASSERT_JH(jh, jh->b_jcount == 0);
>>   	J_ASSERT_JH(jh, jh->b_transaction == NULL);
>>   	J_ASSERT_JH(jh, jh->b_next_transaction == NULL);
>>   	J_ASSERT_JH(jh, jh->b_cp_transaction == NULL);
>> -- 
>> 2.19.1
>>


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

end of thread, other threads:[~2020-01-23  6:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-22  7:05 [PATCH] jbd2: modify assert condition in __journal_remove_journal_head Shijie Luo
2020-01-22  8:50 ` Jan Kara
2020-01-23  6:26   ` Shijie Luo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.