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 7949 : xrep_rgsuperblock( 25 : struct xfs_scrub *sc) 26 : { 27 7949 : struct xfs_buf *bp; 28 7949 : int error; 29 : 30 : /* 31 : * If this is the primary rtgroup superblock, log a superblock update 32 : * to force both to disk. 33 : */ 34 7949 : if (sc->sr.rtg->rtg_rgno == 0) { 35 1503 : xfs_log_sb(sc->tp); 36 1503 : return 0; 37 : } 38 : 39 : /* Otherwise just write a new secondary to disk directly. */ 40 6446 : error = xfs_rtgroup_init_secondary_super(sc->mp, sc->sr.rtg->rtg_rgno, 41 : &bp); 42 6440 : if (error) 43 : return error; 44 : 45 6438 : error = xfs_bwrite(bp); 46 6452 : xfs_buf_relse(bp); 47 6450 : return error; 48 : }