xfs: create a helper to convert rtextents to rtblocks
Create a helper to convert a realtime extent to a realtime block. Later on we'll change the helper to use bit shifts when possible. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "xfs_icache.h"
|
||||
#include "xfs_iomap.h"
|
||||
#include "xfs_reflink.h"
|
||||
#include "xfs_rtbitmap.h"
|
||||
|
||||
/* Kernel only BMAP related definitions and functions */
|
||||
|
||||
@@ -125,7 +126,7 @@ retry:
|
||||
* XFS_BMBT_MAX_EXTLEN), we don't hear about that number, and can't
|
||||
* adjust the starting point to match it.
|
||||
*/
|
||||
if (ralen * mp->m_sb.sb_rextsize >= XFS_MAX_BMBT_EXTLEN)
|
||||
if (xfs_rtxlen_to_extlen(mp, ralen) >= XFS_MAX_BMBT_EXTLEN)
|
||||
ralen = XFS_MAX_BMBT_EXTLEN / mp->m_sb.sb_rextsize;
|
||||
|
||||
/*
|
||||
@@ -147,7 +148,7 @@ retry:
|
||||
error = xfs_rtpick_extent(mp, ap->tp, ralen, &rtx);
|
||||
if (error)
|
||||
return error;
|
||||
ap->blkno = rtx * mp->m_sb.sb_rextsize;
|
||||
ap->blkno = xfs_rtx_to_rtb(mp, rtx);
|
||||
} else {
|
||||
ap->blkno = 0;
|
||||
}
|
||||
@@ -170,8 +171,8 @@ retry:
|
||||
return error;
|
||||
|
||||
if (rtx != NULLRTEXTNO) {
|
||||
ap->blkno = rtx * mp->m_sb.sb_rextsize;
|
||||
ap->length = ralen * mp->m_sb.sb_rextsize;
|
||||
ap->blkno = xfs_rtx_to_rtb(mp, rtx);
|
||||
ap->length = xfs_rtxlen_to_extlen(mp, ralen);
|
||||
ap->ip->i_nblocks += ap->length;
|
||||
xfs_trans_log_inode(ap->tp, ap->ip, XFS_ILOG_CORE);
|
||||
if (ap->wasdel)
|
||||
|
||||
Reference in New Issue
Block a user