* [PATCH 2/2] md: Replace get_seconds with ktime_get_seconds
@ 2015-12-22 13:06 Shraddha Barke
2015-12-22 22:36 ` NeilBrown
0 siblings, 1 reply; 3+ messages in thread
From: Shraddha Barke @ 2015-12-22 13:06 UTC (permalink / raw)
To: Neil Brown; +Cc: linux-raid, Arnd Bergmann, Shraddha Barke
32-bit systems using function get_seconds will break in year 2038,
in order to avoid that replace the code with more appropriate function
ktime_get_seconds which is y2038 safe. Function ktime_get_seconds use
monotonic instead of real time and therefore will not cause overflow
Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
---
drivers/md/md.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 807095f..8dd74bb 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2333,7 +2333,7 @@ repeat:
spin_lock(&mddev->lock);
- mddev->utime = get_seconds();
+ mddev->utime = ktime_get_seconds();
if (test_and_clear_bit(MD_CHANGE_DEVS, &mddev->flags))
force_change = 1;
@@ -6347,13 +6347,13 @@ static int set_array_info(struct mddev *mddev, mdu_array_info_t *info)
/* ensure mddev_put doesn't delete this now that there
* is some minimal configuration.
*/
- mddev->ctime = get_seconds();
+ mddev->ctime = ktime_get_seconds();
return 0;
}
mddev->major_version = MD_MAJOR_VERSION;
mddev->minor_version = MD_MINOR_VERSION;
mddev->patch_version = MD_PATCHLEVEL_VERSION;
- mddev->ctime = get_seconds();
+ mddev->ctime = ktime_get_seconds();
mddev->level = info->level;
mddev->clevel[0] = 0;
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] md: Replace get_seconds with ktime_get_seconds
2015-12-22 13:06 [PATCH 2/2] md: Replace get_seconds with ktime_get_seconds Shraddha Barke
@ 2015-12-22 22:36 ` NeilBrown
2015-12-22 22:51 ` Deepa Dinamani
0 siblings, 1 reply; 3+ messages in thread
From: NeilBrown @ 2015-12-22 22:36 UTC (permalink / raw)
Cc: linux-raid, Arnd Bergmann, Shraddha Barke, Deepa Dinamani
[-- Attachment #1: Type: text/plain, Size: 1915 bytes --]
On Wed, Dec 23 2015, Shraddha Barke wrote:
> 32-bit systems using function get_seconds will break in year 2038,
> in order to avoid that replace the code with more appropriate function
> ktime_get_seconds which is y2038 safe. Function ktime_get_seconds use
> monotonic instead of real time and therefore will not cause overflow
>
> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
> ---
> drivers/md/md.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 807095f..8dd74bb 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -2333,7 +2333,7 @@ repeat:
>
> spin_lock(&mddev->lock);
>
> - mddev->utime = get_seconds();
> + mddev->utime = ktime_get_seconds();
>
> if (test_and_clear_bit(MD_CHANGE_DEVS, &mddev->flags))
> force_change = 1;
> @@ -6347,13 +6347,13 @@ static int set_array_info(struct mddev *mddev, mdu_array_info_t *info)
> /* ensure mddev_put doesn't delete this now that there
> * is some minimal configuration.
> */
> - mddev->ctime = get_seconds();
> + mddev->ctime = ktime_get_seconds();
> return 0;
> }
> mddev->major_version = MD_MAJOR_VERSION;
> mddev->minor_version = MD_MINOR_VERSION;
> mddev->patch_version = MD_PATCHLEVEL_VERSION;
> - mddev->ctime = get_seconds();
> + mddev->ctime = ktime_get_seconds();
>
> mddev->level = info->level;
> mddev->clevel[0] = 0;
> --
> 2.1.4
Thanks for splitting this off.
However I tried to apply it and it doesn't apply.
I already have a patch (in linux-next) from
Deepa Dinamani <deepa.kernel@gmail.com>
which uses ktime_get_real_seconds().
http://git.neil.brown.name/?p=md.git;a=commitdiff;h=195e0e2726a7f93295b28ebf277876d5a7c6cf2d
Which should it be? ktime_get_seconds or ktime_get_real_seconds?
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/2] md: Replace get_seconds with ktime_get_seconds
2015-12-22 22:36 ` NeilBrown
@ 2015-12-22 22:51 ` Deepa Dinamani
0 siblings, 0 replies; 3+ messages in thread
From: Deepa Dinamani @ 2015-12-22 22:51 UTC (permalink / raw)
To: NeilBrown; +Cc: Shraddha Barke, linux-raid, Arnd Bergmann
It should be real seconds.
You cannot use monotonic clock here since these are actual clock time timestamps. Monotonic time starts from 0 on every boot.
-Deepa
> On Dec 23, 2015, at 4:06 AM, NeilBrown <neilb@suse.com> wrote:
>
>> On Wed, Dec 23 2015, Shraddha Barke wrote:
>>
>> 32-bit systems using function get_seconds will break in year 2038,
>> in order to avoid that replace the code with more appropriate function
>> ktime_get_seconds which is y2038 safe. Function ktime_get_seconds use
>> monotonic instead of real time and therefore will not cause overflow
>>
>> Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
>> ---
>> drivers/md/md.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/md/md.c b/drivers/md/md.c
>> index 807095f..8dd74bb 100644
>> --- a/drivers/md/md.c
>> +++ b/drivers/md/md.c
>> @@ -2333,7 +2333,7 @@ repeat:
>>
>> spin_lock(&mddev->lock);
>>
>> - mddev->utime = get_seconds();
>> + mddev->utime = ktime_get_seconds();
>>
>> if (test_and_clear_bit(MD_CHANGE_DEVS, &mddev->flags))
>> force_change = 1;
>> @@ -6347,13 +6347,13 @@ static int set_array_info(struct mddev *mddev, mdu_array_info_t *info)
>> /* ensure mddev_put doesn't delete this now that there
>> * is some minimal configuration.
>> */
>> - mddev->ctime = get_seconds();
>> + mddev->ctime = ktime_get_seconds();
>> return 0;
>> }
>> mddev->major_version = MD_MAJOR_VERSION;
>> mddev->minor_version = MD_MINOR_VERSION;
>> mddev->patch_version = MD_PATCHLEVEL_VERSION;
>> - mddev->ctime = get_seconds();
>> + mddev->ctime = ktime_get_seconds();
>>
>> mddev->level = info->level;
>> mddev->clevel[0] = 0;
>> --
>> 2.1.4
>
> Thanks for splitting this off.
> However I tried to apply it and it doesn't apply.
>
> I already have a patch (in linux-next) from
> Deepa Dinamani <deepa.kernel@gmail.com>
> which uses ktime_get_real_seconds().
>
> http://git.neil.brown.name/?p=md.git;a=commitdiff;h=195e0e2726a7f93295b28ebf277876d5a7c6cf2d
>
> Which should it be? ktime_get_seconds or ktime_get_real_seconds?
>
> Thanks,
> NeilBrown
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-22 22:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-22 13:06 [PATCH 2/2] md: Replace get_seconds with ktime_get_seconds Shraddha Barke
2015-12-22 22:36 ` NeilBrown
2015-12-22 22:51 ` Deepa Dinamani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox