All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ted Ts'o <tytso@mit.edu>
To: Jan Kara <jack@suse.cz>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>,
	ocfs2-devel@oss.oracle.com, John Stultz <johnstul@us.ibm.com>,
	Keith Maanthey <kmannth@us.ibm.com>,
	Eric Whitney <eric.whitney@hp.com>
Subject: Re: [PATCH -v2 1/3] jbd2: Use atomic variables to avoid taking t_handle_lock in jbd2_journal_stop
Date: Mon, 9 Aug 2010 15:05:13 -0400	[thread overview]
Message-ID: <20100809190513.GF3635@thunk.org> (raw)
In-Reply-To: <20100809170216.GB31969@atrey.karlin.mff.cuni.cz>

On Mon, Aug 09, 2010 at 07:02:16PM +0200, Jan Kara wrote:
>         spin_lock(&journal->j_state_lock);
>         spin_lock(&transaction->t_handle_lock);
> -       transaction->t_outstanding_credits -= handle->h_buffer_credits;
> -       transaction->t_updates--;
> -
> -       if (!transaction->t_updates)
> +       atomic_sub(handle->h_buffer_credits,
> +                  &transaction->t_outstanding_credits);
> +       if (atomic_dec_and_test(&transaction->t_updates))
>
> After this a transaction can disappear so subsequent
> __jbd2_log_start_commit shouldn't dereference transaction->t_tid,
> right?

I think it should be ok because we're holding j_state_lock(), so the
transaction can't disappear until we release the j_state_lock.

	    	  	    	     	     	 - Ted

WARNING: multiple messages have this Message-ID (diff)
From: Ted Ts'o <tytso@mit.edu>
To: Jan Kara <jack@suse.cz>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>,
	ocfs2-devel@oss.oracle.com, John Stultz <johnstul@us.ibm.com>,
	Keith Maanthey <kmannth@us.ibm.com>,
	Eric Whitney <eric.whitney@hp.com>
Subject: [Ocfs2-devel] [PATCH -v2 1/3] jbd2: Use atomic variables to avoid taking t_handle_lock in jbd2_journal_stop
Date: Mon, 9 Aug 2010 15:05:13 -0400	[thread overview]
Message-ID: <20100809190513.GF3635@thunk.org> (raw)
In-Reply-To: <20100809170216.GB31969@atrey.karlin.mff.cuni.cz>

On Mon, Aug 09, 2010 at 07:02:16PM +0200, Jan Kara wrote:
>         spin_lock(&journal->j_state_lock);
>         spin_lock(&transaction->t_handle_lock);
> -       transaction->t_outstanding_credits -= handle->h_buffer_credits;
> -       transaction->t_updates--;
> -
> -       if (!transaction->t_updates)
> +       atomic_sub(handle->h_buffer_credits,
> +                  &transaction->t_outstanding_credits);
> +       if (atomic_dec_and_test(&transaction->t_updates))
>
> After this a transaction can disappear so subsequent
> __jbd2_log_start_commit shouldn't dereference transaction->t_tid,
> right?

I think it should be ok because we're holding j_state_lock(), so the
transaction can't disappear until we release the j_state_lock.

	    	  	    	     	     	 - Ted

  reply	other threads:[~2010-08-09 19:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-04 16:39 [PATCH -v2 0/3] jbd2 scalability patches Theodore Ts'o
2010-08-04 16:39 ` [Ocfs2-devel] " Theodore Ts'o
2010-08-04 16:39 ` [PATCH -v2 1/3] jbd2: Use atomic variables to avoid taking t_handle_lock in jbd2_journal_stop Theodore Ts'o
2010-08-04 16:39   ` [Ocfs2-devel] " Theodore Ts'o
2010-08-09 17:02   ` Jan Kara
2010-08-09 17:02     ` [Ocfs2-devel] " Jan Kara
2010-08-09 19:05     ` Ted Ts'o [this message]
2010-08-09 19:05       ` Ted Ts'o
2010-08-09 19:45       ` Jan Kara
2010-08-09 19:45         ` [Ocfs2-devel] " Jan Kara
2010-08-10 16:30         ` Ted Ts'o
2010-08-10 16:30           ` [Ocfs2-devel] " Ted Ts'o
2010-08-11 22:16           ` Jan Kara
2010-08-11 22:16             ` [Ocfs2-devel] " Jan Kara
2010-08-04 16:39 ` [PATCH -v2 2/3] jbd2: Change j_state_lock to be a rwlock_t Theodore Ts'o
2010-08-04 16:39   ` [Ocfs2-devel] " Theodore Ts'o
2010-08-04 16:39 ` [PATCH -v2 3/3] jbd2: Remove t_handle_lock from start_this_handle() Theodore Ts'o
2010-08-04 16:39   ` [Ocfs2-devel] " Theodore Ts'o
2010-08-05  1:58 ` [PATCH -v2 0/3] jbd2 scalability patches john stultz
2010-08-05  1:58   ` [Ocfs2-devel] " john stultz
2010-08-05  5:42   ` Ted Ts'o
2010-08-05  5:42     ` [Ocfs2-devel] " Ted Ts'o
2010-08-05 17:42     ` john stultz
2010-08-05 17:42       ` [Ocfs2-devel] " john stultz
2010-08-09 16:06 ` Joel Becker
2010-08-09 16:06   ` Joel Becker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100809190513.GF3635@thunk.org \
    --to=tytso@mit.edu \
    --cc=eric.whitney@hp.com \
    --cc=jack@suse.cz \
    --cc=johnstul@us.ibm.com \
    --cc=kmannth@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.