aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/mballoc.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2008-10-16 10:06:27 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-10-16 10:06:27 -0400
commit8a0aba733db1adb5e1f0e828889a18f4c1c512de (patch)
treee66c57f34cdb28c45c34dfc63a93c72791316fe0 /fs/ext4/mballoc.c
parenta1aebc1e2da9a7bee4ff8cce510b08f469d1929e (diff)
ext4: let the block device know when unused blocks can be discarded
Let the block device know when unused blocks can be discarded, using the new sb_issue_discard() interface. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r--fs/ext4/mballoc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index bd9b011941a2..815a22ea6078 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2653,6 +2653,7 @@ ext4_mb_free_committed_blocks(struct super_block *sb)
2653 struct ext4_sb_info *sbi = EXT4_SB(sb); 2653 struct ext4_sb_info *sbi = EXT4_SB(sb);
2654 int err, count = 0, count2 = 0; 2654 int err, count = 0, count2 = 0;
2655 struct ext4_free_data *entry; 2655 struct ext4_free_data *entry;
2656 ext4_fsblk_t discard_block;
2656 2657
2657 if (list_empty(&sbi->s_committed_transaction)) 2658 if (list_empty(&sbi->s_committed_transaction))
2658 return; 2659 return;
@@ -2696,6 +2697,12 @@ ext4_mb_free_committed_blocks(struct super_block *sb)
2696 page_cache_release(e4b.bd_bitmap_page); 2697 page_cache_release(e4b.bd_bitmap_page);
2697 } 2698 }
2698 ext4_unlock_group(sb, entry->group); 2699 ext4_unlock_group(sb, entry->group);
2700 discard_block = (ext4_fsblk_t) entry->group * EXT4_BLOCKS_PER_GROUP(sb)
2701 + entry->start_blk
2702 + le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
2703 trace_mark(ext4_discard_blocks, "dev %s blk %llu count %u", sb->s_id,
2704 (unsigned long long) discard_block, entry->count);
2705 sb_issue_discard(sb, discard_block, entry->count);
2699 2706
2700 kmem_cache_free(ext4_free_ext_cachep, entry); 2707 kmem_cache_free(ext4_free_ext_cachep, entry);
2701 ext4_mb_release_desc(&e4b); 2708 ext4_mb_release_desc(&e4b);