|
@@ -2049,3 +2049,26 @@ void inode_nohighmem(struct inode *inode)
|
|
|
mapping_set_gfp_mask(inode->i_mapping, GFP_USER);
|
|
|
}
|
|
|
EXPORT_SYMBOL(inode_nohighmem);
|
|
|
+
|
|
|
+/**
|
|
|
+ * current_time - Return FS time
|
|
|
+ * @inode: inode.
|
|
|
+ *
|
|
|
+ * Return the current time truncated to the time granularity supported by
|
|
|
+ * the fs.
|
|
|
+ *
|
|
|
+ * Note that inode and inode->sb cannot be NULL.
|
|
|
+ * Otherwise, the function warns and returns time without truncation.
|
|
|
+ */
|
|
|
+struct timespec current_time(struct inode *inode)
|
|
|
+{
|
|
|
+ struct timespec now = current_kernel_time();
|
|
|
+
|
|
|
+ if (unlikely(!inode->i_sb)) {
|
|
|
+ WARN(1, "current_time() called with uninitialized super_block in the inode");
|
|
|
+ return now;
|
|
|
+ }
|
|
|
+
|
|
|
+ return timespec_trunc(now, inode->i_sb->s_time_gran);
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(current_time);
|