aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ntfs')
-rw-r--r--fs/ntfs/dir.c5
-rw-r--r--fs/ntfs/inode.c6
-rw-r--r--fs/ntfs/mft.c9
-rw-r--r--fs/ntfs/super.c28
-rw-r--r--fs/ntfs/unistr.c4
5 files changed, 12 insertions, 40 deletions
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c
index d1e2c6f9f05e..85c36b8ca452 100644
--- a/fs/ntfs/dir.c
+++ b/fs/ntfs/dir.c
@@ -1149,8 +1149,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
1149 * Allocate a buffer to store the current name being processed 1149 * Allocate a buffer to store the current name being processed
1150 * converted to format determined by current NLS. 1150 * converted to format determined by current NLS.
1151 */ 1151 */
1152 name = (u8*)kmalloc(NTFS_MAX_NAME_LEN * NLS_MAX_CHARSET_SIZE + 1, 1152 name = kmalloc(NTFS_MAX_NAME_LEN * NLS_MAX_CHARSET_SIZE + 1, GFP_NOFS);
1153 GFP_NOFS);
1154 if (unlikely(!name)) { 1153 if (unlikely(!name)) {
1155 err = -ENOMEM; 1154 err = -ENOMEM;
1156 goto err_out; 1155 goto err_out;
@@ -1191,7 +1190,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
1191 * map the mft record without deadlocking. 1190 * map the mft record without deadlocking.
1192 */ 1191 */
1193 rc = le32_to_cpu(ctx->attr->data.resident.value_length); 1192 rc = le32_to_cpu(ctx->attr->data.resident.value_length);
1194 ir = (INDEX_ROOT*)kmalloc(rc, GFP_NOFS); 1193 ir = kmalloc(rc, GFP_NOFS);
1195 if (unlikely(!ir)) { 1194 if (unlikely(!ir)) {
1196 err = -ENOMEM; 1195 err = -ENOMEM;
1197 goto err_out; 1196 goto err_out;
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index d313f356e66a..933dbd89c2a4 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -137,7 +137,7 @@ static int ntfs_init_locked_inode(struct inode *vi, ntfs_attr *na)
137 137
138 BUG_ON(!na->name); 138 BUG_ON(!na->name);
139 i = na->name_len * sizeof(ntfschar); 139 i = na->name_len * sizeof(ntfschar);
140 ni->name = (ntfschar*)kmalloc(i + sizeof(ntfschar), GFP_ATOMIC); 140 ni->name = kmalloc(i + sizeof(ntfschar), GFP_ATOMIC);
141 if (!ni->name) 141 if (!ni->name)
142 return -ENOMEM; 142 return -ENOMEM;
143 memcpy(ni->name, na->name, i); 143 memcpy(ni->name, na->name, i);
@@ -556,8 +556,6 @@ static int ntfs_read_locked_inode(struct inode *vi)
556 556
557 /* Setup the generic vfs inode parts now. */ 557 /* Setup the generic vfs inode parts now. */
558 558
559 /* This is the optimal IO size (for stat), not the fs block size. */
560 vi->i_blksize = PAGE_CACHE_SIZE;
561 /* 559 /*
562 * This is for checking whether an inode has changed w.r.t. a file so 560 * This is for checking whether an inode has changed w.r.t. a file so
563 * that the file can be updated if necessary (compare with f_version). 561 * that the file can be updated if necessary (compare with f_version).
@@ -1234,7 +1232,6 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
1234 base_ni = NTFS_I(base_vi); 1232 base_ni = NTFS_I(base_vi);
1235 1233
1236 /* Just mirror the values from the base inode. */ 1234 /* Just mirror the values from the base inode. */
1237 vi->i_blksize = base_vi->i_blksize;
1238 vi->i_version = base_vi->i_version; 1235 vi->i_version = base_vi->i_version;
1239 vi->i_uid = base_vi->i_uid; 1236 vi->i_uid = base_vi->i_uid;
1240 vi->i_gid = base_vi->i_gid; 1237 vi->i_gid = base_vi->i_gid;
@@ -1504,7 +1501,6 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi)
1504 ni = NTFS_I(vi); 1501 ni = NTFS_I(vi);
1505 base_ni = NTFS_I(base_vi); 1502 base_ni = NTFS_I(base_vi);
1506 /* Just mirror the values from the base inode. */ 1503 /* Just mirror the values from the base inode. */
1507 vi->i_blksize = base_vi->i_blksize;
1508 vi->i_version = base_vi->i_version; 1504 vi->i_version = base_vi->i_version;
1509 vi->i_uid = base_vi->i_uid; 1505 vi->i_uid = base_vi->i_uid;
1510 vi->i_gid = base_vi->i_gid; 1506 vi->i_gid = base_vi->i_gid;
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c
index 2438c00ec0ce..584260fd6848 100644
--- a/fs/ntfs/mft.c
+++ b/fs/ntfs/mft.c
@@ -331,7 +331,7 @@ map_err_out:
331 ntfs_inode **tmp; 331 ntfs_inode **tmp;
332 int new_size = (base_ni->nr_extents + 4) * sizeof(ntfs_inode *); 332 int new_size = (base_ni->nr_extents + 4) * sizeof(ntfs_inode *);
333 333
334 tmp = (ntfs_inode **)kmalloc(new_size, GFP_NOFS); 334 tmp = kmalloc(new_size, GFP_NOFS);
335 if (unlikely(!tmp)) { 335 if (unlikely(!tmp)) {
336 ntfs_error(base_ni->vol->sb, "Failed to allocate " 336 ntfs_error(base_ni->vol->sb, "Failed to allocate "
337 "internal buffer."); 337 "internal buffer.");
@@ -2638,11 +2638,6 @@ mft_rec_already_initialized:
2638 } 2638 }
2639 vi->i_ino = bit; 2639 vi->i_ino = bit;
2640 /* 2640 /*
2641 * This is the optimal IO size (for stat), not the fs block
2642 * size.
2643 */
2644 vi->i_blksize = PAGE_CACHE_SIZE;
2645 /*
2646 * This is for checking whether an inode has changed w.r.t. a 2641 * This is for checking whether an inode has changed w.r.t. a
2647 * file so that the file can be updated if necessary (compare 2642 * file so that the file can be updated if necessary (compare
2648 * with f_version). 2643 * with f_version).
@@ -2893,7 +2888,7 @@ rollback:
2893 if (!(base_ni->nr_extents & 3)) { 2888 if (!(base_ni->nr_extents & 3)) {
2894 int new_size = (base_ni->nr_extents + 4) * sizeof(ntfs_inode*); 2889 int new_size = (base_ni->nr_extents + 4) * sizeof(ntfs_inode*);
2895 2890
2896 extent_nis = (ntfs_inode**)kmalloc(new_size, GFP_NOFS); 2891 extent_nis = kmalloc(new_size, GFP_NOFS);
2897 if (unlikely(!extent_nis)) { 2892 if (unlikely(!extent_nis)) {
2898 ntfs_error(vol->sb, "Failed to allocate internal " 2893 ntfs_error(vol->sb, "Failed to allocate internal "
2899 "buffer during rollback.%s", es); 2894 "buffer during rollback.%s", es);
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c
index 74e0ee8fce72..6b2712f10dd2 100644
--- a/fs/ntfs/super.c
+++ b/fs/ntfs/super.c
@@ -3248,32 +3248,14 @@ ictx_err_out:
3248 3248
3249static void __exit exit_ntfs_fs(void) 3249static void __exit exit_ntfs_fs(void)
3250{ 3250{
3251 int err = 0;
3252
3253 ntfs_debug("Unregistering NTFS driver."); 3251 ntfs_debug("Unregistering NTFS driver.");
3254 3252
3255 unregister_filesystem(&ntfs_fs_type); 3253 unregister_filesystem(&ntfs_fs_type);
3256 3254 kmem_cache_destroy(ntfs_big_inode_cache);
3257 if (kmem_cache_destroy(ntfs_big_inode_cache) && (err = 1)) 3255 kmem_cache_destroy(ntfs_inode_cache);
3258 printk(KERN_CRIT "NTFS: Failed to destory %s.\n", 3256 kmem_cache_destroy(ntfs_name_cache);
3259 ntfs_big_inode_cache_name); 3257 kmem_cache_destroy(ntfs_attr_ctx_cache);
3260 if (kmem_cache_destroy(ntfs_inode_cache) && (err = 1)) 3258 kmem_cache_destroy(ntfs_index_ctx_cache);
3261 printk(KERN_CRIT "NTFS: Failed to destory %s.\n",
3262 ntfs_inode_cache_name);
3263 if (kmem_cache_destroy(ntfs_name_cache) && (err = 1))
3264 printk(KERN_CRIT "NTFS: Failed to destory %s.\n",
3265 ntfs_name_cache_name);
3266 if (kmem_cache_destroy(ntfs_attr_ctx_cache) && (err = 1))
3267 printk(KERN_CRIT "NTFS: Failed to destory %s.\n",
3268 ntfs_attr_ctx_cache_name);
3269 if (kmem_cache_destroy(ntfs_index_ctx_cache) && (err = 1))
3270 printk(KERN_CRIT "NTFS: Failed to destory %s.\n",
3271 ntfs_index_ctx_cache_name);
3272 if (err)
3273 printk(KERN_CRIT "NTFS: This causes memory to leak! There is "
3274 "probably a BUG in the driver! Please report "
3275 "you saw this message to "
3276 "linux-ntfs-dev@lists.sourceforge.net\n");
3277 /* Unregister the ntfs sysctls. */ 3259 /* Unregister the ntfs sysctls. */
3278 ntfs_sysctl(0); 3260 ntfs_sysctl(0);
3279} 3261}
diff --git a/fs/ntfs/unistr.c b/fs/ntfs/unistr.c
index b123c0fa6bf6..a1b572196fe4 100644
--- a/fs/ntfs/unistr.c
+++ b/fs/ntfs/unistr.c
@@ -350,7 +350,7 @@ int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins,
350 } 350 }
351 if (!ns) { 351 if (!ns) {
352 ns_len = ins_len * NLS_MAX_CHARSET_SIZE; 352 ns_len = ins_len * NLS_MAX_CHARSET_SIZE;
353 ns = (unsigned char*)kmalloc(ns_len + 1, GFP_NOFS); 353 ns = kmalloc(ns_len + 1, GFP_NOFS);
354 if (!ns) 354 if (!ns)
355 goto mem_err_out; 355 goto mem_err_out;
356 } 356 }
@@ -365,7 +365,7 @@ retry: wc = nls->uni2char(le16_to_cpu(ins[i]), ns + o,
365 else if (wc == -ENAMETOOLONG && ns != *outs) { 365 else if (wc == -ENAMETOOLONG && ns != *outs) {
366 unsigned char *tc; 366 unsigned char *tc;
367 /* Grow in multiples of 64 bytes. */ 367 /* Grow in multiples of 64 bytes. */
368 tc = (unsigned char*)kmalloc((ns_len + 64) & 368 tc = kmalloc((ns_len + 64) &
369 ~63, GFP_NOFS); 369 ~63, GFP_NOFS);
370 if (tc) { 370 if (tc) {
371 memcpy(tc, ns, ns_len); 371 memcpy(tc, ns, ns_len);