Line data Source code
1 : // SPDX-License-Identifier: GPL-2.0-or-later 2 : /* 3 : * Copyright (C) 2020-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_btree.h" 13 : #include "xfs_log_format.h" 14 : #include "xfs_trans.h" 15 : #include "xfs_inode.h" 16 : #include "xfs_bit.h" 17 : #include "xfs_bmap.h" 18 : #include "xfs_bmap_btree.h" 19 : #include "scrub/scrub.h" 20 : #include "scrub/common.h" 21 : #include "scrub/trace.h" 22 : #include "scrub/repair.h" 23 : #include "scrub/xfile.h" 24 : 25 : /* Set up to repair the realtime bitmap file metadata. */ 26 : int 27 1760 : xrep_setup_rtbitmap( 28 : struct xfs_scrub *sc, 29 : unsigned int *resblks) 30 : { 31 1760 : struct xfs_mount *mp = sc->mp; 32 1760 : unsigned long long blocks = 0; 33 : 34 : /* 35 : * Reserve enough blocks to write out a completely new bmbt for the 36 : * bitmap file. 37 : */ 38 1760 : blocks = xfs_bmbt_calc_size(mp, mp->m_sb.sb_rbmblocks); 39 1760 : if (blocks > UINT_MAX) 40 : return -EOPNOTSUPP; 41 : 42 1760 : *resblks += blocks; 43 1760 : return 0; 44 : } 45 : 46 : /* Repair the realtime bitmap file metadata. */ 47 : int 48 1756 : xrep_rtbitmap( 49 : struct xfs_scrub *sc) 50 : { 51 : /* 52 : * The only thing we know how to fix right now is problems with the 53 : * inode or its fork data. 54 : */ 55 1756 : return xrep_metadata_inode_forks(sc); 56 : }