From aabdc8ed634869a89414585cb37b8e84d7896bb8 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 22 Nov 2009 21:00:13 -0500 Subject: [PATCH] --- yaml --- r: 174383 b: refs/heads/master c: b7e57e7c2a41826e51fe060fae5158bfc7a04e81 h: refs/heads/master i: 174381: 65ab802240120336ca4d6d41d846bb23ba0993e0 174379: 8646e1cb1acd68d873d3a85ba5ef95793e628456 174375: 76c60541eadc508782bd92080de77859acf9b48b 174367: 4b6b959a72be196b1357e2a6e224dfc5da172f66 v: v3 --- [refs] | 2 +- trunk/fs/ext4/ext4_jbd2.c | 22 +++++----------------- trunk/fs/ext4/ext4_jbd2.h | 6 ------ trunk/fs/ext4/inode.c | 16 ++++++++++++++-- 4 files changed, 20 insertions(+), 26 deletions(-) diff --git a/[refs] b/[refs] index a9fe20f485d7..e57432ed6e02 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: e4684b3fbb848446683feecb4aee133344c93933 +refs/heads/master: b7e57e7c2a41826e51fe060fae5158bfc7a04e81 diff --git a/trunk/fs/ext4/ext4_jbd2.c b/trunk/fs/ext4/ext4_jbd2.c index 92c88a8f734d..b57e5c711b6d 100644 --- a/trunk/fs/ext4/ext4_jbd2.c +++ b/trunk/fs/ext4/ext4_jbd2.c @@ -34,22 +34,6 @@ int __ext4_journal_get_write_access(const char *where, handle_t *handle, return err; } -int __ext4_journal_forget(const char *where, handle_t *handle, - struct buffer_head *bh) -{ - int err = 0; - - if (ext4_handle_valid(handle)) { - err = jbd2_journal_forget(handle, 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 @@ -93,7 +77,11 @@ int __ext4_forget(const char *where, handle_t *handle, int is_metadata, (!is_metadata && !ext4_should_journal_data(inode))) { if (bh) { BUFFER_TRACE(bh, "call jbd2_journal_forget"); - return __ext4_journal_forget(where, handle, bh); + err = jbd2_journal_forget(handle, bh); + if (err) + ext4_journal_abort_handle(where, __func__, bh, + handle, err); + return err; } return 0; } diff --git a/trunk/fs/ext4/ext4_jbd2.h b/trunk/fs/ext4/ext4_jbd2.h index f9fb4bb69577..84bc98ab9f0d 100644 --- a/trunk/fs/ext4/ext4_jbd2.h +++ b/trunk/fs/ext4/ext4_jbd2.h @@ -127,10 +127,6 @@ int __ext4_journal_get_undo_access(const char *where, handle_t *handle, int __ext4_journal_get_write_access(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_forget(const char *where, handle_t *handle, - struct buffer_head *bh); - int __ext4_forget(const char *where, handle_t *handle, int is_metadata, struct inode *inode, struct buffer_head *bh, ext4_fsblk_t blocknr); @@ -150,8 +146,6 @@ int __ext4_handle_dirty_metadata(const char *where, handle_t *handle, (block_nr)) #define ext4_journal_get_create_access(handle, bh) \ __ext4_journal_get_create_access(__func__, (handle), (bh)) -#define ext4_journal_forget(handle, bh) \ - __ext4_journal_forget(__func__, (handle), (bh)) #define ext4_handle_dirty_metadata(handle, inode, bh) \ __ext4_handle_dirty_metadata(__func__, (handle), (inode), (bh)) diff --git a/trunk/fs/ext4/inode.c b/trunk/fs/ext4/inode.c index fa37f9504ece..72c694323492 100644 --- a/trunk/fs/ext4/inode.c +++ b/trunk/fs/ext4/inode.c @@ -767,7 +767,13 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode, /* Allocation failed, free what we already allocated */ for (i = 1; i <= n ; i++) { BUFFER_TRACE(branch[i].bh, "call jbd2_journal_forget"); - ext4_journal_forget(handle, branch[i].bh); + /* + * Note: is_metadata is 0 because branch[i].bh is + * newly allocated, so there is no need to revoke the + * block. If we do, it's harmless, but not necessary. + */ + ext4_forget(handle, 0, inode, branch[i].bh, + branch[i].bh->b_blocknr); } for (i = 0; i < indirect_blks; i++) ext4_free_blocks(handle, inode, new_blocks[i], 1, 0); @@ -852,7 +858,13 @@ static int ext4_splice_branch(handle_t *handle, struct inode *inode, err_out: for (i = 1; i <= num; i++) { BUFFER_TRACE(where[i].bh, "call jbd2_journal_forget"); - ext4_journal_forget(handle, where[i].bh); + /* + * Note: is_metadata is 0 because branch[i].bh is + * newly allocated, so there is no need to revoke the + * block. If we do, it's harmless, but not necessary. + */ + ext4_forget(handle, 0, inode, where[i].bh, + where[i].bh->b_blocknr); ext4_free_blocks(handle, inode, le32_to_cpu(where[i-1].key), 1, 0); }