• Deepa Dinamani's avatar
    drivers: md: use ktime_get_real_seconds() · 9ebc6ef1
    Deepa Dinamani authored
    get_seconds() API is not y2038 safe on 32 bit systems and the API
    is deprecated. Replace it with calls to ktime_get_real_seconds()
    API instead. Change mddev structure types to time64_t accordingly.
    
    32 bit signed timestamps will overflow in the year 2038.
    
    Change the user interface mdu_array_info_s structure timestamps:
    ctime and utime values used in ioctls GET_ARRAY_INFO and
    SET_ARRAY_INFO to unsigned int. This will extend the field to last
    until the year 2106.
    The long term plan is to get rid of ctime and utime values in
    this structure as this information can be read from the on-disk
    meta data directly.
    
    Clamp the tim64_t timestamps to positive values with a max of U32_MAX
    when returning from GET_ARRAY_INFO ioctl to accommodate above changes
    in the data type of timestamps to unsigned int.
    
    v0.90 on disk meta data uses u32 for maintaining time stamps.
    So this will also last until year 2106.
    Assumption is that the usage of v0.90 will be deprecated by
    year 2106.
    
    Timestamp fields in the on disk meta data for v1.0 version already
    use 64 bit data types. Remove the truncation of the bits while
    writing to or reading from these from the disk.
    Signed-off-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
    Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarNeilBrown <neilb@suse.com>
    9ebc6ef1
md.h 23.8 KB