diff options
author | Christoph Hellwig <hch@lst.de> | 2017-02-06 10:42:26 -0800 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2017-02-06 17:47:46 -0800 |
commit | f13eb2055ae46ded52961f27753c245dc5b8967d (patch) | |
tree | f32b49d88486cff8a352e721afe58fcd25fce412 /fs/xfs/xfs_iomap.h | |
parent | 54a4ef8af4e0dc5c983d17fcb9cf5fd25666d94e (diff) | |
download | linux-stable-f13eb2055ae46ded52961f27753c245dc5b8967d.tar.gz linux-stable-f13eb2055ae46ded52961f27753c245dc5b8967d.tar.bz2 linux-stable-f13eb2055ae46ded52961f27753c245dc5b8967d.zip |
xfs: introduce xfs_aligned_fsb_count
Factor a helper to calculate the extent-size aligned block out of the
iomap code, so that it can be reused by the upcoming reflink dio code.
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/xfs_iomap.h')
-rw-r--r-- | fs/xfs/xfs_iomap.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/xfs/xfs_iomap.h b/fs/xfs/xfs_iomap.h index 705224b66b6a..00db3ecea084 100644 --- a/fs/xfs/xfs_iomap.h +++ b/fs/xfs/xfs_iomap.h @@ -33,6 +33,26 @@ void xfs_bmbt_to_iomap(struct xfs_inode *, struct iomap *, struct xfs_bmbt_irec *); xfs_extlen_t xfs_eof_alignment(struct xfs_inode *ip, xfs_extlen_t extsize); +static inline xfs_filblks_t +xfs_aligned_fsb_count( + xfs_fileoff_t offset_fsb, + xfs_filblks_t count_fsb, + xfs_extlen_t extsz) +{ + if (extsz) { + xfs_extlen_t align; + + align = do_mod(offset_fsb, extsz); + if (align) + count_fsb += align; + align = do_mod(count_fsb, extsz); + if (align) + count_fsb += extsz - align; + } + + return count_fsb; +} + extern const struct iomap_ops xfs_iomap_ops; extern const struct iomap_ops xfs_xattr_iomap_ops; |