Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Shraddha Barke <shraddha.6596@gmail.com>
To: Neil Brown <neilb@suse.com>
Cc: linux-raid@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
	Shraddha Barke <shraddha.6596@gmail.com>
Subject: [PATCH 2/2] md: Replace get_seconds with ktime_get_seconds
Date: Tue, 22 Dec 2015 18:36:42 +0530	[thread overview]
Message-ID: <1450789602-31162-1-git-send-email-shraddha.6596@gmail.com> (raw)

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


             reply	other threads:[~2015-12-22 13:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22 13:06 Shraddha Barke [this message]
2015-12-22 22:36 ` [PATCH 2/2] md: Replace get_seconds with ktime_get_seconds NeilBrown
2015-12-22 22:51   ` 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=1450789602-31162-1-git-send-email-shraddha.6596@gmail.com \
    --to=shraddha.6596@gmail.com \
    --cc=arnd@arndb.de \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox