]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxlog: replace xfs_sb_version checks with feature flag checks
authorDarrick J. Wong <djwong@kernel.org>
Mon, 31 Jan 2022 22:27:44 +0000 (17:27 -0500)
committerEric Sandeen <sandeen@redhat.com>
Mon, 31 Jan 2022 22:27:44 +0000 (17:27 -0500)
Convert the xfs_sb_version_hasfoo() to checks against mp->m_features.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
[sandeen: drop hunk to libxfs/init.c that's not a straight replace]
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxlog/util.c
libxlog/xfs_log_recover.c

index a85d70c9ae72b1fb6b040d7466fa484779bc8eef..ad60036f86405963625c980474a8e7af2a007074 100644 (file)
@@ -31,7 +31,7 @@ xlog_is_dirty(
        x->logBBsize = XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
        x->logBBstart = XFS_FSB_TO_DADDR(mp, mp->m_sb.sb_logstart);
        x->lbsize = BBSIZE;
-       if (xfs_sb_version_hassector(&mp->m_sb))
+       if (xfs_has_sector(mp))
                x->lbsize <<= (mp->m_sb.sb_logsectlog - BBSHIFT);
 
        log->l_dev = mp->m_logdev_targp;
@@ -39,13 +39,13 @@ xlog_is_dirty(
        log->l_logBBstart = x->logBBstart;
        log->l_sectBBsize = BTOBB(x->lbsize);
        log->l_mp = mp;
-       if (xfs_sb_version_hassector(&mp->m_sb)) {
+       if (xfs_has_sector(mp)) {
                log->l_sectbb_log = mp->m_sb.sb_logsectlog - BBSHIFT;
                ASSERT(log->l_sectbb_log <= mp->m_sectbb_log);
                /* for larger sector sizes, must have v2 or external log */
                ASSERT(log->l_sectbb_log == 0 ||
                        log->l_logBBstart == 0 ||
-                       xfs_sb_version_haslogv2(&mp->m_sb));
+                       xfs_has_logv2(mp));
                ASSERT(mp->m_sb.sb_logsectlog >= BBSHIFT);
        }
        log->l_sectbb_mask = (1 << log->l_sectbb_log) - 1;
index 40d18b88f0f27eebb63cfcaf981821034e29b0a1..592e450227df24af68937da32984bda7054a24a8 100644 (file)
@@ -364,7 +364,7 @@ xlog_find_verify_log_record(
         * reset last_blk.  Only when last_blk points in the middle of a log
         * record do we update last_blk.
         */
-       if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) {
+       if (xfs_has_logv2(log->l_mp)) {
                uint    h_size = be32_to_cpu(head->h_size);
 
                xhdrs = h_size / XLOG_HEADER_CYCLE_SIZE;
@@ -783,7 +783,7 @@ xlog_find_tail(
         * unmount record if there is one, so we pass the lsn of the
         * unmount record rather than the block after it.
         */
-       if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) {
+       if (xfs_has_logv2(log->l_mp)) {
                int     h_size = be32_to_cpu(rhead->h_size);
                int     h_version = be32_to_cpu(rhead->h_version);
 
@@ -1313,7 +1313,7 @@ xlog_unpack_data_crc(
 
        crc = xlog_cksum(log, rhead, dp, be32_to_cpu(rhead->h_len));
        if (crc != rhead->h_crc) {
-               if (rhead->h_crc || xfs_sb_version_hascrc(&log->l_mp->m_sb)) {
+               if (rhead->h_crc || xfs_has_crc(log->l_mp)) {
                        xfs_alert(log->l_mp,
                "log record CRC mismatch: found 0x%x, expected 0x%x.",
                                        le32_to_cpu(rhead->h_crc),
@@ -1326,7 +1326,7 @@ xlog_unpack_data_crc(
                 * recover past this point. Abort recovery if we are enforcing
                 * CRC protection by punting an error back up the stack.
                 */
-               if (xfs_sb_version_hascrc(&log->l_mp->m_sb))
+               if (xfs_has_crc(log->l_mp))
                        return EFSCORRUPTED;
        }
 
@@ -1352,7 +1352,7 @@ xlog_unpack_data(
                dp += BBSIZE;
        }
 
-       if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) {
+       if (xfs_has_logv2(log->l_mp)) {
                xlog_in_core_2_t *xhdr = (xlog_in_core_2_t *)rhead;
                for ( ; i < BTOBB(be32_to_cpu(rhead->h_len)); i++) {
                        j = i / (XLOG_HEADER_CYCLE_SIZE / BBSIZE);
@@ -1431,7 +1431,7 @@ xlog_do_recovery_pass(
         * Read the header of the tail block and get the iclog buffer size from
         * h_size.  Use this to tell how many sectors make up the log header.
         */
-       if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) {
+       if (xfs_has_logv2(log->l_mp)) {
                /*
                 * When using variable length iclogs, read first sector of
                 * iclog header and extract the header size from it.  Get a