Lines Matching refs:sb
41 struct super_block * sb; in ufs_free_fragments() local
48 sb = inode->i_sb; in ufs_free_fragments()
49 uspi = UFS_SB(sb)->s_uspi; in ufs_free_fragments()
55 ufs_error (sb, "ufs_free_fragments", "internal error"); in ufs_free_fragments()
57 mutex_lock(&UFS_SB(sb)->s_lock); in ufs_free_fragments()
62 ufs_panic (sb, "ufs_free_fragments", "freeing blocks are outside device"); in ufs_free_fragments()
66 ucpi = ufs_load_cylinder (sb, cgno); in ufs_free_fragments()
70 if (!ufs_cg_chkmagic(sb, ucg)) { in ufs_free_fragments()
71 ufs_panic (sb, "ufs_free_fragments", "internal error, bad magic number on cg %u", cgno); in ufs_free_fragments()
78 ufs_fragacct (sb, blkmap, ucg->cg_frsum, -1); in ufs_free_fragments()
83 ufs_error (sb, "ufs_free_fragments", in ufs_free_fragments()
88 fs32_add(sb, &ucg->cg_cs.cs_nffree, count); in ufs_free_fragments()
90 fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); in ufs_free_fragments()
92 ufs_fragacct(sb, blkmap, ucg->cg_frsum, 1); in ufs_free_fragments()
99 fs32_sub(sb, &ucg->cg_cs.cs_nffree, uspi->s_fpb); in ufs_free_fragments()
101 fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, uspi->s_fpb); in ufs_free_fragments()
102 if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) in ufs_free_fragments()
103 ufs_clusteracct (sb, ucpi, blkno, 1); in ufs_free_fragments()
104 fs32_add(sb, &ucg->cg_cs.cs_nbfree, 1); in ufs_free_fragments()
106 fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nbfree, 1); in ufs_free_fragments()
110 fs16_add(sb, &ubh_cg_blks(ucpi, cylno, in ufs_free_fragments()
112 fs32_add(sb, &ubh_cg_blktot(ucpi, cylno), 1); in ufs_free_fragments()
118 if (sb->s_flags & MS_SYNCHRONOUS) in ufs_free_fragments()
120 ufs_mark_sb_dirty(sb); in ufs_free_fragments()
122 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_free_fragments()
127 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_free_fragments()
137 struct super_block * sb; in ufs_free_blocks() local
144 sb = inode->i_sb; in ufs_free_blocks()
145 uspi = UFS_SB(sb)->s_uspi; in ufs_free_blocks()
151 ufs_error (sb, "ufs_free_blocks", "internal error, " in ufs_free_blocks()
157 mutex_lock(&UFS_SB(sb)->s_lock); in ufs_free_blocks()
164 ufs_panic (sb, "ufs_free_blocks", "freeing blocks are outside device"); in ufs_free_blocks()
174 ucpi = ufs_load_cylinder (sb, cgno); in ufs_free_blocks()
178 if (!ufs_cg_chkmagic(sb, ucg)) { in ufs_free_blocks()
179 ufs_panic (sb, "ufs_free_blocks", "internal error, bad magic number on cg %u", cgno); in ufs_free_blocks()
186 ufs_error(sb, "ufs_free_blocks", "freeing free fragment"); in ufs_free_blocks()
190 if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) in ufs_free_blocks()
191 ufs_clusteracct (sb, ucpi, blkno, 1); in ufs_free_blocks()
193 fs32_add(sb, &ucg->cg_cs.cs_nbfree, 1); in ufs_free_blocks()
195 fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nbfree, 1); in ufs_free_blocks()
200 fs16_add(sb, &ubh_cg_blks(ucpi, cylno, in ufs_free_blocks()
202 fs32_add(sb, &ubh_cg_blktot(ucpi, cylno), 1); in ufs_free_blocks()
208 if (sb->s_flags & MS_SYNCHRONOUS) in ufs_free_blocks()
217 ufs_mark_sb_dirty(sb); in ufs_free_blocks()
218 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_free_blocks()
223 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_free_blocks()
348 struct super_block * sb; in ufs_new_fragments() local
358 sb = inode->i_sb; in ufs_new_fragments()
359 uspi = UFS_SB(sb)->s_uspi; in ufs_new_fragments()
363 mutex_lock(&UFS_SB(sb)->s_lock); in ufs_new_fragments()
364 tmp = ufs_data_ptr_to_cpu(sb, p); in ufs_new_fragments()
367 ufs_warning(sb, "ufs_new_fragments", "internal warning" in ufs_new_fragments()
380 ufs_error(sb, "ufs_new_fragments", "internal error, " in ufs_new_fragments()
384 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_new_fragments()
389 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_new_fragments()
396 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_new_fragments()
406 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_new_fragments()
429 ufs_cpu_to_data_ptr(sb, p, result); in ufs_new_fragments()
434 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_new_fragments()
451 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_new_fragments()
459 if (fs32_to_cpu(sb, usb1->fs_optim) == UFS_OPTSPACE) { in ufs_new_fragments()
462 usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTTIME); in ufs_new_fragments()
466 usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTSPACE); in ufs_new_fragments()
472 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_new_fragments()
478 ufs_cpu_to_data_ptr(sb, p, result); in ufs_new_fragments()
489 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_new_fragments()
511 struct super_block * sb; in ufs_add_fragments() local
520 sb = inode->i_sb; in ufs_add_fragments()
521 uspi = UFS_SB(sb)->s_uspi; in ufs_add_fragments()
525 if (fs32_to_cpu(sb, UFS_SB(sb)->fs_cs(cgno).cs_nffree) < count) in ufs_add_fragments()
529 ucpi = ufs_load_cylinder (sb, cgno); in ufs_add_fragments()
533 if (!ufs_cg_chkmagic(sb, ucg)) { in ufs_add_fragments()
534 ufs_panic (sb, "ufs_add_fragments", in ufs_add_fragments()
550 ucg->cg_time = cpu_to_fs32(sb, get_seconds()); in ufs_add_fragments()
555 if (!fs32_to_cpu(sb, ucg->cg_frsum[fragsize])) in ufs_add_fragments()
556 ufs_panic (sb, "ufs_add_fragments", in ufs_add_fragments()
558 fs32_sub(sb, &ucg->cg_frsum[fragsize], 1); in ufs_add_fragments()
560 fs32_add(sb, &ucg->cg_frsum[fragsize - count], 1); in ufs_add_fragments()
564 fs32_sub(sb, &ucg->cg_cs.cs_nffree, count); in ufs_add_fragments()
565 fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); in ufs_add_fragments()
570 if (sb->s_flags & MS_SYNCHRONOUS) in ufs_add_fragments()
572 ufs_mark_sb_dirty(sb); in ufs_add_fragments()
580 ucg = (struct ufs_cylinder_group *) UFS_SB(sb)->s_ucg[cgno]->b_data; \
581 if (fs32_to_cpu(sb, ucg->cg_cs.cs_nbfree)) \
584 if (fs32_to_cpu(sb, ucg->cg_frsum[k])) \
590 struct super_block * sb; in ufs_alloc_fragments() local
600 sb = inode->i_sb; in ufs_alloc_fragments()
601 uspi = UFS_SB(sb)->s_uspi; in ufs_alloc_fragments()
635 ucpi = ufs_load_cylinder (sb, cgno); in ufs_alloc_fragments()
639 if (!ufs_cg_chkmagic(sb, ucg)) in ufs_alloc_fragments()
640 ufs_panic (sb, "ufs_alloc_fragments", in ufs_alloc_fragments()
642 ucg->cg_time = cpu_to_fs32(sb, get_seconds()); in ufs_alloc_fragments()
652 if (fs32_to_cpu(sb, ucg->cg_frsum[allocsize]) != 0) in ufs_alloc_fragments()
665 fs32_add(sb, &ucg->cg_cs.cs_nffree, i); in ufs_alloc_fragments()
667 fs32_add(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, i); in ufs_alloc_fragments()
668 fs32_add(sb, &ucg->cg_frsum[i], 1); in ufs_alloc_fragments()
672 result = ufs_bitmap_search (sb, ucpi, goal, allocsize); in ufs_alloc_fragments()
680 fs32_sub(sb, &ucg->cg_cs.cs_nffree, count); in ufs_alloc_fragments()
682 fs32_sub(sb, &UFS_SB(sb)->fs_cs(cgno).cs_nffree, count); in ufs_alloc_fragments()
683 fs32_sub(sb, &ucg->cg_frsum[allocsize], 1); in ufs_alloc_fragments()
686 fs32_add(sb, &ucg->cg_frsum[allocsize - count], 1); in ufs_alloc_fragments()
691 if (sb->s_flags & MS_SYNCHRONOUS) in ufs_alloc_fragments()
693 ufs_mark_sb_dirty(sb); in ufs_alloc_fragments()
704 struct super_block * sb; in ufs_alloccg_block() local
711 sb = inode->i_sb; in ufs_alloccg_block()
712 uspi = UFS_SB(sb)->s_uspi; in ufs_alloccg_block()
731 result = ufs_bitmap_search (sb, ucpi, goal, uspi->s_fpb); in ufs_alloccg_block()
740 if ((UFS_SB(sb)->s_flags & UFS_CG_MASK) == UFS_CG_44BSD) in ufs_alloccg_block()
741 ufs_clusteracct (sb, ucpi, blkno, -1); in ufs_alloccg_block()
743 fs32_sub(sb, &ucg->cg_cs.cs_nbfree, 1); in ufs_alloccg_block()
745 fs32_sub(sb, &UFS_SB(sb)->fs_cs(ucpi->c_cgx).cs_nbfree, 1); in ufs_alloccg_block()
750 fs16_sub(sb, &ubh_cg_blks(ucpi, cylno, in ufs_alloccg_block()
752 fs32_sub(sb, &ubh_cg_blktot(ucpi, cylno), 1); in ufs_alloccg_block()
795 static u64 ufs_bitmap_search(struct super_block *sb, in ufs_bitmap_search() argument
809 struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; in ufs_bitmap_search()
833 ufs_error(sb, "ufs_bitmap_search", in ufs_bitmap_search()
865 ufs_error(sb, "ufs_bitmap_search", "block not in map on cg %u\n", in ufs_bitmap_search()
871 static void ufs_clusteracct(struct super_block * sb, in ufs_clusteracct() argument
877 uspi = UFS_SB(sb)->s_uspi; in ufs_clusteracct()
917 fs32_add(sb, (__fs32*)ubh_get_addr(UCPI_UBH(ucpi), ucpi->c_clustersumoff + (i << 2)), cnt); in ufs_clusteracct()
919 fs32_sub(sb, (__fs32*)ubh_get_addr(UCPI_UBH(ucpi), ucpi->c_clustersumoff + (back << 2)), cnt); in ufs_clusteracct()
921 fs32_sub(sb, (__fs32*)ubh_get_addr(UCPI_UBH(ucpi), ucpi->c_clustersumoff + (forw << 2)), cnt); in ufs_clusteracct()