[PATCH] bitops: ntfs: remove generic_ffs()
authorAkinobu Mita <mita@miraclelinux.com>
Sun, 26 Mar 2006 09:39:53 +0000 (01:39 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 26 Mar 2006 16:57:15 +0000 (08:57 -0800)
Now the only user who are using generic_ffs() is ntfs filesystem.  This patch
isolates generic_ffs() as ntfs_ffs() for ntfs.

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Cc: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/ntfs/logfile.c
fs/ntfs/mft.c
fs/ntfs/ntfs.h

index 0fd70295cca67347694d815e85e335c25efb2b68..4af2ad1193ec374288f0f803ce7bf3b05ee9da62 100644 (file)
@@ -515,10 +515,10 @@ BOOL ntfs_check_logfile(struct inode *log_vi, RESTART_PAGE_HEADER **rp)
                log_page_size = PAGE_CACHE_SIZE;
        log_page_mask = log_page_size - 1;
        /*
-        * Use generic_ffs() instead of ffs() to enable the compiler to
+        * Use ntfs_ffs() instead of ffs() to enable the compiler to
         * optimize log_page_size and log_page_bits into constants.
         */
-       log_page_bits = generic_ffs(log_page_size) - 1;
+       log_page_bits = ntfs_ffs(log_page_size) - 1;
        size &= ~(s64)(log_page_size - 1);
        /*
         * Ensure the log file is big enough to store at least the two restart
index 4e72bc7afdf9e73dbdcf72b308119e67e6b36bea..2438c00ec0cee309a7f52f23a584fbb2e1769bf1 100644 (file)
@@ -2670,7 +2670,7 @@ mft_rec_already_initialized:
                        ni->name_len = 4;
 
                        ni->itype.index.block_size = 4096;
-                       ni->itype.index.block_size_bits = generic_ffs(4096) - 1;
+                       ni->itype.index.block_size_bits = ntfs_ffs(4096) - 1;
                        ni->itype.index.collation_rule = COLLATION_FILE_NAME;
                        if (vol->cluster_size <= ni->itype.index.block_size) {
                                ni->itype.index.vcn_size = vol->cluster_size;
index 0624c8ef4d9ca9611ad3a877353c052fabc80ea4..166142960b53be467e9392f0d13ce87057185445 100644 (file)
@@ -132,4 +132,33 @@ extern int ntfs_ucstonls(const ntfs_volume *vol, const ntfschar *ins,
 /* From fs/ntfs/upcase.c */
 extern ntfschar *generate_default_upcase(void);
 
+static inline int ntfs_ffs(int x)
+{
+       int r = 1;
+
+       if (!x)
+               return 0;
+       if (!(x & 0xffff)) {
+               x >>= 16;
+               r += 16;
+       }
+       if (!(x & 0xff)) {
+               x >>= 8;
+               r += 8;
+       }
+       if (!(x & 0xf)) {
+               x >>= 4;
+               r += 4;
+       }
+       if (!(x & 3)) {
+               x >>= 2;
+               r += 2;
+       }
+       if (!(x & 1)) {
+               x >>= 1;
+               r += 1;
+       }
+       return r;
+}
+
 #endif /* _LINUX_NTFS_H */