cache.c (1136fa0c07de570dc17858745af8be169d1440ba) cache.c (bc899ee1c898e520574ff4d99356eb2e724a9265)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Ceph cache definitions.
4 *
5 * Copyright (C) 2013 by Adfin Solutions, Inc. All Rights Reserved.
6 * Written by Milosz Tanski (milosz@adfin.com)
7 */
8

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

24 /* Regular files only */
25 if (!S_ISREG(inode->i_mode))
26 return;
27
28 /* Only new inodes! */
29 if (!(inode->i_state & I_NEW))
30 return;
31
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Ceph cache definitions.
4 *
5 * Copyright (C) 2013 by Adfin Solutions, Inc. All Rights Reserved.
6 * Written by Milosz Tanski (milosz@adfin.com)
7 */
8

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

24 /* Regular files only */
25 if (!S_ISREG(inode->i_mode))
26 return;
27
28 /* Only new inodes! */
29 if (!(inode->i_state & I_NEW))
30 return;
31
32 WARN_ON_ONCE(ci->fscache);
32 WARN_ON_ONCE(ci->netfs_ctx.cache);
33
33
34 ci->fscache = fscache_acquire_cookie(fsc->fscache, 0,
35 &ci->i_vino, sizeof(ci->i_vino),
36 &ci->i_version, sizeof(ci->i_version),
37 i_size_read(inode));
34 ci->netfs_ctx.cache =
35 fscache_acquire_cookie(fsc->fscache, 0,
36 &ci->i_vino, sizeof(ci->i_vino),
37 &ci->i_version, sizeof(ci->i_version),
38 i_size_read(inode));
38}
39
39}
40
40void ceph_fscache_unregister_inode_cookie(struct ceph_inode_info* ci)
41void ceph_fscache_unregister_inode_cookie(struct ceph_inode_info *ci)
41{
42{
42 struct fscache_cookie *cookie = ci->fscache;
43
44 fscache_relinquish_cookie(cookie, false);
43 fscache_relinquish_cookie(ceph_fscache_cookie(ci), false);
45}
46
47void ceph_fscache_use_cookie(struct inode *inode, bool will_modify)
48{
49 struct ceph_inode_info *ci = ceph_inode(inode);
50
44}
45
46void ceph_fscache_use_cookie(struct inode *inode, bool will_modify)
47{
48 struct ceph_inode_info *ci = ceph_inode(inode);
49
51 fscache_use_cookie(ci->fscache, will_modify);
50 fscache_use_cookie(ceph_fscache_cookie(ci), will_modify);
52}
53
54void ceph_fscache_unuse_cookie(struct inode *inode, bool update)
55{
56 struct ceph_inode_info *ci = ceph_inode(inode);
57
58 if (update) {
59 loff_t i_size = i_size_read(inode);
60
51}
52
53void ceph_fscache_unuse_cookie(struct inode *inode, bool update)
54{
55 struct ceph_inode_info *ci = ceph_inode(inode);
56
57 if (update) {
58 loff_t i_size = i_size_read(inode);
59
61 fscache_unuse_cookie(ci->fscache, &ci->i_version, &i_size);
60 fscache_unuse_cookie(ceph_fscache_cookie(ci),
61 &ci->i_version, &i_size);
62 } else {
62 } else {
63 fscache_unuse_cookie(ci->fscache, NULL, NULL);
63 fscache_unuse_cookie(ceph_fscache_cookie(ci), NULL, NULL);
64 }
65}
66
67void ceph_fscache_update(struct inode *inode)
68{
69 struct ceph_inode_info *ci = ceph_inode(inode);
70 loff_t i_size = i_size_read(inode);
71
64 }
65}
66
67void ceph_fscache_update(struct inode *inode)
68{
69 struct ceph_inode_info *ci = ceph_inode(inode);
70 loff_t i_size = i_size_read(inode);
71
72 fscache_update_cookie(ci->fscache, &ci->i_version, &i_size);
72 fscache_update_cookie(ceph_fscache_cookie(ci), &ci->i_version, &i_size);
73}
74
75void ceph_fscache_invalidate(struct inode *inode, bool dio_write)
76{
77 struct ceph_inode_info *ci = ceph_inode(inode);
78
73}
74
75void ceph_fscache_invalidate(struct inode *inode, bool dio_write)
76{
77 struct ceph_inode_info *ci = ceph_inode(inode);
78
79 fscache_invalidate(ceph_inode(inode)->fscache,
79 fscache_invalidate(ceph_fscache_cookie(ci),
80 &ci->i_version, i_size_read(inode),
81 dio_write ? FSCACHE_INVAL_DIO_WRITE : 0);
82}
83
84int ceph_fscache_register_fs(struct ceph_fs_client* fsc, struct fs_context *fc)
85{
86 const struct ceph_fsid *fsid = &fsc->client->fsid;
87 const char *fscache_uniq = fsc->mount_options->fscache_uniq;

--- 23 unchanged lines hidden ---
80 &ci->i_version, i_size_read(inode),
81 dio_write ? FSCACHE_INVAL_DIO_WRITE : 0);
82}
83
84int ceph_fscache_register_fs(struct ceph_fs_client* fsc, struct fs_context *fc)
85{
86 const struct ceph_fsid *fsid = &fsc->client->fsid;
87 const char *fscache_uniq = fsc->mount_options->fscache_uniq;

--- 23 unchanged lines hidden ---