All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org
Subject: [PATCH] ocfs2: Use the new jbd_journal_set_triggers() to printk.
Date: Wed, 17 Sep 2008 16:27:25 -0700	[thread overview]
Message-ID: <20080917232725.GC20752@mail.oracle.com> (raw)
In-Reply-To: <20080917232629.GB20752@mail.oracle.com>


Just a placeholder trigger set that prints.  ocfs2 would obviously do
more in the trigger with ot_offset.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
---
 fs/ocfs2/journal.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 373d943..d17d4a9 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -357,6 +357,51 @@ bail:
 	return status;
 }
 
+struct ocfs2_triggers {
+	struct jbd2_buffer_trigger_type	ot_triggers;
+	int				ot_offset;
+};
+
+static inline struct ocfs2_triggers *to_ocfs2_trigger(struct jbd2_buffer_trigger_type *triggers)
+{
+	return container_of(triggers, struct ocfs2_triggers, ot_triggers);
+}
+
+static void ocfs2_commit_trigger(struct jbd2_buffer_trigger_type *triggers,
+				 struct buffer_head *bh,
+				 void *data, size_t size)
+{
+	struct ocfs2_triggers *ot = to_ocfs2_trigger(triggers);
+
+	mlog(ML_NOTICE, "bh = 0x%lx, data = 0x%lx, size = %u, offset = %d\n",
+	     (unsigned long)bh, (unsigned long)data, size, ot->ot_offset);
+}
+
+static void ocfs2_abort_trigger(struct jbd2_buffer_trigger_type *triggers,
+				struct buffer_head *bh)
+{
+	struct ocfs2_triggers *ot = to_ocfs2_trigger(triggers);
+
+	mlog(ML_NOTICE, "bh = 0x%lx, offset = %d\n", (unsigned long)bh, ot->ot_offset);
+}
+
+static struct ocfs2_triggers inode_triggers = {
+	.ot_triggers = {
+		.t_commit = ocfs2_commit_trigger,
+		.t_abort = ocfs2_abort_trigger,
+	},
+	.ot_offset	= 10, /* Garbage */
+};
+
+static struct ocfs2_triggers other_triggers = {
+	.ot_triggers = {
+		.t_commit = ocfs2_commit_trigger,
+		.t_abort = ocfs2_abort_trigger,
+	},
+	.ot_offset	= 20, /* Different garbage */
+};
+
+
 int ocfs2_journal_access(handle_t *handle,
 			 struct inode *inode,
 			 struct buffer_head *bh,
@@ -406,6 +451,12 @@ int ocfs2_journal_access(handle_t *handle,
 		status = -EINVAL;
 		mlog(ML_ERROR, "Uknown access type!\n");
 	}
+	if (!status)
+		jbd2_journal_set_triggers(bh,
+					  bh->b_blocknr ==
+					  OCFS2_I(inode)->ip_blkno ?
+					  &inode_triggers.ot_triggers :
+					  &other_triggers.ot_triggers);
 	mutex_unlock(&OCFS2_I(inode)->ip_io_mutex);
 
 	if (status < 0)
-- 
1.5.6.3

-- 

"There are some experiences in life which should not be demanded
 twice from any man, and one of them is listening to the Brahms Requiem."
        - George Bernard Shaw

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

WARNING: multiple messages have this Message-ID (diff)
From: Joel Becker <Joel.Becker@oracle.com>
To: ocfs2-devel@oss.oracle.com, linux-ext4@vger.kernel.org
Subject: [Ocfs2-devel] [PATCH] ocfs2: Use the new jbd_journal_set_triggers() to printk.
Date: Wed, 17 Sep 2008 16:27:25 -0700	[thread overview]
Message-ID: <20080917232725.GC20752@mail.oracle.com> (raw)
In-Reply-To: <20080917232629.GB20752@mail.oracle.com>


Just a placeholder trigger set that prints.  ocfs2 would obviously do
more in the trigger with ot_offset.

Signed-off-by: Joel Becker <joel.becker@oracle.com>
---
 fs/ocfs2/journal.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 373d943..d17d4a9 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -357,6 +357,51 @@ bail:
 	return status;
 }
 
+struct ocfs2_triggers {
+	struct jbd2_buffer_trigger_type	ot_triggers;
+	int				ot_offset;
+};
+
+static inline struct ocfs2_triggers *to_ocfs2_trigger(struct jbd2_buffer_trigger_type *triggers)
+{
+	return container_of(triggers, struct ocfs2_triggers, ot_triggers);
+}
+
+static void ocfs2_commit_trigger(struct jbd2_buffer_trigger_type *triggers,
+				 struct buffer_head *bh,
+				 void *data, size_t size)
+{
+	struct ocfs2_triggers *ot = to_ocfs2_trigger(triggers);
+
+	mlog(ML_NOTICE, "bh = 0x%lx, data = 0x%lx, size = %u, offset = %d\n",
+	     (unsigned long)bh, (unsigned long)data, size, ot->ot_offset);
+}
+
+static void ocfs2_abort_trigger(struct jbd2_buffer_trigger_type *triggers,
+				struct buffer_head *bh)
+{
+	struct ocfs2_triggers *ot = to_ocfs2_trigger(triggers);
+
+	mlog(ML_NOTICE, "bh = 0x%lx, offset = %d\n", (unsigned long)bh, ot->ot_offset);
+}
+
+static struct ocfs2_triggers inode_triggers = {
+	.ot_triggers = {
+		.t_commit = ocfs2_commit_trigger,
+		.t_abort = ocfs2_abort_trigger,
+	},
+	.ot_offset	= 10, /* Garbage */
+};
+
+static struct ocfs2_triggers other_triggers = {
+	.ot_triggers = {
+		.t_commit = ocfs2_commit_trigger,
+		.t_abort = ocfs2_abort_trigger,
+	},
+	.ot_offset	= 20, /* Different garbage */
+};
+
+
 int ocfs2_journal_access(handle_t *handle,
 			 struct inode *inode,
 			 struct buffer_head *bh,
@@ -406,6 +451,12 @@ int ocfs2_journal_access(handle_t *handle,
 		status = -EINVAL;
 		mlog(ML_ERROR, "Uknown access type!\n");
 	}
+	if (!status)
+		jbd2_journal_set_triggers(bh,
+					  bh->b_blocknr ==
+					  OCFS2_I(inode)->ip_blkno ?
+					  &inode_triggers.ot_triggers :
+					  &other_triggers.ot_triggers);
 	mutex_unlock(&OCFS2_I(inode)->ip_io_mutex);
 
 	if (status < 0)
-- 
1.5.6.3

-- 

"There are some experiences in life which should not be demanded
 twice from any man, and one of them is listening to the Brahms Requiem."
        - George Bernard Shaw

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

  reply	other threads:[~2008-09-17 23:29 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-17 23:26 [PATCH] [RFC] jbd2: Add buffer triggers Joel Becker
2008-09-17 23:26 ` [Ocfs2-devel] " Joel Becker
2008-09-17 23:27 ` Joel Becker [this message]
2008-09-17 23:27   ` [Ocfs2-devel] [PATCH] ocfs2: Use the new jbd_journal_set_triggers() to printk Joel Becker
2008-09-19 21:46 ` [PATCH] [RFC] jbd2: Add buffer triggers Andreas Dilger
2008-09-19 21:46   ` [Ocfs2-devel] " Andreas Dilger
2008-09-20  3:36   ` Joel Becker
2008-09-20  3:36     ` Joel Becker
2008-09-29  1:25 ` Theodore Tso
2008-09-29  1:25   ` [Ocfs2-devel] " Theodore Tso
2008-10-04  0:03   ` Theodore Tso
2008-10-04  0:03     ` [Ocfs2-devel] " Theodore Tso
2008-10-06 21:37     ` Joel Becker
2008-10-06 21:37       ` [Ocfs2-devel] " Joel Becker
2008-10-06 21:42       ` Joel Becker
2008-10-06 21:42         ` [Ocfs2-devel] " Joel Becker
2008-10-06 23:32         ` Theodore Tso
2008-10-06 23:32           ` [Ocfs2-devel] " Theodore Tso
2008-10-07  1:01           ` Joel Becker
2008-10-07  1:01             ` Joel Becker
2008-10-08 23:17             ` Joel Becker
2008-10-08 23:17               ` Joel Becker
2008-10-16 17:42               ` Theodore Tso
2008-10-16 17:42                 ` Theodore Tso
2008-10-16 19:40                 ` Joel Becker
2008-10-16 19:40                   ` Joel Becker
2008-10-16 19:44                   ` Joel Becker
2008-10-16 19:44                     ` [Ocfs2-devel] " Joel Becker
2008-10-17 12:28                   ` Theodore Tso
2008-10-17 12:28                     ` Theodore Tso
2008-10-17 17:11                     ` Mark Fasheh
2008-10-17 17:11                       ` Mark Fasheh
2008-10-07  1:04           ` Joel Becker
2008-10-07  1:04             ` 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=20080917232725.GC20752@mail.oracle.com \
    --to=joel.becker@oracle.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.