X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=blobdiff_plain;f=yaffs_vfs_multi.c;h=7e28c40514242dbf3c8dbf624a9a12f2fba78a17;hp=78e2f9f6ac837ce52421b280ee1f713f27ec7cb4;hb=2c98f380f6e28ef71d4d7a8a174cc22b0481f102;hpb=6820610d6b3ea887af57fbd9706fff78923a2115 diff --git a/yaffs_vfs_multi.c b/yaffs_vfs_multi.c index 78e2f9f..7e28c40 100644 --- a/yaffs_vfs_multi.c +++ b/yaffs_vfs_multi.c @@ -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 @@ -39,24 +39,24 @@ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 10)) #define YAFFS_COMPILE_BACKGROUND -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6, 23)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)) #define YAFFS_COMPILE_FREEZER #endif #endif -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28)) #define YAFFS_COMPILE_EXPORTFS #endif -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35)) +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) #define YAFFS_USE_SETATTR_COPY #define YAFFS_USE_TRUNCATE_SETSIZE #endif -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35)) +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)) #define YAFFS_HAS_EVICT_INODE #endif -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13)) +#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 13)) #define YAFFS_NEW_FOLLOW_LINK 1 #else #define YAFFS_NEW_FOLLOW_LINK 0 @@ -126,7 +126,7 @@ #define YPROC_ROOT NULL #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)) #define Y_INIT_TIMER(a) init_timer(a) #else #define Y_INIT_TIMER(a) init_timer_on_stack(a) @@ -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); @@ -210,7 +210,8 @@ static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino); #define yaffs_inode_to_obj_lv(iptr) ((iptr)->u.generic_ip) #endif -#define yaffs_inode_to_obj(iptr) ((struct yaffs_obj *)(yaffs_inode_to_obj_lv(iptr))) +#define yaffs_inode_to_obj(iptr) \ + ((struct yaffs_obj *)(yaffs_inode_to_obj_lv(iptr))) #define yaffs_dentry_to_obj(dptr) yaffs_inode_to_obj((dptr)->d_inode) #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)) @@ -221,12 +222,12 @@ static struct inode *yaffs_iget(struct super_block *sb, unsigned long ino); #define update_dir_time(dir) do {\ (dir)->i_ctime = (dir)->i_mtime = CURRENT_TIME; \ - } while(0) + } while (0) static void yaffs_put_super(struct super_block *sb); static ssize_t yaffs_file_write(struct file *f, const char *buf, size_t n, - loff_t * pos); + loff_t *pos); static ssize_t yaffs_hold_space(struct file *f); static void yaffs_release_space(struct file *f); @@ -306,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 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, @@ -396,7 +395,7 @@ static const struct file_operations yaffs_file_operations = { }; #endif -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25)) static void zero_user_segment(struct page *page, unsigned start, unsigned end) { void *kaddr = kmap_atomic(page, KM_USER0); @@ -408,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 = { @@ -423,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 = { @@ -442,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 = { @@ -479,7 +472,7 @@ static const struct super_operations yaffs_super_ops = { static int yaffs_vfs_setattr(struct inode *inode, struct iattr *attr) { -#ifdef YAFFS_USE_SETATTR_COPY +#ifdef YAFFS_USE_SETATTR_COPY setattr_copy(inode, attr); return 0; #else @@ -490,7 +483,7 @@ static int yaffs_vfs_setattr(struct inode *inode, struct iattr *attr) static int yaffs_vfs_setsize(struct inode *inode, loff_t newsize) { -#ifdef YAFFS_USE_TRUNCATE_SETSIZE +#ifdef YAFFS_USE_TRUNCATE_SETSIZE truncate_setsize(inode, newsize); return 0; #else @@ -791,7 +784,7 @@ static struct dentry *yaffs_lookup(struct inode *dir, struct dentry *dentry) if (current != yaffs_dev_to_lc(dev)->readdir_process) yaffs_gross_lock(dev); - yaffs_trace(YAFFS_TRACE_OS,"yaffs_lookup for %d:%s", + yaffs_trace(YAFFS_TRACE_OS, "yaffs_lookup for %d:%s", yaffs_inode_to_obj(dir)->obj_id, dentry->d_name.name); obj = yaffs_find_by_name(yaffs_inode_to_obj(dir), dentry->d_name.name); @@ -1961,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) { @@ -2064,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) @@ -2226,7 +2217,7 @@ static int yaffs_do_sync_fs(struct super_block *sb, int request_checkpoint) * yaffs_bg_start() launches the background thread. * yaffs_bg_stop() cleans up the background thread. * - * NB: + * NB: * The thread should only run after the yaffs is initialised * The thread should be stopped before yaffs is unmounted. * The thread should not do any writing while the fs is in read only. @@ -2708,9 +2699,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; } @@ -2721,7 +2710,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 */ @@ -2838,40 +2826,17 @@ 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 if (options.empty_lost_and_found_overridden) param->empty_lost_n_found = options.empty_lost_and_found; @@ -2882,7 +2847,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, param->read_chunk_tags_fn = nandmtd2_read_chunk_tags; param->bad_block_fn = nandmtd2_mark_block_bad; param->query_block_fn = nandmtd2_query_block; - yaffs_dev_to_lc(dev)->spare_buffer = + yaffs_dev_to_lc(dev)->spare_buffer = kmalloc(mtd->oobsize, GFP_NOFS); param->is_yaffs2 = 1; #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 17)) @@ -2920,13 +2885,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; @@ -2960,7 +2919,7 @@ static struct super_block *yaffs_internal_read_super(int yaffs_version, err = yaffs_guts_initialise(dev); - yaffs_trace(YAFFS_TRACE_OS, + yaffs_trace(YAFFS_TRACE_OS, "yaffs_read_super: guts initialised %s", (err == YAFFS_OK) ? "OK" : "FAILED"); @@ -3048,7 +3007,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, @@ -3094,7 +3052,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; @@ -3393,12 +3350,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 */ @@ -3465,5 +3416,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");