diff options
author | Darrick J. Wong <djwong@kernel.org> | 2022-07-09 10:56:05 -0700 |
---|---|---|
committer | Darrick J. Wong <djwong@kernel.org> | 2022-07-09 15:17:21 -0700 |
commit | 732436ef916b4f338d672ea56accfdb11e8d0732 (patch) | |
tree | 7bf08497e6fc504c38c3b6091d832bda615dfd5c /fs/xfs/xfs_inode.h | |
parent | 0f38063d7a38015a47ca1488406bf21e0effe80e (diff) | |
download | linux-stable-732436ef916b4f338d672ea56accfdb11e8d0732.tar.gz linux-stable-732436ef916b4f338d672ea56accfdb11e8d0732.tar.bz2 linux-stable-732436ef916b4f338d672ea56accfdb11e8d0732.zip |
xfs: convert XFS_IFORK_PTR to a static inline helper
We're about to make this logic do a bit more, so convert the macro to a
static inline function for better typechecking and fewer shouty macros.
No functional changes here.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_inode.h')
-rw-r--r-- | fs/xfs/xfs_inode.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 7be6f8e705ab..c22b01859051 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -77,6 +77,24 @@ typedef struct xfs_inode { struct list_head i_ioend_list; } xfs_inode_t; +static inline struct xfs_ifork * +xfs_ifork_ptr( + struct xfs_inode *ip, + int whichfork) +{ + switch (whichfork) { + case XFS_DATA_FORK: + return &ip->i_df; + case XFS_ATTR_FORK: + return ip->i_afp; + case XFS_COW_FORK: + return ip->i_cowfp; + default: + ASSERT(0); + return NULL; + } +} + /* Convert from vfs inode to xfs inode */ static inline struct xfs_inode *XFS_I(struct inode *inode) { |