diff options
Diffstat (limited to 'fs/ntfs')
-rw-r--r-- | fs/ntfs/logfile.c | 4 | ||||
-rw-r--r-- | fs/ntfs/mft.c | 2 | ||||
-rw-r--r-- | fs/ntfs/ntfs.h | 29 |
3 files changed, 32 insertions, 3 deletions
diff --git a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c index 0fd70295cca6..4af2ad1193ec 100644 --- a/fs/ntfs/logfile.c +++ b/fs/ntfs/logfile.c | |||
@@ -515,10 +515,10 @@ BOOL ntfs_check_logfile(struct inode *log_vi, RESTART_PAGE_HEADER **rp) | |||
515 | log_page_size = PAGE_CACHE_SIZE; | 515 | log_page_size = PAGE_CACHE_SIZE; |
516 | log_page_mask = log_page_size - 1; | 516 | log_page_mask = log_page_size - 1; |
517 | /* | 517 | /* |
518 | * Use generic_ffs() instead of ffs() to enable the compiler to | 518 | * Use ntfs_ffs() instead of ffs() to enable the compiler to |
519 | * optimize log_page_size and log_page_bits into constants. | 519 | * optimize log_page_size and log_page_bits into constants. |
520 | */ | 520 | */ |
521 | log_page_bits = generic_ffs(log_page_size) - 1; | 521 | log_page_bits = ntfs_ffs(log_page_size) - 1; |
522 | size &= ~(s64)(log_page_size - 1); | 522 | size &= ~(s64)(log_page_size - 1); |
523 | /* | 523 | /* |
524 | * Ensure the log file is big enough to store at least the two restart | 524 | * Ensure the log file is big enough to store at least the two restart |
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c index 4e72bc7afdf9..2438c00ec0ce 100644 --- a/fs/ntfs/mft.c +++ b/fs/ntfs/mft.c | |||
@@ -2670,7 +2670,7 @@ mft_rec_already_initialized: | |||
2670 | ni->name_len = 4; | 2670 | ni->name_len = 4; |
2671 | 2671 | ||
2672 | ni->itype.index.block_size = 4096; | 2672 | ni->itype.index.block_size = 4096; |
2673 | ni->itype.index.block_size_bits = generic_ffs(4096) - 1; | 2673 | ni->itype.index.block_size_bits = ntfs_ffs(4096) - 1; |
2674 | ni->itype.index.collation_rule = COLLATION_FILE_NAME; | 2674 | ni->itype.index.collation_rule = COLLATION_FILE_NAME; |
2675 | if (vol->cluster_size <= ni->itype.index.block_size) { | 2675 | if (vol->cluster_size <= ni->itype.index.block_size) { |
2676 | ni->itype.index.vcn_size = vol->cluster_size; | 2676 | ni->itype.index.vcn_size = vol->cluster_size; |
diff --git a/fs/ntfs/ntfs.h b/fs/ntfs/ntfs.h index 0624c8ef4d9c..166142960b53 100644 --- a/fs/ntfs/ntfs.h +++ b/fs/ntfs/ntfs.h | |||
@@ -132,4 +132,33 @@ extern int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins, | |||
132 | /* From fs/ntfs/upcase.c */ | 132 | /* From fs/ntfs/upcase.c */ |
133 | extern ntfschar *generate_default_upcase(void); | 133 | extern ntfschar *generate_default_upcase(void); |
134 | 134 | ||
135 | static inline int ntfs_ffs(int x) | ||
136 | { | ||
137 | int r = 1; | ||
138 | |||
139 | if (!x) | ||
140 | return 0; | ||
141 | if (!(x & 0xffff)) { | ||
142 | x >>= 16; | ||
143 | r += 16; | ||
144 | } | ||
145 | if (!(x & 0xff)) { | ||
146 | x >>= 8; | ||
147 | r += 8; | ||
148 | } | ||
149 | if (!(x & 0xf)) { | ||
150 | x >>= 4; | ||
151 | r += 4; | ||
152 | } | ||
153 | if (!(x & 3)) { | ||
154 | x >>= 2; | ||
155 | r += 2; | ||
156 | } | ||
157 | if (!(x & 1)) { | ||
158 | x >>= 1; | ||
159 | r += 1; | ||
160 | } | ||
161 | return r; | ||
162 | } | ||
163 | |||
135 | #endif /* _LINUX_NTFS_H */ | 164 | #endif /* _LINUX_NTFS_H */ |