Commit 8da81535 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] hfs and hfsplus switched to use of ffs(3) instead of homegrown versions

parent 42d08441
...@@ -19,7 +19,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke ...@@ -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 hfs_btree_header_rec *head;
struct address_space *mapping; struct address_space *mapping;
struct page *page; struct page *page;
unsigned int shift, size; unsigned int size;
tree = kmalloc(sizeof(*tree), GFP_KERNEL); tree = kmalloc(sizeof(*tree), GFP_KERNEL);
if (!tree) if (!tree)
...@@ -82,10 +82,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke ...@@ -82,10 +82,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
goto fail_page; goto fail_page;
if (!tree->node_count) if (!tree->node_count)
goto fail_page; goto fail_page;
for (shift = 0; size >>= 1; shift += 1) tree->node_size_shift = ffs(size) - 1;
;
tree->node_size_shift = shift;
tree->pages_per_bnode = (tree->node_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; tree->pages_per_bnode = (tree->node_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
kunmap(page); kunmap(page);
......
...@@ -22,7 +22,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id) ...@@ -22,7 +22,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
struct hfs_btree_header_rec *head; struct hfs_btree_header_rec *head;
struct address_space *mapping; struct address_space *mapping;
struct page *page; struct page *page;
unsigned int shift, size; unsigned int size;
tree = kmalloc(sizeof(*tree), GFP_KERNEL); tree = kmalloc(sizeof(*tree), GFP_KERNEL);
if (!tree) if (!tree)
...@@ -69,9 +69,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id) ...@@ -69,9 +69,7 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id)
goto fail_page; goto fail_page;
if (!tree->node_count) if (!tree->node_count)
goto fail_page; goto fail_page;
for (shift = 0; size >>= 1; shift += 1) tree->node_size_shift = ffs(size) - 1;
;
tree->node_size_shift = shift;
tree->pages_per_bnode = (tree->node_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; tree->pages_per_bnode = (tree->node_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment