All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Adam <obnox@samba.org>
To: Deepa Dinamani <deepa.kernel@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	y2038@lists.linaro.org
Subject: Re: [RFC 13/15] kernel: time: change inode_timespec to timespec64
Date: Thu, 7 Jan 2016 09:50:30 +0100	[thread overview]
Message-ID: <20160107085030.GB27847@samba.org> (raw)
In-Reply-To: <1452144972-15802-14-git-send-email-deepa.kernel@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 6441 bytes --]

Hi,

the patch contains a conflict resolution artifact..

Cheers - Michael

On 2016-01-06 at 21:36 -0800, Deepa Dinamani wrote:
> Substitute inode_timespec aliases with timespec64.
> Since CONFIG_FS_USES_64BIT_TIME is enabled, internally
> all inode_timespec references are using timespec64
> already.
> 
> Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
> 
> Conflicts:
> 	kernel/time/time.c
> 
> Conflicts:
> 	kernel/time/time.c
> ---
>  kernel/time/time.c | 130 +++++++++++++++++++++++++++++++----------------------
>  1 file changed, 76 insertions(+), 54 deletions(-)
> 
> diff --git a/kernel/time/time.c b/kernel/time/time.c
> index 24ca258..87d9a4c 100644
> --- a/kernel/time/time.c
> +++ b/kernel/time/time.c
> @@ -230,6 +230,76 @@ SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p)
>  	return copy_to_user(txc_p, &txc, sizeof(struct timex)) ? -EFAULT : ret;
>  }
>  
> +<<<<<<< HEAD
> +=======

HERE ^^^^^

> +/**
> + * current_fs_time - Return FS time
> + * @sb: Superblock.
> + *
> + * Return the current time truncated to the time granularity supported by
> + * the fs.
> + */
> +struct timespec64 current_fs_time(struct super_block *sb)
> +{
> +	struct timespec64 now = current_kernel_time64();
> +
> +	return fs_time_trunc(now, sb);
> +}
> +EXPORT_SYMBOL(current_fs_time);
> +
> +struct timespec64 current_fs_time_sec(struct super_block *sb)
> +{
> +	struct timespec64 ts = {ktime_get_real_seconds(), 0};
> +
> +	/* range check for time. */
> +	fs_time_range_check(sb, &ts);
> +
> +	return ts;
> +}
> +EXPORT_SYMBOL(current_fs_time_sec);
> +
> +/*
> + * Convert jiffies to milliseconds and back.
> + *
> + * Avoid unnecessary multiplications/divisions in the
> + * two most common HZ cases:
> + */
> +unsigned int jiffies_to_msecs(const unsigned long j)
> +{
> +#if HZ <= MSEC_PER_SEC && !(MSEC_PER_SEC % HZ)
> +	return (MSEC_PER_SEC / HZ) * j;
> +#elif HZ > MSEC_PER_SEC && !(HZ % MSEC_PER_SEC)
> +	return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);
> +#else
> +# if BITS_PER_LONG == 32
> +	return (HZ_TO_MSEC_MUL32 * j) >> HZ_TO_MSEC_SHR32;
> +# else
> +	return (j * HZ_TO_MSEC_NUM) / HZ_TO_MSEC_DEN;
> +# endif
> +#endif
> +}
> +EXPORT_SYMBOL(jiffies_to_msecs);
> +
> +unsigned int jiffies_to_usecs(const unsigned long j)
> +{
> +	/*
> +	 * Hz usually doesn't go much further MSEC_PER_SEC.
> +	 * jiffies_to_usecs() and usecs_to_jiffies() depend on that.
> +	 */
> +	BUILD_BUG_ON(HZ > USEC_PER_SEC);
> +
> +#if !(USEC_PER_SEC % HZ)
> +	return (USEC_PER_SEC / HZ) * j;
> +#else
> +# if BITS_PER_LONG == 32
> +	return (HZ_TO_USEC_MUL32 * j) >> HZ_TO_USEC_SHR32;
> +# else
> +	return (j * HZ_TO_USEC_NUM) / HZ_TO_USEC_DEN;
> +# endif
> +#endif
> +}
> +EXPORT_SYMBOL(jiffies_to_usecs);
> +
>  /* fs_time_range_check:
>   * Function to check if a given timestamp is in the range allowed for a
>   * filesystem.
> @@ -240,7 +310,7 @@ SYSCALL_DEFINE1(adjtimex, struct timex __user *, txc_p)
>   * nsec is set to 0 if not in allowed range.
>   */
>  static void
> -fs_time_range_check(struct super_block *sb, struct inode_timespec *ts)
> +fs_time_range_check(struct super_block *sb, struct timespec64 *ts)
>  {
>  	if (unlikely(sb->s_time_max < ts->tv_sec ||
>  		sb->s_time_min > ts->tv_sec)) {
> @@ -257,7 +327,7 @@ fs_time_range_check(struct super_block *sb, struct inode_timespec *ts)
>   * fs_time_range_check.
>   * returns 0 otherwise.
>   */
> -int is_fs_timestamp_bad(struct inode_timespec ts)
> +int is_fs_timestamp_bad(struct timespec64 ts)
>  {
>  	if (ts.tv_nsec == FS_TIMESTAMP_NSEC_NOT_VALID)
>  		return -1;
> @@ -267,16 +337,16 @@ int is_fs_timestamp_bad(struct inode_timespec ts)
>  EXPORT_SYMBOL(is_fs_timestamp_bad);
>  
>  /*
> - * fs_time_trunc - Truncate inode_timespec to a granularity
> - * @t: inode_timespec
> + * fs_time_trunc - Truncate timespec64 to a granularity
> + * @t: timespec64
>   * @sb: Super block.
>   *
>   * Truncate a timespec to a granularity. Always rounds down. Granularity
>   * must * not be 0 nor greater than a second (NSEC_PER_SEC, or 10^9 ns).
>   * Returns 1 on error, 0 otherwise.
>   */
> -struct inode_timespec
> -fs_time_trunc(struct inode_timespec t, struct super_block *sb)
> +struct timespec64
> +fs_time_trunc(struct timespec64 t, struct super_block *sb)
>  {
>  	u32 gran = sb->s_time_gran;
>  
> @@ -300,34 +370,6 @@ fs_time_trunc(struct inode_timespec t, struct super_block *sb)
>  EXPORT_SYMBOL(fs_time_trunc);
>  
>  /**
> - * timespec_trunc - Truncate timespec to a granularity
> - * @t: Timespec
> - * @gran: Granularity in ns.
> - *
> - * Truncate a timespec to a granularity. Always rounds down. gran must
> - * not be 0 nor greater than a second (NSEC_PER_SEC, or 10^9 ns).
> - *
> - * This function is deprecated and should no longer be used for filesystems.
> - * fs_time_trunc should be used instead.
> - */
> -struct timespec timespec_trunc(struct timespec t, unsigned gran)
> -{
> -
> -	/* Avoid division in the common cases 1 ns and 1 s. */
> -	if (gran == 1) {
> -		/* nothing */
> -	} else if (gran == NSEC_PER_SEC) {
> -		t.tv_nsec = 0;
> -	} else if (gran > 1 && gran < NSEC_PER_SEC) {
> -		t.tv_nsec -= t.tv_nsec % gran;
> -	} else {
> -		WARN(1, "illegal file time granularity: %u", gran);
> -	}
> -	return t;
> -}
> -EXPORT_SYMBOL(timespec_trunc);
> -
> -/**
>   * current_fs_time - Return FS time
>   * @sb: Superblock.
>   *
> @@ -353,26 +395,6 @@ struct timespec64 current_fs_time_sec(struct super_block *sb)
>  	return ts;
>  }
>  EXPORT_SYMBOL(current_fs_time_sec);
> -#else
> -struct timespec current_fs_time(struct super_block *sb)
> -{
> -	struct timespec now = current_kernel_time();
> -
> -	return fs_time_trunc(now, sb);
> -}
> -EXPORT_SYMBOL(current_fs_time);
> -
> -struct timespec current_fs_time_sec(struct super_block *sb)
> -{
> -	struct timespec ts = { get_seconds(), 0 };
> -
> -	/* range check for time. */
> -	fs_time_range_check(sb, &ts);
> -
> -	return ts;
> -}
> -EXPORT_SYMBOL(current_fs_time_sec);
> -#endif
>  
>  /*
>   * Convert jiffies to milliseconds and back.
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2016-01-07  9:03 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-07  5:35 [RFC 00/15] Add 64 bit timestamp support Deepa Dinamani
2016-01-07  5:35 ` [RFC 01/15] fs: add Kconfig entry CONFIG_FS_USES_64BIT_TIME Deepa Dinamani
2016-01-07  5:35 ` [RFC 02/15] vfs: Change all structures to support 64 bit time Deepa Dinamani
2016-01-10 23:03   ` Dave Chinner
2016-01-12  5:42     ` Deepa Dinamani
2016-01-12  8:29       ` Dave Chinner
2016-01-12  9:27         ` [Y2038] " Arnd Bergmann
2016-01-13  6:27           ` Dave Chinner
2016-01-13  9:20             ` Arnd Bergmann
2016-01-13  9:20               ` Arnd Bergmann
2016-01-13 16:33         ` Deepa Dinamani
2016-01-13 21:04           ` Dave Chinner
2016-01-14 16:53             ` [Y2038] " Arnd Bergmann
2016-01-14 18:00               ` Deepa Dinamani
2016-01-14 21:00               ` Dave Chinner
2016-01-14 22:46                 ` Arnd Bergmann
2016-01-14 22:54                   ` Arnd Bergmann
2016-01-15  2:27                     ` Dave Chinner
2016-01-15 17:01                       ` Arnd Bergmann
2016-01-15 22:41                         ` Dave Chinner
2016-01-15  2:49                   ` Dave Chinner
2016-01-15 16:50                     ` Arnd Bergmann
2016-01-16 19:14                       ` Andreas Dilger
2016-01-16 23:36                         ` Arnd Bergmann
2016-01-17  2:30                           ` Andreas Dilger
2016-01-18  6:09                             ` Deepa Dinamani
2016-01-18 10:56                               ` Arnd Bergmann
2016-01-18 17:40                                 ` Deepa Dinamani
2016-01-18 19:53                                   ` Arnd Bergmann
2016-01-18 21:14                                     ` Dave Chinner
2016-01-18 21:46                                       ` Arnd Bergmann
2016-01-19  1:38                                         ` Dave Chinner
2016-01-19  5:27                                           ` Deepa Dinamani
2016-01-19 20:49                                             ` Dave Chinner
2016-01-19 22:25                                               ` Arnd Bergmann
2016-01-20  5:12                                                 ` Deepa Dinamani
2016-01-20 15:04                                                   ` Deepa Dinamani
2016-01-20 23:06                                                 ` Dave Chinner
2016-01-20 23:17                                                   ` [Y2038] " Arnd Bergmann
2016-01-27  6:26                                                     ` Deepa Dinamani
2016-01-15  5:03                 ` Deepa Dinamani
2016-01-07  5:36 ` [RFC 03/15] kernel: time: Add macros and functions " Deepa Dinamani
2016-01-07  5:36 ` [RFC 04/15] vfs: Add support for vfs code to use " Deepa Dinamani
2016-01-07  5:36 ` [RFC 05/15] fs: cifs: Add support for cifs " Deepa Dinamani
2016-01-07  5:36 ` [RFC 06/15] fs: fat: convert fat to " Deepa Dinamani
2016-01-07  5:36 ` [RFC 07/15] fs: ext4: convert to use " Deepa Dinamani
2016-01-07  5:36 ` [RFC 08/15] fs: Enable " Deepa Dinamani
2016-01-07  5:36 ` [RFC 09/15] fs: cifs: replace inode_timespec with timespec64 Deepa Dinamani
2016-01-07  5:36 ` [RFC 10/15] fs: fat: " Deepa Dinamani
2016-01-07  5:36 ` [RFC 11/15] fs: ext4: " Deepa Dinamani
2016-01-07  5:36 ` [RFC 12/15] vfs: remove inode_timespec and timespec references Deepa Dinamani
2016-01-07  5:36 ` [RFC 13/15] kernel: time: change inode_timespec to timespec64 Deepa Dinamani
2016-01-07  8:50   ` Michael Adam [this message]
2016-01-07 10:42     ` Deepa Dinamani
2016-01-07  5:36 ` [RFC 14/15] vfs: Remove inode_timespec aliases Deepa Dinamani
2016-01-07  5:36 ` [RFC 15/15] fs: Drop CONFIG_FS_USES_64BIT_TIME Deepa Dinamani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160107085030.GB27847@samba.org \
    --to=obnox@samba.org \
    --cc=deepa.kernel@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.