diff options
author | Jeff Layton <jlayton@kernel.org> | 2021-08-02 11:01:26 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2021-09-02 22:49:17 +0200 |
commit | 0ba92e1c5f7ce7e9c1c828a84e873d7be51c1b9f (patch) | |
tree | 6820ef381dbcca7a789c4dcf8fb14968fb9b2485 /fs/ceph/inode.c | |
parent | c80dc3aee984c647d747bb07c108862effc917d8 (diff) | |
download | lwn-0ba92e1c5f7ce7e9c1c828a84e873d7be51c1b9f.tar.gz lwn-0ba92e1c5f7ce7e9c1c828a84e873d7be51c1b9f.zip |
ceph: add ceph_change_snap_realm() helper
Consolidate some fiddly code for changing an inode's snap_realm
into a new helper function, and change the callers to use it.
While we're in here, nothing uses the i_snap_realm_counter field, so
remove that from the inode.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Luis Henriques <lhenriques@suse.de>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Diffstat (limited to 'fs/ceph/inode.c')
-rw-r--r-- | fs/ceph/inode.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 1bd2cc015913..2df1e1284451 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -581,16 +581,9 @@ void ceph_evict_inode(struct inode *inode) */ if (ci->i_snap_realm) { if (ceph_snap(inode) == CEPH_NOSNAP) { - struct ceph_snap_realm *realm = ci->i_snap_realm; dout(" dropping residual ref to snap realm %p\n", - realm); - spin_lock(&realm->inodes_with_caps_lock); - list_del_init(&ci->i_snap_realm_item); - ci->i_snap_realm = NULL; - if (realm->ino == ci->i_vino.ino) - realm->inode = NULL; - spin_unlock(&realm->inodes_with_caps_lock); - ceph_put_snap_realm(mdsc, realm); + ci->i_snap_realm); + ceph_change_snap_realm(inode, NULL); } else { ceph_put_snapid_map(mdsc, ci->i_snapid_map); ci->i_snap_realm = NULL; |