-+#ifdef CONFIG_PROC_FS
-+static int ext4_max_dir_size_read(char *page, char **start, off_t off,
-+ int count, int *eof, void *data)
-+{
-+ struct ext4_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 ext4_max_dir_size_write(struct file *file, const char *buffer,
-+ unsigned long count, void *data)
-+{
-+ struct ext4_sb_info *sbi = data;
-+ char str[32];
-+ unsigned long value;
-+ char *end;
-+
-+ if (count >= sizeof(str)) {
-+ printk(KERN_ERR "EXT4-fs: %s string too long, max %u bytes\n",
-+ EXT4_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;
-+}
-+#endif
-+
- static int ext4_fill_super(struct super_block *sb, void *data, int silent)
- __releases(kernel_lock)
- __acquires(kernel_lock)
-@@ -2690,6 +2734,19 @@ static int ext4_fill_super(struct super_
- p->proc_fops = &ext4_ui_proc_fops,
- p->data = &sbi->s_inode_goal;
- }
-+ sbi->s_max_dir_size = EXT4_DEFAULT_MAX_DIR_SIZE;
-+ p = create_proc_entry(EXT4_MAX_DIR_SIZE_NAME,
-+ S_IFREG | S_IRUGO | S_IWUSR, sbi->s_proc);
-+ if (p == NULL) {
-+ printk(KERN_ERR "EXT4-fs: unable to create %s\n",
-+ EXT4_MAX_DIR_SIZE_NAME);
-+ ret = -ENOMEM;
-+ goto failed_mount;
-+ }
-+ p->data = sbi;
-+ p->read_proc = ext4_max_dir_size_read;
-+ p->write_proc = ext4_max_dir_size_write;
-+
- }
- #endif
-
-@@ -2976,6 +3033,7 @@ failed_mount2:
- kfree(sbi->s_group_desc);
- failed_mount:
- if (sbi->s_proc) {
-+ remove_proc_entry(EXT4_MAX_DIR_SIZE_NAME, sbi->s_proc);
- remove_proc_entry("inode_readahead_blks", sbi->s_proc);
- remove_proc_entry("inode_goal", sbi->s_proc);
- remove_proc_entry(sb->s_id, ext4_proc_root);