diff options
author | Dave Jones <davej@redhat.com> | 2006-09-05 17:20:21 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2006-09-05 17:20:21 -0400 |
commit | 115b384cf87249d76adb0b21aca11ee22128927d (patch) | |
tree | f39a2a54863e9d82d1196906f92c82ab5991c6af /fs/fuse/dir.c | |
parent | 8eb7925f93af75e66a240d148efdec212f95bcb7 (diff) | |
parent | c336923b668fdcf0312efbec3b44895d713f4d81 (diff) |
Merge ../linus
Diffstat (limited to 'fs/fuse/dir.c')
-rw-r--r-- | fs/fuse/dir.c | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 72a74cde6de8..409ce6a7cca4 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -14,6 +14,33 @@ | |||
14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
15 | #include <linux/namei.h> | 15 | #include <linux/namei.h> |
16 | 16 | ||
17 | #if BITS_PER_LONG >= 64 | ||
18 | static inline void fuse_dentry_settime(struct dentry *entry, u64 time) | ||
19 | { | ||
20 | entry->d_time = time; | ||
21 | } | ||
22 | |||
23 | static inline u64 fuse_dentry_time(struct dentry *entry) | ||
24 | { | ||
25 | return entry->d_time; | ||
26 | } | ||
27 | #else | ||
28 | /* | ||
29 | * On 32 bit archs store the high 32 bits of time in d_fsdata | ||
30 | */ | ||
31 | static void fuse_dentry_settime(struct dentry *entry, u64 time) | ||
32 | { | ||
33 | entry->d_time = time; | ||
34 | entry->d_fsdata = (void *) (unsigned long) (time >> 32); | ||
35 | } | ||
36 | |||
37 | static u64 fuse_dentry_time(struct dentry *entry) | ||
38 | { | ||
39 | return (u64) entry->d_time + | ||
40 | ((u64) (unsigned long) entry->d_fsdata << 32); | ||
41 | } | ||
42 | #endif | ||
43 | |||
17 | /* | 44 | /* |
18 | * FUSE caches dentries and attributes with separate timeout. The | 45 | * FUSE caches dentries and attributes with separate timeout. The |
19 | * time in jiffies until the dentry/attributes are valid is stored in | 46 | * time in jiffies until the dentry/attributes are valid is stored in |
@@ -23,10 +50,13 @@ | |||
23 | /* | 50 | /* |
24 | * Calculate the time in jiffies until a dentry/attributes are valid | 51 | * Calculate the time in jiffies until a dentry/attributes are valid |
25 | */ | 52 | */ |
26 | static unsigned long time_to_jiffies(unsigned long sec, unsigned long nsec) | 53 | static u64 time_to_jiffies(unsigned long sec, unsigned long nsec) |
27 | { | 54 | { |
28 | struct timespec ts = {sec, nsec}; | 55 | if (sec || nsec) { |
29 | return jiffies + timespec_to_jiffies(&ts); | 56 | struct timespec ts = {sec, nsec}; |
57 | return get_jiffies_64() + timespec_to_jiffies(&ts); | ||
58 | } else | ||
59 | return 0; | ||
30 | } | 60 | } |
31 | 61 | ||
32 | /* | 62 | /* |
@@ -35,7 +65,8 @@ static unsigned long time_to_jiffies(unsigned long sec, unsigned long nsec) | |||
35 | */ | 65 | */ |
36 | static void fuse_change_timeout(struct dentry *entry, struct fuse_entry_out *o) | 66 | static void fuse_change_timeout(struct dentry *entry, struct fuse_entry_out *o) |
37 | { | 67 | { |
38 | entry->d_time = time_to_jiffies(o->entry_valid, o->entry_valid_nsec); | 68 | fuse_dentry_settime(entry, |
69 | time_to_jiffies(o->entry_valid, o->entry_valid_nsec)); | ||
39 | if (entry->d_inode) | 70 | if (entry->d_inode) |
40 | get_fuse_inode(entry->d_inode)->i_time = | 71 | get_fuse_inode(entry->d_inode)->i_time = |
41 | time_to_jiffies(o->attr_valid, o->attr_valid_nsec); | 72 | time_to_jiffies(o->attr_valid, o->attr_valid_nsec); |
@@ -47,7 +78,7 @@ static void fuse_change_timeout(struct dentry *entry, struct fuse_entry_out *o) | |||
47 | */ | 78 | */ |
48 | void fuse_invalidate_attr(struct inode *inode) | 79 | void fuse_invalidate_attr(struct inode *inode) |
49 | { | 80 | { |
50 | get_fuse_inode(inode)->i_time = jiffies - 1; | 81 | get_fuse_inode(inode)->i_time = 0; |
51 | } | 82 | } |
52 | 83 | ||
53 | /* | 84 | /* |
@@ -60,7 +91,7 @@ void fuse_invalidate_attr(struct inode *inode) | |||
60 | */ | 91 | */ |
61 | static void fuse_invalidate_entry_cache(struct dentry *entry) | 92 | static void fuse_invalidate_entry_cache(struct dentry *entry) |
62 | { | 93 | { |
63 | entry->d_time = jiffies - 1; | 94 | fuse_dentry_settime(entry, 0); |
64 | } | 95 | } |
65 | 96 | ||
66 | /* | 97 | /* |
@@ -102,7 +133,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) | |||
102 | 133 | ||
103 | if (inode && is_bad_inode(inode)) | 134 | if (inode && is_bad_inode(inode)) |
104 | return 0; | 135 | return 0; |
105 | else if (time_after(jiffies, entry->d_time)) { | 136 | else if (fuse_dentry_time(entry) < get_jiffies_64()) { |
106 | int err; | 137 | int err; |
107 | struct fuse_entry_out outarg; | 138 | struct fuse_entry_out outarg; |
108 | struct fuse_conn *fc; | 139 | struct fuse_conn *fc; |
@@ -666,7 +697,7 @@ static int fuse_revalidate(struct dentry *entry) | |||
666 | if (!fuse_allow_task(fc, current)) | 697 | if (!fuse_allow_task(fc, current)) |
667 | return -EACCES; | 698 | return -EACCES; |
668 | if (get_node_id(inode) != FUSE_ROOT_ID && | 699 | if (get_node_id(inode) != FUSE_ROOT_ID && |
669 | time_before_eq(jiffies, fi->i_time)) | 700 | fi->i_time >= get_jiffies_64()) |
670 | return 0; | 701 | return 0; |
671 | 702 | ||
672 | return fuse_do_getattr(inode); | 703 | return fuse_do_getattr(inode); |