On Fri, Aug 19, 2011 at 02:02:00PM -0400, Josh Boyer wrote: > -unsigned long minix_count_free_blocks(struct minix_sb_info *sbi) > +unsigned long minix_count_free_blocks(struct super_block *sb) > { > - return (count_free(sbi->s_zmap, sbi->s_zmap_blocks, > - sbi->s_nzones - sbi->s_firstdatazone + 1) > + struct minix_sb_info *sbi = minix_sb(sb); > + u32 bits = sbi->s_nzones - (sbi->s_firstdatazone + 1); > + unsigned blocks = minix_blocks_needed(bits, sb->s_blocksize); > + > + return (count_free(sbi->s_zmap, blocks, bits) > << sbi->s_log_zone_size); > } > + unsigned blocks = minix_blocks_needed(bits, sb->s_blocksize); > + > + return count_free(sbi->s_imap, blocks, bits); I'd pass sb->s_blocksize to that sucker instead of blocks; less redundancy and we have good uses for it there anyway. > +static inline unsigned minix_blocks_needed(unsigned bits, unsigned blocksize) > +{ > + unsigned blocks = bits / (blocksize * 8); > + > + if (bits % (blocksize * 8)) > + blocks++; > + return blocks; > +} Yecchh... The usual idiom for that is DIV_ROUND_UP(bits, blocksize * 8) (see linux/kernel.h for details). -- 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