summaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_bmap.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-10-19 11:02:29 -0700
committerDarrick J. Wong <darrick.wong@oracle.com>2017-10-26 15:38:26 -0700
commit060ea65b39409f3b9952dfa6db5fbe4355e6888a (patch)
tree86783feffcf3652cdcac60f7fd1a34ec9b020b21 /fs/xfs/libxfs/xfs_bmap.h
parentc2fc338c87a31f557b57f5143602444ba3cf2c3e (diff)
downloadlinux-060ea65b39409f3b9952dfa6db5fbe4355e6888a.tar.bz2
xfs: add a xfs_bmap_fork_to_state helper
This creates the right initial bmap state from the passed in inode fork enum. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_bmap.h')
-rw-r--r--fs/xfs/libxfs/xfs_bmap.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h
index 502e0d8fb4ff..612d3c778691 100644
--- a/fs/xfs/libxfs/xfs_bmap.h
+++ b/fs/xfs/libxfs/xfs_bmap.h
@@ -278,4 +278,16 @@ int xfs_bmap_map_extent(struct xfs_mount *mp, struct xfs_defer_ops *dfops,
int xfs_bmap_unmap_extent(struct xfs_mount *mp, struct xfs_defer_ops *dfops,
struct xfs_inode *ip, struct xfs_bmbt_irec *imap);
+static inline int xfs_bmap_fork_to_state(int whichfork)
+{
+ switch (whichfork) {
+ case XFS_ATTR_FORK:
+ return BMAP_ATTRFORK;
+ case XFS_COW_FORK:
+ return BMAP_COWFORK;
+ default:
+ return 0;
+ }
+}
+
#endif /* __XFS_BMAP_H__ */