Lines Matching refs:mp

66 STATIC void	xfs_uuid_unmount(xfs_mount_t *mp);
130 xfs_mount_t *mp; in xfs_mount_init() local
132 mp = kmem_zalloc(sizeof(*mp), KM_SLEEP); in xfs_mount_init()
134 AIL_LOCKINIT(&mp->m_ail_lock, "xfs_ail"); in xfs_mount_init()
135 spinlock_init(&mp->m_sb_lock, "xfs_sb"); in xfs_mount_init()
136 mutex_init(&mp->m_ilock, MUTEX_DEFAULT, "xfs_ilock"); in xfs_mount_init()
137 initnsema(&mp->m_growlock, 1, "xfs_grow"); in xfs_mount_init()
141 xfs_trans_ail_init(mp); in xfs_mount_init()
143 atomic_set(&mp->m_active_trans, 0); in xfs_mount_init()
145 return mp; in xfs_mount_init()
155 xfs_mount_t *mp, in xfs_mount_free() argument
158 if (mp->m_ihash) in xfs_mount_free()
159 xfs_ihash_free(mp); in xfs_mount_free()
160 if (mp->m_chash) in xfs_mount_free()
161 xfs_chash_free(mp); in xfs_mount_free()
163 if (mp->m_perag) { in xfs_mount_free()
166 for (agno = 0; agno < mp->m_maxagi; agno++) in xfs_mount_free()
167 if (mp->m_perag[agno].pagb_list) in xfs_mount_free()
168 kmem_free(mp->m_perag[agno].pagb_list, in xfs_mount_free()
171 kmem_free(mp->m_perag, in xfs_mount_free()
172 sizeof(xfs_perag_t) * mp->m_sb.sb_agcount); in xfs_mount_free()
175 AIL_LOCK_DESTROY(&mp->m_ail_lock); in xfs_mount_free()
176 spinlock_destroy(&mp->m_sb_lock); in xfs_mount_free()
177 mutex_destroy(&mp->m_ilock); in xfs_mount_free()
178 freesema(&mp->m_growlock); in xfs_mount_free()
179 if (mp->m_quotainfo) in xfs_mount_free()
180 XFS_QM_DONE(mp); in xfs_mount_free()
182 if (mp->m_fsname != NULL) in xfs_mount_free()
183 kmem_free(mp->m_fsname, mp->m_fsname_len); in xfs_mount_free()
186 struct vfs *vfsp = XFS_MTOVFS(mp); in xfs_mount_free()
189 VFS_REMOVEBHV(vfsp, &mp->m_bhv); in xfs_mount_free()
192 kmem_free(mp, sizeof(xfs_mount_t)); in xfs_mount_free()
201 xfs_mount_t *mp, argument
222 sbp->sb_logstart == 0 && mp->m_logdev_targp == mp->m_ddev_targp)) {
227 XFS_ERRLEVEL_HIGH, mp, sbp);
232 sbp->sb_logstart != 0 && mp->m_logdev_targp != mp->m_ddev_targp)) {
237 XFS_ERRLEVEL_HIGH, mp, sbp);
262 XFS_ERRLEVEL_LOW, mp, sbp);
277 XFS_ERRLEVEL_LOW, mp);
301 XFS_ERRLEVEL_LOW, mp);
322 xfs_initialize_perag(xfs_mount_t *mp, xfs_agnumber_t agcount) argument
328 xfs_sb_t *sbp = &mp->m_sb;
332 agino = XFS_OFFBNO_TO_AGINO(mp, sbp->sb_agblocks - 1, 0);
333 ino = XFS_AGINO_TO_INO(mp, agcount - 1, agino);
338 if ((mp->m_flags & XFS_MOUNT_32BITINOOPT) && ino > max_inum) {
339 mp->m_flags |= XFS_MOUNT_32BITINODES;
341 mp->m_flags &= ~XFS_MOUNT_32BITINODES;
345 if (mp->m_flags & XFS_MOUNT_32BITINODES) {
349 if (mp->m_maxicount) {
355 do_div(icount, mp->m_ialloc_blks);
361 ino = XFS_AGINO_TO_INO(mp, index, agino);
368 pag = &mp->m_perag[index];
376 pag = &mp->m_perag[index];
462 xfs_readsb(xfs_mount_t *mp) argument
470 ASSERT(mp->m_sb_bp == NULL);
471 ASSERT(mp->m_ddev_targp != NULL);
478 sector_size = xfs_getsize_buftarg(mp->m_ddev_targp);
481 bp = xfs_buf_read_flags(mp->m_ddev_targp, XFS_SB_DADDR,
496 xfs_xlatesb(XFS_BUF_PTR(bp), &(mp->m_sb), 1,
499 error = xfs_mount_validate_sb(mp, &(mp->m_sb));
508 if (sector_size > mp->m_sb.sb_sectsize) {
511 sector_size, mp->m_sb.sb_sectsize);
520 if (sector_size < mp->m_sb.sb_sectsize) {
523 sector_size = mp->m_sb.sb_sectsize;
524 bp = xfs_buf_read_flags(mp->m_ddev_targp, XFS_SB_DADDR,
535 mp->m_sb_bp = bp;
557 xfs_mount_common(xfs_mount_t *mp, xfs_sb_t *sbp) argument
561 mp->m_agfrotor = mp->m_agirotor = 0;
562 spinlock_init(&mp->m_agirotor_lock, "m_agirotor_lock");
563 mp->m_maxagi = mp->m_sb.sb_agcount;
564 mp->m_blkbit_log = sbp->sb_blocklog + XFS_NBBYLOG;
565 mp->m_blkbb_log = sbp->sb_blocklog - BBSHIFT;
566 mp->m_sectbb_log = sbp->sb_sectlog - BBSHIFT;
567 mp->m_agno_log = xfs_highbit32(sbp->sb_agcount - 1) + 1;
568 mp->m_agino_log = sbp->sb_inopblog + sbp->sb_agblklog;
569 mp->m_litino = sbp->sb_inodesize -
571 mp->m_blockmask = sbp->sb_blocksize - 1;
572 mp->m_blockwsize = sbp->sb_blocksize >> XFS_WORDLOG;
573 mp->m_blockwmask = mp->m_blockwsize - 1;
574 INIT_LIST_HEAD(&mp->m_del_inodes);
584 mp->m_attroffset = XFS_LITINO(mp) - XFS_BMDR_SPACE_CALC(2);
589 mp->m_attroffset = XFS_BMDR_SPACE_CALC(12);
594 ASSERT(mp->m_attroffset < XFS_LITINO(mp));
597 mp->m_alloc_mxr[i] = XFS_BTREE_BLOCK_MAXRECS(sbp->sb_blocksize,
599 mp->m_alloc_mnr[i] = XFS_BTREE_BLOCK_MINRECS(sbp->sb_blocksize,
603 mp->m_bmap_dmxr[i] = XFS_BTREE_BLOCK_MAXRECS(sbp->sb_blocksize,
605 mp->m_bmap_dmnr[i] = XFS_BTREE_BLOCK_MINRECS(sbp->sb_blocksize,
609 mp->m_inobt_mxr[i] = XFS_BTREE_BLOCK_MAXRECS(sbp->sb_blocksize,
611 mp->m_inobt_mnr[i] = XFS_BTREE_BLOCK_MINRECS(sbp->sb_blocksize,
615 mp->m_bsize = XFS_FSB_TO_BB(mp, 1);
616 mp->m_ialloc_inos = (int)MAX((__uint16_t)XFS_INODES_PER_CHUNK,
618 mp->m_ialloc_blks = mp->m_ialloc_inos >> sbp->sb_inopblog;
635 xfs_mount_t *mp, argument
639 xfs_sb_t *sbp = &(mp->m_sb);
651 if (mp->m_sb_bp == NULL) {
652 if ((error = xfs_readsb(mp))) {
656 xfs_mount_common(mp, sbp);
665 if (mp->m_dalign && !(mfsi_flags & XFS_MFSI_SECOND)) {
670 if ((BBTOB(mp->m_dalign) & mp->m_blockmask) ||
671 (BBTOB(mp->m_swidth) & mp->m_blockmask)) {
672 if (mp->m_flags & XFS_MOUNT_RETERR) {
678 mp->m_dalign = mp->m_swidth = 0;
683 mp->m_dalign = XFS_BB_TO_FSBT(mp, mp->m_dalign);
684 if (mp->m_dalign && (sbp->sb_agblocks % mp->m_dalign)) {
685 if (mp->m_flags & XFS_MOUNT_RETERR) {
689 xfs_fs_cmn_err(CE_WARN, mp,
691 mp->m_dalign, mp->m_swidth,
694 mp->m_dalign = 0;
695 mp->m_swidth = 0;
696 } else if (mp->m_dalign) {
697 mp->m_swidth = XFS_BB_TO_FSBT(mp, mp->m_swidth);
699 if (mp->m_flags & XFS_MOUNT_RETERR) {
700 xfs_fs_cmn_err(CE_WARN, mp,
702 mp->m_dalign,
703 mp->m_blockmask +1);
707 mp->m_swidth = 0;
716 if (sbp->sb_unit != mp->m_dalign) {
717 sbp->sb_unit = mp->m_dalign;
720 if (sbp->sb_width != mp->m_swidth) {
721 sbp->sb_width = mp->m_swidth;
725 } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN &&
726 XFS_SB_VERSION_HASDALIGN(&mp->m_sb)) {
727 mp->m_dalign = sbp->sb_unit;
728 mp->m_swidth = sbp->sb_width;
731 xfs_alloc_compute_maxlevels(mp);
732 xfs_bmap_compute_maxlevels(mp, XFS_DATA_FORK);
733 xfs_bmap_compute_maxlevels(mp, XFS_ATTR_FORK);
734 xfs_ialloc_compute_maxlevels(mp);
745 do_div(icount, mp->m_ialloc_blks);
746 mp->m_maxicount = (icount * mp->m_ialloc_blks) <<
749 mp->m_maxicount = 0;
751 mp->m_maxioffset = xfs_max_file_offset(sbp->sb_blocklog);
760 (mp->m_flags & XFS_MOUNT_NOUUID) == 0) {
761 if (xfs_uuid_mount(mp)) {
776 if (!(mp->m_flags & XFS_MOUNT_DFLT_IOSIZE)) {
777 if (mp->m_flags & XFS_MOUNT_WSYNC) {
785 readio_log = mp->m_readio_log;
786 writeio_log = mp->m_writeio_log;
794 mp->m_nreadaheads = XFS_RW_NREADAHEAD_16MB;
796 mp->m_nreadaheads = XFS_RW_NREADAHEAD_32MB;
798 mp->m_nreadaheads = XFS_RW_NREADAHEAD_K32;
800 mp->m_readio_log = sbp->sb_blocklog;
802 mp->m_readio_log = readio_log;
804 mp->m_readio_blocks = 1 << (mp->m_readio_log - sbp->sb_blocklog);
806 mp->m_writeio_log = sbp->sb_blocklog;
808 mp->m_writeio_log = writeio_log;
810 mp->m_writeio_blocks = 1 << (mp->m_writeio_log - sbp->sb_blocklog);
818 mp->m_inode_cluster_size = XFS_INODE_SMALL_CLUSTER_SIZE;
820 mp->m_inode_cluster_size = XFS_INODE_BIG_CLUSTER_SIZE;
825 if (XFS_SB_VERSION_HASALIGN(&mp->m_sb) &&
826 mp->m_sb.sb_inoalignmt >=
827 XFS_B_TO_FSBT(mp, mp->m_inode_cluster_size))
828 mp->m_inoalign_mask = mp->m_sb.sb_inoalignmt - 1;
830 mp->m_inoalign_mask = 0;
835 if (mp->m_dalign && mp->m_inoalign_mask &&
836 !(mp->m_dalign & mp->m_inoalign_mask))
837 mp->m_sinoalign = mp->m_dalign;
839 mp->m_sinoalign = 0;
843 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks);
844 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_dblocks) {
849 error = xfs_read_buf(mp, mp->m_ddev_targp,
850 d - XFS_FSS_TO_BB(mp, 1),
851 XFS_FSS_TO_BB(mp, 1), 0, &bp);
863 mp->m_logdev_targp != mp->m_ddev_targp) {
864 d = (xfs_daddr_t)XFS_FSB_TO_BB(mp, mp->m_sb.sb_logblocks);
865 if (XFS_BB_TO_FSB(mp, d) != mp->m_sb.sb_logblocks) {
870 error = xfs_read_buf(mp, mp->m_logdev_targp,
871 d - XFS_FSB_TO_BB(mp, 1),
872 XFS_FSB_TO_BB(mp, 1), 0, &bp);
887 if ((error = xfs_rtmount_init(mp))) {
903 uuid_getnodeuniq(&sbp->sb_uuid, mp->m_fixedfsid);
914 vfsp->vfs_altfsid = (xfs_fsid_t *)mp->m_fixedfsid;
915 mp->m_dmevmask = 0; /* not persistent; set after each mount */
920 mp->m_dirops =
921 XFS_SB_VERSION_HASDIRV2(&mp->m_sb) ?
928 XFS_DIR_MOUNT(mp);
933 mp->m_attr_magicpct = (mp->m_sb.sb_blocksize * 37) / 100;
938 xfs_trans_init(mp);
944 xfs_ihash_init(mp);
945 xfs_chash_init(mp);
950 init_rwsem(&mp->m_peraglock);
951 mp->m_perag =
954 mp->m_maxagi = xfs_initialize_perag(mp, sbp->sb_agcount);
960 error = xfs_log_mount(mp, mp->m_logdev_targp,
961 XFS_FSB_TO_DADDR(mp, sbp->sb_logstart),
962 XFS_FSB_TO_BB(mp, sbp->sb_logblocks));
969 XFS_ERROR_REPORT("xfs_mountfs_int(1)", XFS_ERRLEVEL_LOW, mp);
978 error = xfs_iget(mp, NULL, sbp->sb_rootino, 0, XFS_ILOCK_EXCL, &rip, 0);
990 mp->m_ddev_targp, (unsigned long long)rip->i_ino);
993 mp);
997 mp->m_rootip = rip; /* save it */
1004 if ((error = xfs_rtmount_inodes(mp))) {
1017 xfs_mount_log_sbunit(mp, update_flags);
1022 if ((error = XFS_QM_INIT(mp, &quotamount, &quotaflags)))
1030 error = xfs_log_mount_finish(mp, mfsi_flags);
1039 if ((error = XFS_QM_MOUNT(mp, quotamount, quotaflags, mfsi_flags)))
1050 xfs_log_unmount_dealloc(mp);
1052 xfs_ihash_free(mp);
1053 xfs_chash_free(mp);
1055 if (mp->m_perag[agno].pagb_list)
1056 kmem_free(mp->m_perag[agno].pagb_list,
1058 kmem_free(mp->m_perag, sbp->sb_agcount * sizeof(xfs_perag_t));
1059 mp->m_perag = NULL;
1063 xfs_uuid_unmount(mp);
1064 xfs_freesb(mp);
1075 xfs_unmountfs(xfs_mount_t *mp, struct cred *cr) argument
1077 struct vfs *vfsp = XFS_MTOVFS(mp);
1082 xfs_iflush_all(mp, XFS_FLUSH_ALL);
1084 XFS_QM_DQPURGEALL(mp,
1092 xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC);
1094 xfs_binval(mp->m_ddev_targp);
1095 if (mp->m_rtdev_targp) {
1096 xfs_binval(mp->m_rtdev_targp);
1099 xfs_unmountfs_writesb(mp);
1101 xfs_unmountfs_wait(mp); /* wait for async bufs */
1103 xfs_log_unmount(mp); /* Done! No more fs ops. */
1105 xfs_freesb(mp);
1110 ASSERT(mp->m_inodes == NULL);
1117 if (XFS_FORCED_SHUTDOWN(mp)) {
1118 xfs_incore_relse(mp->m_ddev_targp, 0, 1); /* synchronous */
1121 xfs_unmountfs_close(mp, cr);
1122 if ((mp->m_flags & XFS_MOUNT_NOUUID) == 0)
1123 xfs_uuid_unmount(mp);
1130 xfs_errortag_clearall_umount(fsid, mp->m_fsname, 0);
1133 xfs_mount_free(mp, 1);
1138 xfs_unmountfs_close(xfs_mount_t *mp, struct cred *cr) argument
1140 if (mp->m_logdev_targp != mp->m_ddev_targp)
1141 xfs_free_buftarg(mp->m_logdev_targp, 1);
1142 if (mp->m_rtdev_targp)
1143 xfs_free_buftarg(mp->m_rtdev_targp, 1);
1144 xfs_free_buftarg(mp->m_ddev_targp, 0);
1148 xfs_unmountfs_wait(xfs_mount_t *mp) argument
1150 if (mp->m_logdev_targp != mp->m_ddev_targp)
1151 xfs_wait_buftarg(mp->m_logdev_targp);
1152 if (mp->m_rtdev_targp)
1153 xfs_wait_buftarg(mp->m_rtdev_targp);
1154 xfs_wait_buftarg(mp->m_ddev_targp);
1158 xfs_unmountfs_writesb(xfs_mount_t *mp) argument
1168 sbp = xfs_getsb(mp, 0);
1169 if (!(XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY ||
1170 XFS_FORCED_SHUTDOWN(mp))) {
1175 if (mp->m_mk_sharedro) {
1180 xfs_fs_cmn_err(CE_NOTE, mp,
1188 ASSERT(XFS_BUF_TARGET(sbp) == mp->m_ddev_targp);
1189 xfsbdstrat(mp, sbp);
1194 mp, sbp, XFS_BUF_ADDR(sbp));
1195 if (error && mp->m_mk_sharedro)
1196 …xfs_fs_cmn_err(CE_ALERT, mp, "Superblock write error detected while unmounting. Filesystem may no…
1215 xfs_mount_t *mp; local
1222 mp = tp->t_mountp;
1223 bp = xfs_trans_getsb(tp, mp, 0);
1230 xfs_xlatesb(XFS_BUF_PTR(bp), &(mp->m_sb), -1, ARCH_CONVERT, fields);
1255 xfs_mod_incore_sb_unlocked(xfs_mount_t *mp, xfs_sb_field_t field, argument
1270 lcounter = (long long)mp->m_sb.sb_icount;
1276 mp->m_sb.sb_icount = lcounter;
1279 lcounter = (long long)mp->m_sb.sb_ifree;
1285 mp->m_sb.sb_ifree = lcounter;
1289 lcounter = (long long)mp->m_sb.sb_fdblocks;
1290 res_used = (long long)(mp->m_resblks - mp->m_resblks_avail);
1294 mp->m_resblks_avail += delta;
1297 mp->m_resblks_avail = mp->m_resblks;
1311 lcounter = (long long)mp->m_resblks_avail + delta;
1315 mp->m_resblks_avail = lcounter;
1323 mp->m_sb.sb_fdblocks = lcounter;
1326 lcounter = (long long)mp->m_sb.sb_frextents;
1331 mp->m_sb.sb_frextents = lcounter;
1334 lcounter = (long long)mp->m_sb.sb_dblocks;
1340 mp->m_sb.sb_dblocks = lcounter;
1343 scounter = mp->m_sb.sb_agcount;
1349 mp->m_sb.sb_agcount = scounter;
1352 scounter = mp->m_sb.sb_imax_pct;
1358 mp->m_sb.sb_imax_pct = scounter;
1361 scounter = mp->m_sb.sb_rextsize;
1367 mp->m_sb.sb_rextsize = scounter;
1370 scounter = mp->m_sb.sb_rbmblocks;
1376 mp->m_sb.sb_rbmblocks = scounter;
1379 lcounter = (long long)mp->m_sb.sb_rblocks;
1385 mp->m_sb.sb_rblocks = lcounter;
1388 lcounter = (long long)mp->m_sb.sb_rextents;
1394 mp->m_sb.sb_rextents = lcounter;
1397 scounter = mp->m_sb.sb_rextslog;
1403 mp->m_sb.sb_rextslog = scounter;
1418 xfs_mod_incore_sb(xfs_mount_t *mp, xfs_sb_field_t field, int delta, int rsvd) argument
1423 s = XFS_SB_LOCK(mp);
1424 status = xfs_mod_incore_sb_unlocked(mp, field, delta, rsvd);
1425 XFS_SB_UNLOCK(mp, s);
1441 xfs_mod_incore_sb_batch(xfs_mount_t *mp, xfs_mod_sb_t *msb, uint nmsb, int rsvd) argument
1454 s = XFS_SB_LOCK(mp);
1462 status = xfs_mod_incore_sb_unlocked(mp, msbp->msb_field,
1480 status = xfs_mod_incore_sb_unlocked(mp,
1486 XFS_SB_UNLOCK(mp, s);
1501 xfs_mount_t *mp, argument
1506 ASSERT(mp->m_sb_bp != NULL);
1507 bp = mp->m_sb_bp;
1525 xfs_mount_t *mp) argument
1533 bp = xfs_getsb(mp, 0);
1536 mp->m_sb_bp = NULL;
1545 xfs_mount_t *mp) argument
1547 if (uuid_is_nil(&mp->m_sb.sb_uuid)) {
1550 mp->m_fsname);
1553 if (!uuid_table_insert(&mp->m_sb.sb_uuid)) {
1556 mp->m_fsname);
1567 xfs_mount_t *mp) argument
1569 uuid_table_remove(&mp->m_sb.sb_uuid);
1578 xfs_mount_t *mp, argument
1585 tp = xfs_trans_alloc(mp, XFS_TRANS_SB_UNIT);
1586 if (xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0,