--- /dev/null
+dnl #
+dnl # 4.9, current_time() added
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_CURRENT_TIME],
+ [AC_MSG_CHECKING([whether current_time() exists])
+ ZFS_LINUX_TRY_COMPILE_SYMBOL([
+ #include <linux/fs.h>
+ ], [
+ struct inode ip;
+ struct timespec now __attribute__ ((unused));
+
+ now = current_time(&ip);
+ ], [current_time], [fs/inode.c], [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_CURRENT_TIME, 1, [current_time() exists])
+ ], [
+ AC_MSG_RESULT(no)
+ ])
+])
ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST
ZFS_AC_KERNEL_RENAME_WANTS_FLAGS
ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR
+ ZFS_AC_KERNEL_CURRENT_TIME
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
#error
#endif
+/*
+ * 4.9 API change
+ * Preferred interface to get the current FS time.
+ */
+#if !defined(HAVE_CURRENT_TIME)
+static inline struct timespec
+current_time(struct inode *ip)
+{
+ return (timespec_trunc(current_kernel_time(), ip->i_sb->s_time_gran));
+}
+#endif
#endif /* _ZFS_VFS_H */
zfsctl_inode_alloc(zfsvfs_t *zfsvfs, uint64_t id,
const struct file_operations *fops, const struct inode_operations *ops)
{
- struct timespec now = current_fs_time(zfsvfs->z_sb);
+ struct timespec now;
struct inode *ip;
znode_t *zp;
if (ip == NULL)
return (NULL);
+ now = current_time(ip);
zp = ITOZ(ip);
ASSERT3P(zp->z_dirlocks, ==, NULL);
ASSERT3P(zp->z_acl_cached, ==, NULL);
zpl_root_getattr_impl(const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int query_flags)
{
- generic_fillattr(path->dentry->d_inode, stat);
- stat->atime = CURRENT_TIME;
+ struct inode *ip = path->dentry->d_inode;
+
+ generic_fillattr(ip, stat);
+ stat->atime = current_time(ip);
return (0);
}
zpl_snapdir_getattr_impl(const struct path *path, struct kstat *stat,
u32 request_mask, unsigned int query_flags)
{
- zfsvfs_t *zfsvfs = ITOZSB(path->dentry->d_inode);
+ struct inode *ip = path->dentry->d_inode;
+ zfsvfs_t *zfsvfs = ITOZSB(ip);
ZFS_ENTER(zfsvfs);
- generic_fillattr(path->dentry->d_inode, stat);
+ generic_fillattr(ip, stat);
stat->nlink = stat->size = 2;
stat->ctime = stat->mtime = dmu_objset_snap_cmtime(zfsvfs->z_os);
- stat->atime = CURRENT_TIME;
+ stat->atime = current_time(ip);
ZFS_EXIT(zfsvfs);
return (0);
if (zfsvfs->z_shares_dir == 0) {
generic_fillattr(path->dentry->d_inode, stat);
stat->nlink = stat->size = 2;
- stat->atime = CURRENT_TIME;
+ stat->atime = current_time(ip);
ZFS_EXIT(zfsvfs);
return (0);
}
return (-EMLINK);
crhold(cr);
- ip->i_ctime = CURRENT_TIME_SEC;
+ ip->i_ctime = current_time(ip);
igrab(ip); /* Use ihold() if available */
cookie = spl_fstrans_mark();
int
zpl_set_acl(struct inode *ip, struct posix_acl *acl, int type)
{
- struct super_block *sb = ITOZSB(ip)->z_sb;
char *name, *value = NULL;
int error = 0;
size_t size = 0;
*/
if (ip->i_mode != mode) {
ip->i_mode = mode;
- ip->i_ctime = current_fs_time(sb);
+ ip->i_ctime = current_time(ip);
zfs_mark_inode_dirty(ip);
}
if (!acl) {
ip->i_mode &= ~current_umask();
- ip->i_ctime = current_fs_time(ITOZSB(ip)->z_sb);
+ ip->i_ctime = current_time(ip);
zfs_mark_inode_dirty(ip);
return (0);
}