cache.c (6288cf1e768ae73db5ddaaae54d85245cc1c2b56) cache.c (fd2421f54423f307ecd31bdebdca6bc317e0c492)
1/*
2 * V9FS cache definitions.
3 *
4 * Copyright (C) 2009 by Abhishek Kulkarni <adkulkar@umail.iu.edu>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.

--- 94 unchanged lines hidden (view full) ---

103 v9ses->fscache = NULL;
104}
105
106
107static uint16_t v9fs_cache_inode_get_key(const void *cookie_netfs_data,
108 void *buffer, uint16_t bufmax)
109{
110 const struct v9fs_inode *v9inode = cookie_netfs_data;
1/*
2 * V9FS cache definitions.
3 *
4 * Copyright (C) 2009 by Abhishek Kulkarni <adkulkar@umail.iu.edu>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.

--- 94 unchanged lines hidden (view full) ---

103 v9ses->fscache = NULL;
104}
105
106
107static uint16_t v9fs_cache_inode_get_key(const void *cookie_netfs_data,
108 void *buffer, uint16_t bufmax)
109{
110 const struct v9fs_inode *v9inode = cookie_netfs_data;
111 memcpy(buffer, &v9inode->fscache_key->path,
112 sizeof(v9inode->fscache_key->path));
111 memcpy(buffer, &v9inode->qid.path, sizeof(v9inode->qid.path));
113 P9_DPRINTK(P9_DEBUG_FSC, "inode %p get key %llu", &v9inode->vfs_inode,
112 P9_DPRINTK(P9_DEBUG_FSC, "inode %p get key %llu", &v9inode->vfs_inode,
114 v9inode->fscache_key->path);
115 return sizeof(v9inode->fscache_key->path);
113 v9inode->qid.path);
114 return sizeof(v9inode->qid.path);
116}
117
118static void v9fs_cache_inode_get_attr(const void *cookie_netfs_data,
119 uint64_t *size)
120{
121 const struct v9fs_inode *v9inode = cookie_netfs_data;
122 *size = i_size_read(&v9inode->vfs_inode);
123
124 P9_DPRINTK(P9_DEBUG_FSC, "inode %p get attr %llu", &v9inode->vfs_inode,
125 *size);
126}
127
128static uint16_t v9fs_cache_inode_get_aux(const void *cookie_netfs_data,
129 void *buffer, uint16_t buflen)
130{
131 const struct v9fs_inode *v9inode = cookie_netfs_data;
115}
116
117static void v9fs_cache_inode_get_attr(const void *cookie_netfs_data,
118 uint64_t *size)
119{
120 const struct v9fs_inode *v9inode = cookie_netfs_data;
121 *size = i_size_read(&v9inode->vfs_inode);
122
123 P9_DPRINTK(P9_DEBUG_FSC, "inode %p get attr %llu", &v9inode->vfs_inode,
124 *size);
125}
126
127static uint16_t v9fs_cache_inode_get_aux(const void *cookie_netfs_data,
128 void *buffer, uint16_t buflen)
129{
130 const struct v9fs_inode *v9inode = cookie_netfs_data;
132 memcpy(buffer, &v9inode->fscache_key->version,
133 sizeof(v9inode->fscache_key->version));
131 memcpy(buffer, &v9inode->qid.version, sizeof(v9inode->qid.version));
134 P9_DPRINTK(P9_DEBUG_FSC, "inode %p get aux %u", &v9inode->vfs_inode,
132 P9_DPRINTK(P9_DEBUG_FSC, "inode %p get aux %u", &v9inode->vfs_inode,
135 v9inode->fscache_key->version);
136 return sizeof(v9inode->fscache_key->version);
133 v9inode->qid.version);
134 return sizeof(v9inode->qid.version);
137}
138
139static enum
140fscache_checkaux v9fs_cache_inode_check_aux(void *cookie_netfs_data,
141 const void *buffer,
142 uint16_t buflen)
143{
144 const struct v9fs_inode *v9inode = cookie_netfs_data;
145
135}
136
137static enum
138fscache_checkaux v9fs_cache_inode_check_aux(void *cookie_netfs_data,
139 const void *buffer,
140 uint16_t buflen)
141{
142 const struct v9fs_inode *v9inode = cookie_netfs_data;
143
146 if (buflen != sizeof(v9inode->fscache_key->version))
144 if (buflen != sizeof(v9inode->qid.version))
147 return FSCACHE_CHECKAUX_OBSOLETE;
148
145 return FSCACHE_CHECKAUX_OBSOLETE;
146
149 if (memcmp(buffer, &v9inode->fscache_key->version,
150 sizeof(v9inode->fscache_key->version)))
147 if (memcmp(buffer, &v9inode->qid.version,
148 sizeof(v9inode->qid.version)))
151 return FSCACHE_CHECKAUX_OBSOLETE;
152
153 return FSCACHE_CHECKAUX_OKAY;
154}
155
156static void v9fs_cache_inode_now_uncached(void *cookie_netfs_data)
157{
158 struct v9fs_inode *v9inode = cookie_netfs_data;

--- 259 unchanged lines hidden ---
149 return FSCACHE_CHECKAUX_OBSOLETE;
150
151 return FSCACHE_CHECKAUX_OKAY;
152}
153
154static void v9fs_cache_inode_now_uncached(void *cookie_netfs_data)
155{
156 struct v9fs_inode *v9inode = cookie_netfs_data;

--- 259 unchanged lines hidden ---