From: Andreas Dilger <adilger@sun.com>
To: Abhijit Paithankar <apaithan@akamai.com>
Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,
Jamie Lokier <jamie@shareable.org>,
Dave Chinner <david@fromorbit.com>
Subject: Re: [RFC PATCH] Filesystem Journal Notifications
Date: Mon, 15 Sep 2008 16:37:40 -0700 [thread overview]
Message-ID: <20080915233740.GF3241@webber.adilger.int> (raw)
In-Reply-To: <20080915193648.GC31055@apaithan-desktop.sanmateo.corp.akamai.com>
On Sep 15, 2008 12:36 -0700, Abhijit Paithankar wrote:
> In this version of the patch I've done away with most of the file-system
> specific changes. The file system now only needs to send out a journal
> commit notification.
Is there a reason NOT to use the journal commit callback mechanism that
I posted? This would only require registering a single callback for
each transaction for the inotify, but has the benefit of being completely
generic and can be used for other commit notifiers in the future.
Most of the rest of my comments are related to following the Linux
coding style. Please also generate your patch with "diff -up" so
that the context includes the function name.
> +void journal_notify_commit (journal_t *journal)
> +{
No space between the function name and the '(', journal_notify_commit(
> + struct super_block *sb = journal->j_private;
> + if (sb->s_priv_inode && sb->s_journal_cookie)
> + fsnotify_journal_commit(sb);
> +}
Please add an empty line between variable declarations and the code.
> +void jbd2_journal_notify_commit (journal_t *journal)
> +{
> + struct super_block *sb = journal->j_private;
> + if (sb->s_priv_inode && sb->s_journal_cookie)
> + fsnotify_journal_commit(sb);
> +}
Same comments as above.
> + if (journal_cookie) {
> + size_t len, rem, event_size = sizeof(struct inotify_event);
Wrap at 80 columns, likely putting "size_t event_size = ..." on a new line.
> static void inotify_dev_queue_event(struct inotify_watch *w, u32 wd, u32 mask,
> + if (mask & IN_JOURNAL_COMMIT) {
> + if (!(w->inode) || !(w->inode->i_sb)
> + || !(w->inode->i_sb->s_priv_inode)
> + || !(w->inode->i_sb->s_journal_cookie))
> + goto out;
> + }
Operators like "||" should go at the end of the line, and the new line
should be aligned with the opening parenthesis:
if (!(w->inode) || !(w->inode->i_sb) ||
!(w->inode->i_sb->s_priv_inode) ||
!(w->inode->i_sb->s_journal_cookie))
> + journal_notify_commit(journal);
> jbd_debug(1, "JBD: commit %d complete, head %d\n",
> journal->j_commit_sequence, journal->j_tail_sequence);
Note that this is also a "late" notification. At phase 7 the transaction
is complete and committed to disk, the rest of journal_commit_transaction()
is just doing cleanup and background processing.
> +/* This is a journal commit event for file systems. These events are sent
> + * from a journaling filesystem or the journal itself.
> + *
> + * IN_JOURNAL_COMMIT is special in that only one file per journaling
> + * filesystem partition (super-block) is allowed. Registering for this
> + * event with multiple files will overwrite previous registrations.
This is a major limitation of your implementation - what if 2 applications
want to be notified of this event? Using the journal_callback_set() API
in the patch I sent out would allow an arbitrary number of applications
to monitor the commit.
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
next prev parent reply other threads:[~2008-09-15 23:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-12 22:06 [RFC PATCH] Filesystem Journal Notifications Abhijit Paithankar
2008-09-13 9:19 ` Dave Chinner
2008-09-15 2:31 ` Andreas Dilger
2008-09-15 5:39 ` Andreas Dilger
2008-09-15 19:36 ` Abhijit Paithankar
2008-09-15 23:37 ` Andreas Dilger [this message]
2008-09-16 23:05 ` Abhijit Paithankar
2008-09-19 20:34 ` Andreas Dilger
2008-09-20 15:51 ` Jamie Lokier
2008-09-20 5:15 ` Jan Kara
2008-09-23 22:26 ` Andreas Dilger
2008-09-15 13:23 ` Jamie Lokier
2008-09-17 0:06 ` Abhijit Paithankar
2008-09-17 11:35 ` Jamie Lokier
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=20080915233740.GF3241@webber.adilger.int \
--to=adilger@sun.com \
--cc=apaithan@akamai.com \
--cc=david@fromorbit.com \
--cc=jamie@shareable.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@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 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).