i=adilger
i=johann
fix mballoc prealloc table
Index: linux-2.6.27.21-0.1/fs/ext4/ext4_sb.h
===================================================================
Index: linux-2.6.27.21-0.1/fs/ext4/ext4_sb.h
===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_sb.h
-+++ linux-2.6.27.21-0.1/fs/ext4/ext4_sb.h
-@@ -111,11 +111,14 @@ struct ext4_sb_info {
+--- linux-2.6.27.21-0.1.orig/fs/ext4/ext4_sb.h 2009-05-28 11:13:24.000000000 +0530
++++ linux-2.6.27.21-0.1/fs/ext4/ext4_sb.h 2009-05-28 11:16:48.000000000 +0530
+@@ -109,11 +109,14 @@
/* tunables */
unsigned long s_stripe;
/* tunables */
unsigned long s_stripe;
unsigned long s_mb_last_group;
Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
===================================================================
unsigned long s_mb_last_group;
Index: linux-2.6.27.21-0.1/fs/ext4/mballoc.c
===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/mballoc.c
-+++ linux-2.6.27.21-0.1/fs/ext4/mballoc.c
-@@ -1996,7 +1996,7 @@ ext4_mb_regular_allocator(struct ext4_al
+--- linux-2.6.27.21-0.1.orig/fs/ext4/mballoc.c 2009-05-28 11:12:43.000000000 +0530
++++ linux-2.6.27.21-0.1/fs/ext4/mballoc.c 2009-05-28 11:18:09.000000000 +0530
+@@ -1996,7 +1996,7 @@
if (size < isize)
size = isize;
if (size < isize)
size = isize;
(ac->ac_flags & EXT4_MB_HINT_DATA)) {
/* TBD: may be hot point */
spin_lock(&sbi->s_md_lock);
(ac->ac_flags & EXT4_MB_HINT_DATA)) {
/* TBD: may be hot point */
spin_lock(&sbi->s_md_lock);
-@@ -2686,6 +2686,26 @@ err_freesgi:
int ext4_mb_init(struct super_block *sb, int needs_recovery)
{
struct ext4_sb_info *sbi = EXT4_SB(sb);
int ext4_mb_init(struct super_block *sb, int needs_recovery)
{
struct ext4_sb_info *sbi = EXT4_SB(sb);
-@@ -2738,13 +2758,55 @@ int ext4_mb_init(struct super_block *sb,
sbi->s_mb_max_to_scan = MB_DEFAULT_MAX_TO_SCAN;
sbi->s_mb_min_to_scan = MB_DEFAULT_MIN_TO_SCAN;
sbi->s_mb_stats = MB_DEFAULT_STATS;
sbi->s_mb_max_to_scan = MB_DEFAULT_MAX_TO_SCAN;
sbi->s_mb_min_to_scan = MB_DEFAULT_MIN_TO_SCAN;
sbi->s_mb_stats = MB_DEFAULT_STATS;
kfree(sbi->s_mb_offsets);
kfree(sbi->s_mb_maxs);
return -ENOMEM;
kfree(sbi->s_mb_offsets);
kfree(sbi->s_mb_maxs);
return -ENOMEM;
-@@ -2915,9 +2977,89 @@ ext4_mb_free_committed_blocks(struct sup
#define EXT4_MB_MAX_TO_SCAN_NAME "max_to_scan"
#define EXT4_MB_MIN_TO_SCAN_NAME "min_to_scan"
#define EXT4_MB_ORDER2_REQ "order2_req"
#define EXT4_MB_MAX_TO_SCAN_NAME "max_to_scan"
#define EXT4_MB_MIN_TO_SCAN_NAME "min_to_scan"
#define EXT4_MB_ORDER2_REQ "order2_req"
-+static const struct file_operations ext4_mb_prealloc_table_proc_fops = {
-+ .owner = THIS_MODULE,
-+ .read = ext4_mb_prealloc_table_proc_read,
-+ .write = ext4_mb_prealloc_table_proc_write,
-+};
-+
static int ext4_mb_init_per_dev_proc(struct super_block *sb)
{
#ifdef CONFIG_PROC_FS
static int ext4_mb_init_per_dev_proc(struct super_block *sb)
{
#ifdef CONFIG_PROC_FS
-@@ -2932,13 +3074,17 @@ static int ext4_mb_init_per_dev_proc(str
+ mode_t mode = S_IFREG | S_IRUGO | S_IWUSR;
+ struct ext4_sb_info *sbi = EXT4_SB(sb);
+ struct proc_dir_entry *proc;
++ struct proc_dir_entry *proc_entry;
+
+ if (sbi->s_proc == NULL)
+ return -EINVAL;
+@@ -2932,13 +3069,28 @@
EXT4_PROC_HANDLER(EXT4_MB_MAX_TO_SCAN_NAME, mb_max_to_scan);
EXT4_PROC_HANDLER(EXT4_MB_MIN_TO_SCAN_NAME, mb_min_to_scan);
EXT4_PROC_HANDLER(EXT4_MB_ORDER2_REQ, mb_order2_reqs);
- EXT4_PROC_HANDLER(EXT4_MB_STREAM_REQ, mb_stream_request);
+ EXT4_PROC_HANDLER(EXT4_MB_SMALL_REQ, mb_small_req);
+ EXT4_PROC_HANDLER(EXT4_MB_LARGE_REQ, mb_large_req);
EXT4_PROC_HANDLER(EXT4_MB_MAX_TO_SCAN_NAME, mb_max_to_scan);
EXT4_PROC_HANDLER(EXT4_MB_MIN_TO_SCAN_NAME, mb_min_to_scan);
EXT4_PROC_HANDLER(EXT4_MB_ORDER2_REQ, mb_order2_reqs);
- EXT4_PROC_HANDLER(EXT4_MB_STREAM_REQ, mb_stream_request);
+ EXT4_PROC_HANDLER(EXT4_MB_SMALL_REQ, mb_small_req);
+ EXT4_PROC_HANDLER(EXT4_MB_LARGE_REQ, mb_large_req);
-+ EXT4_PROC_HANDLER(EXT4_MB_PREALLOC_TABLE, mb_prealloc_table);
EXT4_PROC_HANDLER(EXT4_MB_GROUP_PREALLOC, mb_group_prealloc);
EXT4_PROC_HANDLER(EXT4_MB_GROUP_PREALLOC, mb_group_prealloc);
++
++ proc_entry = create_proc_entry(EXT4_MB_PREALLOC_TABLE, S_IFREG |
++ S_IRUGO | S_IWUSR, sbi->s_proc);
++ if (proc_entry == NULL) {
++ printk(KERN_ERR "EXT4-fs: unable to create %s\n",
++ EXT4_MB_PREALLOC_TABLE);
++ goto err_out;
++ }
++ proc_entry->data = sbi;
++ proc_entry->read_proc = ext4_mb_prealloc_table_proc_read;
++ proc_entry->write_proc = ext4_mb_prealloc_table_proc_write;
++
remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_proc);
remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_proc);
remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_proc);
remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_proc);
remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_proc);
remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_proc);
-@@ -2959,7 +3105,9 @@ static int ext4_mb_destroy_per_dev_proc(
return -EINVAL;
remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_proc);
return -EINVAL;
remove_proc_entry(EXT4_MB_GROUP_PREALLOC, sbi->s_proc);
remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_proc);
remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_proc);
remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_proc);
remove_proc_entry(EXT4_MB_ORDER2_REQ, sbi->s_proc);
remove_proc_entry(EXT4_MB_MIN_TO_SCAN_NAME, sbi->s_proc);
remove_proc_entry(EXT4_MB_MAX_TO_SCAN_NAME, sbi->s_proc);
-@@ -3162,11 +3310,12 @@ static noinline_for_stack void
ext4_mb_normalize_request(struct ext4_allocation_context *ac,
struct ext4_allocation_request *ar)
{
ext4_mb_normalize_request(struct ext4_allocation_context *ac,
struct ext4_allocation_request *ar)
{
struct ext4_prealloc_space *pa;
/* do normalize only data requests, metadata requests
struct ext4_prealloc_space *pa;
/* do normalize only data requests, metadata requests
-@@ -3196,49 +3345,35 @@ ext4_mb_normalize_request(struct ext4_al
size = size << bsbits;
if (size < i_size_read(ac->ac_inode))
size = i_size_read(ac->ac_inode);
size = size << bsbits;
if (size < i_size_read(ac->ac_inode))
size = i_size_read(ac->ac_inode);
/* don't cover already allocated blocks in selected range */
if (ar->pleft && start <= ar->lleft) {
/* don't cover already allocated blocks in selected range */
if (ar->pleft && start <= ar->lleft) {
-@@ -3315,7 +3450,6 @@ ext4_mb_normalize_request(struct ext4_al
}
BUG_ON(start + size <= ac->ac_o_ex.fe_logical &&
start > ac->ac_o_ex.fe_logical);
}
BUG_ON(start + size <= ac->ac_o_ex.fe_logical &&
start > ac->ac_o_ex.fe_logical);
/* now prepare goal request */
/* now prepare goal request */
-@@ -4236,22 +4370,32 @@ static void ext4_mb_group_or_file(struct
{
struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
int bsbits = ac->ac_sb->s_blocksize_bits;
{
struct ext4_sb_info *sbi = EXT4_SB(ac->ac_sb);
int bsbits = ac->ac_sb->s_blocksize_bits;
* locality group prealloc space are per cpu. The reason for having
Index: linux-2.6.27.21-0.1/fs/ext4/inode.c
===================================================================
* locality group prealloc space are per cpu. The reason for having
Index: linux-2.6.27.21-0.1/fs/ext4/inode.c
===================================================================
---- linux-2.6.27.21-0.1.orig/fs/ext4/inode.c
-+++ linux-2.6.27.21-0.1/fs/ext4/inode.c
-@@ -2442,14 +2442,14 @@ static int ext4_da_writepages(struct add
+--- linux-2.6.27.21-0.1.orig/fs/ext4/inode.c 2009-05-28 11:12:42.000000000 +0530
++++ linux-2.6.27.21-0.1/fs/ext4/inode.c 2009-05-28 11:16:48.000000000 +0530
+@@ -2442,14 +2442,14 @@