1 Index: linux-2.6.10/drivers/char/qtronix.c
2 ===================================================================
3 --- linux-2.6.10.orig/drivers/char/qtronix.c 2004-12-24 14:35:50.000000000 -0700
4 +++ linux-2.6.10/drivers/char/qtronix.c 2006-01-03 16:16:52.000000000 -0700
9 - file->f_dentry->d_inode->i_atime = CURRENT_TIME;
10 + file->f_dentry->d_inode->i_atime = current_fs_time(inode->i_sb);
13 if (signal_pending(current))
14 Index: linux-2.6.10/drivers/char/random.c
15 ===================================================================
16 --- linux-2.6.10.orig/drivers/char/random.c 2005-04-06 09:38:33.000000000 -0600
17 +++ linux-2.6.10/drivers/char/random.c 2006-01-03 16:16:52.000000000 -0700
22 - file->f_dentry->d_inode->i_mtime = CURRENT_TIME;
23 - mark_inode_dirty(file->f_dentry->d_inode);
24 + struct inode *inode = file->f_dentry->d_inode;
25 + inode->i_mtime = current_fs_time(inode->i_sb);
26 + mark_inode_dirty(inode);
27 return (ssize_t)(p - buffer);
30 Index: linux-2.6.10/drivers/char/sonypi.c
31 ===================================================================
32 --- linux-2.6.10.orig/drivers/char/sonypi.c 2004-12-24 14:35:23.000000000 -0700
33 +++ linux-2.6.10/drivers/char/sonypi.c 2006-01-03 16:18:31.000000000 -0700
38 - file->f_dentry->d_inode->i_atime = CURRENT_TIME;
39 + struct inode *inode = file->f_dentry->d_inode;
40 + inode->i_atime = current_fs_time(inode->i_sb);
44 Index: linux-2.6.10/drivers/char/tty_io.c
45 ===================================================================
46 --- linux-2.6.10.orig/drivers/char/tty_io.c 2005-04-06 09:38:33.000000000 -0600
47 +++ linux-2.6.10/drivers/char/tty_io.c 2006-01-03 16:16:52.000000000 -0700
52 - inode->i_atime = CURRENT_TIME;
53 + inode->i_atime = current_fs_time(inode->i_sb);
61 - file->f_dentry->d_inode->i_mtime = CURRENT_TIME;
62 + struct inode *inode = file->f_dentry->d_inode;
63 + inode->i_mtime = current_fs_time(inode->i_sb);
66 up(&tty->atomic_write);
67 Index: linux-2.6.10/fs/attr.c
68 ===================================================================
69 --- linux-2.6.10.orig/fs/attr.c 2004-12-24 14:34:00.000000000 -0700
70 +++ linux-2.6.10/fs/attr.c 2006-01-03 16:16:52.000000000 -0700
72 #include <linux/fcntl.h>
73 #include <linux/quotaops.h>
74 #include <linux/security.h>
75 +#include <linux/time.h>
77 /* Taken over from the old code... */
80 if (ia_valid & ATTR_GID)
81 inode->i_gid = attr->ia_gid;
82 if (ia_valid & ATTR_ATIME)
83 - inode->i_atime = attr->ia_atime;
84 + inode->i_atime = timespec_trunc(attr->ia_atime,
85 + get_sb_time_gran(inode->i_sb));
86 if (ia_valid & ATTR_MTIME)
87 - inode->i_mtime = attr->ia_mtime;
88 + inode->i_mtime = timespec_trunc(attr->ia_mtime,
89 + get_sb_time_gran(inode->i_sb));
90 if (ia_valid & ATTR_CTIME)
91 - inode->i_ctime = attr->ia_ctime;
92 + inode->i_ctime = timespec_trunc(attr->ia_ctime,
93 + get_sb_time_gran(inode->i_sb));
94 if (ia_valid & ATTR_MODE) {
95 umode_t mode = attr->ia_mode;
98 int notify_change(struct dentry * dentry, struct iattr * attr)
100 struct inode *inode = dentry->d_inode;
101 - mode_t mode = inode->i_mode;
104 - struct timespec now = CURRENT_TIME;
105 + struct timespec now;
106 unsigned int ia_valid = attr->ia_valid;
111 + mode = inode->i_mode;
112 + now = current_fs_time(inode->i_sb);
114 attr->ia_ctime = now;
115 if (!(ia_valid & ATTR_ATIME_SET))
116 attr->ia_atime = now;
117 Index: linux-2.6.10/fs/bad_inode.c
118 ===================================================================
119 --- linux-2.6.10.orig/fs/bad_inode.c 2004-12-24 14:35:50.000000000 -0700
120 +++ linux-2.6.10/fs/bad_inode.c 2006-01-03 16:16:52.000000000 -0700
122 remove_inode_hash(inode);
124 inode->i_mode = S_IFREG;
125 - inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
126 + inode->i_atime = inode->i_mtime = inode->i_ctime =
127 + current_fs_time(inode->i_sb);
128 inode->i_op = &bad_inode_ops;
129 inode->i_fop = &bad_file_ops;
131 Index: linux-2.6.10/fs/binfmt_misc.c
132 ===================================================================
133 --- linux-2.6.10.orig/fs/binfmt_misc.c 2004-12-24 14:34:31.000000000 -0700
134 +++ linux-2.6.10/fs/binfmt_misc.c 2006-01-03 16:16:52.000000000 -0700
137 inode->i_blksize = PAGE_CACHE_SIZE;
139 - inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
140 + inode->i_atime = inode->i_mtime = inode->i_ctime =
141 + current_fs_time(inode->i_sb);
145 Index: linux-2.6.10/fs/ext2/dir.c
146 ===================================================================
147 --- linux-2.6.10.orig/fs/ext2/dir.c 2004-12-24 14:34:58.000000000 -0700
148 +++ linux-2.6.10/fs/ext2/dir.c 2006-01-03 16:16:52.000000000 -0700
150 ext2_set_de_type (de, inode);
151 err = ext2_commit_chunk(page, from, to);
153 - dir->i_mtime = dir->i_ctime = CURRENT_TIME;
154 + dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
155 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
156 mark_inode_dirty(dir);
159 de->inode = cpu_to_le32(inode->i_ino);
160 ext2_set_de_type (de, inode);
161 err = ext2_commit_chunk(page, from, to);
162 - dir->i_mtime = dir->i_ctime = CURRENT_TIME;
163 + dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
164 EXT2_I(dir)->i_flags &= ~EXT2_BTREE_FL;
165 mark_inode_dirty(dir);
168 pde->rec_len = cpu_to_le16(to-from);
170 err = ext2_commit_chunk(page, from, to);
171 - inode->i_ctime = inode->i_mtime = CURRENT_TIME;
172 + inode->i_ctime = inode->i_mtime = CURRENT_TIME_SEC;
173 EXT2_I(inode)->i_flags &= ~EXT2_BTREE_FL;
174 mark_inode_dirty(inode);
176 Index: linux-2.6.10/fs/ext2/ialloc.c
177 ===================================================================
178 --- linux-2.6.10.orig/fs/ext2/ialloc.c 2004-12-24 14:34:47.000000000 -0700
179 +++ linux-2.6.10/fs/ext2/ialloc.c 2006-01-03 16:16:52.000000000 -0700
182 inode->i_blksize = PAGE_SIZE; /* This is the optimal IO size (for stat), not the fs block size */
184 - inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
185 + inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
186 memset(ei->i_data, 0, sizeof(ei->i_data));
187 ei->i_flags = EXT2_I(dir)->i_flags & ~EXT2_BTREE_FL;
189 Index: linux-2.6.10/fs/ext2/inode.c
190 ===================================================================
191 --- linux-2.6.10.orig/fs/ext2/inode.c 2004-12-24 14:33:51.000000000 -0700
192 +++ linux-2.6.10/fs/ext2/inode.c 2006-01-03 16:16:52.000000000 -0700
195 /* We are done with atomic stuff, now do the rest of housekeeping */
197 - inode->i_ctime = CURRENT_TIME;
198 + inode->i_ctime = CURRENT_TIME_SEC;
200 /* had we spliced it onto indirect block? */
203 case EXT2_TIND_BLOCK:
206 - inode->i_mtime = inode->i_ctime = CURRENT_TIME;
207 + inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
208 if (inode_needs_sync(inode)) {
209 sync_mapping_buffers(inode->i_mapping);
210 ext2_sync_inode (inode);
211 Index: linux-2.6.10/fs/ext2/ioctl.c
212 ===================================================================
213 --- linux-2.6.10.orig/fs/ext2/ioctl.c 2004-12-24 14:35:49.000000000 -0700
214 +++ linux-2.6.10/fs/ext2/ioctl.c 2006-01-03 16:16:52.000000000 -0700
218 ext2_set_inode_flags(inode);
219 - inode->i_ctime = CURRENT_TIME;
220 + inode->i_ctime = CURRENT_TIME_SEC;
221 mark_inode_dirty(inode);
226 if (get_user(inode->i_generation, (int __user *) arg))
228 - inode->i_ctime = CURRENT_TIME;
229 + inode->i_ctime = CURRENT_TIME_SEC;
230 mark_inode_dirty(inode);
233 Index: linux-2.6.10/fs/ext2/namei.c
234 ===================================================================
235 --- linux-2.6.10.orig/fs/ext2/namei.c 2004-12-24 14:35:25.000000000 -0700
236 +++ linux-2.6.10/fs/ext2/namei.c 2006-01-03 16:16:52.000000000 -0700
238 if (inode->i_nlink >= EXT2_LINK_MAX)
241 - inode->i_ctime = CURRENT_TIME;
242 + inode->i_ctime = CURRENT_TIME_SEC;
243 ext2_inc_count(inode);
244 atomic_inc(&inode->i_count);
248 ext2_inc_count(old_inode);
249 ext2_set_link(new_dir, new_de, new_page, old_inode);
250 - new_inode->i_ctime = CURRENT_TIME;
251 + new_inode->i_ctime = CURRENT_TIME_SEC;
253 new_inode->i_nlink--;
254 ext2_dec_count(new_inode);
257 * ext2_dec_count() will mark the inode dirty.
259 - old_inode->i_ctime = CURRENT_TIME;
260 + old_inode->i_ctime = CURRENT_TIME_SEC;
262 ext2_delete_entry (old_de, old_page);
263 ext2_dec_count(old_inode);
264 Index: linux-2.6.10/fs/ext2/super.c
265 ===================================================================
266 --- linux-2.6.10.orig/fs/ext2/super.c 2004-12-24 14:35:01.000000000 -0700
267 +++ linux-2.6.10/fs/ext2/super.c 2006-01-03 16:19:06.000000000 -0700
269 es = (struct ext2_super_block *) (((char *)bh->b_data) + offset);
271 sb->s_magic = le16_to_cpu(es->s_magic);
272 - sb->s_flags |= MS_ONE_SECOND;
273 + set_sb_time_gran(sb, 1000000000U);
275 if (sb->s_magic != EXT2_SUPER_MAGIC)
277 Index: linux-2.6.10/fs/ext2/xattr.c
278 ===================================================================
279 --- linux-2.6.10.orig/fs/ext2/xattr.c 2005-04-06 09:38:35.000000000 -0600
280 +++ linux-2.6.10/fs/ext2/xattr.c 2006-01-03 16:16:52.000000000 -0700
283 /* Update the inode. */
284 EXT2_I(inode)->i_file_acl = new_bh ? new_bh->b_blocknr : 0;
285 - inode->i_ctime = CURRENT_TIME;
286 + inode->i_ctime = CURRENT_TIME_SEC;
287 if (IS_SYNC(inode)) {
288 error = ext2_sync_inode (inode);
290 Index: linux-2.6.10/fs/ext3/ialloc.c
291 ===================================================================
292 --- linux-2.6.10.orig/fs/ext3/ialloc.c 2004-12-24 14:34:45.000000000 -0700
293 +++ linux-2.6.10/fs/ext3/ialloc.c 2006-01-03 16:16:52.000000000 -0700
295 /* This is the optimal IO size (for stat), not the fs block size */
296 inode->i_blksize = PAGE_SIZE;
298 - inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
299 + inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC;
301 memset(ei->i_data, 0, sizeof(ei->i_data));
302 ei->i_next_alloc_block = 0;
303 Index: linux-2.6.10/fs/ext3/inode.c
304 ===================================================================
305 --- linux-2.6.10.orig/fs/ext3/inode.c 2005-04-06 09:38:35.000000000 -0600
306 +++ linux-2.6.10/fs/ext3/inode.c 2006-01-03 16:16:52.000000000 -0700
309 /* We are done with atomic stuff, now do the rest of housekeeping */
311 - inode->i_ctime = CURRENT_TIME;
312 + inode->i_ctime = CURRENT_TIME_SEC;
313 ext3_mark_inode_dirty(handle, inode);
315 /* had we spliced it onto indirect block? */
316 @@ -2199,7 +2199,7 @@
319 up(&ei->truncate_sem);
320 - inode->i_mtime = inode->i_ctime = CURRENT_TIME;
321 + inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC;
322 ext3_mark_inode_dirty(handle, inode);
324 /* In a multi-transaction truncate, we only make the final
325 Index: linux-2.6.10/fs/ext3/ioctl.c
326 ===================================================================
327 --- linux-2.6.10.orig/fs/ext3/ioctl.c 2004-12-24 14:34:31.000000000 -0700
328 +++ linux-2.6.10/fs/ext3/ioctl.c 2006-01-03 16:16:52.000000000 -0700
332 ext3_set_inode_flags(inode);
333 - inode->i_ctime = CURRENT_TIME;
334 + inode->i_ctime = CURRENT_TIME_SEC;
336 err = ext3_mark_iloc_dirty(handle, inode, &iloc);
339 return PTR_ERR(handle);
340 err = ext3_reserve_inode_write(handle, inode, &iloc);
342 - inode->i_ctime = CURRENT_TIME;
343 + inode->i_ctime = CURRENT_TIME_SEC;
344 inode->i_generation = generation;
345 err = ext3_mark_iloc_dirty(handle, inode, &iloc);
347 Index: linux-2.6.10/fs/ext3/namei.c
348 ===================================================================
349 --- linux-2.6.10.orig/fs/ext3/namei.c 2004-12-24 14:34:58.000000000 -0700
350 +++ linux-2.6.10/fs/ext3/namei.c 2006-01-03 16:16:52.000000000 -0700
351 @@ -1251,7 +1251,7 @@
352 * happen is that the times are slightly out of date
353 * and/or different from the directory change time.
355 - dir->i_mtime = dir->i_ctime = CURRENT_TIME;
356 + dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC;
357 ext3_update_dx_flag(dir);
359 ext3_mark_inode_dirty(handle, dir);
360 @@ -2029,7 +2029,7 @@
363 ext3_orphan_add(handle, inode);
364 - inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
365 + inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
366 ext3_mark_inode_dirty(handle, inode);
368 ext3_update_dx_flag(dir);
369 @@ -2079,7 +2079,7 @@
370 retval = ext3_delete_entry(handle, dir, de, bh);
373 - dir->i_ctime = dir->i_mtime = CURRENT_TIME;
374 + dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
375 ext3_update_dx_flag(dir);
376 ext3_mark_inode_dirty(handle, dir);
378 @@ -2169,7 +2169,7 @@
382 - inode->i_ctime = CURRENT_TIME;
383 + inode->i_ctime = CURRENT_TIME_SEC;
384 ext3_inc_count(handle, inode);
385 atomic_inc(&inode->i_count);
387 @@ -2270,7 +2270,7 @@
388 * Like most other Unix systems, set the ctime for inodes on a
391 - old_inode->i_ctime = CURRENT_TIME;
392 + old_inode->i_ctime = CURRENT_TIME_SEC;
393 ext3_mark_inode_dirty(handle, old_inode);
396 @@ -2303,9 +2303,9 @@
399 new_inode->i_nlink--;
400 - new_inode->i_ctime = CURRENT_TIME;
401 + new_inode->i_ctime = CURRENT_TIME_SEC;
403 - old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME;
404 + old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME_SEC;
405 ext3_update_dx_flag(old_dir);
407 BUFFER_TRACE(dir_bh, "get_write_access");
408 Index: linux-2.6.10/fs/ext3/super.c
409 ===================================================================
410 --- linux-2.6.10.orig/fs/ext3/super.c 2005-04-06 09:38:35.000000000 -0600
411 +++ linux-2.6.10/fs/ext3/super.c 2006-01-03 16:16:52.000000000 -0700
412 @@ -1318,7 +1318,7 @@
413 if (!parse_options ((char *) data, sb, &journal_inum, NULL, 0))
416 - sb->s_flags |= MS_ONE_SECOND;
417 + set_sb_time_gran(sb, 1000000000U);
418 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
419 ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
421 Index: linux-2.6.10/fs/ext3/xattr.c
422 ===================================================================
423 --- linux-2.6.10.orig/fs/ext3/xattr.c 2005-04-06 09:38:35.000000000 -0600
424 +++ linux-2.6.10/fs/ext3/xattr.c 2006-01-03 16:16:52.000000000 -0700
427 /* Update the inode. */
428 EXT3_I(inode)->i_file_acl = new_bh ? new_bh->b_blocknr : 0;
429 - inode->i_ctime = CURRENT_TIME;
430 + inode->i_ctime = CURRENT_TIME_SEC;
431 ext3_mark_inode_dirty(handle, inode);
434 Index: linux-2.6.10/fs/inode.c
435 ===================================================================
436 --- linux-2.6.10.orig/fs/inode.c 2006-01-03 15:33:21.000000000 -0700
437 +++ linux-2.6.10/fs/inode.c 2006-01-03 16:16:52.000000000 -0700
438 @@ -1131,19 +1131,6 @@
443 - * Return true if the filesystem which backs this inode considers the two
444 - * passed timespecs to be sufficiently different to warrant flushing the
445 - * altered time out to disk.
447 -static int inode_times_differ(struct inode *inode,
448 - struct timespec *old, struct timespec *new)
450 - if (IS_ONE_SECOND(inode))
451 - return old->tv_sec != new->tv_sec;
452 - return !timespec_equal(old, new);
456 * update_atime - update the access time
457 * @inode: inode accessed
458 @@ -1163,8 +1150,8 @@
459 if (IS_RDONLY(inode))
462 - now = current_kernel_time();
463 - if (inode_times_differ(inode, &inode->i_atime, &now)) {
464 + now = current_fs_time(inode->i_sb);
465 + if (!timespec_equal(&inode->i_atime, &now)) {
466 inode->i_atime = now;
467 mark_inode_dirty_sync(inode);
469 @@ -1194,14 +1181,13 @@
470 if (IS_RDONLY(inode))
473 - now = current_kernel_time();
475 - if (inode_times_differ(inode, &inode->i_mtime, &now))
476 + now = current_fs_time(inode->i_sb);
477 + if (!timespec_equal(&inode->i_mtime, &now))
479 inode->i_mtime = now;
482 - if (inode_times_differ(inode, &inode->i_ctime, &now))
483 + if (!timespec_equal(&inode->i_ctime, &now))
485 inode->i_ctime = now;
487 Index: linux-2.6.10/fs/locks.c
488 ===================================================================
489 --- linux-2.6.10.orig/fs/locks.c 2004-12-24 14:35:28.000000000 -0700
490 +++ linux-2.6.10/fs/locks.c 2006-01-03 16:16:52.000000000 -0700
491 @@ -1228,7 +1228,7 @@
493 struct file_lock *flock = inode->i_flock;
494 if (flock && IS_LEASE(flock) && (flock->fl_type & F_WRLCK))
495 - *time = CURRENT_TIME;
496 + *time = current_fs_time(inode->i_sb);
498 *time = inode->i_mtime;
500 Index: linux-2.6.10/include/linux/fs.h
501 ===================================================================
502 --- linux-2.6.10.orig/include/linux/fs.h 2006-01-03 16:04:26.000000000 -0700
503 +++ linux-2.6.10/include/linux/fs.h 2006-01-03 16:16:52.000000000 -0700
506 #define MS_VERBOSE 32768
507 #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
508 -#define MS_ONE_SECOND (1<<17) /* fs has 1 sec a/m/ctime resolution */
509 +#define MS_ONE_SECOND (1<<17) /* fs has 1 sec time resolution (obsolete) */
510 +#define MS_TIME_GRAN (1<<18) /* fs has s_time_gran field */
511 #define MS_ACTIVE (1<<30)
512 #define MS_NOUSER (1<<31)
515 * even looking at it. You had been warned.
517 struct semaphore s_vfs_rename_sem; /* Kludge */
519 + /* Granuality of c/m/atime in ns.
520 + Cannot be worse than a second */
521 +#ifndef __GENKSYMS__
526 +extern struct timespec current_fs_time(struct super_block *sb);
528 +static inline u32 get_sb_time_gran(struct super_block *sb)
530 + if (sb->s_flags & MS_TIME_GRAN)
531 + return sb->s_time_gran;
532 + if (sb->s_flags & MS_ONE_SECOND)
533 + return 1000000000U;
537 +static inline void set_sb_time_gran(struct super_block *sb, u32 time_gran)
539 + sb->s_time_gran = time_gran;
540 + sb->s_flags |= MS_TIME_GRAN;
541 + if (time_gran == 1000000000U)
542 + sb->s_flags |= MS_ONE_SECOND;
546 * Snapshotting support.
548 Index: linux-2.6.10/include/linux/time.h
549 ===================================================================
550 --- linux-2.6.10.orig/include/linux/time.h 2004-12-24 14:35:00.000000000 -0700
551 +++ linux-2.6.10/include/linux/time.h 2006-01-03 16:16:52.000000000 -0700
553 struct timespec current_kernel_time(void);
555 #define CURRENT_TIME (current_kernel_time())
556 +#define CURRENT_TIME_SEC ((struct timespec) { xtime.tv_sec, 0 })
558 extern void do_gettimeofday(struct timeval *tv);
559 extern int do_settimeofday(struct timespec *tv);
561 extern int do_getitimer(int which, struct itimerval *value);
562 extern void getnstimeofday (struct timespec *tv);
564 +extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
567 set_normalized_timespec (struct timespec *ts, time_t sec, long nsec)
569 Index: linux-2.6.10/kernel/time.c
570 ===================================================================
571 --- linux-2.6.10.orig/kernel/time.c 2004-12-24 14:34:26.000000000 -0700
572 +++ linux-2.6.10/kernel/time.c 2006-01-03 16:16:52.000000000 -0700
575 #include <asm/uaccess.h>
576 #include <asm/unistd.h>
577 +#include <linux/fs.h>
580 * The timezone where the local system is located. Used as a default by some
583 EXPORT_SYMBOL(current_kernel_time);
586 + * current_fs_time - Return FS time
589 + * Return the current time truncated to the time granuality supported by
592 +struct timespec current_fs_time(struct super_block *sb)
594 + struct timespec now = current_kernel_time();
595 + return timespec_trunc(now, get_sb_time_gran(sb));
597 +EXPORT_SYMBOL(current_fs_time);
600 + * timespec_trunc - Truncate timespec to a granuality
602 + * @gran: Granuality in ns.
604 + * Truncate a timespec to a granuality. gran must be smaller than a second.
605 + * Always rounds down.
607 + * This function should be only used for timestamps returned by
608 + * current_kernel_time() or CURRENT_TIME, not with do_gettimeofday() because
609 + * it doesn't handle the better resolution of the later.
611 +struct timespec timespec_trunc(struct timespec t, unsigned gran)
614 + * Division is pretty slow so avoid it for common cases.
615 + * Currently current_kernel_time() never returns better than
616 + * jiffies resolution. Exploit that.
618 + if (gran <= jiffies_to_usecs(1) * 1000) {
620 + } else if (gran == 1000000000) {
623 + t.tv_nsec -= t.tv_nsec % gran;
627 +EXPORT_SYMBOL(timespec_trunc);
629 #ifdef CONFIG_TIME_INTERPOLATION
630 void getnstimeofday (struct timespec *tv)