On Tue 05-10-10 22:20:21, Dmitry Monakhov wrote: > @@ -1925,6 +1927,47 @@ int dquot_file_open(struct inode *inode, struct file *file) > } > EXPORT_SYMBOL(dquot_file_open); > > +int dquot_hash_alloc(struct super_block *sb, int order) > +{ > + unsigned long nr_hash, i; > + struct hlist_head *hash_array; > + struct dquot_hash *dq_hash = &sb_dqopt(sb)->dq_hash; > + > + hash_array = (struct hlist_head *)__get_free_pages(GFP_KERNEL, order); > + if (!hash_array) > + return -ENOMEM; > + > + /* Find power-of-two hlist_heads which can fit into allocation */ > + nr_hash = (1UL << order) * PAGE_SIZE / sizeof(struct hlist_head); > + dq_hash->bits = 0; > + do { > + dq_hash->bits++; > + } while (nr_hash >> dq_hash->bits); > + dq_hash->bits--; We have ilog2() function for this these days... > +void dquot_hash_destroy(struct super_block *sb) > +{ > + > + struct dquot_hash * dq_hash = &sb_dqopt(sb)->dq_hash; > + unsigned long i, nr_hash = 1UL << dq_hash->bits; > + unsigned long addr = (unsigned long )dq_hash->head; ^ superfluous space > + > + for (i = 0; i < nr_hash; i++) > + BUG_ON(!hlist_empty(dq_hash->head + i)); Just WARN_ON + return would be better. It's probably better to leak a page of kernel memory than crash the whole kernel... Honza -- Jan Kara <jack@xxxxxxx> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html