Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1484949

[PATCH 11/12] cifs: don't use ->d_time

From Miklos Szeredi <mszeredi@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 11/12] cifs: don't use ->d_time
Date 2016-09-16 14:30 +0200
Message-ID <si0rg-4Fp-41@gated-at.bofh.it> (permalink)
References <si0hz-4BJ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Use d_fsdata instead, which is the same size.  Introduce helpers to hide
the typecasts.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: Steve French <sfrench@samba.org>
---
 fs/cifs/cifsfs.h | 10 ++++++++++
 fs/cifs/dir.c    |  6 +++---
 fs/cifs/inode.c  |  2 +-
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h
index 9dcf974acc47..c9c00a862036 100644
--- a/fs/cifs/cifsfs.h
+++ b/fs/cifs/cifsfs.h
@@ -41,6 +41,16 @@ cifs_uniqueid_to_ino_t(u64 fileid)
 
 }
 
+static inline void cifs_set_time(struct dentry *dentry, unsigned long time)
+{
+	dentry->d_fsdata = (void *) time;
+}
+
+static inline unsigned long cifs_get_time(struct dentry *dentry)
+{
+	return (unsigned long) dentry->d_fsdata;
+}
+
 extern struct file_system_type cifs_fs_type;
 extern const struct address_space_operations cifs_addr_ops;
 extern const struct address_space_operations cifs_addr_ops_smallbuf;
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 4716c54dbfc6..789ff1df2d8d 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -40,7 +40,7 @@ renew_parental_timestamps(struct dentry *direntry)
 	/* BB check if there is a way to get the kernel to do this or if we
 	   really need this */
 	do {
-		direntry->d_time = jiffies;
+		cifs_set_time(direntry, jiffies);
 		direntry = direntry->d_parent;
 	} while (!IS_ROOT(direntry));
 }
@@ -802,7 +802,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
 
 	} else if (rc == -ENOENT) {
 		rc = 0;
-		direntry->d_time = jiffies;
+		cifs_set_time(direntry, jiffies);
 		d_add(direntry, NULL);
 	/*	if it was once a directory (but how can we tell?) we could do
 		shrink_dcache_parent(direntry); */
@@ -862,7 +862,7 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
 	if (flags & (LOOKUP_CREATE | LOOKUP_RENAME_TARGET))
 		return 0;
 
-	if (time_after(jiffies, direntry->d_time + HZ) || !lookupCacheEnabled)
+	if (time_after(jiffies, cifs_get_time(direntry) + HZ) || !lookupCacheEnabled)
 		return 0;
 
 	return 1;
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index b87efd0c92d6..0b4a35514351 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1951,7 +1951,7 @@ int cifs_revalidate_dentry_attr(struct dentry *dentry)
 
 	cifs_dbg(FYI, "Update attributes: %s inode 0x%p count %d dentry: 0x%p d_time %ld jiffies %ld\n",
 		 full_path, inode, inode->i_count.counter,
-		 dentry, dentry->d_time, jiffies);
+		 dentry, cifs_get_time(dentry), jiffies);
 
 	if (cifs_sb_master_tcon(CIFS_SB(sb))->unix_ext)
 		rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid);
-- 
2.5.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/12] misc filesystem patches for 4.9 Miklos Szeredi <mszeredi@redhat.com> - 2016-09-16 14:20 +0200
  [PATCH 10/12] posix_acl: don't ignore return value of posix_acl_create_masq() Miklos Szeredi <mszeredi@redhat.com> - 2016-09-16 14:30 +0200
    Re: [PATCH 10/12] posix_acl: don't ignore return value of posix_acl_create_masq() Andreas Grünbacher <andreas.gruenbacher@gmail.com> - 2016-09-16 14:50 +0200
  [PATCH 01/12] ima: use file_dentry() Miklos Szeredi <mszeredi@redhat.com> - 2016-09-16 14:30 +0200
  [PATCH 12/12] vfat: don't use ->d_time Miklos Szeredi <mszeredi@redhat.com> - 2016-09-16 14:30 +0200
  [PATCH 05/12] locks: fix file locking on overlayfs Miklos Szeredi <mszeredi@redhat.com> - 2016-09-16 14:30 +0200
  [PATCH 08/12] btrfs: use filemap_check_errors() Miklos Szeredi <mszeredi@redhat.com> - 2016-09-16 14:30 +0200
  [PATCH 11/12] cifs: don't use ->d_time Miklos Szeredi <mszeredi@redhat.com> - 2016-09-16 14:30 +0200
  [PATCH 07/12] vfs: do get_write_access() on upper layer of overlayfs Miklos Szeredi <mszeredi@redhat.com> - 2016-09-16 14:30 +0200
  [PATCH 02/12] vfs: move permission checking into notify_change() for utimes(NULL) Miklos Szeredi <mszeredi@redhat.com> - 2016-09-16 14:30 +0200
  [PATCH 09/12] f2fs: use filemap_check_errors() Miklos Szeredi <mszeredi@redhat.com> - 2016-09-16 14:30 +0200
  [PATCH 03/12] vfs: update ovl inode before relatime check Miklos Szeredi <mszeredi@redhat.com> - 2016-09-16 14:30 +0200
  [PATCH 04/12] fsnotify: support overlayfs Miklos Szeredi <mszeredi@redhat.com> - 2016-09-16 14:30 +0200
    Re: [PATCH 04/12] fsnotify: support overlayfs Jan Kara <jack@suse.cz> - 2016-09-16 21:10 +0200
      Re: [PATCH 04/12] fsnotify: support overlayfs Amir Goldstein <amir73il@gmail.com> - 2016-09-17 08:30 +0200
  [PATCH 06/12] vfs: make argument of d_real_inode() const Miklos Szeredi <mszeredi@redhat.com> - 2016-09-16 14:30 +0200

csiph-web