diff options
author | Alexander Viro <viro@www.linux.org.uk> | 2004-07-15 22:51:51 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-07-15 22:51:51 -0700 |
commit | 8da81535be9de15a6e038a4cee2c0975050cab11 (patch) | |
tree | a5b46b2551e33df0c51b52795c8258f2fd1b847b /fs | |
parent | 42d0844119edb980a6aba30aad7fe96d401af85e (diff) | |
download | history-8da81535be9de15a6e038a4cee2c0975050cab11.tar.gz |
[PATCH] hfs and hfsplus switched to use of ffs(3) instead of homegrown versions
Diffstat (limited to 'fs')
-rw-r--r-- | fs/hfs/btree.c | 7 | ||||
-rw-r--r-- | fs/hfsplus/btree.c | 6 |
2 files changed, 4 insertions, 9 deletions
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c index 3e620efdd476ee..19f10cf9f6fb73 100644 --- a/fs/hfs/btree.c +++ b/fs/hfs/btree.c @@ -19,7 +19,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke struct hfs_btree_header_rec *head; struct address_space *mapping; struct page *page; - unsigned int shift, size; + unsigned int size; tree = kmalloc(sizeof(*tree), GFP_KERNEL); if (!tree) @@ -82,10 +82,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke goto fail_page; if (!tree->node_count) goto fail_page; - for (shift = 0; size >>= 1; shift += 1) - ; - tree->node_size_shift = shift; - + tree->node_size_shift = ffs(size) - 1; tree->pages_per_bnode = (tree->node_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; kunmap(page); diff --git a/fs/hfsplus/btree.c b/fs/hfsplus/btree.c index 84870a169fc727..b0713649010251 100644 --- a/fs/hfsplus/btree.c +++ b/fs/hfsplus/btree.c @@ -22,7 +22,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id) struct hfs_btree_header_rec *head; struct address_space *mapping; struct page *page; - unsigned int shift, size; + unsigned int size; tree = kmalloc(sizeof(*tree), GFP_KERNEL); if (!tree) @@ -69,9 +69,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id) goto fail_page; if (!tree->node_count) goto fail_page; - for (shift = 0; size >>= 1; shift += 1) - ; - tree->node_size_shift = shift; + tree->node_size_shift = ffs(size) - 1; tree->pages_per_bnode = (tree->node_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; |