On Tue, 22 Dec 2015, NeilBrown wrote:
On Tue, Dec 22 2015, Shraddha Barke wrote:
32-bit systems using get_seconds will break in the year 2038, in order to avoid that replace the code with more appropriate types. This patch replaces get_seconds with ktime_get_seconds which is y2038 safe.Function ktime_get_seconds is used since it uses monotonic instead of real time and thus will not cause overflow.
Signed-off-by: Shraddha Barke shraddha.6596@gmail.com
Changes in v2- Fix sender's list
drivers/md/bcache/super.c | 12 ++++++------ drivers/md/md.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index 679a093..f4bd17d 100644 --- a/drivers/md/bcache/super.c +++ b/drivers/md/bcache/super.c @@ -188,7 +188,7 @@ static const char *read_super(struct cache_sb *sb, struct block_device *bdev, goto err; }
- sb->last_mount = get_seconds();
sb->last_mount = ktime_get_seconds(); err = NULL;
get_page(bh->b_page);
@@ -696,7 +696,7 @@ static void bcache_device_detach(struct bcache_device *d)
SET_UUID_FLASH_ONLY(u, 0); memcpy(u->uuid, invalid_uuid, 16);
u->invalidated = cpu_to_le32(get_seconds());
bch_uuid_write(d->c); }u->invalidated = cpu_to_le32(ktime_get_seconds());
@@ -927,7 +927,7 @@ void bch_cached_dev_detach(struct cached_dev *dc)
int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c) {
- uint32_t rtime = cpu_to_le32(get_seconds());
- uint32_t rtime = cpu_to_le32(ktime_get_seconds()); struct uuid_entry *u; char buf[BDEVNAME_SIZE];
@@ -959,7 +959,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c) (BDEV_STATE(&dc->sb) == BDEV_STATE_STALE || BDEV_STATE(&dc->sb) == BDEV_STATE_NONE)) { memcpy(u->uuid, invalid_uuid, 16);
u->invalidated = cpu_to_le32(get_seconds());
u = NULL; }u->invalidated = cpu_to_le32(ktime_get_seconds());
@@ -1261,7 +1261,7 @@ int bch_flash_dev_create(struct cache_set *c, uint64_t size)
get_random_bytes(u->uuid, 16); memset(u->label, 0, 32);
- u->first_reg = u->last_reg = cpu_to_le32(get_seconds());
u->first_reg = u->last_reg = cpu_to_le32(ktime_get_seconds());
SET_UUID_FLASH_ONLY(u, 1); u->sectors = size >> 9;
@@ -1670,7 +1670,7 @@ static void run_cache_set(struct cache_set *c) goto err;
closure_sync(&cl);
- c->sb.last_mount = get_seconds();
c->sb.last_mount = ktime_get_seconds(); bcache_write_super(c);
list_for_each_entry_safe(dc, t, &uncached_devices, list)
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();
return 0; } mddev->major_version = MD_MAJOR_VERSION; mddev->minor_version = MD_MINOR_VERSION; mddev->patch_version = MD_PATCHLEVEL_VERSION;mddev->ctime = ktime_get_seconds();
- mddev->ctime = get_seconds();
mddev->ctime = ktime_get_seconds();
mddev->level = info->level; mddev->clevel[0] = 0;
-- 2.1.4
Maybe I'm being a bit fussy, but these is two completely separate patches, one for md/raid and one for bcache (which happens to live in drivers/md). I'll take the md.c one, someone else should process the bcache one.
Sure. I'll split it up and resend.
Shraddha
NeilBrown