From 49566f6f06b38d7c1a5c7eacc8a38c6ea2e36549 Mon Sep 17 00:00:00 2001 From: David Howells Date: Thu, 2 Nov 2017 15:27:46 +0000 Subject: afs: Note the cell in the superblock info also Keep a reference to the cell in the superblock info structure in addition to the volume and net pointers. This will make it easier to clean up in a future patch in which afs_put_volume() will need the cell pointer. Whilst we're at it, make the cell and volume getting functions return a pointer to the object got to make the call sites look neater. Signed-off-by: David Howells --- fs/afs/internal.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'fs/afs/internal.h') diff --git a/fs/afs/internal.h b/fs/afs/internal.h index bc9ded4..2d90cb7 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -178,6 +178,7 @@ struct afs_writeback { */ struct afs_super_info { struct afs_net *net; /* Network namespace */ + struct afs_cell *cell; /* The cell in which the volume resides */ struct afs_volume *volume; /* volume record */ char rwparent; /* T if parent is R/W AFS volume */ }; @@ -502,7 +503,12 @@ extern void afs_flush_callback_breaks(struct afs_server *); /* * cell.c */ -#define afs_get_cell(C) do { atomic_inc(&(C)->usage); } while(0) +static inline struct afs_cell *afs_get_cell(struct afs_cell *cell) +{ + if (cell) + atomic_inc(&cell->usage); + return cell; +} extern int afs_cell_init(struct afs_net *, char *); extern struct afs_cell *afs_cell_create(struct afs_net *, const char *, unsigned, char *, bool); extern struct afs_cell *afs_cell_lookup(struct afs_net *, const char *, unsigned, bool); @@ -789,7 +795,12 @@ extern int afs_vnode_release_lock(struct afs_vnode *, struct key *); /* * volume.c */ -#define afs_get_volume(V) do { atomic_inc(&(V)->usage); } while(0) +static inline struct afs_volume *afs_get_volume(struct afs_volume *volume) +{ + if (volume) + atomic_inc(&volume->usage); + return volume; +} extern void afs_put_volume(struct afs_net *, struct afs_volume *); extern struct afs_volume *afs_volume_lookup(struct afs_mount_params *); -- cgit v1.1