xfs_super.c (355a47ae7ebcf9d605aa809b259d380422e81b8d) | xfs_super.c (1058d0f5eeb422325e2574dbd88927dc821dee57) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 4 * All Rights Reserved. 5 */ 6 7#include "xfs.h" 8#include "xfs_shared.h" --- 568 unchanged lines hidden (view full) --- 577 xfs_agnumber_t max_metadata; 578 xfs_agino_t agino; 579 xfs_ino_t ino; 580 581 /* 582 * Calculate how much should be reserved for inodes to meet 583 * the max inode percentage. Used only for inode32. 584 */ | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (c) 2000-2006 Silicon Graphics, Inc. 4 * All Rights Reserved. 5 */ 6 7#include "xfs.h" 8#include "xfs_shared.h" --- 568 unchanged lines hidden (view full) --- 577 xfs_agnumber_t max_metadata; 578 xfs_agino_t agino; 579 xfs_ino_t ino; 580 581 /* 582 * Calculate how much should be reserved for inodes to meet 583 * the max inode percentage. Used only for inode32. 584 */ |
585 if (mp->m_maxicount) { | 585 if (M_IGEO(mp)->maxicount) { |
586 uint64_t icount; 587 588 icount = sbp->sb_dblocks * sbp->sb_imax_pct; 589 do_div(icount, 100); 590 icount += sbp->sb_agblocks - 1; 591 do_div(icount, sbp->sb_agblocks); 592 max_metadata = icount; 593 } else { --- 241 unchanged lines hidden (view full) --- 835 if (!mp->m_cil_workqueue) 836 goto out_destroy_unwritten; 837 838 mp->m_reclaim_workqueue = alloc_workqueue("xfs-reclaim/%s", 839 WQ_MEM_RECLAIM|WQ_FREEZABLE, 0, mp->m_fsname); 840 if (!mp->m_reclaim_workqueue) 841 goto out_destroy_cil; 842 | 586 uint64_t icount; 587 588 icount = sbp->sb_dblocks * sbp->sb_imax_pct; 589 do_div(icount, 100); 590 icount += sbp->sb_agblocks - 1; 591 do_div(icount, sbp->sb_agblocks); 592 max_metadata = icount; 593 } else { --- 241 unchanged lines hidden (view full) --- 835 if (!mp->m_cil_workqueue) 836 goto out_destroy_unwritten; 837 838 mp->m_reclaim_workqueue = alloc_workqueue("xfs-reclaim/%s", 839 WQ_MEM_RECLAIM|WQ_FREEZABLE, 0, mp->m_fsname); 840 if (!mp->m_reclaim_workqueue) 841 goto out_destroy_cil; 842 |
843 mp->m_log_workqueue = alloc_workqueue("xfs-log/%s", 844 WQ_MEM_RECLAIM|WQ_FREEZABLE|WQ_HIGHPRI, 0, 845 mp->m_fsname); 846 if (!mp->m_log_workqueue) 847 goto out_destroy_reclaim; 848 | |
849 mp->m_eofblocks_workqueue = alloc_workqueue("xfs-eofblocks/%s", 850 WQ_MEM_RECLAIM|WQ_FREEZABLE, 0, mp->m_fsname); 851 if (!mp->m_eofblocks_workqueue) | 843 mp->m_eofblocks_workqueue = alloc_workqueue("xfs-eofblocks/%s", 844 WQ_MEM_RECLAIM|WQ_FREEZABLE, 0, mp->m_fsname); 845 if (!mp->m_eofblocks_workqueue) |
852 goto out_destroy_log; | 846 goto out_destroy_reclaim; |
853 854 mp->m_sync_workqueue = alloc_workqueue("xfs-sync/%s", WQ_FREEZABLE, 0, 855 mp->m_fsname); 856 if (!mp->m_sync_workqueue) 857 goto out_destroy_eofb; 858 859 return 0; 860 861out_destroy_eofb: 862 destroy_workqueue(mp->m_eofblocks_workqueue); | 847 848 mp->m_sync_workqueue = alloc_workqueue("xfs-sync/%s", WQ_FREEZABLE, 0, 849 mp->m_fsname); 850 if (!mp->m_sync_workqueue) 851 goto out_destroy_eofb; 852 853 return 0; 854 855out_destroy_eofb: 856 destroy_workqueue(mp->m_eofblocks_workqueue); |
863out_destroy_log: 864 destroy_workqueue(mp->m_log_workqueue); | |
865out_destroy_reclaim: 866 destroy_workqueue(mp->m_reclaim_workqueue); 867out_destroy_cil: 868 destroy_workqueue(mp->m_cil_workqueue); 869out_destroy_unwritten: 870 destroy_workqueue(mp->m_unwritten_workqueue); 871out_destroy_buf: 872 destroy_workqueue(mp->m_buf_workqueue); 873out: 874 return -ENOMEM; 875} 876 877STATIC void 878xfs_destroy_mount_workqueues( 879 struct xfs_mount *mp) 880{ 881 destroy_workqueue(mp->m_sync_workqueue); 882 destroy_workqueue(mp->m_eofblocks_workqueue); | 857out_destroy_reclaim: 858 destroy_workqueue(mp->m_reclaim_workqueue); 859out_destroy_cil: 860 destroy_workqueue(mp->m_cil_workqueue); 861out_destroy_unwritten: 862 destroy_workqueue(mp->m_unwritten_workqueue); 863out_destroy_buf: 864 destroy_workqueue(mp->m_buf_workqueue); 865out: 866 return -ENOMEM; 867} 868 869STATIC void 870xfs_destroy_mount_workqueues( 871 struct xfs_mount *mp) 872{ 873 destroy_workqueue(mp->m_sync_workqueue); 874 destroy_workqueue(mp->m_eofblocks_workqueue); |
883 destroy_workqueue(mp->m_log_workqueue); | |
884 destroy_workqueue(mp->m_reclaim_workqueue); 885 destroy_workqueue(mp->m_cil_workqueue); 886 destroy_workqueue(mp->m_unwritten_workqueue); 887 destroy_workqueue(mp->m_buf_workqueue); 888} 889 890/* 891 * Flush all dirty data to disk. Must not be called while holding an XFS_ILOCK --- 234 unchanged lines hidden (view full) --- 1126 statp->f_blocks = sbp->sb_dblocks - lsize; 1127 spin_unlock(&mp->m_sb_lock); 1128 1129 statp->f_bfree = fdblocks - mp->m_alloc_set_aside; 1130 statp->f_bavail = statp->f_bfree; 1131 1132 fakeinos = XFS_FSB_TO_INO(mp, statp->f_bfree); 1133 statp->f_files = min(icount + fakeinos, (uint64_t)XFS_MAXINUMBER); | 875 destroy_workqueue(mp->m_reclaim_workqueue); 876 destroy_workqueue(mp->m_cil_workqueue); 877 destroy_workqueue(mp->m_unwritten_workqueue); 878 destroy_workqueue(mp->m_buf_workqueue); 879} 880 881/* 882 * Flush all dirty data to disk. Must not be called while holding an XFS_ILOCK --- 234 unchanged lines hidden (view full) --- 1117 statp->f_blocks = sbp->sb_dblocks - lsize; 1118 spin_unlock(&mp->m_sb_lock); 1119 1120 statp->f_bfree = fdblocks - mp->m_alloc_set_aside; 1121 statp->f_bavail = statp->f_bfree; 1122 1123 fakeinos = XFS_FSB_TO_INO(mp, statp->f_bfree); 1124 statp->f_files = min(icount + fakeinos, (uint64_t)XFS_MAXINUMBER); |
1134 if (mp->m_maxicount) | 1125 if (M_IGEO(mp)->maxicount) |
1135 statp->f_files = min_t(typeof(statp->f_files), 1136 statp->f_files, | 1126 statp->f_files = min_t(typeof(statp->f_files), 1127 statp->f_files, |
1137 mp->m_maxicount); | 1128 M_IGEO(mp)->maxicount); |
1138 1139 /* If sb_icount overshot maxicount, report actual allocation */ 1140 statp->f_files = max_t(typeof(statp->f_files), 1141 statp->f_files, 1142 sbp->sb_icount); 1143 1144 /* make sure statp->f_ffree does not underflow */ 1145 ffree = statp->f_files - (icount - ifree); --- 1061 unchanged lines hidden --- | 1129 1130 /* If sb_icount overshot maxicount, report actual allocation */ 1131 statp->f_files = max_t(typeof(statp->f_files), 1132 statp->f_files, 1133 sbp->sb_icount); 1134 1135 /* make sure statp->f_ffree does not underflow */ 1136 ffree = statp->f_files - (icount - ifree); --- 1061 unchanged lines hidden --- |