From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH 2/8] ext4: fold ext4_journal_revoke() into ext4_forget()
Date: Sun, 22 Nov 2009 21:18:24 -0500 [thread overview]
Message-ID: <1258942710-31930-3-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1258942710-31930-1-git-send-email-tytso@mit.edu>
The only caller of ext4_journal_revoke() is ext4_forget(), so we can
fold ext4_journal_revoke() into ext4_forget() to simplfy the code and
shorten the call stack.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
fs/ext4/ext4_jbd2.c | 30 +++++++++++-------------------
fs/ext4/ext4_jbd2.h | 12 +-----------
2 files changed, 12 insertions(+), 30 deletions(-)
diff --git a/fs/ext4/ext4_jbd2.c b/fs/ext4/ext4_jbd2.c
index 913f857..92c88a8 100644
--- a/fs/ext4/ext4_jbd2.c
+++ b/fs/ext4/ext4_jbd2.c
@@ -50,22 +50,6 @@ int __ext4_journal_forget(const char *where, handle_t *handle,
return err;
}
-int __ext4_journal_revoke(const char *where, handle_t *handle,
- ext4_fsblk_t blocknr, struct buffer_head *bh)
-{
- int err = 0;
-
- if (ext4_handle_valid(handle)) {
- err = jbd2_journal_revoke(handle, blocknr, bh);
- if (err)
- ext4_journal_abort_handle(where, __func__, bh,
- handle, err);
- }
- else
- bforget(bh);
- return err;
-}
-
/*
* The ext4 forget function must perform a revoke if we are freeing data
* which has been journaled. Metadata (eg. indirect blocks) must be
@@ -94,6 +78,12 @@ int __ext4_forget(const char *where, handle_t *handle, int is_metadata,
bh, is_metadata, inode->i_mode,
test_opt(inode->i_sb, DATA_FLAGS));
+ /* In the no journal case, we can just do a bforget and return */
+ if (!ext4_handle_valid(handle)) {
+ bforget(bh);
+ return 0;
+ }
+
/* Never use the revoke function if we are doing full data
* journaling: there is no need to, and a V1 superblock won't
* support it. Otherwise, only skip the revoke on un-journaled
@@ -111,11 +101,13 @@ int __ext4_forget(const char *where, handle_t *handle, int is_metadata,
/*
* data!=journal && (is_metadata || should_journal_data(inode))
*/
- BUFFER_TRACE(bh, "call ext4_journal_revoke");
- err = __ext4_journal_revoke(where, handle, blocknr, bh);
- if (err)
+ BUFFER_TRACE(bh, "call jbd2_journal_revoke");
+ err = jbd2_journal_revoke(handle, blocknr, bh);
+ if (err) {
+ ext4_journal_abort_handle(where, __func__, bh, handle, err);
ext4_abort(inode->i_sb, __func__,
"error %d when attempting revoke", err);
+ }
BUFFER_TRACE(bh, "exit");
return err;
}
diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
index dc0b34a..f9fb4bb 100644
--- a/fs/ext4/ext4_jbd2.h
+++ b/fs/ext4/ext4_jbd2.h
@@ -116,12 +116,8 @@ int ext4_reserve_inode_write(handle_t *handle, struct inode *inode,
int ext4_mark_inode_dirty(handle_t *handle, struct inode *inode);
/*
- * Wrapper functions with which ext4 calls into JBD. The intent here is
- * to allow these to be turned into appropriate stubs so ext4 can control
- * ext2 filesystems, so ext2+ext4 systems only nee one fs. This work hasn't
- * been done yet.
+ * Wrapper functions with which ext4 calls into JBD.
*/
-
void ext4_journal_abort_handle(const char *caller, const char *err_fn,
struct buffer_head *bh, handle_t *handle, int err);
@@ -135,10 +131,6 @@ int __ext4_journal_get_write_access(const char *where, handle_t *handle,
int __ext4_journal_forget(const char *where, handle_t *handle,
struct buffer_head *bh);
-/* When called with an invalid handle, this will still do a put on the BH */
-int __ext4_journal_revoke(const char *where, handle_t *handle,
- ext4_fsblk_t blocknr, struct buffer_head *bh);
next prev parent reply other threads:[~2009-11-23 2:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-23 2:18 [PATCH 0/8] Clean up ext4's block free code paths Theodore Ts'o
2009-11-23 2:18 ` [PATCH 1/8] ext4: move ext4_forget() to ext4_jbd2.c Theodore Ts'o
2009-11-23 2:18 ` Theodore Ts'o [this message]
2009-11-23 2:18 ` [PATCH 3/8] ext4: fold ext4_journal_forget() into ext4_forget() Theodore Ts'o
2009-11-23 2:18 ` [PATCH 4/8] ext4: fold ext4_free_blocks() and ext4_mb_free_blocks() Theodore Ts'o
2009-11-23 2:18 ` [PATCH 5/8] ext4: call ext4_forget() from ext4_free_blocks() Theodore Ts'o
2009-11-23 19:22 ` Andreas Dilger
2009-11-23 20:28 ` tytso
2009-11-23 2:18 ` [PATCH 6/8] ext4: print i_mode in octal in ext4 tracepoints Theodore Ts'o
2009-11-23 2:18 ` [PATCH 7/8] ext4: add check for wraparound in ext4_data_block_valid() Theodore Ts'o
2009-11-23 2:18 ` [PATCH 8/8] ext4: use ext4_data_block_valid() in ext4_free_blocks() Theodore Ts'o
2009-11-23 3:53 ` [PATCH 0/8] Clean up ext4's block free code paths Eric Sandeen
2009-11-23 14:46 ` tytso
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=1258942710-31930-3-git-send-email-tytso@mit.edu \
--to=tytso@mit.edu \
--cc=linux-ext4@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).