lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y9pxi7C+uUumQKFA@qxy-XPS-13-9360>
Date:   Wed, 1 Feb 2023 22:04:59 +0800
From:   qixiaoyu <qxy65535@...il.com>
To:     Chao Yu <chao@...nel.org>, Jaegeuk Kim <jaegeuk@...nel.org>
Cc:     xiongping1@...omi.com, qixiaoyu1@...omi.com,
        linux-kernel@...r.kernel.org,
        linux-f2fs-devel@...ts.sourceforge.net
Subject: Re: [PATCH 1/2 v2] f2fs: fix wrong calculation of block age

On Wed, Feb 01, 2023 at 08:57:33PM +0800, Chao Yu wrote:
> On 2023/2/1 20:23, qixiaoyu wrote:
> > > > 
> > > > How about updating as below to avoid lossing accuracy if new is less than 100?
> > > > 
> > > > return div_u64(new * (100 - LAST_AGE_WEIGHT), 100) +
> > > > 		div_u64(old * LAST_AGE_WEIGHT, 100);
> > > > 
> > > > Thanks,
> > > > 
> > > 
> > > We want to avoid overflow by doing the division first. To keep the accuracy, how
> 
> Alright,
> 
> > > about updating as below:
> > > 
> > > 	res = div_u64_rem(new, 100, &rem_new) * (100 - LAST_AGE_WEIGHT)
> > > 		+ div_u64_rem(old, 100, &rem_old) * LAST_AGE_WEIGHT;
> > > 	res += rem_new * (100 - LAST_AGE_WEIGHT) / 100 + rem_old * LAST_AGE_WEIGHT / 100;
> > > 	return res;
> 
> if (rem_new)
> 	res += rem_new * (100 - LAST_AGE_WEIGHT) / 100;
> if (rem_old)
> 	res += rem_old * LAST_AGE_WEIGHT / 100;
> 
> Otherwise, it looks fine to me. :)
> 
> Thanks,
> 

Thank you! I will update v3 soon :)

> > > 
> > > Thanks,
> > > 
> > 
> > Friendly ping
> > 
> > > > >    }
> > > > >    /* This returns a new age and allocated blocks in ei */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ