mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-09 06:43:09 +00:00
xfs: refactor xfs_rtsummary_blockcount
Make xfs_rtsummary_blockcount take all the required information from the mount structure and return the number of summary levels from it as well. This cleans up many of the callers and prepares for making the rtsummary files per-rtgroup where they need to look at different value. This means we recalculate some values in some callers, but as all these calculations are outside the fast path and cheap, which seems like a price worth paying. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
This commit is contained in:
parent
5a7566c8d6
commit
f8c5a8415f
@ -20,6 +20,7 @@
|
||||
#include "xfs_error.h"
|
||||
#include "xfs_rtbitmap.h"
|
||||
#include "xfs_health.h"
|
||||
#include "xfs_sb.h"
|
||||
|
||||
/*
|
||||
* Realtime allocator bitmap functions shared with userspace.
|
||||
@ -1166,16 +1167,20 @@ xfs_rtbitmap_blockcount(
|
||||
return xfs_rtbitmap_blockcount_len(mp, mp->m_sb.sb_rextents);
|
||||
}
|
||||
|
||||
/* Compute the number of rtsummary blocks needed to track the given rt space. */
|
||||
/*
|
||||
* Compute the geometry of the rtsummary file needed to track the given rt
|
||||
* space.
|
||||
*/
|
||||
xfs_filblks_t
|
||||
xfs_rtsummary_blockcount(
|
||||
struct xfs_mount *mp,
|
||||
unsigned int rsumlevels,
|
||||
xfs_extlen_t rbmblocks)
|
||||
unsigned int *rsumlevels)
|
||||
{
|
||||
unsigned long long rsumwords;
|
||||
|
||||
rsumwords = (unsigned long long)rsumlevels * rbmblocks;
|
||||
*rsumlevels = xfs_compute_rextslog(mp->m_sb.sb_rextents) + 1;
|
||||
|
||||
rsumwords = xfs_rtbitmap_blockcount(mp) * (*rsumlevels);
|
||||
return XFS_B_TO_FSB(mp, rsumwords << XFS_WORDLOG);
|
||||
}
|
||||
|
||||
|
@ -311,7 +311,7 @@ xfs_filblks_t xfs_rtbitmap_blockcount(struct xfs_mount *mp);
|
||||
xfs_filblks_t xfs_rtbitmap_blockcount_len(struct xfs_mount *mp,
|
||||
xfs_rtbxlen_t rtextents);
|
||||
xfs_filblks_t xfs_rtsummary_blockcount(struct xfs_mount *mp,
|
||||
unsigned int rsumlevels, xfs_extlen_t rbmblocks);
|
||||
unsigned int *rsumlevels);
|
||||
|
||||
int xfs_rtfile_initialize_blocks(struct xfs_rtgroup *rtg,
|
||||
enum xfs_rtg_inodes type, xfs_fileoff_t offset_fsb,
|
||||
@ -342,7 +342,6 @@ xfs_rtbitmap_blockcount_len(struct xfs_mount *mp, xfs_rtbxlen_t rtextents)
|
||||
/* shut up gcc */
|
||||
return 0;
|
||||
}
|
||||
# define xfs_rtsummary_blockcount(mp, l, b) (0)
|
||||
#endif /* CONFIG_XFS_RT */
|
||||
|
||||
#endif /* __XFS_RTBITMAP_H__ */
|
||||
|
@ -102,14 +102,10 @@ xchk_setup_rtsummary(
|
||||
*/
|
||||
xchk_rtgroup_lock(&sc->sr, XFS_RTGLOCK_BITMAP);
|
||||
if (mp->m_sb.sb_rblocks) {
|
||||
int rextslog;
|
||||
|
||||
rts->rextents = xfs_rtb_to_rtx(mp, mp->m_sb.sb_rblocks);
|
||||
rextslog = xfs_compute_rextslog(mp->m_sb.sb_rextents);
|
||||
rts->rsumlevels = rextslog + 1;
|
||||
rts->rbmblocks = xfs_rtbitmap_blockcount(mp);
|
||||
rts->rsumblocks = xfs_rtsummary_blockcount(mp, rts->rsumlevels,
|
||||
rts->rbmblocks);
|
||||
rts->rsumblocks =
|
||||
xfs_rtsummary_blockcount(mp, &rts->rsumlevels);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -173,7 +173,7 @@ typedef struct xfs_mount {
|
||||
uint m_allocsize_blocks; /* min write size blocks */
|
||||
int m_logbufs; /* number of log buffers */
|
||||
int m_logbsize; /* size of each log buffer */
|
||||
uint m_rsumlevels; /* rt summary levels */
|
||||
unsigned int m_rsumlevels; /* rt summary levels */
|
||||
xfs_filblks_t m_rsumblocks; /* size of rt summary, FSBs */
|
||||
uint32_t m_rgblocks; /* size of rtgroup in rtblocks */
|
||||
int m_fixedfsid[2]; /* unchanged for life of FS */
|
||||
|
@ -751,9 +751,7 @@ xfs_growfs_rt_alloc_fake_mount(
|
||||
nmp->m_sb.sb_rextents = xfs_rtb_to_rtx(nmp, nmp->m_sb.sb_rblocks);
|
||||
nmp->m_sb.sb_rbmblocks = xfs_rtbitmap_blockcount(nmp);
|
||||
nmp->m_sb.sb_rextslog = xfs_compute_rextslog(nmp->m_sb.sb_rextents);
|
||||
nmp->m_rsumlevels = nmp->m_sb.sb_rextslog + 1;
|
||||
nmp->m_rsumblocks = xfs_rtsummary_blockcount(nmp, nmp->m_rsumlevels,
|
||||
nmp->m_sb.sb_rbmblocks);
|
||||
nmp->m_rsumblocks = xfs_rtsummary_blockcount(nmp, &nmp->m_rsumlevels);
|
||||
|
||||
if (rblocks > 0)
|
||||
nmp->m_features |= XFS_FEAT_REALTIME;
|
||||
@ -1138,21 +1136,18 @@ xfs_rtmount_init(
|
||||
struct xfs_mount *mp) /* file system mount structure */
|
||||
{
|
||||
struct xfs_buf *bp; /* buffer for last block of subvolume */
|
||||
struct xfs_sb *sbp; /* filesystem superblock copy in mount */
|
||||
xfs_daddr_t d; /* address of last block of subvolume */
|
||||
int error;
|
||||
|
||||
sbp = &mp->m_sb;
|
||||
if (sbp->sb_rblocks == 0)
|
||||
if (mp->m_sb.sb_rblocks == 0)
|
||||
return 0;
|
||||
if (mp->m_rtdev_targp == NULL) {
|
||||
xfs_warn(mp,
|
||||
"Filesystem has a realtime volume, use rtdev=device option");
|
||||
return -ENODEV;
|
||||
}
|
||||
mp->m_rsumlevels = sbp->sb_rextslog + 1;
|
||||
mp->m_rsumblocks = xfs_rtsummary_blockcount(mp, mp->m_rsumlevels,
|
||||
mp->m_sb.sb_rbmblocks);
|
||||
|
||||
mp->m_rsumblocks = xfs_rtsummary_blockcount(mp, &mp->m_rsumlevels);
|
||||
|
||||
/*
|
||||
* Check that the realtime section is an ok size.
|
||||
|
Loading…
Reference in New Issue
Block a user