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


Groups > linux.kernel > #1484944

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

From Miklos Szeredi <mszeredi@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 12/12] vfat: don't use ->d_time
Date 2016-09-16 14:30 +0200
Message-ID <si0rf-4Fp-23@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: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---
 fs/fat/namei_vfat.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 92b7363dafa9..4afdc3f36470 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -21,6 +21,17 @@
 #include <linux/namei.h>
 #include "fat.h"
 
+static inline unsigned long vfat_d_version(struct dentry *dentry)
+{
+	return (unsigned long) dentry->d_fsdata;
+}
+
+static inline void vfat_d_version_set(struct dentry *dentry,
+				      unsigned long version)
+{
+	dentry->d_fsdata = (void *) version;
+}
+
 /*
  * If new entry was created in the parent, it could create the 8.3
  * alias (the shortname of logname).  So, the parent may have the
@@ -33,7 +44,7 @@ static int vfat_revalidate_shortname(struct dentry *dentry)
 {
 	int ret = 1;
 	spin_lock(&dentry->d_lock);
-	if (dentry->d_time != d_inode(dentry->d_parent)->i_version)
+	if (vfat_d_version(dentry) != d_inode(dentry->d_parent)->i_version)
 		ret = 0;
 	spin_unlock(&dentry->d_lock);
 	return ret;
@@ -759,7 +770,7 @@ static struct dentry *vfat_lookup(struct inode *dir, struct dentry *dentry,
 out:
 	mutex_unlock(&MSDOS_SB(sb)->s_lock);
 	if (!inode)
-		dentry->d_time = dir->i_version;
+		vfat_d_version_set(dentry, dir->i_version);
 	return d_splice_alias(inode, dentry);
 error:
 	mutex_unlock(&MSDOS_SB(sb)->s_lock);
@@ -823,7 +834,7 @@ static int vfat_rmdir(struct inode *dir, struct dentry *dentry)
 	clear_nlink(inode);
 	inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC;
 	fat_detach(inode);
-	dentry->d_time = dir->i_version;
+	vfat_d_version_set(dentry, dir->i_version);
 out:
 	mutex_unlock(&MSDOS_SB(sb)->s_lock);
 
@@ -849,7 +860,7 @@ static int vfat_unlink(struct inode *dir, struct dentry *dentry)
 	clear_nlink(inode);
 	inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC;
 	fat_detach(inode);
-	dentry->d_time = dir->i_version;
+	vfat_d_version_set(dentry, dir->i_version);
 out:
 	mutex_unlock(&MSDOS_SB(sb)->s_lock);
 
-- 
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