Re: [patch 7/7] reiserfs: ignore on disk s_bmap_nr value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 16 Oct 2007 19:02:17 -0400
Jeff Mahoney <jeffm@xxxxxxxx> wrote:

> +/* s_bmap_nr is a u16 */
> +#define reiserfs_bmap_count(sb)	reiserfs_bmap_nr(SB_BLOCK_COUNT(sb), sb->s_blocksize)
> +#define reiserfs_bmap_nr(count, blk_size) ((count - 1) / (blk_size * 8) + 1)
> +#define bmap_would_wrap(n)		(n > ((1LL << 16) - 1))

Please only use macros when the code HAS to be implemented as a macro for
some reason.  These could have been implemented as (possibly inlined) C
functions.  

reiserfs_bmap_count() is in fact buggy - it references its argument more
than once.  Nobody will be doing reiserfs_bmap_count(foo++), but it is bad
practice.

Also, all three macros fail to sufficiently parenthesise their arguments.

All this is fixable by coding in C, not cpp...
-
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux