Re: [PATCH 01/41] fs/adfs: inode: update timestamps to centisecond precision

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

 



On Mon, Dec 09, 2019 at 02:40:00PM +0000, Russell King - ARM Linux admin wrote:
> > Sounds good. :) But why namely 10000000?
> 
> I don't know what you mean.
> 
> If you're asking, why "10000000", isn't it obvious if you read the
> commit message?  adfs has "centi-second" granularity. s_time_gran
> is in nanoseconds. There are 10000000 nanoseconds in a centisecond.
> 
> What do you expect?
> 
> #define ADFS_TIME_GRAN 10000000
> 
> 	sb->s_time_gran = ADFS_TIME_GRAN;
> 
> ?
> 
> How does that help - it just stupidly and needlessly obfuscates the
> code.
> 
> The whole "use definitions for constants" is idiotic when a constant
> is only used in one place - when it means you have to search through
> more source code to find it's single definition. Sorry, I'm not
> doing that and make readability *worse*.

I'd find it more readable if you wrote it as 10 * 1000 * 1000.  Saves
trying to count zeroes.  I know C added the ability to spell that as
10'000'000, but I don't think all compiler versions support that yet.

Maybe this would be cleanest:

	sb->s_time_gran = NSEC_PER_SEC / 100;

This is definitely how not to do it:

include/acpi/actypes.h:#define ACPI_100NSEC_PER_SEC            10000000L




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux