diff options
Diffstat (limited to 'fs/ntfs')
-rw-r--r-- | fs/ntfs/debug.c | 58 | ||||
-rw-r--r-- | fs/ntfs/debug.h | 7 | ||||
-rw-r--r-- | fs/ntfs/inode.c | 4 | ||||
-rw-r--r-- | fs/ntfs/super.c | 30 |
4 files changed, 45 insertions, 54 deletions
diff --git a/fs/ntfs/debug.c b/fs/ntfs/debug.c index 807150e2c2b9..dd6103cc93c1 100644 --- a/fs/ntfs/debug.c +++ b/fs/ntfs/debug.c | |||
@@ -18,16 +18,9 @@ | |||
18 | * distribution in the file COPYING); if not, write to the Free Software | 18 | * distribution in the file COPYING); if not, write to the Free Software |
19 | * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 19 | * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
20 | */ | 20 | */ |
21 | 21 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | |
22 | #include "debug.h" | 22 | #include "debug.h" |
23 | 23 | ||
24 | /* | ||
25 | * A static buffer to hold the error string being displayed and a spinlock | ||
26 | * to protect concurrent accesses to it. | ||
27 | */ | ||
28 | static char err_buf[1024]; | ||
29 | static DEFINE_SPINLOCK(err_buf_lock); | ||
30 | |||
31 | /** | 24 | /** |
32 | * __ntfs_warning - output a warning to the syslog | 25 | * __ntfs_warning - output a warning to the syslog |
33 | * @function: name of function outputting the warning | 26 | * @function: name of function outputting the warning |
@@ -50,6 +43,7 @@ static DEFINE_SPINLOCK(err_buf_lock); | |||
50 | void __ntfs_warning(const char *function, const struct super_block *sb, | 43 | void __ntfs_warning(const char *function, const struct super_block *sb, |
51 | const char *fmt, ...) | 44 | const char *fmt, ...) |
52 | { | 45 | { |
46 | struct va_format vaf; | ||
53 | va_list args; | 47 | va_list args; |
54 | int flen = 0; | 48 | int flen = 0; |
55 | 49 | ||
@@ -59,17 +53,15 @@ void __ntfs_warning(const char *function, const struct super_block *sb, | |||
59 | #endif | 53 | #endif |
60 | if (function) | 54 | if (function) |
61 | flen = strlen(function); | 55 | flen = strlen(function); |
62 | spin_lock(&err_buf_lock); | ||
63 | va_start(args, fmt); | 56 | va_start(args, fmt); |
64 | vsnprintf(err_buf, sizeof(err_buf), fmt, args); | 57 | vaf.fmt = fmt; |
65 | va_end(args); | 58 | vaf.va = &args; |
66 | if (sb) | 59 | if (sb) |
67 | printk(KERN_ERR "NTFS-fs warning (device %s): %s(): %s\n", | 60 | pr_warn("(device %s): %s(): %pV\n", |
68 | sb->s_id, flen ? function : "", err_buf); | 61 | sb->s_id, flen ? function : "", &vaf); |
69 | else | 62 | else |
70 | printk(KERN_ERR "NTFS-fs warning: %s(): %s\n", | 63 | pr_warn("%s(): %pV\n", flen ? function : "", &vaf); |
71 | flen ? function : "", err_buf); | 64 | va_end(args); |
72 | spin_unlock(&err_buf_lock); | ||
73 | } | 65 | } |
74 | 66 | ||
75 | /** | 67 | /** |
@@ -94,6 +86,7 @@ void __ntfs_warning(const char *function, const struct super_block *sb, | |||
94 | void __ntfs_error(const char *function, const struct super_block *sb, | 86 | void __ntfs_error(const char *function, const struct super_block *sb, |
95 | const char *fmt, ...) | 87 | const char *fmt, ...) |
96 | { | 88 | { |
89 | struct va_format vaf; | ||
97 | va_list args; | 90 | va_list args; |
98 | int flen = 0; | 91 | int flen = 0; |
99 | 92 | ||
@@ -103,17 +96,15 @@ void __ntfs_error(const char *function, const struct super_block *sb, | |||
103 | #endif | 96 | #endif |
104 | if (function) | 97 | if (function) |
105 | flen = strlen(function); | 98 | flen = strlen(function); |
106 | spin_lock(&err_buf_lock); | ||
107 | va_start(args, fmt); | 99 | va_start(args, fmt); |
108 | vsnprintf(err_buf, sizeof(err_buf), fmt, args); | 100 | vaf.fmt = fmt; |
109 | va_end(args); | 101 | vaf.va = &args; |
110 | if (sb) | 102 | if (sb) |
111 | printk(KERN_ERR "NTFS-fs error (device %s): %s(): %s\n", | 103 | pr_err("(device %s): %s(): %pV\n", |
112 | sb->s_id, flen ? function : "", err_buf); | 104 | sb->s_id, flen ? function : "", &vaf); |
113 | else | 105 | else |
114 | printk(KERN_ERR "NTFS-fs error: %s(): %s\n", | 106 | pr_err("%s(): %pV\n", flen ? function : "", &vaf); |
115 | flen ? function : "", err_buf); | 107 | va_end(args); |
116 | spin_unlock(&err_buf_lock); | ||
117 | } | 108 | } |
118 | 109 | ||
119 | #ifdef DEBUG | 110 | #ifdef DEBUG |
@@ -124,6 +115,7 @@ int debug_msgs = 0; | |||
124 | void __ntfs_debug (const char *file, int line, const char *function, | 115 | void __ntfs_debug (const char *file, int line, const char *function, |
125 | const char *fmt, ...) | 116 | const char *fmt, ...) |
126 | { | 117 | { |
118 | struct va_format vaf; | ||
127 | va_list args; | 119 | va_list args; |
128 | int flen = 0; | 120 | int flen = 0; |
129 | 121 | ||
@@ -131,13 +123,11 @@ void __ntfs_debug (const char *file, int line, const char *function, | |||
131 | return; | 123 | return; |
132 | if (function) | 124 | if (function) |
133 | flen = strlen(function); | 125 | flen = strlen(function); |
134 | spin_lock(&err_buf_lock); | ||
135 | va_start(args, fmt); | 126 | va_start(args, fmt); |
136 | vsnprintf(err_buf, sizeof(err_buf), fmt, args); | 127 | vaf.fmt = fmt; |
128 | vaf.va = &args; | ||
129 | pr_debug("(%s, %d): %s(): %pV", file, line, flen ? function : "", &vaf); | ||
137 | va_end(args); | 130 | va_end(args); |
138 | printk(KERN_DEBUG "NTFS-fs DEBUG (%s, %d): %s(): %s\n", file, line, | ||
139 | flen ? function : "", err_buf); | ||
140 | spin_unlock(&err_buf_lock); | ||
141 | } | 131 | } |
142 | 132 | ||
143 | /* Dump a runlist. Caller has to provide synchronisation for @rl. */ | 133 | /* Dump a runlist. Caller has to provide synchronisation for @rl. */ |
@@ -149,12 +139,12 @@ void ntfs_debug_dump_runlist(const runlist_element *rl) | |||
149 | 139 | ||
150 | if (!debug_msgs) | 140 | if (!debug_msgs) |
151 | return; | 141 | return; |
152 | printk(KERN_DEBUG "NTFS-fs DEBUG: Dumping runlist (values in hex):\n"); | 142 | pr_debug("Dumping runlist (values in hex):\n"); |
153 | if (!rl) { | 143 | if (!rl) { |
154 | printk(KERN_DEBUG "Run list not present.\n"); | 144 | pr_debug("Run list not present.\n"); |
155 | return; | 145 | return; |
156 | } | 146 | } |
157 | printk(KERN_DEBUG "VCN LCN Run length\n"); | 147 | pr_debug("VCN LCN Run length\n"); |
158 | for (i = 0; ; i++) { | 148 | for (i = 0; ; i++) { |
159 | LCN lcn = (rl + i)->lcn; | 149 | LCN lcn = (rl + i)->lcn; |
160 | 150 | ||
@@ -163,13 +153,13 @@ void ntfs_debug_dump_runlist(const runlist_element *rl) | |||
163 | 153 | ||
164 | if (index > -LCN_ENOENT - 1) | 154 | if (index > -LCN_ENOENT - 1) |
165 | index = 3; | 155 | index = 3; |
166 | printk(KERN_DEBUG "%-16Lx %s %-16Lx%s\n", | 156 | pr_debug("%-16Lx %s %-16Lx%s\n", |
167 | (long long)(rl + i)->vcn, lcn_str[index], | 157 | (long long)(rl + i)->vcn, lcn_str[index], |
168 | (long long)(rl + i)->length, | 158 | (long long)(rl + i)->length, |
169 | (rl + i)->length ? "" : | 159 | (rl + i)->length ? "" : |
170 | " (runlist end)"); | 160 | " (runlist end)"); |
171 | } else | 161 | } else |
172 | printk(KERN_DEBUG "%-16Lx %-16Lx %-16Lx%s\n", | 162 | pr_debug("%-16Lx %-16Lx %-16Lx%s\n", |
173 | (long long)(rl + i)->vcn, | 163 | (long long)(rl + i)->vcn, |
174 | (long long)(rl + i)->lcn, | 164 | (long long)(rl + i)->lcn, |
175 | (long long)(rl + i)->length, | 165 | (long long)(rl + i)->length, |
diff --git a/fs/ntfs/debug.h b/fs/ntfs/debug.h index 53c27eaf2307..61bf091e32a8 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); | |||
48 | 48 | ||
49 | #else /* !DEBUG */ | 49 | #else /* !DEBUG */ |
50 | 50 | ||
51 | #define ntfs_debug(f, a...) do {} while (0) | 51 | #define ntfs_debug(fmt, ...) \ |
52 | do { \ | ||
53 | if (0) \ | ||
54 | no_printk(fmt, ##__VA_ARGS__); \ | ||
55 | } while (0) | ||
56 | |||
52 | #define ntfs_debug_dump_runlist(rl) do {} while (0) | 57 | #define ntfs_debug_dump_runlist(rl) do {} while (0) |
53 | 58 | ||
54 | #endif /* !DEBUG */ | 59 | #endif /* !DEBUG */ |
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index ffb9b3675736..f47af5e6e230 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c | |||
@@ -1704,8 +1704,6 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi) | |||
1704 | iput(bvi); | 1704 | iput(bvi); |
1705 | skip_large_index_stuff: | 1705 | skip_large_index_stuff: |
1706 | /* Setup the operations for this index inode. */ | 1706 | /* Setup the operations for this index inode. */ |
1707 | vi->i_op = NULL; | ||
1708 | vi->i_fop = NULL; | ||
1709 | vi->i_mapping->a_ops = &ntfs_mst_aops; | 1707 | vi->i_mapping->a_ops = &ntfs_mst_aops; |
1710 | vi->i_blocks = ni->allocated_size >> 9; | 1708 | vi->i_blocks = ni->allocated_size >> 9; |
1711 | /* | 1709 | /* |
@@ -2259,7 +2257,7 @@ void ntfs_evict_big_inode(struct inode *vi) | |||
2259 | { | 2257 | { |
2260 | ntfs_inode *ni = NTFS_I(vi); | 2258 | ntfs_inode *ni = NTFS_I(vi); |
2261 | 2259 | ||
2262 | truncate_inode_pages(&vi->i_data, 0); | 2260 | truncate_inode_pages_final(&vi->i_data); |
2263 | clear_inode(vi); | 2261 | clear_inode(vi); |
2264 | 2262 | ||
2265 | #ifdef NTFS_RW | 2263 | #ifdef NTFS_RW |
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 82650d52d916..9de2491f2926 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * distribution in the file COPYING); if not, write to the Free Software | 19 | * distribution in the file COPYING); if not, write to the Free Software |
20 | * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 20 | * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 | */ | 21 | */ |
22 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
22 | 23 | ||
23 | #include <linux/stddef.h> | 24 | #include <linux/stddef.h> |
24 | #include <linux/init.h> | 25 | #include <linux/init.h> |
@@ -468,6 +469,8 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
468 | 469 | ||
469 | ntfs_debug("Entering with remount options string: %s", opt); | 470 | ntfs_debug("Entering with remount options string: %s", opt); |
470 | 471 | ||
472 | sync_filesystem(sb); | ||
473 | |||
471 | #ifndef NTFS_RW | 474 | #ifndef NTFS_RW |
472 | /* For read-only compiled driver, enforce read-only flag. */ | 475 | /* For read-only compiled driver, enforce read-only flag. */ |
473 | *flags |= MS_RDONLY; | 476 | *flags |= MS_RDONLY; |
@@ -1894,7 +1897,7 @@ get_ctx_vol_failed: | |||
1894 | vol->minor_ver = vi->minor_ver; | 1897 | vol->minor_ver = vi->minor_ver; |
1895 | ntfs_attr_put_search_ctx(ctx); | 1898 | ntfs_attr_put_search_ctx(ctx); |
1896 | unmap_mft_record(NTFS_I(vol->vol_ino)); | 1899 | unmap_mft_record(NTFS_I(vol->vol_ino)); |
1897 | printk(KERN_INFO "NTFS volume version %i.%i.\n", vol->major_ver, | 1900 | pr_info("volume version %i.%i.\n", vol->major_ver, |
1898 | vol->minor_ver); | 1901 | vol->minor_ver); |
1899 | if (vol->major_ver < 3 && NVolSparseEnabled(vol)) { | 1902 | if (vol->major_ver < 3 && NVolSparseEnabled(vol)) { |
1900 | ntfs_warning(vol->sb, "Disabling sparse support due to NTFS " | 1903 | ntfs_warning(vol->sb, "Disabling sparse support due to NTFS " |
@@ -3093,7 +3096,7 @@ static int __init init_ntfs_fs(void) | |||
3093 | int err = 0; | 3096 | int err = 0; |
3094 | 3097 | ||
3095 | /* This may be ugly but it results in pretty output so who cares. (-8 */ | 3098 | /* This may be ugly but it results in pretty output so who cares. (-8 */ |
3096 | printk(KERN_INFO "NTFS driver " NTFS_VERSION " [Flags: R/" | 3099 | pr_info("driver " NTFS_VERSION " [Flags: R/" |
3097 | #ifdef NTFS_RW | 3100 | #ifdef NTFS_RW |
3098 | "W" | 3101 | "W" |
3099 | #else | 3102 | #else |
@@ -3113,16 +3116,15 @@ static int __init init_ntfs_fs(void) | |||
3113 | sizeof(ntfs_index_context), 0 /* offset */, | 3116 | sizeof(ntfs_index_context), 0 /* offset */, |
3114 | SLAB_HWCACHE_ALIGN, NULL /* ctor */); | 3117 | SLAB_HWCACHE_ALIGN, NULL /* ctor */); |
3115 | if (!ntfs_index_ctx_cache) { | 3118 | if (!ntfs_index_ctx_cache) { |
3116 | printk(KERN_CRIT "NTFS: Failed to create %s!\n", | 3119 | pr_crit("Failed to create %s!\n", ntfs_index_ctx_cache_name); |
3117 | ntfs_index_ctx_cache_name); | ||
3118 | goto ictx_err_out; | 3120 | goto ictx_err_out; |
3119 | } | 3121 | } |
3120 | ntfs_attr_ctx_cache = kmem_cache_create(ntfs_attr_ctx_cache_name, | 3122 | ntfs_attr_ctx_cache = kmem_cache_create(ntfs_attr_ctx_cache_name, |
3121 | sizeof(ntfs_attr_search_ctx), 0 /* offset */, | 3123 | sizeof(ntfs_attr_search_ctx), 0 /* offset */, |
3122 | SLAB_HWCACHE_ALIGN, NULL /* ctor */); | 3124 | SLAB_HWCACHE_ALIGN, NULL /* ctor */); |
3123 | if (!ntfs_attr_ctx_cache) { | 3125 | if (!ntfs_attr_ctx_cache) { |
3124 | printk(KERN_CRIT "NTFS: Failed to create %s!\n", | 3126 | pr_crit("NTFS: Failed to create %s!\n", |
3125 | ntfs_attr_ctx_cache_name); | 3127 | ntfs_attr_ctx_cache_name); |
3126 | goto actx_err_out; | 3128 | goto actx_err_out; |
3127 | } | 3129 | } |
3128 | 3130 | ||
@@ -3130,8 +3132,7 @@ static int __init init_ntfs_fs(void) | |||
3130 | (NTFS_MAX_NAME_LEN+1) * sizeof(ntfschar), 0, | 3132 | (NTFS_MAX_NAME_LEN+1) * sizeof(ntfschar), 0, |
3131 | SLAB_HWCACHE_ALIGN, NULL); | 3133 | SLAB_HWCACHE_ALIGN, NULL); |
3132 | if (!ntfs_name_cache) { | 3134 | if (!ntfs_name_cache) { |
3133 | printk(KERN_CRIT "NTFS: Failed to create %s!\n", | 3135 | pr_crit("Failed to create %s!\n", ntfs_name_cache_name); |
3134 | ntfs_name_cache_name); | ||
3135 | goto name_err_out; | 3136 | goto name_err_out; |
3136 | } | 3137 | } |
3137 | 3138 | ||
@@ -3139,8 +3140,7 @@ static int __init init_ntfs_fs(void) | |||
3139 | sizeof(ntfs_inode), 0, | 3140 | sizeof(ntfs_inode), 0, |
3140 | SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL); | 3141 | SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, NULL); |
3141 | if (!ntfs_inode_cache) { | 3142 | if (!ntfs_inode_cache) { |
3142 | printk(KERN_CRIT "NTFS: Failed to create %s!\n", | 3143 | pr_crit("Failed to create %s!\n", ntfs_inode_cache_name); |
3143 | ntfs_inode_cache_name); | ||
3144 | goto inode_err_out; | 3144 | goto inode_err_out; |
3145 | } | 3145 | } |
3146 | 3146 | ||
@@ -3149,15 +3149,14 @@ static int __init init_ntfs_fs(void) | |||
3149 | SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, | 3149 | SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD, |
3150 | ntfs_big_inode_init_once); | 3150 | ntfs_big_inode_init_once); |
3151 | if (!ntfs_big_inode_cache) { | 3151 | if (!ntfs_big_inode_cache) { |
3152 | printk(KERN_CRIT "NTFS: Failed to create %s!\n", | 3152 | pr_crit("Failed to create %s!\n", ntfs_big_inode_cache_name); |
3153 | ntfs_big_inode_cache_name); | ||
3154 | goto big_inode_err_out; | 3153 | goto big_inode_err_out; |
3155 | } | 3154 | } |
3156 | 3155 | ||
3157 | /* Register the ntfs sysctls. */ | 3156 | /* Register the ntfs sysctls. */ |
3158 | err = ntfs_sysctl(1); | 3157 | err = ntfs_sysctl(1); |
3159 | if (err) { | 3158 | if (err) { |
3160 | printk(KERN_CRIT "NTFS: Failed to register NTFS sysctls!\n"); | 3159 | pr_crit("Failed to register NTFS sysctls!\n"); |
3161 | goto sysctl_err_out; | 3160 | goto sysctl_err_out; |
3162 | } | 3161 | } |
3163 | 3162 | ||
@@ -3166,7 +3165,7 @@ static int __init init_ntfs_fs(void) | |||
3166 | ntfs_debug("NTFS driver registered successfully."); | 3165 | ntfs_debug("NTFS driver registered successfully."); |
3167 | return 0; /* Success! */ | 3166 | return 0; /* Success! */ |
3168 | } | 3167 | } |
3169 | printk(KERN_CRIT "NTFS: Failed to register NTFS filesystem driver!\n"); | 3168 | pr_crit("Failed to register NTFS filesystem driver!\n"); |
3170 | 3169 | ||
3171 | /* Unregister the ntfs sysctls. */ | 3170 | /* Unregister the ntfs sysctls. */ |
3172 | ntfs_sysctl(0); | 3171 | ntfs_sysctl(0); |
@@ -3182,8 +3181,7 @@ actx_err_out: | |||
3182 | kmem_cache_destroy(ntfs_index_ctx_cache); | 3181 | kmem_cache_destroy(ntfs_index_ctx_cache); |
3183 | ictx_err_out: | 3182 | ictx_err_out: |
3184 | if (!err) { | 3183 | if (!err) { |
3185 | printk(KERN_CRIT "NTFS: Aborting NTFS filesystem driver " | 3184 | pr_crit("Aborting NTFS filesystem driver registration...\n"); |
3186 | "registration...\n"); | ||
3187 | err = -ENOMEM; | 3185 | err = -ENOMEM; |
3188 | } | 3186 | } |
3189 | return err; | 3187 | return err; |