Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fscache: remove unused ->now_uncached callback

Patch series "Ranged pagevec lookup", v2.

In this series I make pagevec_lookup() update the index (to be
consistent with pagevec_lookup_tag() and also as a preparation for
ranged lookups), provide ranged variant of pagevec_lookup() and use it
in places where it makes sense. This not only removes some common code
but is also a measurable performance win for some use cases (see patch
4/10) where radix tree is sparse and searching & grabing of a page after
the end of the range has measurable overhead.

This patch (of 10):

The callback doesn't ever get called. Remove it.

Link: http://lkml.kernel.org/r/20170726114704.7626-2-jack@suse.cz
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jan Kara and committed by
Linus Torvalds
26b433d0 db73ee0d

-185
-2
Documentation/filesystems/caching/netfs-api.txt
··· 151 151 void (*mark_pages_cached)(void *cookie_netfs_data, 152 152 struct address_space *mapping, 153 153 struct pagevec *cached_pvec); 154 - 155 - void (*now_uncached)(void *cookie_netfs_data); 156 154 }; 157 155 158 156 This has the following fields:
-29
fs/9p/cache.c
··· 151 151 return FSCACHE_CHECKAUX_OKAY; 152 152 } 153 153 154 - static void v9fs_cache_inode_now_uncached(void *cookie_netfs_data) 155 - { 156 - struct v9fs_inode *v9inode = cookie_netfs_data; 157 - struct pagevec pvec; 158 - pgoff_t first; 159 - int loop, nr_pages; 160 - 161 - pagevec_init(&pvec, 0); 162 - first = 0; 163 - 164 - for (;;) { 165 - nr_pages = pagevec_lookup(&pvec, v9inode->vfs_inode.i_mapping, 166 - first, 167 - PAGEVEC_SIZE - pagevec_count(&pvec)); 168 - if (!nr_pages) 169 - break; 170 - 171 - for (loop = 0; loop < nr_pages; loop++) 172 - ClearPageFsCache(pvec.pages[loop]); 173 - 174 - first = pvec.pages[nr_pages - 1]->index + 1; 175 - 176 - pvec.nr = nr_pages; 177 - pagevec_release(&pvec); 178 - cond_resched(); 179 - } 180 - } 181 - 182 154 const struct fscache_cookie_def v9fs_cache_inode_index_def = { 183 155 .name = "9p.inode", 184 156 .type = FSCACHE_COOKIE_TYPE_DATAFILE, ··· 158 186 .get_attr = v9fs_cache_inode_get_attr, 159 187 .get_aux = v9fs_cache_inode_get_aux, 160 188 .check_aux = v9fs_cache_inode_check_aux, 161 - .now_uncached = v9fs_cache_inode_now_uncached, 162 189 }; 163 190 164 191 void v9fs_cache_inode_get_cookie(struct inode *inode)
-43
fs/afs/cache.c
··· 39 39 static enum fscache_checkaux afs_vnode_cache_check_aux(void *cookie_netfs_data, 40 40 const void *buffer, 41 41 uint16_t buflen); 42 - static void afs_vnode_cache_now_uncached(void *cookie_netfs_data); 43 42 44 43 struct fscache_netfs afs_cache_netfs = { 45 44 .name = "afs", ··· 74 75 .get_attr = afs_vnode_cache_get_attr, 75 76 .get_aux = afs_vnode_cache_get_aux, 76 77 .check_aux = afs_vnode_cache_check_aux, 77 - .now_uncached = afs_vnode_cache_now_uncached, 78 78 }; 79 79 80 80 /* ··· 356 358 357 359 _leave(" = SUCCESS"); 358 360 return FSCACHE_CHECKAUX_OKAY; 359 - } 360 - 361 - /* 362 - * indication the cookie is no longer uncached 363 - * - this function is called when the backing store currently caching a cookie 364 - * is removed 365 - * - the netfs should use this to clean up any markers indicating cached pages 366 - * - this is mandatory for any object that may have data 367 - */ 368 - static void afs_vnode_cache_now_uncached(void *cookie_netfs_data) 369 - { 370 - struct afs_vnode *vnode = cookie_netfs_data; 371 - struct pagevec pvec; 372 - pgoff_t first; 373 - int loop, nr_pages; 374 - 375 - _enter("{%x,%x,%Lx}", 376 - vnode->fid.vnode, vnode->fid.unique, vnode->status.data_version); 377 - 378 - pagevec_init(&pvec, 0); 379 - first = 0; 380 - 381 - for (;;) { 382 - /* grab a bunch of pages to clean */ 383 - nr_pages = pagevec_lookup(&pvec, vnode->vfs_inode.i_mapping, 384 - first, 385 - PAGEVEC_SIZE - pagevec_count(&pvec)); 386 - if (!nr_pages) 387 - break; 388 - 389 - for (loop = 0; loop < nr_pages; loop++) 390 - ClearPageFsCache(pvec.pages[loop]); 391 - 392 - first = pvec.pages[nr_pages - 1]->index + 1; 393 - 394 - pvec.nr = nr_pages; 395 - pagevec_release(&pvec); 396 - cond_resched(); 397 - } 398 - 399 - _leave(""); 400 361 }
-31
fs/ceph/cache.c
··· 194 194 return FSCACHE_CHECKAUX_OKAY; 195 195 } 196 196 197 - static void ceph_fscache_inode_now_uncached(void* cookie_netfs_data) 198 - { 199 - struct ceph_inode_info* ci = cookie_netfs_data; 200 - struct pagevec pvec; 201 - pgoff_t first; 202 - int loop, nr_pages; 203 - 204 - pagevec_init(&pvec, 0); 205 - first = 0; 206 - 207 - dout("ceph inode 0x%p now uncached", ci); 208 - 209 - while (1) { 210 - nr_pages = pagevec_lookup(&pvec, ci->vfs_inode.i_mapping, first, 211 - PAGEVEC_SIZE - pagevec_count(&pvec)); 212 - 213 - if (!nr_pages) 214 - break; 215 - 216 - for (loop = 0; loop < nr_pages; loop++) 217 - ClearPageFsCache(pvec.pages[loop]); 218 - 219 - first = pvec.pages[nr_pages - 1]->index + 1; 220 - 221 - pvec.nr = nr_pages; 222 - pagevec_release(&pvec); 223 - cond_resched(); 224 - } 225 - } 226 - 227 197 static const struct fscache_cookie_def ceph_fscache_inode_object_def = { 228 198 .name = "CEPH.inode", 229 199 .type = FSCACHE_COOKIE_TYPE_DATAFILE, ··· 201 231 .get_attr = ceph_fscache_inode_get_attr, 202 232 .get_aux = ceph_fscache_inode_get_aux, 203 233 .check_aux = ceph_fscache_inode_check_aux, 204 - .now_uncached = ceph_fscache_inode_now_uncached, 205 234 }; 206 235 207 236 void ceph_fscache_register_inode_cookie(struct inode *inode)
-31
fs/cifs/cache.c
··· 292 292 return FSCACHE_CHECKAUX_OKAY; 293 293 } 294 294 295 - static void cifs_fscache_inode_now_uncached(void *cookie_netfs_data) 296 - { 297 - struct cifsInodeInfo *cifsi = cookie_netfs_data; 298 - struct pagevec pvec; 299 - pgoff_t first; 300 - int loop, nr_pages; 301 - 302 - pagevec_init(&pvec, 0); 303 - first = 0; 304 - 305 - cifs_dbg(FYI, "%s: cifs inode 0x%p now uncached\n", __func__, cifsi); 306 - 307 - for (;;) { 308 - nr_pages = pagevec_lookup(&pvec, 309 - cifsi->vfs_inode.i_mapping, first, 310 - PAGEVEC_SIZE - pagevec_count(&pvec)); 311 - if (!nr_pages) 312 - break; 313 - 314 - for (loop = 0; loop < nr_pages; loop++) 315 - ClearPageFsCache(pvec.pages[loop]); 316 - 317 - first = pvec.pages[nr_pages - 1]->index + 1; 318 - 319 - pvec.nr = nr_pages; 320 - pagevec_release(&pvec); 321 - cond_resched(); 322 - } 323 - } 324 - 325 295 const struct fscache_cookie_def cifs_fscache_inode_object_def = { 326 296 .name = "CIFS.uniqueid", 327 297 .type = FSCACHE_COOKIE_TYPE_DATAFILE, ··· 299 329 .get_attr = cifs_fscache_inode_get_attr, 300 330 .get_aux = cifs_fscache_inode_get_aux, 301 331 .check_aux = cifs_fscache_inode_check_aux, 302 - .now_uncached = cifs_fscache_inode_now_uncached, 303 332 };
-40
fs/nfs/fscache-index.c
··· 252 252 } 253 253 254 254 /* 255 - * Indication from FS-Cache that the cookie is no longer cached 256 - * - This function is called when the backing store currently caching a cookie 257 - * is removed 258 - * - The netfs should use this to clean up any markers indicating cached pages 259 - * - This is mandatory for any object that may have data 260 - */ 261 - static void nfs_fscache_inode_now_uncached(void *cookie_netfs_data) 262 - { 263 - struct nfs_inode *nfsi = cookie_netfs_data; 264 - struct pagevec pvec; 265 - pgoff_t first; 266 - int loop, nr_pages; 267 - 268 - pagevec_init(&pvec, 0); 269 - first = 0; 270 - 271 - dprintk("NFS: nfs_inode_now_uncached: nfs_inode 0x%p\n", nfsi); 272 - 273 - for (;;) { 274 - /* grab a bunch of pages to unmark */ 275 - nr_pages = pagevec_lookup(&pvec, 276 - nfsi->vfs_inode.i_mapping, 277 - first, 278 - PAGEVEC_SIZE - pagevec_count(&pvec)); 279 - if (!nr_pages) 280 - break; 281 - 282 - for (loop = 0; loop < nr_pages; loop++) 283 - ClearPageFsCache(pvec.pages[loop]); 284 - 285 - first = pvec.pages[nr_pages - 1]->index + 1; 286 - 287 - pvec.nr = nr_pages; 288 - pagevec_release(&pvec); 289 - cond_resched(); 290 - } 291 - } 292 - 293 - /* 294 255 * Get an extra reference on a read context. 295 256 * - This function can be absent if the completion function doesn't require a 296 257 * context. ··· 291 330 .get_attr = nfs_fscache_inode_get_attr, 292 331 .get_aux = nfs_fscache_inode_get_aux, 293 332 .check_aux = nfs_fscache_inode_check_aux, 294 - .now_uncached = nfs_fscache_inode_now_uncached, 295 333 .get_context = nfs_fh_get_context, 296 334 .put_context = nfs_fh_put_context, 297 335 };
-9
include/linux/fscache.h
··· 143 143 void (*mark_page_cached)(void *cookie_netfs_data, 144 144 struct address_space *mapping, 145 145 struct page *page); 146 - 147 - /* indicate the cookie is no longer cached 148 - * - this function is called when the backing store currently caching 149 - * a cookie is removed 150 - * - the netfs should use this to clean up any markers indicating 151 - * cached pages 152 - * - this is mandatory for any object that may have data 153 - */ 154 - void (*now_uncached)(void *cookie_netfs_data); 155 146 }; 156 147 157 148 /*