Lines Matching +full:data +full:- +full:mapping

1 // SPDX-License-Identifier: GPL-2.0-only
9 * Copyright (C) 2009-2010 Oracle Corp. All rights reserved.
38 switch (sb->cleancache_poolid) { in cleancache_register_ops_sb()
54 return -EBUSY; in cleancache_register_ops()
59 * handle such a scenario, here we call ->init_fs or ->init_shared_fs in cleancache_register_ops()
61 * shared filesystems, we temporarily initialize sb->cleancache_poolid in cleancache_register_ops()
74 * ->kill_sb in cleancache_register_ops()
77 * ->mount yet, it waits until it is finished in cleancache_register_ops()
79 * c) cleancache_init_fs is called from ->mount and in cleancache_register_ops()
80 * cleancache_invalidate_fs is called from ->kill_sb in cleancache_register_ops()
89 * ->mount by itself according to c). This proves that we call in cleancache_register_ops()
90 * ->init_fs at least once for each active super block. in cleancache_register_ops()
93 * block that has already started ->init_fs, it will wait until ->mount in cleancache_register_ops()
94 * and hence ->init_fs has finished, then check cleancache_poolid, see in cleancache_register_ops()
96 * that we call ->init_fs no more than once for each super block. in cleancache_register_ops()
104 * until the corresponding ->init_fs has been actually called and in cleancache_register_ops()
112 /* Called by a cleancache-enabled filesystem at time of mount */
118 pool_id = cleancache_ops->init_fs(PAGE_SIZE); in __cleancache_init_fs()
122 sb->cleancache_poolid = pool_id; in __cleancache_init_fs()
126 /* Called by a cleancache-enabled clustered filesystem at time of mount */
132 pool_id = cleancache_ops->init_shared_fs(&sb->s_uuid, PAGE_SIZE); in __cleancache_init_shared_fs()
136 sb->cleancache_poolid = pool_id; in __cleancache_init_shared_fs()
149 struct super_block *sb = inode->i_sb; in cleancache_get_key()
151 key->u.ino = inode->i_ino; in cleancache_get_key()
152 if (sb->s_export_op != NULL) { in cleancache_get_key()
153 fhfn = sb->s_export_op->encode_fh; in cleancache_get_key()
155 len = (*fhfn)(inode, &key->u.fh[0], &maxlen, NULL); in cleancache_get_key()
157 return -1; in cleancache_get_key()
159 return -1; in cleancache_get_key()
166 * "Get" data from cleancache associated with the poolid/inode/index
167 * that were specified when the data was put to cleanache and, if
168 * successful, use it to fill the specified page with data and return 0.
169 * The pageframe is unchanged and returns -1 if the get fails.
172 * The function has two checks before any action is taken - whether
173 * a backend is registered and whether the sb->cleancache_poolid
178 int ret = -1; in __cleancache_get_page()
188 pool_id = page->mapping->host->i_sb->cleancache_poolid; in __cleancache_get_page()
192 if (cleancache_get_key(page->mapping->host, &key) < 0) in __cleancache_get_page()
195 ret = cleancache_ops->get_page(pool_id, key, page->index, page); in __cleancache_get_page()
206 * "Put" data from a page to cleancache and associate it with the
207 * (previously-obtained per-filesystem) poolid and the page's,
211 * The function has two checks before any action is taken - whether
212 * a backend is registered and whether the sb->cleancache_poolid
226 pool_id = page->mapping->host->i_sb->cleancache_poolid; in __cleancache_put_page()
228 cleancache_get_key(page->mapping->host, &key) >= 0) { in __cleancache_put_page()
229 cleancache_ops->put_page(pool_id, key, page->index, page); in __cleancache_put_page()
236 * Invalidate any data from cleancache associated with the poolid and the
239 * The function has two checks before any action is taken - whether
240 * a backend is registered and whether the sb->cleancache_poolid
243 void __cleancache_invalidate_page(struct address_space *mapping, in __cleancache_invalidate_page() argument
246 /* careful... page->mapping is NULL sometimes when this is called */ in __cleancache_invalidate_page()
247 int pool_id = mapping->host->i_sb->cleancache_poolid; in __cleancache_invalidate_page()
255 if (cleancache_get_key(mapping->host, &key) >= 0) { in __cleancache_invalidate_page()
256 cleancache_ops->invalidate_page(pool_id, in __cleancache_invalidate_page()
257 key, page->index); in __cleancache_invalidate_page()
265 * Invalidate all data from cleancache associated with the poolid and the
269 * The function has two checks before any action is taken - whether
270 * a backend is registered and whether the sb->cleancache_poolid
273 void __cleancache_invalidate_inode(struct address_space *mapping) in __cleancache_invalidate_inode() argument
275 int pool_id = mapping->host->i_sb->cleancache_poolid; in __cleancache_invalidate_inode()
281 if (pool_id >= 0 && cleancache_get_key(mapping->host, &key) >= 0) in __cleancache_invalidate_inode()
282 cleancache_ops->invalidate_inode(pool_id, key); in __cleancache_invalidate_inode()
287 * Called by any cleancache-enabled filesystem at time of unmount;
295 pool_id = sb->cleancache_poolid; in __cleancache_invalidate_fs()
296 sb->cleancache_poolid = CLEANCACHE_NO_POOL; in __cleancache_invalidate_fs()
299 cleancache_ops->invalidate_fs(pool_id); in __cleancache_invalidate_fs()