From: Miklos Szeredi <mszeredi@redhat.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: [PATCH 5/8] fuse: don't use ->d_time
Date: Wed, 22 Jun 2016 16:35:07 +0200 [thread overview]
Message-ID: <1466606110-24297-6-git-send-email-mszeredi@redhat.com> (raw)
In-Reply-To: <1466606110-24297-1-git-send-email-mszeredi@redhat.com>
Store in memory pointed to by ->d_fsdata. Use ->d_allocate() to allocate
the storage.
We could cast ->d_fsdata directly on 64bit archs, but I don't think this is
worth the extra complexity.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
---
fs/fuse/dir.c | 36 ++++++++++++++++--------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index ccd4971cc6c1..1a1dabb72036 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -37,37 +37,20 @@ static void fuse_advise_use_readdirplus(struct inode *dir)
set_bit(FUSE_I_ADVISE_RDPLUS, &fi->state);
}
-#if BITS_PER_LONG >= 64
static inline void fuse_dentry_settime(struct dentry *entry, u64 time)
{
- entry->d_time = time;
+ *(u64 *) entry->d_fsdata = time;
}
static inline u64 fuse_dentry_time(struct dentry *entry)
{
- return entry->d_time;
+ return *(u64 *) entry->d_fsdata;
}
-#else
-/*
- * On 32 bit archs store the high 32 bits of time in d_fsdata
- */
-static void fuse_dentry_settime(struct dentry *entry, u64 time)
-{
- entry->d_time = time;
- entry->d_fsdata = (void *) (unsigned long) (time >> 32);
-}
-
-static u64 fuse_dentry_time(struct dentry *entry)
-{
- return (u64) entry->d_time +
- ((u64) (unsigned long) entry->d_fsdata << 32);
-}
-#endif
/*
* FUSE caches dentries and attributes with separate timeout. The
* time in jiffies until the dentry/attributes are valid is stored in
- * dentry->d_time and fuse_inode->i_time respectively.
+ * dentry->d_fsdata and fuse_inode->i_time respectively.
*/
/*
@@ -272,8 +255,21 @@ static int invalid_nodeid(u64 nodeid)
return !nodeid || nodeid == FUSE_ROOT_ID;
}
+static int fuse_dentry_allocate(struct dentry *dentry)
+{
+ dentry->d_fsdata = kzalloc(sizeof(u64), GFP_KERNEL);
+
+ return dentry->d_fsdata ? 0 : -ENOMEM;
+}
+static void fuse_dentry_release(struct dentry *dentry)
+{
+ kfree(dentry->d_fsdata);
+}
+
const struct dentry_operations fuse_dentry_operations = {
.d_revalidate = fuse_dentry_revalidate,
+ .d_allocate = fuse_dentry_allocate,
+ .d_release = fuse_dentry_release,
};
int fuse_valid_type(int m)
--
2.5.5
next prev parent reply other threads:[~2016-06-22 14:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-22 14:35 [PATCH 0/8] remove d_time from dentry Miklos Szeredi
2016-06-22 14:35 ` [PATCH 1/8] vfs: new d_allocate method Miklos Szeredi
2016-06-22 17:02 ` Al Viro
2016-06-22 20:33 ` Miklos Szeredi
2016-06-22 14:35 ` [PATCH 2/8] ceph: don't use ->d_time Miklos Szeredi
2016-06-23 6:21 ` Yan, Zheng
2016-06-28 8:09 ` Miklos Szeredi
2016-06-28 8:39 ` Yan, Zheng
2016-06-22 14:35 ` [PATCH 3/8] cifs: " Miklos Szeredi
2016-06-22 14:35 ` [PATCH 4/8] vfat: " Miklos Szeredi
2016-06-22 14:35 ` Miklos Szeredi [this message]
2016-06-22 16:46 ` [PATCH 5/8] fuse: " Al Viro
2016-06-22 14:35 ` [PATCH 6/8] nfs: " Miklos Szeredi
2016-06-22 16:48 ` Al Viro
2016-06-22 14:35 ` [PATCH 7/8] ncpfs: " Miklos Szeredi
2016-06-22 16:52 ` Al Viro
2016-06-22 14:35 ` [PATCH 8/8] vfs: remove ->d_time Miklos Szeredi
2016-06-22 21:21 ` [PATCH 0/8] remove d_time from dentry Miklos Szeredi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1466606110-24297-6-git-send-email-mszeredi@redhat.com \
--to=mszeredi@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).