Line data Source code
1 : // SPDX-License-Identifier: GPL-2.0-or-later 2 : /* 3 : * Copyright (C) 2022-2023 Oracle. All Rights Reserved. 4 : * Author: Darrick J. Wong <djwong@kernel.org> 5 : */ 6 : #include "xfs.h" 7 : #include "xfs_fs.h" 8 : #include "xfs_shared.h" 9 : #include "xfs_format.h" 10 : #include "xfs_trans_resv.h" 11 : #include "xfs_mount.h" 12 : #include "xfs_defer.h" 13 : #include "xfs_btree.h" 14 : #include "xfs_inode.h" 15 : #include "xfs_bit.h" 16 : #include "xfs_log_format.h" 17 : #include "xfs_trans.h" 18 : #include "xfs_rtgroup.h" 19 : #include "xfs_sb.h" 20 : #include "scrub/scrub.h" 21 : #include "scrub/repair.h" 22 : 23 : int 24 2500 : xrep_rgsuperblock( 25 : struct xfs_scrub *sc) 26 : { 27 2500 : struct xfs_buf *bp; 28 2500 : int error; 29 : 30 : /* 31 : * If this is the primary rtgroup superblock, log a superblock update 32 : * to force both to disk. 33 : */ 34 2500 : if (sc->sr.rtg->rtg_rgno == 0) { 35 500 : xfs_log_sb(sc->tp); 36 500 : return 0; 37 : } 38 : 39 : /* Otherwise just write a new secondary to disk directly. */ 40 2000 : error = xfs_rtgroup_init_secondary_super(sc->mp, sc->sr.rtg->rtg_rgno, 41 : &bp); 42 2000 : if (error) 43 : return error; 44 : 45 2000 : error = xfs_bwrite(bp); 46 2000 : xfs_buf_relse(bp); 47 2000 : return error; 48 : }