aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorMingming Cao <cmm@us.ibm.com>2006-10-11 04:21:01 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-11 14:14:16 -0400
commitdab291af8d6307a3075c3d67d0cc8f98e646cb94 (patch)
treea2207ab3e2e00472e5e3c969ad0dd211fb9e4151 /fs/ext4/inode.c
parenta920e9416b3469994860ab552dfd7fd5a5aff162 (diff)
[PATCH] jbd2: enable building of jbd2 and have ext4 use it rather than jbd
Reworked from a patch by Mingming Cao and Randy Dunlap Signed-off-By: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Mingming Cao <cmm@us.ibm.com> Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 7275d60dcc59..0d96c7d3bb5b 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -25,8 +25,8 @@
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/fs.h> 26#include <linux/fs.h>
27#include <linux/time.h> 27#include <linux/time.h>
28#include <linux/ext4_jbd.h> 28#include <linux/ext4_jbd2.h>
29#include <linux/jbd.h> 29#include <linux/jbd2.h>
30#include <linux/smp_lock.h> 30#include <linux/smp_lock.h>
31#include <linux/highuid.h> 31#include <linux/highuid.h>
32#include <linux/pagemap.h> 32#include <linux/pagemap.h>
@@ -84,7 +84,7 @@ int ext4_forget(handle_t *handle, int is_metadata, struct inode *inode,
84 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA || 84 if (test_opt(inode->i_sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ||
85 (!is_metadata && !ext4_should_journal_data(inode))) { 85 (!is_metadata && !ext4_should_journal_data(inode))) {
86 if (bh) { 86 if (bh) {
87 BUFFER_TRACE(bh, "call journal_forget"); 87 BUFFER_TRACE(bh, "call jbd2_journal_forget");
88 return ext4_journal_forget(handle, bh); 88 return ext4_journal_forget(handle, bh);
89 } 89 }
90 return 0; 90 return 0;
@@ -657,7 +657,7 @@ static int ext4_alloc_branch(handle_t *handle, struct inode *inode,
657failed: 657failed:
658 /* Allocation failed, free what we already allocated */ 658 /* Allocation failed, free what we already allocated */
659 for (i = 1; i <= n ; i++) { 659 for (i = 1; i <= n ; i++) {
660 BUFFER_TRACE(branch[i].bh, "call journal_forget"); 660 BUFFER_TRACE(branch[i].bh, "call jbd2_journal_forget");
661 ext4_journal_forget(handle, branch[i].bh); 661 ext4_journal_forget(handle, branch[i].bh);
662 } 662 }
663 for (i = 0; i <indirect_blks; i++) 663 for (i = 0; i <indirect_blks; i++)
@@ -758,7 +758,7 @@ static int ext4_splice_branch(handle_t *handle, struct inode *inode,
758 758
759err_out: 759err_out:
760 for (i = 1; i <= num; i++) { 760 for (i = 1; i <= num; i++) {
761 BUFFER_TRACE(where[i].bh, "call journal_forget"); 761 BUFFER_TRACE(where[i].bh, "call jbd2_journal_forget");
762 ext4_journal_forget(handle, where[i].bh); 762 ext4_journal_forget(handle, where[i].bh);
763 ext4_free_blocks(handle,inode,le32_to_cpu(where[i-1].key),1); 763 ext4_free_blocks(handle,inode,le32_to_cpu(where[i-1].key),1);
764 } 764 }
@@ -1119,7 +1119,7 @@ static int walk_page_buffers( handle_t *handle,
1119 * To preserve ordering, it is essential that the hole instantiation and 1119 * To preserve ordering, it is essential that the hole instantiation and
1120 * the data write be encapsulated in a single transaction. We cannot 1120 * the data write be encapsulated in a single transaction. We cannot
1121 * close off a transaction and start a new one between the ext4_get_block() 1121 * close off a transaction and start a new one between the ext4_get_block()
1122 * and the commit_write(). So doing the journal_start at the start of 1122 * and the commit_write(). So doing the jbd2_journal_start at the start of
1123 * prepare_write() is the right place. 1123 * prepare_write() is the right place.
1124 * 1124 *
1125 * Also, this function can nest inside ext4_writepage() -> 1125 * Also, this function can nest inside ext4_writepage() ->
@@ -1135,7 +1135,7 @@ static int walk_page_buffers( handle_t *handle,
1135 * transaction open and was blocking on the quota lock - a ranking 1135 * transaction open and was blocking on the quota lock - a ranking
1136 * violation. 1136 * violation.
1137 * 1137 *
1138 * So what we do is to rely on the fact that journal_stop/journal_start 1138 * So what we do is to rely on the fact that jbd2_journal_stop/journal_start
1139 * will _not_ run commit under these circumstances because handle->h_ref 1139 * will _not_ run commit under these circumstances because handle->h_ref
1140 * is elevated. We'll still have enough credits for the tiny quotafile 1140 * is elevated. We'll still have enough credits for the tiny quotafile
1141 * write. 1141 * write.
@@ -1184,7 +1184,7 @@ out:
1184 1184
1185int ext4_journal_dirty_data(handle_t *handle, struct buffer_head *bh) 1185int ext4_journal_dirty_data(handle_t *handle, struct buffer_head *bh)
1186{ 1186{
1187 int err = journal_dirty_data(handle, bh); 1187 int err = jbd2_journal_dirty_data(handle, bh);
1188 if (err) 1188 if (err)
1189 ext4_journal_abort_handle(__FUNCTION__, __FUNCTION__, 1189 ext4_journal_abort_handle(__FUNCTION__, __FUNCTION__,
1190 bh, handle,err); 1190 bh, handle,err);
@@ -1333,9 +1333,9 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
1333 1333
1334 EXT4_I(inode)->i_state &= ~EXT4_STATE_JDATA; 1334 EXT4_I(inode)->i_state &= ~EXT4_STATE_JDATA;
1335 journal = EXT4_JOURNAL(inode); 1335 journal = EXT4_JOURNAL(inode);
1336 journal_lock_updates(journal); 1336 jbd2_journal_lock_updates(journal);
1337 err = journal_flush(journal); 1337 err = jbd2_journal_flush(journal);
1338 journal_unlock_updates(journal); 1338 jbd2_journal_unlock_updates(journal);
1339 1339
1340 if (err) 1340 if (err)
1341 return 0; 1341 return 0;
@@ -1356,7 +1356,7 @@ static int bput_one(handle_t *handle, struct buffer_head *bh)
1356 return 0; 1356 return 0;
1357} 1357}
1358 1358
1359static int journal_dirty_data_fn(handle_t *handle, struct buffer_head *bh) 1359static int jbd2_journal_dirty_data_fn(handle_t *handle, struct buffer_head *bh)
1360{ 1360{
1361 if (buffer_mapped(bh)) 1361 if (buffer_mapped(bh))
1362 return ext4_journal_dirty_data(handle, bh); 1362 return ext4_journal_dirty_data(handle, bh);
@@ -1464,7 +1464,7 @@ static int ext4_ordered_writepage(struct page *page,
1464 */ 1464 */
1465 if (ret == 0) { 1465 if (ret == 0) {
1466 err = walk_page_buffers(handle, page_bufs, 0, PAGE_CACHE_SIZE, 1466 err = walk_page_buffers(handle, page_bufs, 0, PAGE_CACHE_SIZE,
1467 NULL, journal_dirty_data_fn); 1467 NULL, jbd2_journal_dirty_data_fn);
1468 if (!ret) 1468 if (!ret)
1469 ret = err; 1469 ret = err;
1470 } 1470 }
@@ -1595,7 +1595,7 @@ static void ext4_invalidatepage(struct page *page, unsigned long offset)
1595 if (offset == 0) 1595 if (offset == 0)
1596 ClearPageChecked(page); 1596 ClearPageChecked(page);
1597 1597
1598 journal_invalidatepage(journal, page, offset); 1598 jbd2_journal_invalidatepage(journal, page, offset);
1599} 1599}
1600 1600
1601static int ext4_releasepage(struct page *page, gfp_t wait) 1601static int ext4_releasepage(struct page *page, gfp_t wait)
@@ -1605,7 +1605,7 @@ static int ext4_releasepage(struct page *page, gfp_t wait)
1605 WARN_ON(PageChecked(page)); 1605 WARN_ON(PageChecked(page));
1606 if (!page_has_buffers(page)) 1606 if (!page_has_buffers(page))
1607 return 0; 1607 return 0;
1608 return journal_try_to_free_buffers(journal, page, wait); 1608 return jbd2_journal_try_to_free_buffers(journal, page, wait);
1609} 1609}
1610 1610
1611/* 1611/*
@@ -1982,11 +1982,11 @@ static void ext4_clear_blocks(handle_t *handle, struct inode *inode,
1982 1982
1983 /* 1983 /*
1984 * Any buffers which are on the journal will be in memory. We find 1984 * Any buffers which are on the journal will be in memory. We find
1985 * them on the hash table so journal_revoke() will run journal_forget() 1985 * them on the hash table so jbd2_journal_revoke() will run jbd2_journal_forget()
1986 * on them. We've already detached each block from the file, so 1986 * on them. We've already detached each block from the file, so
1987 * bforget() in journal_forget() should be safe. 1987 * bforget() in jbd2_journal_forget() should be safe.
1988 * 1988 *
1989 * AKPM: turn on bforget in journal_forget()!!! 1989 * AKPM: turn on bforget in jbd2_journal_forget()!!!
1990 */ 1990 */
1991 for (p = first; p < last; p++) { 1991 for (p = first; p < last; p++) {
1992 u32 nr = le32_to_cpu(*p); 1992 u32 nr = le32_to_cpu(*p);
@@ -2132,11 +2132,11 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode,
2132 * We've probably journalled the indirect block several 2132 * We've probably journalled the indirect block several
2133 * times during the truncate. But it's no longer 2133 * times during the truncate. But it's no longer
2134 * needed and we now drop it from the transaction via 2134 * needed and we now drop it from the transaction via
2135 * journal_revoke(). 2135 * jbd2_journal_revoke().
2136 * 2136 *
2137 * That's easy if it's exclusively part of this 2137 * That's easy if it's exclusively part of this
2138 * transaction. But if it's part of the committing 2138 * transaction. But if it's part of the committing
2139 * transaction then journal_forget() will simply 2139 * transaction then jbd2_journal_forget() will simply
2140 * brelse() it. That means that if the underlying 2140 * brelse() it. That means that if the underlying
2141 * block is reallocated in ext4_get_block(), 2141 * block is reallocated in ext4_get_block(),
2142 * unmap_underlying_metadata() will find this block 2142 * unmap_underlying_metadata() will find this block
@@ -2251,7 +2251,7 @@ void ext4_truncate(struct inode *inode)
2251 2251
2252 /* 2252 /*
2253 * We have to lock the EOF page here, because lock_page() nests 2253 * We have to lock the EOF page here, because lock_page() nests
2254 * outside journal_start(). 2254 * outside jbd2_journal_start().
2255 */ 2255 */
2256 if ((inode->i_size & (blocksize - 1)) == 0) { 2256 if ((inode->i_size & (blocksize - 1)) == 0) {
2257 /* Block boundary? Nothing to do */ 2257 /* Block boundary? Nothing to do */
@@ -3035,7 +3035,7 @@ int ext4_mark_iloc_dirty(handle_t *handle,
3035 /* the do_update_inode consumes one bh->b_count */ 3035 /* the do_update_inode consumes one bh->b_count */
3036 get_bh(iloc->bh); 3036 get_bh(iloc->bh);
3037 3037
3038 /* ext4_do_update_inode() does journal_dirty_metadata */ 3038 /* ext4_do_update_inode() does jbd2_journal_dirty_metadata */
3039 err = ext4_do_update_inode(handle, inode, iloc); 3039 err = ext4_do_update_inode(handle, inode, iloc);
3040 put_bh(iloc->bh); 3040 put_bh(iloc->bh);
3041 return err; 3041 return err;
@@ -3153,7 +3153,7 @@ static int ext4_pin_inode(handle_t *handle, struct inode *inode)
3153 err = ext4_get_inode_loc(inode, &iloc); 3153 err = ext4_get_inode_loc(inode, &iloc);
3154 if (!err) { 3154 if (!err) {
3155 BUFFER_TRACE(iloc.bh, "get_write_access"); 3155 BUFFER_TRACE(iloc.bh, "get_write_access");
3156 err = journal_get_write_access(handle, iloc.bh); 3156 err = jbd2_journal_get_write_access(handle, iloc.bh);
3157 if (!err) 3157 if (!err)
3158 err = ext4_journal_dirty_metadata(handle, 3158 err = ext4_journal_dirty_metadata(handle,
3159 iloc.bh); 3159 iloc.bh);
@@ -3185,8 +3185,8 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val)
3185 if (is_journal_aborted(journal) || IS_RDONLY(inode)) 3185 if (is_journal_aborted(journal) || IS_RDONLY(inode))
3186 return -EROFS; 3186 return -EROFS;
3187 3187
3188 journal_lock_updates(journal); 3188 jbd2_journal_lock_updates(journal);
3189 journal_flush(journal); 3189 jbd2_journal_flush(journal);
3190 3190
3191 /* 3191 /*
3192 * OK, there are no updates running now, and all cached data is 3192 * OK, there are no updates running now, and all cached data is
@@ -3202,7 +3202,7 @@ int ext4_change_inode_journal_flag(struct inode *inode, int val)
3202 EXT4_I(inode)->i_flags &= ~EXT4_JOURNAL_DATA_FL; 3202 EXT4_I(inode)->i_flags &= ~EXT4_JOURNAL_DATA_FL;
3203 ext4_set_aops(inode); 3203 ext4_set_aops(inode);
3204 3204
3205 journal_unlock_updates(journal); 3205 jbd2_journal_unlock_updates(journal);
3206 3206
3207 /* Finally we can mark the inode as dirty. */ 3207 /* Finally we can mark the inode as dirty. */
3208 3208