All of lore.kernel.org
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@mit.edu>
To: Andreas Dilger <adilger@sun.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH, RFC] ext4: Replace hackish ext4_mb_poll_new_transaction with commit callback
Date: Sun, 19 Oct 2008 21:13:28 -0400	[thread overview]
Message-ID: <20081020011327.GA8162@mit.edu> (raw)
In-Reply-To: <20081019224904.GF3184@webber.adilger.int>

On Sun, Oct 19, 2008 at 04:49:28PM -0600, Andreas Dilger wrote:
> 
> The problem with the mechanism you've implemented is that it isn't
> possible to add any other kind of callback to the journal.  There
> is only a single callback function, and the entries in the "t_private_list"
> are all assumed to be "ext4_free_data" structures so even if other
> users wanted to add callbacks they would only be handled by the
> release_blocks_on_commit() function.
> 
> Is there any reason not to make this more generic and have the callback
> function pointer embedded in the "ext4_free_data" struct in some way
> that other callbacks could be registered?  This would still avoid the
> need to allocate for each of these operations, but would make the
> callback mechanism more generic and useful.

Another possibility would be to simply re-point
sbi->s_journal->j_commit_callback() to a function like this:

static void new_commit_callback_func(journal_t *journal, transaction_t *txn)
{
	do_new_callback_stuff(journal, txn)
	release_blocks_on_commit(journal, txn)
}

Or Luster could initialize ext4, and then intercept the callback,
stash it away in a pointer, and then do this:

static void new_commit_callback_func(journal_t *journal, transaction_t *txn)
{
	do_new_callback_stuff(journal, txn)
	(*orig_value_of_j_commit_callback)(journal, txn)
}


If you want to be even *more* general, we could hang a struct
list_head off of struct ext4_sb_info which contains the linked list of
functions to be called, one of which would be release_blocks_on_commit(), 
and then change sbi->s_journal->j_commit_callback to point to a function
which iterates over the functions in the list_head
sbi->s_commit_callback_funcs.

Do you have specific use in mind for Lustre?  Could one of the above
schemes work for you?

							- Ted

      reply	other threads:[~2008-10-20  1:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-17  0:02 [PATCH, RFC] ext4: Replace hackish ext4_mb_poll_new_transaction with commit callback Theodore Ts'o
2008-10-17  6:04 ` Aneesh Kumar K.V
2008-10-17 10:02   ` Theodore Tso
2008-10-17 12:25     ` Theodore Tso
2008-10-17 20:27       ` Joel Becker
2008-10-19 22:49       ` Andreas Dilger
2008-10-20  1:13         ` Theodore Tso [this message]

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=20081020011327.GA8162@mit.edu \
    --to=tytso@mit.edu \
    --cc=adilger@sun.com \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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.