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: <201007161302.35775.arnd@arndb.de>
Date:	Fri, 16 Jul 2010 13:02:35 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	David Howells <dhowells@...hat.com>
Cc:	Mark Harris <mhlk@....us>, Steve French <smfrench@...il.com>,
	viro@...iv.linux.org.uk, linux-fsdevel@...r.kernel.org,
	linux-nfs@...r.kernel.org, linux-cifs@...r.kernel.org,
	linux-kernel@...r.kernel.org, samba-technical@...ts.samba.org,
	linux-ext4@...r.kernel.org
Subject: Re: [PATCH 02/18] xstat: Add a pair of system calls to make extended file stats available [ver #6]

On Friday 16 July 2010, David Howells wrote:
> Mark Harris <mhlk@....us> wrote:
> So how about using up the dead space for what Steve French wanted:
> 
>         | One hole that this reminded me about is how to return the superblock
>         | time granularity (for NFSv4 this is attribute 51 "time_delta" which
>         | is called on a superblock not on a file).  We run into time rounding
>         | issues with Samba too.
> 
> By doing something like:
> 
>         struct xstat_time {
>                 signed long long        tv_sec;
>                 unsigned int            tv_nsec;
>                 unsigned short          tv_granularity;
>                 unsigned short          tv_gran_units;
>         };

I like that!

> Where tv_granularity is the minimum granularity for tv_sec and tv_nsec given
> as a quantity of tv_gran_units.  tv_gran_units could then be a constant, such
> as:
> 
>         XSTAT_NANOSECONDS_GRANULARITY
>         XSTAT_MICROSECONDS_GRANULARITY
>         XSTAT_MILLISECONDS_GRANULARITY
>         XSTAT_SECONDS_GRANULARITY
>         XSTAT_MINUTES_GRANULARITY
>         XSTAT_HOURS_GRANULARITY
>         XSTAT_DAYS_GRANULARITY
> 
> So, for example, FAT times are a 2s granularity, so FAT would set
> tv_granularity to 2 and tv_gran_units to XSTAT_SECONDS_GRANULARITY.

You could also define the tv_gran_units to be power-of-ten nanoseconds,
making it a decimal floating point number like 

enum {
	XSTAT_NANOSECONDS_GRANULARITY = 0,
	XSTAT_MICROSECONDS_GRANULARITY = 3,
	XSTAT_MILLISECONDS_GRANULARITY = 6,
	XSTAT_SECONDS_GRANULARITY = 9,
};

That would make it easier to define an xstat_time_before() function, though
it means that you could no longer do XSTAT_MINUTES_GRANULARITY and
higher directly other than { .tv_gran_units = 10, .tv_granularity = 6, }.

> We could even support picosecond granularity if we made tv_nsec a 5-byte
> field (tv_psec):
> 
>         struct xstat_time {
>                 signed long long        tv_sec;
>                 unsigned long long      tv_gran_units : 8;
>                 unsigned long long      tv_granularity : 16;
>                 unsigned long long      tv_psec : 48;
>         };
> 
> but that's probably excessive.  Does any filesystem we currently support need
> that?

I wouldn't even go that far if we needed sub-ns (I don't think we do), because
that breaks old compilers that cannot do bit fields.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ