aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/mballoc.c
diff options
context:
space:
mode:
authorFrank Mayhar <fmayhar@google.com>2009-01-07 00:06:22 -0500
committerTheodore Ts'o <tytso@mit.edu>2009-01-07 00:06:22 -0500
commit0390131ba84fd3f726f9e24fc4553828125700bb (patch)
tree4c90afad4e8690e25aec0ce069fd450e92ab5f96 /fs/ext4/mballoc.c
parentff7ef329b268b603ea4a2303241ef1c3829fd574 (diff)
ext4: Allow ext4 to run without a journal
A few weeks ago I posted a patch for discussion that allowed ext4 to run without a journal. Since that time I've integrated the excellent comments from Andreas and fixed several serious bugs. We're currently running with this patch and generating some performance numbers against both ext2 (with backported reservations code) and ext4 with and without a journal. It just so happens that running without a journal is slightly faster for most everything. We did iozone -T -t 4 s 2g -r 256k -T -I -i0 -i1 -i2 which creates 4 threads, each of which create and do reads and writes on a 2G file, with a buffer size of 256K, using O_DIRECT for all file opens to bypass the page cache. Results: ext2 ext4, default ext4, no journal initial writes 13.0 MB/s 15.4 MB/s 15.7 MB/s rewrites 13.1 MB/s 15.6 MB/s 15.9 MB/s reads 15.2 MB/s 16.9 MB/s 17.2 MB/s re-reads 15.3 MB/s 16.9 MB/s 17.2 MB/s random readers 5.6 MB/s 5.6 MB/s 5.7 MB/s random writers 5.1 MB/s 5.3 MB/s 5.4 MB/s So it seems that, so far, this was a useful exercise. Signed-off-by: Frank Mayhar <fmayhar@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r--fs/ext4/mballoc.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 7beab7141dd5..edb512b2ec49 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2553,7 +2553,8 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery)
2553 ext4_mb_init_per_dev_proc(sb); 2553 ext4_mb_init_per_dev_proc(sb);
2554 ext4_mb_history_init(sb); 2554 ext4_mb_history_init(sb);
2555 2555
2556 sbi->s_journal->j_commit_callback = release_blocks_on_commit; 2556 if (sbi->s_journal)
2557 sbi->s_journal->j_commit_callback = release_blocks_on_commit;
2557 2558
2558 printk(KERN_INFO "EXT4-fs: mballoc enabled\n"); 2559 printk(KERN_INFO "EXT4-fs: mballoc enabled\n");
2559 return 0; 2560 return 0;
@@ -2854,7 +2855,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
2854 mb_set_bits(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group), 2855 mb_set_bits(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group),
2855 bitmap_bh->b_data, ac->ac_b_ex.fe_start, 2856 bitmap_bh->b_data, ac->ac_b_ex.fe_start,
2856 ac->ac_b_ex.fe_len); 2857 ac->ac_b_ex.fe_len);
2857 err = ext4_journal_dirty_metadata(handle, bitmap_bh); 2858 err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh);
2858 if (!err) 2859 if (!err)
2859 err = -EAGAIN; 2860 err = -EAGAIN;
2860 goto out_err; 2861 goto out_err;
@@ -2901,10 +2902,10 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
2901 spin_unlock(sb_bgl_lock(sbi, flex_group)); 2902 spin_unlock(sb_bgl_lock(sbi, flex_group));
2902 } 2903 }
2903 2904
2904 err = ext4_journal_dirty_metadata(handle, bitmap_bh); 2905 err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh);
2905 if (err) 2906 if (err)
2906 goto out_err; 2907 goto out_err;
2907 err = ext4_journal_dirty_metadata(handle, gdp_bh); 2908 err = ext4_handle_dirty_metadata(handle, NULL, gdp_bh);
2908 2909
2909out_err: 2910out_err:
2910 sb->s_dirt = 1; 2911 sb->s_dirt = 1;
@@ -4414,7 +4415,7 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
4414 struct rb_node **n = &db->bb_free_root.rb_node, *node; 4415 struct rb_node **n = &db->bb_free_root.rb_node, *node;
4415 struct rb_node *parent = NULL, *new_node; 4416 struct rb_node *parent = NULL, *new_node;
4416 4417
4417 4418 BUG_ON(!ext4_handle_valid(handle));
4418 BUG_ON(e4b->bd_bitmap_page == NULL); 4419 BUG_ON(e4b->bd_bitmap_page == NULL);
4419 BUG_ON(e4b->bd_buddy_page == NULL); 4420 BUG_ON(e4b->bd_buddy_page == NULL);
4420 4421
@@ -4600,7 +4601,7 @@ do_more:
4600 4601
4601 /* We dirtied the bitmap block */ 4602 /* We dirtied the bitmap block */
4602 BUFFER_TRACE(bitmap_bh, "dirtied bitmap block"); 4603 BUFFER_TRACE(bitmap_bh, "dirtied bitmap block");
4603 err = ext4_journal_dirty_metadata(handle, bitmap_bh); 4604 err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh);
4604 4605
4605 if (ac) { 4606 if (ac) {
4606 ac->ac_b_ex.fe_group = block_group; 4607 ac->ac_b_ex.fe_group = block_group;
@@ -4609,7 +4610,7 @@ do_more:
4609 ext4_mb_store_history(ac); 4610 ext4_mb_store_history(ac);
4610 } 4611 }
4611 4612
4612 if (metadata) { 4613 if (metadata && ext4_handle_valid(handle)) {
4613 /* blocks being freed are metadata. these blocks shouldn't 4614 /* blocks being freed are metadata. these blocks shouldn't
4614 * be used until this transaction is committed */ 4615 * be used until this transaction is committed */
4615 ext4_mb_free_metadata(handle, &e4b, block_group, bit, count); 4616 ext4_mb_free_metadata(handle, &e4b, block_group, bit, count);
@@ -4639,7 +4640,7 @@ do_more:
4639 4640
4640 /* And the group descriptor block */ 4641 /* And the group descriptor block */
4641 BUFFER_TRACE(gd_bh, "dirtied group descriptor block"); 4642 BUFFER_TRACE(gd_bh, "dirtied group descriptor block");
4642 ret = ext4_journal_dirty_metadata(handle, gd_bh); 4643 ret = ext4_handle_dirty_metadata(handle, NULL, gd_bh);
4643 if (!err) 4644 if (!err)
4644 err = ret; 4645 err = ret;
4645 4646