Preparation patch for bugfix-sums-with-different-block-size.patch A new function au_add_muldiv_till_max which works like au_add_till_max but adds the result of b*mul/div instead of just b.
NEED SOME HELP HERE: the function is not overflow-safe yet. I think there must be such functions in the kernel already, but I'm to new to know where to find it. Possibly this function could also be implemented by using bit shifting. =================================================================== --- aufs3-standalone.git.orig/fs/aufs/super.c 2012-03-13 21:47:55.000000000 +0100 +++ aufs3-standalone.git/fs/aufs/super.c 2012-03-13 22:28:48.000000000 +0100 @@ -310,6 +310,19 @@ return ULLONG_MAX; } +static u64 au_add_muldiv_till_max(u64 a, u64 b, u64 mul, u64 div) +{ + u64 old; + + b *= mul; + + old = a; + a += div64_u64(b, div); + if (old <= a) + return a; + return ULLONG_MAX; +} + static int au_statfs_sum(struct super_block *sb, struct kstatfs *buf) { int err; ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d