Skip to content

Commit 25b7351

Browse files
jtlaytonidryomov
authored andcommitted
ceph: just use ci->i_version for fscache aux info
If the i_version regresses, then it's likely that the mtime will do the same in lockstep with it. There's no need to track both here, just use the i_version counter since it's just as good and gets the aux size down to 64 bits. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Ilya Dryomov <[email protected]>
1 parent 5d6451b commit 25b7351

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

fs/ceph/cache.c

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
#include "super.h"
1313
#include "cache.h"
1414

15-
struct ceph_aux_inode {
16-
u64 version;
17-
u64 mtime_sec;
18-
u64 mtime_nsec;
19-
};
20-
2115
struct fscache_netfs ceph_cache_netfs = {
2216
.name = "ceph",
2317
.version = 0,
@@ -109,20 +103,14 @@ static enum fscache_checkaux ceph_fscache_inode_check_aux(
109103
void *cookie_netfs_data, const void *data, uint16_t dlen,
110104
loff_t object_size)
111105
{
112-
struct ceph_aux_inode aux;
113106
struct ceph_inode_info* ci = cookie_netfs_data;
114107
struct inode* inode = &ci->vfs_inode;
115108

116-
if (dlen != sizeof(aux) ||
109+
if (dlen != sizeof(ci->i_version) ||
117110
i_size_read(inode) != object_size)
118111
return FSCACHE_CHECKAUX_OBSOLETE;
119112

120-
memset(&aux, 0, sizeof(aux));
121-
aux.version = ci->i_version;
122-
aux.mtime_sec = inode->i_mtime.tv_sec;
123-
aux.mtime_nsec = inode->i_mtime.tv_nsec;
124-
125-
if (memcmp(data, &aux, sizeof(aux)) != 0)
113+
if (*(u64 *)data != ci->i_version)
126114
return FSCACHE_CHECKAUX_OBSOLETE;
127115

128116
dout("ceph inode 0x%p cached okay\n", ci);
@@ -139,7 +127,6 @@ void ceph_fscache_register_inode_cookie(struct inode *inode)
139127
{
140128
struct ceph_inode_info *ci = ceph_inode(inode);
141129
struct ceph_fs_client *fsc = ceph_inode_to_client(inode);
142-
struct ceph_aux_inode aux;
143130

144131
/* No caching for filesystem */
145132
if (!fsc->fscache)
@@ -151,14 +138,10 @@ void ceph_fscache_register_inode_cookie(struct inode *inode)
151138

152139
inode_lock_nested(inode, I_MUTEX_CHILD);
153140
if (!ci->fscache) {
154-
memset(&aux, 0, sizeof(aux));
155-
aux.version = ci->i_version;
156-
aux.mtime_sec = inode->i_mtime.tv_sec;
157-
aux.mtime_nsec = inode->i_mtime.tv_nsec;
158141
ci->fscache = fscache_acquire_cookie(fsc->fscache,
159142
&ceph_fscache_inode_object_def,
160143
&ci->i_vino, sizeof(ci->i_vino),
161-
&aux, sizeof(aux),
144+
&ci->i_version, sizeof(ci->i_version),
162145
ci, i_size_read(inode), false);
163146
}
164147
inode_unlock(inode);

0 commit comments

Comments
 (0)