diff --git a/ldiskfs/kernel_patches/patches/ext3-max-dir-size-2.6.5-suse.patch b/ldiskfs/kernel_patches/patches/ext3-max-dir-size-2.6.5-suse.patch new file mode 100644 index 0000000000000000000000000000000000000000..39f5b276e5b7d0ea998a6d3968960ae2727d6e38 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/ext3-max-dir-size-2.6.5-suse.patch @@ -0,0 +1,144 @@ +Index: linux-stage/fs/ext3/ialloc.c +=================================================================== +--- linux-stage.orig/fs/ext3/ialloc.c ++++ linux-stage/fs/ext3/ialloc.c +@@ -520,12 +520,15 @@ struct inode *ext3_new_inode(handle_t *h + return ERR_PTR(-EPERM); + + sb = dir->i_sb; ++ sbi = EXT3_SB(sb); ++ if (sbi->s_max_dir_size > 0 && i_size_read(dir) >= sbi->s_max_dir_size) ++ return ERR_PTR(-EFBIG); ++ + inode = new_inode(sb); + if (!inode) + return ERR_PTR(-ENOMEM); + ei = EXT3_I(inode); + +- sbi = EXT3_SB(sb); + es = sbi->s_es; + if (goal) { + group = (goal - 1) / EXT3_INODES_PER_GROUP(sb); +Index: linux-stage/fs/ext3/super.c +=================================================================== +--- linux-stage.orig/fs/ext3/super.c ++++ linux-stage/fs/ext3/super.c +@@ -37,6 +37,12 @@ + #include "acl.h" + #include "group.h" + ++/* ++ * max directory size tunable ++ */ ++#define EXT3_DEFAULT_MAX_DIR_SIZE 0 ++#define EXT3_MAX_DIR_SIZE_NAME "max_dir_size" ++ + static int ext3_load_journal(struct super_block *, struct ext3_super_block *, + unsigned long journal_devnum); + static int ext3_create_journal(struct super_block *, struct ext3_super_block *, +@@ -431,6 +437,7 @@ void ext3_put_super (struct super_block + invalidate_bdev(sbi->journal_bdev, 0); + ext3_blkdev_remove(sbi); + } ++ remove_proc_entry(EXT3_MAX_DIR_SIZE_NAME, sbi->s_dev_proc); + remove_proc_entry(sb->s_id, proc_root_ext3); + sbi->s_dev_proc = NULL; + sb->s_fs_info = NULL; +@@ -1251,6 +1258,45 @@ static unsigned long descriptor_loc(stru + return (first_data_block + has_super + (bg * sbi->s_blocks_per_group)); + } + ++static int ext3_max_dir_size_read(char *page, char **start, off_t off, ++ int count, int *eof, void *data) ++{ ++ struct ext3_sb_info *sbi = data; ++ int len; ++ ++ *eof = 1; ++ if (off != 0) ++ return 0; ++ ++ len = sprintf(page, "%lu\n", sbi->s_max_dir_size); ++ *start = page; ++ return len; ++} ++ ++static int ext3_max_dir_size_write(struct file *file, const char *buffer, ++ unsigned long count, void *data) ++{ ++ struct ext3_sb_info *sbi = data; ++ char str[32]; ++ unsigned long value; ++ char *end; ++ ++ if (count >= sizeof(str)) { ++ printk(KERN_ERR "EXT3-fs: %s string too long, max %u bytes\n", ++ EXT3_MAX_DIR_SIZE_NAME, (int)sizeof(str)); ++ return -EOVERFLOW; ++ } ++ ++ if (copy_from_user(str, buffer, count)) ++ return -EFAULT; ++ ++ value = simple_strtol(str, &end, 0); ++ if (value < 0) ++ return -ERANGE; ++ ++ sbi->s_max_dir_size = value; ++ return count; ++} + + static int ext3_fill_super (struct super_block *sb, void *data, int silent) + { +@@ -1270,6 +1316,7 @@ static int ext3_fill_super (struct super + int db_count; + int i; + int needs_recovery; ++ struct proc_dir_entry *proc; + + sbi = kmalloc(sizeof(*sbi), GFP_KERNEL); + if (!sbi) +@@ -1287,6 +1334,23 @@ static int ext3_fill_super (struct super + return -ENOMEM; + } + ++ sbi->s_max_dir_size = EXT3_DEFAULT_MAX_DIR_SIZE; ++ proc = create_proc_entry(EXT3_MAX_DIR_SIZE_NAME, ++ S_IFREG | S_IRUGO | S_IWUSR, sbi->s_dev_proc); ++ if (proc == NULL) { ++ printk(KERN_ERR "EXT3-fs: unable to create %s\n", ++ EXT3_MAX_DIR_SIZE_NAME); ++ remove_proc_entry(EXT3_MAX_DIR_SIZE_NAME, sbi->s_dev_proc); ++ remove_proc_entry(sb->s_id, proc_root_ext3); ++ sbi->s_dev_proc = NULL; ++ sb->s_fs_info = NULL; ++ kfree(sbi); ++ return -ENOMEM; ++ } ++ proc->data = sbi; ++ proc->read_proc = ext3_max_dir_size_read; ++ proc->write_proc = ext3_max_dir_size_write; ++ + blocksize = sb_min_blocksize(sb, EXT3_MIN_BLOCK_SIZE); + if (!blocksize) { + printk(KERN_ERR "EXT3-fs: unable to set blocksize\n"); +@@ -1701,6 +1765,7 @@ failed_mount: + ext3_blkdev_remove(sbi); + brelse(bh); + out_fail: ++ remove_proc_entry(EXT3_MAX_DIR_SIZE_NAME, sbi->s_dev_proc); + remove_proc_entry(sb->s_id, proc_root_ext3); + sbi->s_dev_proc = NULL; + sb->s_fs_info = NULL; +Index: linux-stage/include/linux/ext3_fs_sb.h +=================================================================== +--- linux-stage.orig/include/linux/ext3_fs_sb.h ++++ linux-stage/include/linux/ext3_fs_sb.h +@@ -111,6 +111,7 @@ struct ext3_sb_info { + unsigned long s_mb_max_groups_to_scan; + unsigned long s_mb_stats; + unsigned long s_mb_order2_reqs; ++ unsigned long s_max_dir_size; + + /* history to debug policy */ + struct ext3_mb_history *s_mb_history; diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series index f263ea3a27e40038e921db9af9e7f93ecbcb4b43..ce02d10e824046e125a509ee63c839cbe330920b 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-suse.series @@ -22,5 +22,5 @@ ext3-uninit-2.6-suse.patch ext3-nanosecond-2.6-suse.patch ext3-fiemap-stub-suse.patch ext3-external-journal-2.6.5.patch -ext3-max-dir-size-2.6-suse.patch +ext3-max-dir-size-2.6.5-suse.patch ext3-print-inum-in-htree-warning.patch