Lines Matching +full:usb3 +full:- +full:if
1 // SPDX-License-Identifier: GPL-2.0-only
16 * Laboratoire MASI - Institut Blaise Pascal
25 * Big-endian to little-endian byte-swapping/bitmaps by
35 * Adrian Rodriguez (adrian@franklins-tower.rutgers.edu)
48 * Francois-Rene Rideau <fare@tunes.org>
52 * on code by Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>.
84 #include <linux/backing-dev.h>
101 struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; in ufs_nfs_get_inode()
104 if (ino < UFS_ROOTINO || ino > (u64)uspi->s_ncg * uspi->s_ipg) in ufs_nfs_get_inode()
105 return ERR_PTR(-ESTALE); in ufs_nfs_get_inode()
108 if (IS_ERR(inode)) in ufs_nfs_get_inode()
110 if (generation && inode->i_generation != generation) { in ufs_nfs_get_inode()
112 return ERR_PTR(-ESTALE); in ufs_nfs_get_inode()
134 if (!ino) in ufs_get_parent()
135 return ERR_PTR(-ENOENT); in ufs_get_parent()
136 return d_obtain_alias(ufs_iget(child->d_sb, ino)); in ufs_get_parent()
153 struct ufs_super_block_third *usb3) in ufs_print_super_stuff() argument
155 u32 magic = fs32_to_cpu(sb, usb3->fs_magic); in ufs_print_super_stuff()
159 if (fs32_to_cpu(sb, usb3->fs_magic) == UFS2_MAGIC) { in ufs_print_super_stuff()
161 fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_size)); in ufs_print_super_stuff()
163 fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_dsize)); in ufs_print_super_stuff()
165 fs32_to_cpu(sb, usb1->fs_bsize)); in ufs_print_super_stuff()
167 fs32_to_cpu(sb, usb1->fs_fsize)); in ufs_print_super_stuff()
168 pr_debug(" fs_volname: %s\n", usb2->fs_un.fs_u2.fs_volname); in ufs_print_super_stuff()
170 fs64_to_cpu(sb, usb2->fs_un.fs_u2.fs_sblockloc)); in ufs_print_super_stuff()
172 fs64_to_cpu(sb, usb2->fs_un.fs_u2.cs_ndir)); in ufs_print_super_stuff()
175 fs64_to_cpu(sb, usb2->fs_un.fs_u2.cs_nbfree)); in ufs_print_super_stuff()
178 fs64_to_cpu(sb, usb3->fs_un1.fs_u2.cs_nifree)); in ufs_print_super_stuff()
181 fs64_to_cpu(sb, usb3->fs_un1.fs_u2.cs_nffree)); in ufs_print_super_stuff()
183 fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_maxsymlinklen)); in ufs_print_super_stuff()
185 pr_debug(" sblkno: %u\n", fs32_to_cpu(sb, usb1->fs_sblkno)); in ufs_print_super_stuff()
186 pr_debug(" cblkno: %u\n", fs32_to_cpu(sb, usb1->fs_cblkno)); in ufs_print_super_stuff()
187 pr_debug(" iblkno: %u\n", fs32_to_cpu(sb, usb1->fs_iblkno)); in ufs_print_super_stuff()
188 pr_debug(" dblkno: %u\n", fs32_to_cpu(sb, usb1->fs_dblkno)); in ufs_print_super_stuff()
190 fs32_to_cpu(sb, usb1->fs_cgoffset)); in ufs_print_super_stuff()
192 ~fs32_to_cpu(sb, usb1->fs_cgmask)); in ufs_print_super_stuff()
193 pr_debug(" size: %u\n", fs32_to_cpu(sb, usb1->fs_size)); in ufs_print_super_stuff()
194 pr_debug(" dsize: %u\n", fs32_to_cpu(sb, usb1->fs_dsize)); in ufs_print_super_stuff()
195 pr_debug(" ncg: %u\n", fs32_to_cpu(sb, usb1->fs_ncg)); in ufs_print_super_stuff()
196 pr_debug(" bsize: %u\n", fs32_to_cpu(sb, usb1->fs_bsize)); in ufs_print_super_stuff()
197 pr_debug(" fsize: %u\n", fs32_to_cpu(sb, usb1->fs_fsize)); in ufs_print_super_stuff()
198 pr_debug(" frag: %u\n", fs32_to_cpu(sb, usb1->fs_frag)); in ufs_print_super_stuff()
200 fs32_to_cpu(sb, usb1->fs_fragshift)); in ufs_print_super_stuff()
201 pr_debug(" ~fmask: %u\n", ~fs32_to_cpu(sb, usb1->fs_fmask)); in ufs_print_super_stuff()
202 pr_debug(" fshift: %u\n", fs32_to_cpu(sb, usb1->fs_fshift)); in ufs_print_super_stuff()
203 pr_debug(" sbsize: %u\n", fs32_to_cpu(sb, usb1->fs_sbsize)); in ufs_print_super_stuff()
204 pr_debug(" spc: %u\n", fs32_to_cpu(sb, usb1->fs_spc)); in ufs_print_super_stuff()
205 pr_debug(" cpg: %u\n", fs32_to_cpu(sb, usb1->fs_cpg)); in ufs_print_super_stuff()
206 pr_debug(" ipg: %u\n", fs32_to_cpu(sb, usb1->fs_ipg)); in ufs_print_super_stuff()
207 pr_debug(" fpg: %u\n", fs32_to_cpu(sb, usb1->fs_fpg)); in ufs_print_super_stuff()
208 pr_debug(" csaddr: %u\n", fs32_to_cpu(sb, usb1->fs_csaddr)); in ufs_print_super_stuff()
209 pr_debug(" cssize: %u\n", fs32_to_cpu(sb, usb1->fs_cssize)); in ufs_print_super_stuff()
210 pr_debug(" cgsize: %u\n", fs32_to_cpu(sb, usb1->fs_cgsize)); in ufs_print_super_stuff()
212 fs32_to_cpu(sb, usb1->fs_fsbtodb)); in ufs_print_super_stuff()
213 pr_debug(" nrpos: %u\n", fs32_to_cpu(sb, usb3->fs_nrpos)); in ufs_print_super_stuff()
215 fs32_to_cpu(sb, usb1->fs_cstotal.cs_ndir)); in ufs_print_super_stuff()
217 fs32_to_cpu(sb, usb1->fs_cstotal.cs_nifree)); in ufs_print_super_stuff()
219 fs32_to_cpu(sb, usb1->fs_cstotal.cs_nbfree)); in ufs_print_super_stuff()
221 fs32_to_cpu(sb, usb1->fs_cstotal.cs_nffree)); in ufs_print_super_stuff()
234 pr_debug(" magic: %x\n", fs32_to_cpu(sb, cg->cg_magic)); in ufs_print_cylinder_stuff()
235 pr_debug(" time: %u\n", fs32_to_cpu(sb, cg->cg_time)); in ufs_print_cylinder_stuff()
236 pr_debug(" cgx: %u\n", fs32_to_cpu(sb, cg->cg_cgx)); in ufs_print_cylinder_stuff()
237 pr_debug(" ncyl: %u\n", fs16_to_cpu(sb, cg->cg_ncyl)); in ufs_print_cylinder_stuff()
238 pr_debug(" niblk: %u\n", fs16_to_cpu(sb, cg->cg_niblk)); in ufs_print_cylinder_stuff()
239 pr_debug(" ndblk: %u\n", fs32_to_cpu(sb, cg->cg_ndblk)); in ufs_print_cylinder_stuff()
240 pr_debug(" cs_ndir: %u\n", fs32_to_cpu(sb, cg->cg_cs.cs_ndir)); in ufs_print_cylinder_stuff()
241 pr_debug(" cs_nbfree: %u\n", fs32_to_cpu(sb, cg->cg_cs.cs_nbfree)); in ufs_print_cylinder_stuff()
242 pr_debug(" cs_nifree: %u\n", fs32_to_cpu(sb, cg->cg_cs.cs_nifree)); in ufs_print_cylinder_stuff()
243 pr_debug(" cs_nffree: %u\n", fs32_to_cpu(sb, cg->cg_cs.cs_nffree)); in ufs_print_cylinder_stuff()
244 pr_debug(" rotor: %u\n", fs32_to_cpu(sb, cg->cg_rotor)); in ufs_print_cylinder_stuff()
245 pr_debug(" frotor: %u\n", fs32_to_cpu(sb, cg->cg_frotor)); in ufs_print_cylinder_stuff()
246 pr_debug(" irotor: %u\n", fs32_to_cpu(sb, cg->cg_irotor)); in ufs_print_cylinder_stuff()
248 fs32_to_cpu(sb, cg->cg_frsum[0]), fs32_to_cpu(sb, cg->cg_frsum[1]), in ufs_print_cylinder_stuff()
249 fs32_to_cpu(sb, cg->cg_frsum[2]), fs32_to_cpu(sb, cg->cg_frsum[3]), in ufs_print_cylinder_stuff()
250 fs32_to_cpu(sb, cg->cg_frsum[4]), fs32_to_cpu(sb, cg->cg_frsum[5]), in ufs_print_cylinder_stuff()
251 fs32_to_cpu(sb, cg->cg_frsum[6]), fs32_to_cpu(sb, cg->cg_frsum[7])); in ufs_print_cylinder_stuff()
252 pr_debug(" btotoff: %u\n", fs32_to_cpu(sb, cg->cg_btotoff)); in ufs_print_cylinder_stuff()
253 pr_debug(" boff: %u\n", fs32_to_cpu(sb, cg->cg_boff)); in ufs_print_cylinder_stuff()
254 pr_debug(" iuseoff: %u\n", fs32_to_cpu(sb, cg->cg_iusedoff)); in ufs_print_cylinder_stuff()
255 pr_debug(" freeoff: %u\n", fs32_to_cpu(sb, cg->cg_freeoff)); in ufs_print_cylinder_stuff()
256 pr_debug(" nextfreeoff: %u\n", fs32_to_cpu(sb, cg->cg_nextfreeoff)); in ufs_print_cylinder_stuff()
258 fs32_to_cpu(sb, cg->cg_u.cg_44.cg_clustersumoff)); in ufs_print_cylinder_stuff()
260 fs32_to_cpu(sb, cg->cg_u.cg_44.cg_clusteroff)); in ufs_print_cylinder_stuff()
262 fs32_to_cpu(sb, cg->cg_u.cg_44.cg_nclusterblks)); in ufs_print_cylinder_stuff()
266 # define ufs_print_super_stuff(sb, usb1, usb2, usb3) /**/ argument
280 uspi = UFS_SB(sb)->s_uspi; in ufs_error()
283 if (!sb_rdonly(sb)) { in ufs_error()
284 usb1->fs_clean = UFS_FSBAD; in ufs_error()
287 sb->s_flags |= SB_RDONLY; in ufs_error()
292 switch (UFS_SB(sb)->s_mount_opt & UFS_MOUNT_ONERROR) { in ufs_error()
295 sb->s_id, function, &vaf); in ufs_error()
301 sb->s_id, function, &vaf); in ufs_error()
314 uspi = UFS_SB(sb)->s_uspi; in ufs_panic()
317 if (!sb_rdonly(sb)) { in ufs_panic()
318 usb1->fs_clean = UFS_FSBAD; in ufs_panic()
325 sb->s_flags |= SB_RDONLY; in ufs_panic()
327 sb->s_id, function, &vaf); in ufs_panic()
341 sb->s_id, function, &vaf); in ufs_warning()
372 {Opt_type_nextstepcd, "ufstype=nextstep-cd"},
389 if (!options) in ufs_parse_options()
395 if (!*p) in ufs_parse_options()
473 struct ufs_sb_private_info *uspi = sbi->s_uspi; in ufs_setup_cstotal()
476 struct ufs_super_block_third *usb3; in ufs_setup_cstotal() local
477 unsigned mtype = sbi->s_mount_opt & UFS_MOUNT_UFSTYPE; in ufs_setup_cstotal()
482 usb3 = ubh_get_usb_third(uspi); in ufs_setup_cstotal()
484 if ((mtype == UFS_MOUNT_UFSTYPE_44BSD && in ufs_setup_cstotal()
485 (usb2->fs_un.fs_u2.fs_maxbsize == usb1->fs_bsize)) || in ufs_setup_cstotal()
488 uspi->cs_total.cs_ndir = fs64_to_cpu(sb, usb2->fs_un.fs_u2.cs_ndir); in ufs_setup_cstotal()
489 uspi->cs_total.cs_nbfree = fs64_to_cpu(sb, usb2->fs_un.fs_u2.cs_nbfree); in ufs_setup_cstotal()
490 uspi->cs_total.cs_nifree = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.cs_nifree); in ufs_setup_cstotal()
491 uspi->cs_total.cs_nffree = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.cs_nffree); in ufs_setup_cstotal()
493 uspi->cs_total.cs_ndir = fs32_to_cpu(sb, usb1->fs_cstotal.cs_ndir); in ufs_setup_cstotal()
494 uspi->cs_total.cs_nbfree = fs32_to_cpu(sb, usb1->fs_cstotal.cs_nbfree); in ufs_setup_cstotal()
495 uspi->cs_total.cs_nifree = fs32_to_cpu(sb, usb1->fs_cstotal.cs_nifree); in ufs_setup_cstotal()
496 uspi->cs_total.cs_nffree = fs32_to_cpu(sb, usb1->fs_cstotal.cs_nffree); in ufs_setup_cstotal()
502 * Read on-disk structures associated with cylinder groups
507 struct ufs_sb_private_info *uspi = sbi->s_uspi; in ufs_read_cylinder_structures()
518 size = uspi->s_cssize; in ufs_read_cylinder_structures()
519 blks = (size + uspi->s_fsize - 1) >> uspi->s_fshift; in ufs_read_cylinder_structures()
521 if (!base) in ufs_read_cylinder_structures()
523 sbi->s_csp = (struct ufs_csum *)space; in ufs_read_cylinder_structures()
524 for (i = 0; i < blks; i += uspi->s_fpb) { in ufs_read_cylinder_structures()
525 size = uspi->s_bsize; in ufs_read_cylinder_structures()
526 if (i + uspi->s_fpb > blks) in ufs_read_cylinder_structures()
527 size = (blks - i) * uspi->s_fsize; in ufs_read_cylinder_structures()
529 ubh = ubh_bread(sb, uspi->s_csaddr + i, size); in ufs_read_cylinder_structures()
531 if (!ubh) in ufs_read_cylinder_structures()
545 sbi->s_ucg = kmalloc_array(uspi->s_ncg, sizeof(struct buffer_head *), in ufs_read_cylinder_structures()
547 if (!sbi->s_ucg) in ufs_read_cylinder_structures()
549 for (i = 0; i < uspi->s_ncg; i++) in ufs_read_cylinder_structures()
550 sbi->s_ucg[i] = NULL; in ufs_read_cylinder_structures()
552 sbi->s_ucpi[i] = NULL; in ufs_read_cylinder_structures()
553 sbi->s_cgno[i] = UFS_CGNO_EMPTY; in ufs_read_cylinder_structures()
555 for (i = 0; i < uspi->s_ncg; i++) { in ufs_read_cylinder_structures()
557 if (!(sbi->s_ucg[i] = sb_bread(sb, ufs_cgcmin(i)))) in ufs_read_cylinder_structures()
559 if (!ufs_cg_chkmagic (sb, (struct ufs_cylinder_group *) sbi->s_ucg[i]->b_data)) in ufs_read_cylinder_structures()
562 ufs_print_cylinder_stuff(sb, (struct ufs_cylinder_group *) sbi->s_ucg[i]->b_data); in ufs_read_cylinder_structures()
565 if (!(sbi->s_ucpi[i] = kmalloc (sizeof(struct ufs_cg_private_info), GFP_NOFS))) in ufs_read_cylinder_structures()
567 sbi->s_cgno[i] = UFS_CGNO_EMPTY; in ufs_read_cylinder_structures()
569 sbi->s_cg_loaded = 0; in ufs_read_cylinder_structures()
575 if (sbi->s_ucg) { in ufs_read_cylinder_structures()
576 for (i = 0; i < uspi->s_ncg; i++) in ufs_read_cylinder_structures()
577 if (sbi->s_ucg[i]) in ufs_read_cylinder_structures()
578 brelse (sbi->s_ucg[i]); in ufs_read_cylinder_structures()
579 kfree (sbi->s_ucg); in ufs_read_cylinder_structures()
581 kfree (sbi->s_ucpi[i]); in ufs_read_cylinder_structures()
592 unsigned mtype = UFS_SB(sb)->s_mount_opt & UFS_MOUNT_UFSTYPE; in ufs_put_cstotal()
593 struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; in ufs_put_cstotal()
596 struct ufs_super_block_third *usb3; in ufs_put_cstotal() local
601 usb3 = ubh_get_usb_third(uspi); in ufs_put_cstotal()
603 if (mtype == UFS_MOUNT_UFSTYPE_UFS2) { in ufs_put_cstotal()
605 usb2->fs_un.fs_u2.cs_ndir = in ufs_put_cstotal()
606 cpu_to_fs64(sb, uspi->cs_total.cs_ndir); in ufs_put_cstotal()
607 usb2->fs_un.fs_u2.cs_nbfree = in ufs_put_cstotal()
608 cpu_to_fs64(sb, uspi->cs_total.cs_nbfree); in ufs_put_cstotal()
609 usb3->fs_un1.fs_u2.cs_nifree = in ufs_put_cstotal()
610 cpu_to_fs64(sb, uspi->cs_total.cs_nifree); in ufs_put_cstotal()
611 usb3->fs_un1.fs_u2.cs_nffree = in ufs_put_cstotal()
612 cpu_to_fs64(sb, uspi->cs_total.cs_nffree); in ufs_put_cstotal()
616 if (mtype == UFS_MOUNT_UFSTYPE_44BSD && in ufs_put_cstotal()
617 (usb2->fs_un.fs_u2.fs_maxbsize == usb1->fs_bsize)) { in ufs_put_cstotal()
619 usb2->fs_un.fs_u2.cs_ndir = in ufs_put_cstotal()
620 cpu_to_fs64(sb, uspi->cs_total.cs_ndir); in ufs_put_cstotal()
621 usb2->fs_un.fs_u2.cs_nbfree = in ufs_put_cstotal()
622 cpu_to_fs64(sb, uspi->cs_total.cs_nbfree); in ufs_put_cstotal()
623 usb3->fs_un1.fs_u2.cs_nifree = in ufs_put_cstotal()
624 cpu_to_fs64(sb, uspi->cs_total.cs_nifree); in ufs_put_cstotal()
625 usb3->fs_un1.fs_u2.cs_nffree = in ufs_put_cstotal()
626 cpu_to_fs64(sb, uspi->cs_total.cs_nffree); in ufs_put_cstotal()
628 usb1->fs_cstotal.cs_ndir = cpu_to_fs32(sb, uspi->cs_total.cs_ndir); in ufs_put_cstotal()
629 usb1->fs_cstotal.cs_nbfree = cpu_to_fs32(sb, uspi->cs_total.cs_nbfree); in ufs_put_cstotal()
630 usb1->fs_cstotal.cs_nifree = cpu_to_fs32(sb, uspi->cs_total.cs_nifree); in ufs_put_cstotal()
631 usb1->fs_cstotal.cs_nffree = cpu_to_fs32(sb, uspi->cs_total.cs_nffree); in ufs_put_cstotal()
634 ufs_print_super_stuff(sb, usb1, usb2, usb3); in ufs_put_cstotal()
639 * ufs_put_super_internal() - put on-disk intrenal structures
641 * Put on-disk structures associated with cylinder groups
647 struct ufs_sb_private_info *uspi = sbi->s_uspi; in ufs_put_super_internal()
656 size = uspi->s_cssize; in ufs_put_super_internal()
657 blks = (size + uspi->s_fsize - 1) >> uspi->s_fshift; in ufs_put_super_internal()
658 base = space = (char*) sbi->s_csp; in ufs_put_super_internal()
659 for (i = 0; i < blks; i += uspi->s_fpb) { in ufs_put_super_internal()
660 size = uspi->s_bsize; in ufs_put_super_internal()
661 if (i + uspi->s_fpb > blks) in ufs_put_super_internal()
662 size = (blks - i) * uspi->s_fsize; in ufs_put_super_internal()
664 ubh = ubh_bread(sb, uspi->s_csaddr + i, size); in ufs_put_super_internal()
672 for (i = 0; i < sbi->s_cg_loaded; i++) { in ufs_put_super_internal()
674 kfree (sbi->s_ucpi[i]); in ufs_put_super_internal()
677 kfree (sbi->s_ucpi[i]); in ufs_put_super_internal()
678 for (i = 0; i < uspi->s_ncg; i++) in ufs_put_super_internal()
679 brelse (sbi->s_ucg[i]); in ufs_put_super_internal()
680 kfree (sbi->s_ucg); in ufs_put_super_internal()
690 struct ufs_super_block_third * usb3; in ufs_sync_fs() local
693 mutex_lock(&UFS_SB(sb)->s_lock); in ufs_sync_fs()
697 flags = UFS_SB(sb)->s_flags; in ufs_sync_fs()
698 uspi = UFS_SB(sb)->s_uspi; in ufs_sync_fs()
700 usb3 = ubh_get_usb_third(uspi); in ufs_sync_fs()
702 usb1->fs_time = ufs_get_seconds(sb); in ufs_sync_fs()
703 if ((flags & UFS_ST_MASK) == UFS_ST_SUN || in ufs_sync_fs()
706 ufs_set_fs_state(sb, usb1, usb3, in ufs_sync_fs()
707 UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); in ufs_sync_fs()
711 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_sync_fs()
722 spin_lock(&sbi->work_lock); in delayed_sync_fs()
723 sbi->work_queued = 0; in delayed_sync_fs()
724 spin_unlock(&sbi->work_lock); in delayed_sync_fs()
726 ufs_sync_fs(sbi->sb, 1); in delayed_sync_fs()
734 spin_lock(&sbi->work_lock); in ufs_mark_sb_dirty()
735 if (!sbi->work_queued) { in ufs_mark_sb_dirty()
737 queue_delayed_work(system_long_wq, &sbi->sync_work, delay); in ufs_mark_sb_dirty()
738 sbi->work_queued = 1; in ufs_mark_sb_dirty()
740 spin_unlock(&sbi->work_lock); in ufs_mark_sb_dirty()
749 if (!sb_rdonly(sb)) in ufs_put_super()
751 cancel_delayed_work_sync(&sbi->sync_work); in ufs_put_super()
753 ubh_brelse_uspi (sbi->s_uspi); in ufs_put_super()
754 kfree (sbi->s_uspi); in ufs_put_super()
756 sb->s_fs_info = NULL; in ufs_put_super()
763 struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; in ufs_max_bytes()
764 int bits = uspi->s_apbshift; in ufs_max_bytes()
767 if (bits > 21) in ufs_max_bytes()
773 if (res >= (MAX_LFS_FILESIZE >> uspi->s_bshift)) in ufs_max_bytes()
775 return res << uspi->s_bshift; in ufs_max_bytes()
784 struct ufs_super_block_third * usb3; in ufs_fill_super() local
791 int ret = -EINVAL; in ufs_fill_super()
800 if (!sb_rdonly(sb)) { in ufs_fill_super()
801 pr_err("ufs was compiled with read-only support, can't be mounted as read-write\n"); in ufs_fill_super()
802 return -EROFS; in ufs_fill_super()
807 if (!sbi) in ufs_fill_super()
809 sb->s_fs_info = sbi; in ufs_fill_super()
810 sbi->sb = sb; in ufs_fill_super()
814 mutex_init(&sbi->s_lock); in ufs_fill_super()
815 spin_lock_init(&sbi->work_lock); in ufs_fill_super()
816 INIT_DELAYED_WORK(&sbi->sync_work, delayed_sync_fs); in ufs_fill_super()
821 sbi->s_mount_opt = 0; in ufs_fill_super()
822 ufs_set_opt (sbi->s_mount_opt, ONERROR_LOCK); in ufs_fill_super()
823 if (!ufs_parse_options ((char *) data, &sbi->s_mount_opt)) { in ufs_fill_super()
827 if (!(sbi->s_mount_opt & UFS_MOUNT_UFSTYPE)) { in ufs_fill_super()
828 if (!silent) in ufs_fill_super()
830 "mount -t ufs -o ufstype=" in ufs_fill_super()
831 "sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextstep|nextstep-cd|openstep ...\n\n" in ufs_fill_super()
834 ufs_set_opt (sbi->s_mount_opt, UFSTYPE_OLD); in ufs_fill_super()
838 sbi->s_uspi = uspi; in ufs_fill_super()
839 if (!uspi) in ufs_fill_super()
841 uspi->s_dirblksize = UFS_SECTOR_SIZE; in ufs_fill_super()
844 sb->s_maxbytes = MAX_LFS_FILESIZE; in ufs_fill_super()
846 sb->s_time_gran = NSEC_PER_SEC; in ufs_fill_super()
847 sb->s_time_min = S32_MIN; in ufs_fill_super()
848 sb->s_time_max = S32_MAX; in ufs_fill_super()
850 switch (sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) { in ufs_fill_super()
853 uspi->s_fsize = block_size = 512; in ufs_fill_super()
854 uspi->s_fmask = ~(512 - 1); in ufs_fill_super()
855 uspi->s_fshift = 9; in ufs_fill_super()
856 uspi->s_sbsize = super_block_size = 1536; in ufs_fill_super()
857 uspi->s_sbbase = 0; in ufs_fill_super()
863 uspi->s_fsize = block_size = 512; in ufs_fill_super()
864 uspi->s_fmask = ~(512 - 1); in ufs_fill_super()
865 uspi->s_fshift = 9; in ufs_fill_super()
866 uspi->s_sbsize = super_block_size = 1536; in ufs_fill_super()
867 uspi->s_sbbase = 0; in ufs_fill_super()
868 sb->s_time_gran = 1; in ufs_fill_super()
869 sb->s_time_min = S64_MIN; in ufs_fill_super()
870 sb->s_time_max = S64_MAX; in ufs_fill_super()
876 uspi->s_fsize = block_size = 1024; in ufs_fill_super()
877 uspi->s_fmask = ~(1024 - 1); in ufs_fill_super()
878 uspi->s_fshift = 10; in ufs_fill_super()
879 uspi->s_sbsize = super_block_size = 2048; in ufs_fill_super()
880 uspi->s_sbbase = 0; in ufs_fill_super()
881 uspi->s_maxsymlinklen = 0; /* Not supported on disk */ in ufs_fill_super()
887 uspi->s_fsize = block_size = 1024; in ufs_fill_super()
888 uspi->s_fmask = ~(1024 - 1); in ufs_fill_super()
889 uspi->s_fshift = 10; in ufs_fill_super()
890 uspi->s_sbsize = 2048; in ufs_fill_super()
892 uspi->s_sbbase = 0; in ufs_fill_super()
893 uspi->s_maxsymlinklen = 0; /* Not supported on disk */ in ufs_fill_super()
899 uspi->s_fsize = block_size = 1024; in ufs_fill_super()
900 uspi->s_fmask = ~(1024 - 1); in ufs_fill_super()
901 uspi->s_fshift = 10; in ufs_fill_super()
902 uspi->s_sbsize = super_block_size = 2048; in ufs_fill_super()
903 uspi->s_sbbase = 0; in ufs_fill_super()
904 uspi->s_maxsymlinklen = 0; /* Not supported on disk */ in ufs_fill_super()
910 uspi->s_fsize = block_size = 1024; in ufs_fill_super()
911 uspi->s_fmask = ~(1024 - 1); in ufs_fill_super()
912 uspi->s_fshift = 10; in ufs_fill_super()
913 uspi->s_sbsize = super_block_size = 2048; in ufs_fill_super()
914 uspi->s_sbbase = 0; in ufs_fill_super()
916 if (!sb_rdonly(sb)) { in ufs_fill_super()
917 if (!silent) in ufs_fill_super()
918 pr_info("ufstype=old is supported read-only\n"); in ufs_fill_super()
919 sb->s_flags |= SB_RDONLY; in ufs_fill_super()
925 uspi->s_fsize = block_size = 1024; in ufs_fill_super()
926 uspi->s_fmask = ~(1024 - 1); in ufs_fill_super()
927 uspi->s_fshift = 10; in ufs_fill_super()
928 uspi->s_sbsize = super_block_size = 2048; in ufs_fill_super()
929 uspi->s_sbbase = 0; in ufs_fill_super()
930 uspi->s_dirblksize = 1024; in ufs_fill_super()
932 if (!sb_rdonly(sb)) { in ufs_fill_super()
933 if (!silent) in ufs_fill_super()
934 pr_info("ufstype=nextstep is supported read-only\n"); in ufs_fill_super()
935 sb->s_flags |= SB_RDONLY; in ufs_fill_super()
940 UFSD("ufstype=nextstep-cd\n"); in ufs_fill_super()
941 uspi->s_fsize = block_size = 2048; in ufs_fill_super()
942 uspi->s_fmask = ~(2048 - 1); in ufs_fill_super()
943 uspi->s_fshift = 11; in ufs_fill_super()
944 uspi->s_sbsize = super_block_size = 2048; in ufs_fill_super()
945 uspi->s_sbbase = 0; in ufs_fill_super()
946 uspi->s_dirblksize = 1024; in ufs_fill_super()
948 if (!sb_rdonly(sb)) { in ufs_fill_super()
949 if (!silent) in ufs_fill_super()
950 pr_info("ufstype=nextstep-cd is supported read-only\n"); in ufs_fill_super()
951 sb->s_flags |= SB_RDONLY; in ufs_fill_super()
957 uspi->s_fsize = block_size = 1024; in ufs_fill_super()
958 uspi->s_fmask = ~(1024 - 1); in ufs_fill_super()
959 uspi->s_fshift = 10; in ufs_fill_super()
960 uspi->s_sbsize = super_block_size = 2048; in ufs_fill_super()
961 uspi->s_sbbase = 0; in ufs_fill_super()
962 uspi->s_dirblksize = 1024; in ufs_fill_super()
964 if (!sb_rdonly(sb)) { in ufs_fill_super()
965 if (!silent) in ufs_fill_super()
966 pr_info("ufstype=openstep is supported read-only\n"); in ufs_fill_super()
967 sb->s_flags |= SB_RDONLY; in ufs_fill_super()
973 uspi->s_fsize = block_size = 1024; in ufs_fill_super()
974 uspi->s_fmask = ~(1024 - 1); in ufs_fill_super()
975 uspi->s_fshift = 10; in ufs_fill_super()
976 uspi->s_sbsize = super_block_size = 2048; in ufs_fill_super()
977 uspi->s_sbbase = 0; in ufs_fill_super()
979 if (!sb_rdonly(sb)) { in ufs_fill_super()
980 if (!silent) in ufs_fill_super()
981 pr_info("ufstype=hp is supported read-only\n"); in ufs_fill_super()
982 sb->s_flags |= SB_RDONLY; in ufs_fill_super()
986 if (!silent) in ufs_fill_super()
992 if (!sb_set_blocksize(sb, block_size)) { in ufs_fill_super()
1001 ubh = ubh_bread_uspi(uspi, sb, uspi->s_sbbase + super_block_offset/block_size, super_block_size); in ufs_fill_super()
1003 if (!ubh) in ufs_fill_super()
1008 usb3 = ubh_get_usb_third(uspi); in ufs_fill_super()
1011 uspi->s_postblformat = fs32_to_cpu(sb, usb3->fs_postblformat); in ufs_fill_super()
1012 if (((flags & UFS_ST_MASK) == UFS_ST_SUNOS) && in ufs_fill_super()
1013 (uspi->s_postblformat != UFS_42POSTBLFMT)) { in ufs_fill_super()
1018 if ((flags & UFS_ST_MASK) == UFS_ST_44BSD && in ufs_fill_super()
1019 uspi->s_postblformat == UFS_42POSTBLFMT) { in ufs_fill_super()
1020 if (!silent) in ufs_fill_super()
1028 sbi->s_bytesex = BYTESEX_LE; in ufs_fill_super()
1029 switch ((uspi->fs_magic = fs32_to_cpu(sb, usb3->fs_magic))) { in ufs_fill_super()
1038 sbi->s_bytesex = BYTESEX_BE; in ufs_fill_super()
1039 switch ((uspi->fs_magic = fs32_to_cpu(sb, usb3->fs_magic))) { in ufs_fill_super()
1049 if ((((sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) == UFS_MOUNT_UFSTYPE_NEXTSTEP) in ufs_fill_super()
1050 || ((sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) == UFS_MOUNT_UFSTYPE_NEXTSTEP_CD) in ufs_fill_super()
1051 || ((sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) == UFS_MOUNT_UFSTYPE_OPENSTEP)) in ufs_fill_super()
1052 && uspi->s_sbbase < 256) { in ufs_fill_super()
1055 uspi->s_sbbase += 8; in ufs_fill_super()
1058 if (!silent) in ufs_fill_super()
1066 uspi->s_bsize = fs32_to_cpu(sb, usb1->fs_bsize); in ufs_fill_super()
1067 uspi->s_fsize = fs32_to_cpu(sb, usb1->fs_fsize); in ufs_fill_super()
1068 uspi->s_sbsize = fs32_to_cpu(sb, usb1->fs_sbsize); in ufs_fill_super()
1069 uspi->s_fmask = fs32_to_cpu(sb, usb1->fs_fmask); in ufs_fill_super()
1070 uspi->s_fshift = fs32_to_cpu(sb, usb1->fs_fshift); in ufs_fill_super()
1072 if (!is_power_of_2(uspi->s_fsize)) { in ufs_fill_super()
1074 __func__, uspi->s_fsize); in ufs_fill_super()
1077 if (uspi->s_fsize < 512) { in ufs_fill_super()
1079 __func__, uspi->s_fsize); in ufs_fill_super()
1082 if (uspi->s_fsize > 4096) { in ufs_fill_super()
1084 __func__, uspi->s_fsize); in ufs_fill_super()
1087 if (!is_power_of_2(uspi->s_bsize)) { in ufs_fill_super()
1089 __func__, uspi->s_bsize); in ufs_fill_super()
1092 if (uspi->s_bsize < 4096) { in ufs_fill_super()
1094 __func__, uspi->s_bsize); in ufs_fill_super()
1097 if (uspi->s_bsize / uspi->s_fsize > 8) { in ufs_fill_super()
1099 __func__, uspi->s_bsize / uspi->s_fsize); in ufs_fill_super()
1102 if (uspi->s_fsize != block_size || uspi->s_sbsize != super_block_size) { in ufs_fill_super()
1105 block_size = uspi->s_fsize; in ufs_fill_super()
1106 super_block_size = uspi->s_sbsize; in ufs_fill_super()
1111 sbi->s_flags = flags;/*after that line some functions use s_flags*/ in ufs_fill_super()
1112 ufs_print_super_stuff(sb, usb1, usb2, usb3); in ufs_fill_super()
1115 * Check, if file system was correctly unmounted. in ufs_fill_super()
1116 * If not, make it read only. in ufs_fill_super()
1118 if (((flags & UFS_ST_MASK) == UFS_ST_44BSD) || in ufs_fill_super()
1123 (ufs_get_fs_state(sb, usb1, usb3) == (UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time))))) { in ufs_fill_super()
1124 switch(usb1->fs_clean) { in ufs_fill_super()
1139 sb->s_flags |= SB_RDONLY; in ufs_fill_super()
1143 sb->s_flags |= SB_RDONLY; in ufs_fill_super()
1147 __func__, usb1->fs_clean); in ufs_fill_super()
1148 sb->s_flags |= SB_RDONLY; in ufs_fill_super()
1153 sb->s_flags |= SB_RDONLY; in ufs_fill_super()
1159 sb->s_op = &ufs_super_ops; in ufs_fill_super()
1160 sb->s_export_op = &ufs_export_ops; in ufs_fill_super()
1162 sb->s_magic = fs32_to_cpu(sb, usb3->fs_magic); in ufs_fill_super()
1164 uspi->s_sblkno = fs32_to_cpu(sb, usb1->fs_sblkno); in ufs_fill_super()
1165 uspi->s_cblkno = fs32_to_cpu(sb, usb1->fs_cblkno); in ufs_fill_super()
1166 uspi->s_iblkno = fs32_to_cpu(sb, usb1->fs_iblkno); in ufs_fill_super()
1167 uspi->s_dblkno = fs32_to_cpu(sb, usb1->fs_dblkno); in ufs_fill_super()
1168 uspi->s_cgoffset = fs32_to_cpu(sb, usb1->fs_cgoffset); in ufs_fill_super()
1169 uspi->s_cgmask = fs32_to_cpu(sb, usb1->fs_cgmask); in ufs_fill_super()
1171 if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) { in ufs_fill_super()
1172 uspi->s_size = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_size); in ufs_fill_super()
1173 uspi->s_dsize = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_dsize); in ufs_fill_super()
1175 uspi->s_size = fs32_to_cpu(sb, usb1->fs_size); in ufs_fill_super()
1176 uspi->s_dsize = fs32_to_cpu(sb, usb1->fs_dsize); in ufs_fill_super()
1179 uspi->s_ncg = fs32_to_cpu(sb, usb1->fs_ncg); in ufs_fill_super()
1182 uspi->s_fpb = fs32_to_cpu(sb, usb1->fs_frag); in ufs_fill_super()
1183 uspi->s_minfree = fs32_to_cpu(sb, usb1->fs_minfree); in ufs_fill_super()
1184 uspi->s_bmask = fs32_to_cpu(sb, usb1->fs_bmask); in ufs_fill_super()
1185 uspi->s_fmask = fs32_to_cpu(sb, usb1->fs_fmask); in ufs_fill_super()
1186 uspi->s_bshift = fs32_to_cpu(sb, usb1->fs_bshift); in ufs_fill_super()
1187 uspi->s_fshift = fs32_to_cpu(sb, usb1->fs_fshift); in ufs_fill_super()
1188 UFSD("uspi->s_bshift = %d,uspi->s_fshift = %d", uspi->s_bshift, in ufs_fill_super()
1189 uspi->s_fshift); in ufs_fill_super()
1190 uspi->s_fpbshift = fs32_to_cpu(sb, usb1->fs_fragshift); in ufs_fill_super()
1191 uspi->s_fsbtodb = fs32_to_cpu(sb, usb1->fs_fsbtodb); in ufs_fill_super()
1193 uspi->s_csmask = fs32_to_cpu(sb, usb1->fs_csmask); in ufs_fill_super()
1194 uspi->s_csshift = fs32_to_cpu(sb, usb1->fs_csshift); in ufs_fill_super()
1195 uspi->s_nindir = fs32_to_cpu(sb, usb1->fs_nindir); in ufs_fill_super()
1196 uspi->s_inopb = fs32_to_cpu(sb, usb1->fs_inopb); in ufs_fill_super()
1197 uspi->s_nspf = fs32_to_cpu(sb, usb1->fs_nspf); in ufs_fill_super()
1198 uspi->s_npsect = ufs_get_fs_npsect(sb, usb1, usb3); in ufs_fill_super()
1199 uspi->s_interleave = fs32_to_cpu(sb, usb1->fs_interleave); in ufs_fill_super()
1200 uspi->s_trackskew = fs32_to_cpu(sb, usb1->fs_trackskew); in ufs_fill_super()
1202 if (uspi->fs_magic == UFS2_MAGIC) in ufs_fill_super()
1203 uspi->s_csaddr = fs64_to_cpu(sb, usb3->fs_un1.fs_u2.fs_csaddr); in ufs_fill_super()
1205 uspi->s_csaddr = fs32_to_cpu(sb, usb1->fs_csaddr); in ufs_fill_super()
1207 uspi->s_cssize = fs32_to_cpu(sb, usb1->fs_cssize); in ufs_fill_super()
1208 uspi->s_cgsize = fs32_to_cpu(sb, usb1->fs_cgsize); in ufs_fill_super()
1209 uspi->s_ntrak = fs32_to_cpu(sb, usb1->fs_ntrak); in ufs_fill_super()
1210 uspi->s_nsect = fs32_to_cpu(sb, usb1->fs_nsect); in ufs_fill_super()
1211 uspi->s_spc = fs32_to_cpu(sb, usb1->fs_spc); in ufs_fill_super()
1212 uspi->s_ipg = fs32_to_cpu(sb, usb1->fs_ipg); in ufs_fill_super()
1213 uspi->s_fpg = fs32_to_cpu(sb, usb1->fs_fpg); in ufs_fill_super()
1214 uspi->s_cpc = fs32_to_cpu(sb, usb2->fs_un.fs_u1.fs_cpc); in ufs_fill_super()
1215 uspi->s_contigsumsize = fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_contigsumsize); in ufs_fill_super()
1216 uspi->s_qbmask = ufs_get_fs_qbmask(sb, usb3); in ufs_fill_super()
1217 uspi->s_qfmask = ufs_get_fs_qfmask(sb, usb3); in ufs_fill_super()
1218 uspi->s_nrpos = fs32_to_cpu(sb, usb3->fs_nrpos); in ufs_fill_super()
1219 uspi->s_postbloff = fs32_to_cpu(sb, usb3->fs_postbloff); in ufs_fill_super()
1220 uspi->s_rotbloff = fs32_to_cpu(sb, usb3->fs_rotbloff); in ufs_fill_super()
1222 uspi->s_root_blocks = mul_u64_u32_div(uspi->s_dsize, in ufs_fill_super()
1223 uspi->s_minfree, 100); in ufs_fill_super()
1224 if (uspi->s_minfree <= 5) { in ufs_fill_super()
1225 uspi->s_time_to_space = ~0ULL; in ufs_fill_super()
1226 uspi->s_space_to_time = 0; in ufs_fill_super()
1227 usb1->fs_optim = cpu_to_fs32(sb, UFS_OPTSPACE); in ufs_fill_super()
1229 uspi->s_time_to_space = (uspi->s_root_blocks / 2) + 1; in ufs_fill_super()
1230 uspi->s_space_to_time = mul_u64_u32_div(uspi->s_dsize, in ufs_fill_super()
1231 uspi->s_minfree - 2, 100) - 1; in ufs_fill_super()
1237 uspi->s_fpbmask = uspi->s_fpb - 1; in ufs_fill_super()
1238 if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) in ufs_fill_super()
1239 uspi->s_apbshift = uspi->s_bshift - 3; in ufs_fill_super()
1241 uspi->s_apbshift = uspi->s_bshift - 2; in ufs_fill_super()
1243 uspi->s_2apbshift = uspi->s_apbshift * 2; in ufs_fill_super()
1244 uspi->s_3apbshift = uspi->s_apbshift * 3; in ufs_fill_super()
1245 uspi->s_apb = 1 << uspi->s_apbshift; in ufs_fill_super()
1246 uspi->s_2apb = 1 << uspi->s_2apbshift; in ufs_fill_super()
1247 uspi->s_3apb = 1 << uspi->s_3apbshift; in ufs_fill_super()
1248 uspi->s_apbmask = uspi->s_apb - 1; in ufs_fill_super()
1249 uspi->s_nspfshift = uspi->s_fshift - UFS_SECTOR_BITS; in ufs_fill_super()
1250 uspi->s_nspb = uspi->s_nspf << uspi->s_fpbshift; in ufs_fill_super()
1251 uspi->s_inopf = uspi->s_inopb >> uspi->s_fpbshift; in ufs_fill_super()
1252 uspi->s_bpf = uspi->s_fsize << 3; in ufs_fill_super()
1253 uspi->s_bpfshift = uspi->s_fshift + 3; in ufs_fill_super()
1254 uspi->s_bpfmask = uspi->s_bpf - 1; in ufs_fill_super()
1255 if ((sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) == UFS_MOUNT_UFSTYPE_44BSD || in ufs_fill_super()
1256 (sbi->s_mount_opt & UFS_MOUNT_UFSTYPE) == UFS_MOUNT_UFSTYPE_UFS2) in ufs_fill_super()
1257 uspi->s_maxsymlinklen = in ufs_fill_super()
1258 fs32_to_cpu(sb, usb3->fs_un2.fs_44.fs_maxsymlinklen); in ufs_fill_super()
1260 if (uspi->fs_magic == UFS2_MAGIC) in ufs_fill_super()
1264 if (uspi->s_maxsymlinklen > maxsymlen) { in ufs_fill_super()
1266 "fast symlink size (%u)\n", uspi->s_maxsymlinklen); in ufs_fill_super()
1267 uspi->s_maxsymlinklen = maxsymlen; in ufs_fill_super()
1269 sb->s_maxbytes = ufs_max_bytes(sb); in ufs_fill_super()
1270 sb->s_max_links = UFS_LINK_MAX; in ufs_fill_super()
1273 if (IS_ERR(inode)) { in ufs_fill_super()
1277 sb->s_root = d_make_root(inode); in ufs_fill_super()
1278 if (!sb->s_root) { in ufs_fill_super()
1279 ret = -ENOMEM; in ufs_fill_super()
1287 if (!sb_rdonly(sb)) in ufs_fill_super()
1288 if (!ufs_read_cylinder_structures(sb)) in ufs_fill_super()
1295 if (ubh) in ufs_fill_super()
1299 sb->s_fs_info = NULL; in ufs_fill_super()
1305 return -ENOMEM; in ufs_fill_super()
1312 struct ufs_super_block_third * usb3; in ufs_remount() local
1317 mutex_lock(&UFS_SB(sb)->s_lock); in ufs_remount()
1318 uspi = UFS_SB(sb)->s_uspi; in ufs_remount()
1319 flags = UFS_SB(sb)->s_flags; in ufs_remount()
1321 usb3 = ubh_get_usb_third(uspi); in ufs_remount()
1327 ufstype = UFS_SB(sb)->s_mount_opt & UFS_MOUNT_UFSTYPE; in ufs_remount()
1330 if (!ufs_parse_options (data, &new_mount_opt)) { in ufs_remount()
1331 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_remount()
1332 return -EINVAL; in ufs_remount()
1334 if (!(new_mount_opt & UFS_MOUNT_UFSTYPE)) { in ufs_remount()
1336 } else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) { in ufs_remount()
1338 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_remount()
1339 return -EINVAL; in ufs_remount()
1342 if ((bool)(*mount_flags & SB_RDONLY) == sb_rdonly(sb)) { in ufs_remount()
1343 UFS_SB(sb)->s_mount_opt = new_mount_opt; in ufs_remount()
1344 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_remount()
1351 if (*mount_flags & SB_RDONLY) { in ufs_remount()
1353 usb1->fs_time = ufs_get_seconds(sb); in ufs_remount()
1354 if ((flags & UFS_ST_MASK) == UFS_ST_SUN in ufs_remount()
1357 ufs_set_fs_state(sb, usb1, usb3, in ufs_remount()
1358 UFS_FSOK - fs32_to_cpu(sb, usb1->fs_time)); in ufs_remount()
1360 sb->s_flags |= SB_RDONLY; in ufs_remount()
1366 pr_err("ufs was compiled with read-only support, can't be mounted as read-write\n"); in ufs_remount()
1367 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_remount()
1368 return -EINVAL; in ufs_remount()
1370 if (ufstype != UFS_MOUNT_UFSTYPE_SUN && in ufs_remount()
1375 pr_err("this ufstype is read-only supported\n"); in ufs_remount()
1376 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_remount()
1377 return -EINVAL; in ufs_remount()
1379 if (!ufs_read_cylinder_structures(sb)) { in ufs_remount()
1381 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_remount()
1382 return -EPERM; in ufs_remount()
1384 sb->s_flags &= ~SB_RDONLY; in ufs_remount()
1387 UFS_SB(sb)->s_mount_opt = new_mount_opt; in ufs_remount()
1388 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_remount()
1394 struct ufs_sb_info *sbi = UFS_SB(root->d_sb); in ufs_show_options()
1395 unsigned mval = sbi->s_mount_opt & UFS_MOUNT_UFSTYPE; in ufs_show_options()
1398 while (tp->token != Opt_onerror_panic && tp->token != mval) in ufs_show_options()
1400 BUG_ON(tp->token == Opt_onerror_panic); in ufs_show_options()
1401 seq_printf(seq, ",%s", tp->pattern); in ufs_show_options()
1403 mval = sbi->s_mount_opt & UFS_MOUNT_ONERROR; in ufs_show_options()
1404 while (tp->token != Opt_err && tp->token != mval) in ufs_show_options()
1406 BUG_ON(tp->token == Opt_err); in ufs_show_options()
1407 seq_printf(seq, ",%s", tp->pattern); in ufs_show_options()
1414 struct super_block *sb = dentry->d_sb; in ufs_statfs()
1415 struct ufs_sb_private_info *uspi= UFS_SB(sb)->s_uspi; in ufs_statfs()
1416 unsigned flags = UFS_SB(sb)->s_flags; in ufs_statfs()
1417 u64 id = huge_encode_dev(sb->s_bdev->bd_dev); in ufs_statfs()
1419 mutex_lock(&UFS_SB(sb)->s_lock); in ufs_statfs()
1421 if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) in ufs_statfs()
1422 buf->f_type = UFS2_MAGIC; in ufs_statfs()
1424 buf->f_type = UFS_MAGIC; in ufs_statfs()
1426 buf->f_blocks = uspi->s_dsize; in ufs_statfs()
1427 buf->f_bfree = ufs_freefrags(uspi); in ufs_statfs()
1428 buf->f_ffree = uspi->cs_total.cs_nifree; in ufs_statfs()
1429 buf->f_bsize = sb->s_blocksize; in ufs_statfs()
1430 buf->f_bavail = (buf->f_bfree > uspi->s_root_blocks) in ufs_statfs()
1431 ? (buf->f_bfree - uspi->s_root_blocks) : 0; in ufs_statfs()
1432 buf->f_files = uspi->s_ncg * uspi->s_ipg; in ufs_statfs()
1433 buf->f_namelen = UFS_MAXNAMLEN; in ufs_statfs()
1434 buf->f_fsid = u64_to_fsid(id); in ufs_statfs()
1436 mutex_unlock(&UFS_SB(sb)->s_lock); in ufs_statfs()
1448 if (!ei) in ufs_alloc_inode()
1451 inode_set_iversion(&ei->vfs_inode, 1); in ufs_alloc_inode()
1452 seqlock_init(&ei->meta_lock); in ufs_alloc_inode()
1453 mutex_init(&ei->truncate_mutex); in ufs_alloc_inode()
1454 return &ei->vfs_inode; in ufs_alloc_inode()
1466 inode_init_once(&ei->vfs_inode); in init_once()
1478 if (ufs_inode_cachep == NULL) in init_inodecache()
1479 return -ENOMEM; in init_inodecache()
1523 if (err) in init_ufs_fs()
1526 if (err) in init_ufs_fs()