mirror of
https://github.com/torvalds/linux.git
synced 2025-01-01 15:51:46 +00:00
fs: ubifs: Eliminate timespec64_trunc() usage
DEFAULT_TIME_GRAN is seconds granularity. We can just drop the nsec while creating the default root node. Delete the unneeded call to timespec64_trunc(). Also update the ktime_get_* api to match the one used in current_time(). This allows for the timestamps to be updated by using the same ktime_get_* api always. Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Cc: richard@nod.at Cc: linux-mtd@lists.infradead.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
668c9a61e3
commit
1bfad0c079
@ -84,7 +84,6 @@ static int create_default_filesystem(struct ubifs_info *c)
|
|||||||
int idx_node_size;
|
int idx_node_size;
|
||||||
long long tmp64, main_bytes;
|
long long tmp64, main_bytes;
|
||||||
__le64 tmp_le64;
|
__le64 tmp_le64;
|
||||||
__le32 tmp_le32;
|
|
||||||
struct timespec64 ts;
|
struct timespec64 ts;
|
||||||
u8 hash[UBIFS_HASH_ARR_SZ];
|
u8 hash[UBIFS_HASH_ARR_SZ];
|
||||||
u8 hash_lpt[UBIFS_HASH_ARR_SZ];
|
u8 hash_lpt[UBIFS_HASH_ARR_SZ];
|
||||||
@ -291,16 +290,14 @@ static int create_default_filesystem(struct ubifs_info *c)
|
|||||||
ino->creat_sqnum = cpu_to_le64(++c->max_sqnum);
|
ino->creat_sqnum = cpu_to_le64(++c->max_sqnum);
|
||||||
ino->nlink = cpu_to_le32(2);
|
ino->nlink = cpu_to_le32(2);
|
||||||
|
|
||||||
ktime_get_real_ts64(&ts);
|
ktime_get_coarse_real_ts64(&ts);
|
||||||
ts = timespec64_trunc(ts, DEFAULT_TIME_GRAN);
|
|
||||||
tmp_le64 = cpu_to_le64(ts.tv_sec);
|
tmp_le64 = cpu_to_le64(ts.tv_sec);
|
||||||
ino->atime_sec = tmp_le64;
|
ino->atime_sec = tmp_le64;
|
||||||
ino->ctime_sec = tmp_le64;
|
ino->ctime_sec = tmp_le64;
|
||||||
ino->mtime_sec = tmp_le64;
|
ino->mtime_sec = tmp_le64;
|
||||||
tmp_le32 = cpu_to_le32(ts.tv_nsec);
|
ino->atime_nsec = 0;
|
||||||
ino->atime_nsec = tmp_le32;
|
ino->ctime_nsec = 0;
|
||||||
ino->ctime_nsec = tmp_le32;
|
ino->mtime_nsec = 0;
|
||||||
ino->mtime_nsec = tmp_le32;
|
|
||||||
ino->mode = cpu_to_le32(S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO);
|
ino->mode = cpu_to_le32(S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO);
|
||||||
ino->size = cpu_to_le64(UBIFS_INO_NODE_SZ);
|
ino->size = cpu_to_le64(UBIFS_INO_NODE_SZ);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user