aboutsummaryrefslogtreecommitdiffstats
path: root/fs
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
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')
-rw-r--r--fs/ext4/mballoc.c7
-rw-r--r--fs/ext4/mballoc.h2
2 files changed, 9 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);
diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
index 9e815c4e37df..94cb7b9fe3ee 100644
--- a/fs/ext4/mballoc.h
+++ b/fs/ext4/mballoc.h
@@ -18,6 +18,8 @@
18#include <linux/pagemap.h> 18#include <linux/pagemap.h>
19#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include <linux/version.h> 20#include <linux/version.h>
21#include <linux/blkdev.h>
22#include <linux/marker.h>
21#include "ext4_jbd2.h" 23#include "ext4_jbd2.h"
22#include "ext4.h" 24#include "ext4.h"
23#include "group.h" 25#include "group.h"