diff options
Diffstat (limited to 'fs/ntfs')
| -rw-r--r-- | fs/ntfs/attrib.c | 1 | ||||
| -rw-r--r-- | fs/ntfs/compress.c | 2 | ||||
| -rw-r--r-- | fs/ntfs/debug.c | 58 | ||||
| -rw-r--r-- | fs/ntfs/debug.h | 7 | ||||
| -rw-r--r-- | fs/ntfs/file.c | 12 | ||||
| -rw-r--r-- | fs/ntfs/inode.c | 6 | ||||
| -rw-r--r-- | fs/ntfs/super.c | 34 | ||||
| -rw-r--r-- | fs/ntfs/sysctl.c | 6 | 
8 files changed, 56 insertions, 70 deletions
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c index a27e3fecefa..250ed5b20c8 100644 --- a/fs/ntfs/attrib.c +++ b/fs/ntfs/attrib.c @@ -1748,7 +1748,6 @@ int ntfs_attr_make_non_resident(ntfs_inode *ni, const u32 data_size)  	if (page) {  		set_page_dirty(page);  		unlock_page(page); -		mark_page_accessed(page);  		page_cache_release(page);  	}  	ntfs_debug("Done."); diff --git a/fs/ntfs/compress.c b/fs/ntfs/compress.c index ee4144ce5d7..f82498c35e7 100644 --- a/fs/ntfs/compress.c +++ b/fs/ntfs/compress.c @@ -58,7 +58,7 @@ typedef enum {  /**   * ntfs_compression_buffer - one buffer for the decompression engine   */ -static u8 *ntfs_compression_buffer = NULL; +static u8 *ntfs_compression_buffer;  /**   * ntfs_cb_lock - spinlock which protects ntfs_compression_buffer diff --git a/fs/ntfs/debug.c b/fs/ntfs/debug.c index 807150e2c2b..dd6103cc93c 100644 --- a/fs/ntfs/debug.c +++ b/fs/ntfs/debug.c @@ -18,16 +18,9 @@   * distribution in the file COPYING); if not, write to the Free Software   * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   */ - +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt  #include "debug.h" -/* - * A static buffer to hold the error string being displayed and a spinlock - * to protect concurrent accesses to it. - */ -static char err_buf[1024]; -static DEFINE_SPINLOCK(err_buf_lock); -  /**   * __ntfs_warning - output a warning to the syslog   * @function:	name of function outputting the warning @@ -50,6 +43,7 @@ static DEFINE_SPINLOCK(err_buf_lock);  void __ntfs_warning(const char *function, const struct super_block *sb,  		const char *fmt, ...)  { +	struct va_format vaf;  	va_list args;  	int flen = 0; @@ -59,17 +53,15 @@ void __ntfs_warning(const char *function, const struct super_block *sb,  #endif  	if (function)  		flen = strlen(function); -	spin_lock(&err_buf_lock);  	va_start(args, fmt); -	vsnprintf(err_buf, sizeof(err_buf), fmt, args); -	va_end(args); +	vaf.fmt = fmt; +	vaf.va = &args;  	if (sb) -		printk(KERN_ERR "NTFS-fs warning (device %s): %s(): %s\n", -				sb->s_id, flen ? function : "", err_buf); +		pr_warn("(device %s): %s(): %pV\n", +			sb->s_id, flen ? function : "", &vaf);  	else -		printk(KERN_ERR "NTFS-fs warning: %s(): %s\n", -				flen ? function : "", err_buf); -	spin_unlock(&err_buf_lock); +		pr_warn("%s(): %pV\n", flen ? function : "", &vaf); +	va_end(args);  }  /** @@ -94,6 +86,7 @@ void __ntfs_warning(const char *function, const struct super_block *sb,  void __ntfs_error(const char *function, const struct super_block *sb,  		const char *fmt, ...)  { +	struct va_format vaf;  	va_list args;  	int flen = 0; @@ -103,17 +96,15 @@ void __ntfs_error(const char *function, const struct super_block *sb,  #endif  	if (function)  		flen = strlen(function); -	spin_lock(&err_buf_lock);  	va_start(args, fmt); -	vsnprintf(err_buf, sizeof(err_buf), fmt, args); -	va_end(args); +	vaf.fmt = fmt; +	vaf.va = &args;  	if (sb) -		printk(KERN_ERR "NTFS-fs error (device %s): %s(): %s\n", -				sb->s_id, flen ? function : "", err_buf); +		pr_err("(device %s): %s(): %pV\n", +		       sb->s_id, flen ? function : "", &vaf);  	else -		printk(KERN_ERR "NTFS-fs error: %s(): %s\n", -				flen ? function : "", err_buf); -	spin_unlock(&err_buf_lock); +		pr_err("%s(): %pV\n", flen ? function : "", &vaf); +	va_end(args);  }  #ifdef DEBUG @@ -124,6 +115,7 @@ int debug_msgs = 0;  void __ntfs_debug (const char *file, int line, const char *function,  		const char *fmt, ...)  { +	struct va_format vaf;  	va_list args;  	int flen = 0; @@ -131,13 +123,11 @@ void __ntfs_debug (const char *file, int line, const char *function,  		return;  	if (function)  		flen = strlen(function); -	spin_lock(&err_buf_lock);  	va_start(args, fmt); -	vsnprintf(err_buf, sizeof(err_buf), fmt, args); +	vaf.fmt = fmt; +	vaf.va = &args; +	pr_debug("(%s, %d): %s(): %pV", file, line, flen ? function : "", &vaf);  	va_end(args); -	printk(KERN_DEBUG "NTFS-fs DEBUG (%s, %d): %s(): %s\n", file, line, -			flen ? function : "", err_buf); -	spin_unlock(&err_buf_lock);  }  /* Dump a runlist. Caller has to provide synchronisation for @rl. */ @@ -149,12 +139,12 @@ void ntfs_debug_dump_runlist(const runlist_element *rl)  	if (!debug_msgs)  		return; -	printk(KERN_DEBUG "NTFS-fs DEBUG: Dumping runlist (values in hex):\n"); +	pr_debug("Dumping runlist (values in hex):\n");  	if (!rl) { -		printk(KERN_DEBUG "Run list not present.\n"); +		pr_debug("Run list not present.\n");  		return;  	} -	printk(KERN_DEBUG "VCN              LCN               Run length\n"); +	pr_debug("VCN              LCN               Run length\n");  	for (i = 0; ; i++) {  		LCN lcn = (rl + i)->lcn; @@ -163,13 +153,13 @@ void ntfs_debug_dump_runlist(const runlist_element *rl)  			if (index > -LCN_ENOENT - 1)  				index = 3; -			printk(KERN_DEBUG "%-16Lx %s %-16Lx%s\n", +			pr_debug("%-16Lx %s %-16Lx%s\n",  					(long long)(rl + i)->vcn, lcn_str[index],  					(long long)(rl + i)->length,  					(rl + i)->length ? "" :  						" (runlist end)");  		} else -			printk(KERN_DEBUG "%-16Lx %-16Lx  %-16Lx%s\n", +			pr_debug("%-16Lx %-16Lx  %-16Lx%s\n",  					(long long)(rl + i)->vcn,  					(long long)(rl + i)->lcn,  					(long long)(rl + i)->length, diff --git a/fs/ntfs/debug.h b/fs/ntfs/debug.h index 53c27eaf230..61bf091e32a 100644 --- a/fs/ntfs/debug.h +++ b/fs/ntfs/debug.h @@ -48,7 +48,12 @@ extern void ntfs_debug_dump_runlist(const runlist_element *rl);  #else	/* !DEBUG */ -#define ntfs_debug(f, a...)		do {} while (0) +#define ntfs_debug(fmt, ...)						\ +do {									\ +	if (0)								\ +		no_printk(fmt, ##__VA_ARGS__);				\ +} while (0) +  #define ntfs_debug_dump_runlist(rl)	do {} while (0)  #endif	/* !DEBUG */ diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index ea4ba9daeb4..5c9e2c81cb1 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c @@ -2060,7 +2060,6 @@ static ssize_t ntfs_file_buffered_write(struct kiocb *iocb,  		}  		do {  			unlock_page(pages[--do_pages]); -			mark_page_accessed(pages[do_pages]);  			page_cache_release(pages[do_pages]);  		} while (do_pages);  		if (unlikely(status)) @@ -2091,10 +2090,7 @@ static ssize_t ntfs_file_aio_write_nolock(struct kiocb *iocb,  	size_t count;		/* after file limit checks */  	ssize_t written, err; -	count = 0; -	err = generic_segment_checks(iov, &nr_segs, &count, VERIFY_READ); -	if (err) -		return err; +	count = iov_length(iov, nr_segs);  	pos = *ppos;  	/* We can write back this queue in page reclaim. */  	current->backing_dev_info = mapping->backing_dev_info; @@ -2134,7 +2130,7 @@ static ssize_t ntfs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,  	ret = ntfs_file_aio_write_nolock(iocb, iov, nr_segs, &iocb->ki_pos);  	mutex_unlock(&inode->i_mutex);  	if (ret > 0) { -		int err = generic_write_sync(file, pos, ret); +		int err = generic_write_sync(file, iocb->ki_pos - ret, ret);  		if (err < 0)  			ret = err;  	} @@ -2203,8 +2199,8 @@ static int ntfs_file_fsync(struct file *filp, loff_t start, loff_t end,  const struct file_operations ntfs_file_ops = {  	.llseek		= generic_file_llseek,	 /* Seek inside file. */ -	.read		= do_sync_read,		 /* Read from file. */ -	.aio_read	= generic_file_aio_read, /* Async read from file. */ +	.read		= new_sync_read,	 /* Read from file. */ +	.read_iter	= generic_file_read_iter, /* Async read from file. */  #ifdef NTFS_RW  	.write		= do_sync_write,	 /* Write to file. */  	.aio_write	= ntfs_file_aio_write,	 /* Async write to file. */ diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 2778b0255dc..f47af5e6e23 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c @@ -55,7 +55,7 @@   *   * Return 1 if the attributes match and 0 if not.   * - * NOTE: This function runs with the inode->i_lock spin lock held so it is not + * NOTE: This function runs with the inode_hash_lock spin lock held so it is not   * allowed to sleep.   */  int ntfs_test_inode(struct inode *vi, ntfs_attr *na) @@ -1704,8 +1704,6 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)  	iput(bvi);  skip_large_index_stuff:  	/* Setup the operations for this index inode. */ -	vi->i_op = NULL; -	vi->i_fop = NULL;  	vi->i_mapping->a_ops = &ntfs_mst_aops;  	vi->i_blocks = ni->allocated_size >> 9;  	/* @@ -2259,7 +2257,7 @@ void ntfs_evict_big_inode(struct inode *vi)  {  	ntfs_inode *ni = NTFS_I(vi); -	truncate_inode_pages(&vi->i_data, 0); +	truncate_inode_pages_final(&vi->i_data);  	clear_inode(vi);  #ifdef NTFS_RW diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 82650d52d91..6c3296e546c 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -19,6 +19,7 @@   * distribution in the file COPYING); if not, write to the Free Software   * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA   */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt  #include <linux/stddef.h>  #include <linux/init.h> @@ -49,8 +50,8 @@  static unsigned long ntfs_nr_compression_users;  /* A global default upcase table and a corresponding reference count. */ -static ntfschar *default_upcase = NULL; -static unsigned long ntfs_nr_upcase_users = 0; +static ntfschar *default_upcase; +static unsigned long ntfs_nr_upcase_users;  /* Error constants/strings used in inode.c::ntfs_show_options(). */  typedef enum { @@ -468,6 +469,8 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt)  	ntfs_debug("Entering with remount options string: %s", opt); +	sync_filesystem(sb); +  #ifndef NTFS_RW  	/* For read-only compiled driver, enforce read-only flag. */  	*flags |= MS_RDONLY; @@ -1894,7 +1897,7 @@ get_ctx_vol_failed:  	vol->minor_ver = vi->minor_ver;  	ntfs_attr_put_search_ctx(ctx);  	unmap_mft_record(NTFS_I(vol->vol_ino)); -	printk(KERN_INFO "NTFS volume version %i.%i.\n", vol->major_ver, +	pr_info("volume version %i.%i.\n", vol->major_ver,  			vol->minor_ver);  	if (vol->major_ver < 3 && NVolSparseEnabled(vol)) {  		ntfs_warning(vol->sb, "Disabling sparse support due to NTFS " @@ -3093,7 +3096,7 @@ static int __init init_ntfs_fs(void)  	int err = 0;  	/* This may be ugly but it results in pretty output so who cares. (-8 */ -	printk(KERN_INFO "NTFS driver " NTFS_VERSION " [Flags: R/" +	pr_info("driver " NTFS_VERSION " [Flags: R/"  #ifdef NTFS_RW  			"W"  #else @@ -3113,16 +3116,15 @@ static int __init init_ntfs_fs(void)  			sizeof(ntfs_index_context), 0 /* offset */,  			SLAB_HWCACHE_ALIGN, NULL /* ctor */);  	if (!ntfs_index_ctx_cache) { -		printk(KERN_CRIT "NTFS: Failed to create %s!\n", -				ntfs_index_ctx_cache_name); +		pr_crit("Failed to create %s!\n", ntfs_index_ctx_cache_name);  		goto ictx_err_out;  	}  	ntfs_attr_ctx_cache = kmem_cache_create(ntfs_attr_ctx_cache_name,  			sizeof(ntfs_attr_search_ctx), 0 /* offset */,  			SLAB_HWCACHE_ALIGN, NULL /* ctor */);  	if (!ntfs_attr_ctx_cache) { -		printk(KERN_CRIT "NTFS: Failed to create %s!\n", -				ntfs_attr_ctx_cache_name); +		pr_crit("NTFS: Failed to create %s!\n", +			ntfs_attr_ctx_cache_name);  		goto actx_err_out;  	} @@ -3130,8 +3132,7 @@ static int __init init_ntfs_fs(void)  			(NTFS_MAX_NAME_LEN+1) * sizeof(ntfschar), 0,  			SLAB_HWCACHE_ALIGN, NULL);  	if (!ntfs_name_cache) { -		printk(KERN_CRIT "NTFS: Failed to create %s!\n", -				ntfs_name_cache_name); +		pr_crit("Failed to create %s!\n", ntfs_name_cache_name);  		goto name_err_out;  	} @@ -3139,8 +3140,7 @@ static int __init init_ntfs_fs(void)  			sizeof(ntfs_inode), 0,  			SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL);  	if (!ntfs_inode_cache) { -		printk(KERN_CRIT "NTFS: Failed to create %s!\n", -				ntfs_inode_cache_name); +		pr_crit("Failed to create %s!\n", ntfs_inode_cache_name);  		goto inode_err_out;  	} @@ -3149,15 +3149,14 @@ static int __init init_ntfs_fs(void)  			SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD,  			ntfs_big_inode_init_once);  	if (!ntfs_big_inode_cache) { -		printk(KERN_CRIT "NTFS: Failed to create %s!\n", -				ntfs_big_inode_cache_name); +		pr_crit("Failed to create %s!\n", ntfs_big_inode_cache_name);  		goto big_inode_err_out;  	}  	/* Register the ntfs sysctls. */  	err = ntfs_sysctl(1);  	if (err) { -		printk(KERN_CRIT "NTFS: Failed to register NTFS sysctls!\n"); +		pr_crit("Failed to register NTFS sysctls!\n");  		goto sysctl_err_out;  	} @@ -3166,7 +3165,7 @@ static int __init init_ntfs_fs(void)  		ntfs_debug("NTFS driver registered successfully.");  		return 0; /* Success! */  	} -	printk(KERN_CRIT "NTFS: Failed to register NTFS filesystem driver!\n"); +	pr_crit("Failed to register NTFS filesystem driver!\n");  	/* Unregister the ntfs sysctls. */  	ntfs_sysctl(0); @@ -3182,8 +3181,7 @@ actx_err_out:  	kmem_cache_destroy(ntfs_index_ctx_cache);  ictx_err_out:  	if (!err) { -		printk(KERN_CRIT "NTFS: Aborting NTFS filesystem driver " -				"registration...\n"); +		pr_crit("Aborting NTFS filesystem driver registration...\n");  		err = -ENOMEM;  	}  	return err; diff --git a/fs/ntfs/sysctl.c b/fs/ntfs/sysctl.c index 79a89184cb5..a503156ec15 100644 --- a/fs/ntfs/sysctl.c +++ b/fs/ntfs/sysctl.c @@ -34,7 +34,7 @@  #include "debug.h"  /* Definition of the ntfs sysctl. */ -static ctl_table ntfs_sysctls[] = { +static struct ctl_table ntfs_sysctls[] = {  	{  		.procname	= "ntfs-debug",  		.data		= &debug_msgs,		/* Data pointer and size. */ @@ -46,7 +46,7 @@ static ctl_table ntfs_sysctls[] = {  };  /* Define the parent directory /proc/sys/fs. */ -static ctl_table sysctls_root[] = { +static struct ctl_table sysctls_root[] = {  	{  		.procname	= "fs",  		.mode		= 0555, @@ -56,7 +56,7 @@ static ctl_table sysctls_root[] = {  };  /* Storage for the sysctls header. */ -static struct ctl_table_header *sysctls_root_table = NULL; +static struct ctl_table_header *sysctls_root_table;  /**   * ntfs_sysctl - add or remove the debug sysctl  | 
