Commit 7fafb8b634121f4fa35ff92f85737f8bc2259f06

Authored by Anton Altaparmakov
1 parent bb3cf33509

NTFS: Minor cleanup: Define and use NTFS_MAX_CLUSTER_SIZE constant instead

of hard coded 0x10000 in fs/ntfs/super.c.

Signed-off-by: Anton Altaparmakov <aia21@cantab.net>

Showing 3 changed files with 8 additions and 3 deletions Side-by-side Diff

... ... @@ -111,6 +111,8 @@
111 111 refusing the mount. Thanks to Bernd Casimir for pointing this
112 112 problem out.
113 113 - Update attribute definition handling.
  114 + - Add NTFS_MAX_CLUSTER_SIZE and NTFS_MAX_PAGES_PER_CLUSTER constants.
  115 + - Use NTFS_MAX_CLUSTER_SIZE in super.c instead of hard coding 0x10000.
114 116  
115 117 2.1.22 - Many bug and race fixes and error handling improvements.
116 118  
... ... @@ -31,6 +31,7 @@
31 31 #include <linux/fs.h>
32 32 #include <linux/nls.h>
33 33 #include <linux/smp.h>
  34 +#include <linux/pagemap.h>
34 35  
35 36 #include "types.h"
36 37 #include "volume.h"
... ... @@ -42,6 +43,8 @@
42 43 NTFS_SB_MAGIC = 0x5346544e, /* 'NTFS' */
43 44 NTFS_MAX_NAME_LEN = 255,
44 45 NTFS_MAX_ATTR_NAME_LEN = 255,
  46 + NTFS_MAX_CLUSTER_SIZE = 64 * 1024, /* 64kiB */
  47 + NTFS_MAX_PAGES_PER_CLUSTER = NTFS_MAX_CLUSTER_SIZE / PAGE_CACHE_SIZE,
45 48 } NTFS_CONSTANTS;
46 49  
47 50 /* Global variables. */
... ... @@ -561,9 +561,9 @@
561 561 default:
562 562 goto not_ntfs;
563 563 }
564   - /* Check the cluster size is not above 65536 bytes. */
  564 + /* Check the cluster size is not above the maximum (64kiB). */
565 565 if ((u32)le16_to_cpu(b->bpb.bytes_per_sector) *
566   - b->bpb.sectors_per_cluster > 0x10000)
  566 + b->bpb.sectors_per_cluster > NTFS_MAX_CLUSTER_SIZE)
567 567 goto not_ntfs;
568 568 /* Check reserved/unused fields are really zero. */
569 569 if (le16_to_cpu(b->bpb.reserved_sectors) ||
... ... @@ -2585,7 +2585,7 @@
2585 2585 */
2586 2586 kmem_cache_t *ntfs_name_cache;
2587 2587  
2588   -/* Slab caches for efficient allocation/deallocation of of inodes. */
  2588 +/* Slab caches for efficient allocation/deallocation of inodes. */
2589 2589 kmem_cache_t *ntfs_inode_cache;
2590 2590 kmem_cache_t *ntfs_big_inode_cache;
2591 2591