yaffs: Change disable-summary option to be consistent with others
[yaffs2.git] / yaffs_vfs_multi.c
index 0d8dd51a72281e741ef328b3db92ecee7a051620..966df484835990673eb43167ea4b4338113512ad 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
  *
- * Copyright (C) 2002-2010 Aleph One Ltd.
+ * Copyright (C) 2002-2011 Aleph One Ltd.
  *   for Toby Churchill Ltd and Brightstar Engineering
  *
  * Created by Charles Manning <charles@aleph1.co.uk>
@@ -176,7 +176,7 @@ unsigned int yaffs_wr_attempts = YAFFS_WR_ATTEMPTS;
 unsigned int yaffs_auto_checkpoint = 1;
 unsigned int yaffs_gc_control = 1;
 unsigned int yaffs_bg_enable = 1;
-
+unsigned int yaffs_auto_select = 1;
 /* Module Parameters */
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
 module_param(yaffs_trace_mask, uint, 0644);
@@ -307,14 +307,12 @@ static int yaffs_writepage(struct page *page, struct writeback_control *wbc);
 static int yaffs_writepage(struct page *page);
 #endif
 
-#ifdef CONFIG_YAFFS_XATTR
 static int yaffs_setxattr(struct dentry *dentry, const char *name,
                   const void *value, size_t size, int flags);
 static ssize_t yaffs_getxattr(struct dentry *dentry, const char *name,
                                void *buff, size_t size);
 static int yaffs_removexattr(struct dentry *dentry, const char *name);
 static ssize_t yaffs_listxattr(struct dentry *dentry, char *buff, size_t size);
-#endif
 
 #if (YAFFS_USE_WRITE_BEGIN_END != 0)
 static int yaffs_write_begin(struct file *filp, struct address_space *mapping,
@@ -409,12 +407,10 @@ static void zero_user_segment(struct page *page, unsigned start, unsigned end)
 
 static const struct inode_operations yaffs_file_inode_operations = {
        .setattr = yaffs_setattr,
-#ifdef CONFIG_YAFFS_XATTR
        .setxattr = yaffs_setxattr,
        .getxattr = yaffs_getxattr,
        .listxattr = yaffs_listxattr,
        .removexattr = yaffs_removexattr,
-#endif
 };
 
 static const struct inode_operations yaffs_symlink_inode_operations = {
@@ -424,12 +420,10 @@ static const struct inode_operations yaffs_symlink_inode_operations = {
        .put_link = yaffs_put_link,
 #endif
        .setattr = yaffs_setattr,
-#ifdef CONFIG_YAFFS_XATTR
        .setxattr = yaffs_setxattr,
        .getxattr = yaffs_getxattr,
        .listxattr = yaffs_listxattr,
        .removexattr = yaffs_removexattr,
-#endif
 };
 
 static const struct inode_operations yaffs_dir_inode_operations = {
@@ -443,12 +437,10 @@ static const struct inode_operations yaffs_dir_inode_operations = {
        .mknod = yaffs_mknod,
        .rename = yaffs_rename,
        .setattr = yaffs_setattr,
-#ifdef CONFIG_YAFFS_XATTR
        .setxattr = yaffs_setxattr,
        .getxattr = yaffs_getxattr,
        .listxattr = yaffs_listxattr,
        .removexattr = yaffs_removexattr,
-#endif
 };
 
 static const struct file_operations yaffs_dir_operations = {
@@ -1962,7 +1954,6 @@ static int yaffs_setattr(struct dentry *dentry, struct iattr *attr)
        return error;
 }
 
-#ifdef CONFIG_YAFFS_XATTR
 static int yaffs_setxattr(struct dentry *dentry, const char *name,
                   const void *value, size_t size, int flags)
 {
@@ -2065,7 +2056,6 @@ static ssize_t yaffs_listxattr(struct dentry * dentry, char *buff, size_t size)
        return error;
 }
 
-#endif
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17))
 static int yaffs_statfs(struct dentry *dentry, struct kstatfs *buf)
@@ -2534,6 +2524,7 @@ struct yaffs_options {
        int lazy_loading_overridden;
        int empty_lost_and_found;
        int empty_lost_and_found_overridden;
+       int disable_summary;
 };
 
 #define MAX_OPT_LEN 30
@@ -2575,6 +2566,8 @@ static int yaffs_parse_options(struct yaffs_options *options,
                } else if (!strcmp(cur_opt, "lazy-loading-on")) {
                        options->lazy_loading_enabled = 1;
                        options->lazy_loading_overridden = 1;
+               } else if (!strcmp(cur_opt, "disable-summary")) {
+                       options->disable_summary = 1;
                } else if (!strcmp(cur_opt, "empty-lost-and-found-off")) {
                        options->empty_lost_and_found = 0;
                        options->empty_lost_and_found_overridden = 1;
@@ -2709,9 +2702,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
        yaffs_trace(YAFFS_TRACE_OS, " size %lld", mtd->size);
 #endif
 
-#ifdef CONFIG_YAFFS_AUTO_YAFFS2
-
-       if (yaffs_version == 1 && WRITE_SIZE(mtd) >= 2048) {
+       if (yaffs_auto_select && yaffs_version == 1 && WRITE_SIZE(mtd) >= 2048) {
                yaffs_trace(YAFFS_TRACE_ALWAYS, "auto selecting yaffs2");
                yaffs_version = 2;
        }
@@ -2722,7 +2713,6 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
                yaffs_trace(YAFFS_TRACE_ALWAYS, "auto selecting yaffs1");
                yaffs_version = 1;
        }
-#endif
 
        if (yaffs_version == 2) {
                /* Check for version 2 style functions */
@@ -2839,40 +2829,18 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
        param->n_caches = (options.no_cache) ? 0 : 10;
        param->inband_tags = options.inband_tags;
 
-#ifdef CONFIG_YAFFS_DISABLE_LAZY_LOAD
-       param->disable_lazy_load = 1;
-#endif
-#ifdef CONFIG_YAFFS_XATTR
        param->enable_xattr = 1;
-#endif
        if (options.lazy_loading_overridden)
                param->disable_lazy_load = !options.lazy_loading_enabled;
 
-#ifdef CONFIG_YAFFS_DISABLE_TAGS_ECC
-       param->no_tags_ecc = 1;
-#endif
-
-#ifdef CONFIG_YAFFS_DISABLE_BACKGROUND
-#else
        param->defered_dir_update = 1;
-#endif
 
        if (options.tags_ecc_overridden)
                param->no_tags_ecc = !options.tags_ecc_on;
 
-#ifdef CONFIG_YAFFS_EMPTY_LOST_AND_FOUND
        param->empty_lost_n_found = 1;
-#endif
-
-#ifdef CONFIG_YAFFS_DISABLE_BLOCK_REFRESHING
-       param->refresh_period = 0;
-#else
        param->refresh_period = 500;
-#endif
-
-#ifdef CONFIG_YAFFS__ALWAYS_CHECK_CHUNK_ERASED
-       param->always_check_erased = 1;
-#endif
+       param->disable_summary = options.disable_summary;
 
        if (options.empty_lost_and_found_overridden)
                param->empty_lost_n_found = options.empty_lost_and_found;
@@ -2921,13 +2889,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version,
 
        yaffs_dev_to_lc(dev)->super = sb;
 
-#ifndef CONFIG_YAFFS_DOES_ECC
        param->use_nand_ecc = 1;
-#endif
-
-#ifdef CONFIG_YAFFS_DISABLE_WIDE_TNODES
-       param->wide_tnodes_disabled = 1;
-#endif
 
        param->skip_checkpt_rd = options.skip_checkpoint_read;
        param->skip_checkpt_wr = options.skip_checkpoint_write;
@@ -3049,7 +3011,6 @@ static DECLARE_FSTYPE(yaffs_fs_type, "yaffs", yaffs_read_super,
                      FS_REQUIRES_DEV);
 #endif
 
-#ifdef CONFIG_YAFFS_YAFFS2
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0))
 static int yaffs2_internal_read_super_mtd(struct super_block *sb, void *data,
@@ -3095,7 +3056,6 @@ static DECLARE_FSTYPE(yaffs2_fs_type, "yaffs2", yaffs2_read_super,
                      FS_REQUIRES_DEV);
 #endif
 
-#endif /* CONFIG_YAFFS_YAFFS2 */
 
 static struct proc_dir_entry *my_proc_entry;
 
@@ -3168,6 +3128,8 @@ static char *yaffs_dump_dev_part1(char *buf, struct yaffs_dev *dev)
                                dev->n_unlinked_files);
        buf += sprintf(buf, "refresh_count........ %u\n", dev->refresh_count);
        buf += sprintf(buf, "n_bg_deletions....... %u\n", dev->n_bg_deletions);
+       buf += sprintf(buf, "tags_used............ %u\n", dev->tags_used);
+       buf += sprintf(buf, "summary_used......... %u\n", dev->summary_used);
 
        return buf;
 }
@@ -3394,12 +3356,6 @@ static int __init init_yaffs_fs(void)
        yaffs_trace(YAFFS_TRACE_ALWAYS,
                "yaffs built " __DATE__ " " __TIME__ " Installing.");
 
-#ifdef CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED
-       yaffs_trace(YAFFS_TRACE_ALWAYS,
-               " \n\n\n\nYAFFS-WARNING CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED selected.\n\n\n\n"
-       );
-#endif
-
        mutex_init(&yaffs_context_lock);
 
        /* Install the proc_fs entries */
@@ -3466,5 +3422,5 @@ module_init(init_yaffs_fs)
     module_exit(exit_yaffs_fs)
 
     MODULE_DESCRIPTION("YAFFS2 - a NAND specific flash file system");
-MODULE_AUTHOR("Charles Manning, Aleph One Ltd., 2002-2010");
+MODULE_AUTHOR("Charles Manning, Aleph One Ltd., 2002-2011");
 MODULE_LICENSE("GPL");