Lines Matching refs:s
22 static void mark_dirty(struct super_block *s, int remount) in mark_dirty() argument
24 if (hpfs_sb(s)->sb_chkdsk && (remount || !(s->s_flags & MS_RDONLY))) { in mark_dirty()
27 if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { in mark_dirty()
40 static void unmark_dirty(struct super_block *s) in unmark_dirty() argument
44 if (s->s_flags & MS_RDONLY) return; in unmark_dirty()
45 sync_blockdev(s->s_bdev); in unmark_dirty()
46 if ((sb = hpfs_map_sector(s, 17, &bh, 0))) { in unmark_dirty()
47 sb->dirty = hpfs_sb(s)->sb_chkdsk > 1 - hpfs_sb(s)->sb_was_error; in unmark_dirty()
48 sb->old_wrote = hpfs_sb(s)->sb_chkdsk >= 2 && !hpfs_sb(s)->sb_was_error; in unmark_dirty()
56 void hpfs_error(struct super_block *s, const char *fmt, ...) in hpfs_error() argument
70 if (!hpfs_sb(s)->sb_was_error) { in hpfs_error()
71 if (hpfs_sb(s)->sb_err == 2) { in hpfs_error()
73 mark_dirty(s, 0); in hpfs_error()
75 } else if (hpfs_sb(s)->sb_err == 1) { in hpfs_error()
76 if (s->s_flags & MS_RDONLY) in hpfs_error()
80 mark_dirty(s, 0); in hpfs_error()
81 s->s_flags |= MS_RDONLY; in hpfs_error()
83 } else if (s->s_flags & MS_RDONLY) in hpfs_error()
89 hpfs_sb(s)->sb_was_error = 1; in hpfs_error()
100 int hpfs_stop_cycles(struct super_block *s, int key, int *c1, int *c2, in hpfs_stop_cycles() argument
104 hpfs_error(s, "cycle detected on key %08x in %s", key, msg); in hpfs_stop_cycles()
124 static void hpfs_put_super(struct super_block *s) in hpfs_put_super() argument
126 hpfs_lock(s); in hpfs_put_super()
127 unmark_dirty(s); in hpfs_put_super()
128 hpfs_unlock(s); in hpfs_put_super()
129 call_rcu(&hpfs_sb(s)->rcu, lazy_free_sbi); in hpfs_put_super()
132 static unsigned hpfs_count_one_bitmap(struct super_block *s, secno secno) in hpfs_count_one_bitmap() argument
138 bits = hpfs_map_4sectors(s, secno, &qbh, 0); in hpfs_count_one_bitmap()
146 static unsigned count_bitmaps(struct super_block *s) in count_bitmaps() argument
149 n_bands = (hpfs_sb(s)->sb_fs_size + 0x3fff) >> 14; in count_bitmaps()
152 hpfs_prefetch_bitmap(s, n); in count_bitmaps()
156 hpfs_prefetch_bitmap(s, n + COUNT_RD_AHEAD); in count_bitmaps()
157 c = hpfs_count_one_bitmap(s, le32_to_cpu(hpfs_sb(s)->sb_bmp_dir[n])); in count_bitmaps()
164 unsigned hpfs_get_free_dnodes(struct super_block *s) in hpfs_get_free_dnodes() argument
166 struct hpfs_sb_info *sbi = hpfs_sb(s); in hpfs_get_free_dnodes()
168 unsigned c = hpfs_count_one_bitmap(s, sbi->sb_dmap); in hpfs_get_free_dnodes()
178 struct super_block *s = dentry->d_sb; in hpfs_statfs() local
179 struct hpfs_sb_info *sbi = hpfs_sb(s); in hpfs_statfs()
180 u64 id = huge_encode_dev(s->s_bdev->bd_dev); in hpfs_statfs()
182 hpfs_lock(s); in hpfs_statfs()
185 sbi->sb_n_free = count_bitmaps(s); in hpfs_statfs()
187 buf->f_type = s->s_magic; in hpfs_statfs()
193 buf->f_ffree = hpfs_get_free_dnodes(s); in hpfs_statfs()
198 hpfs_unlock(s); in hpfs_statfs()
422 static int hpfs_remount_fs(struct super_block *s, int *flags, char *data) in hpfs_remount_fs() argument
429 struct hpfs_sb_info *sbi = hpfs_sb(s); in hpfs_remount_fs()
431 sync_filesystem(s); in hpfs_remount_fs()
435 hpfs_lock(s); in hpfs_remount_fs()
456 unmark_dirty(s); in hpfs_remount_fs()
464 if (!(*flags & MS_RDONLY)) mark_dirty(s, 1); in hpfs_remount_fs()
466 hpfs_unlock(s); in hpfs_remount_fs()
470 hpfs_unlock(s); in hpfs_remount_fs()
517 static int hpfs_fill_super(struct super_block *s, void *options, int silent) in hpfs_fill_super() argument
541 s->s_fs_info = sbi; in hpfs_fill_super()
544 hpfs_lock(s); in hpfs_fill_super()
567 sb_set_blocksize(s, 512); in hpfs_fill_super()
569 if (!(bootblock = hpfs_map_sector(s, 0, &bh0, 0))) goto bail1; in hpfs_fill_super()
570 if (!(superblock = hpfs_map_sector(s, 16, &bh1, 1))) goto bail2; in hpfs_fill_super()
571 if (!(spareblock = hpfs_map_sector(s, 17, &bh2, 0))) goto bail3; in hpfs_fill_super()
583 if (!(s->s_flags & MS_RDONLY) && in hpfs_fill_super()
591 s->s_flags |= MS_NOATIME; in hpfs_fill_super()
594 s->s_magic = HPFS_SUPER_MAGIC; in hpfs_fill_super()
595 s->s_op = &hpfs_sops; in hpfs_fill_super()
596 s->s_d_op = &hpfs_dentry_operations; in hpfs_fill_super()
621 hpfs_error(s, "invalid size in superblock: %08x", in hpfs_fill_super()
627 if (!(sbi->sb_bmp_dir = hpfs_load_bitmap_directory(s, le32_to_cpu(superblock->bitmaps)))) in hpfs_fill_super()
636 hpfs_error(s, "improperly stopped"); in hpfs_fill_super()
639 if (!(s->s_flags & MS_RDONLY)) { in hpfs_fill_super()
648 mark_dirty(s, 0); in hpfs_fill_super()
651 hpfs_error(s, "hotfixes not supported here, try chkdsk"); in hpfs_fill_super()
660 mark_dirty(s, 0); in hpfs_fill_super()
663 hpfs_error(s, "warning: spare dnodes used, try chkdsk"); in hpfs_fill_super()
671 …hpfs_error(s, "dir band size mismatch: dir_band_start==%08x, dir_band_end==%08x, n_dir_band==%08x", in hpfs_fill_super()
677 …if (hpfs_chk_sectors(s, le32_to_cpu(superblock->dir_band_start), le32_to_cpu(superblock->n_dir_ban… in hpfs_fill_super()
678 hpfs_chk_sectors(s, le32_to_cpu(superblock->dir_band_bitmap), 4, "dir_band_bitmap") || in hpfs_fill_super()
679 hpfs_chk_sectors(s, le32_to_cpu(superblock->bitmaps), 4, "bitmaps")) { in hpfs_fill_super()
680 mark_dirty(s, 0); in hpfs_fill_super()
689 if (!(sbi->sb_cp_table = hpfs_load_code_page(s, le32_to_cpu(spareblock->code_page_dir)))) in hpfs_fill_super()
696 root = iget_locked(s, sbi->sb_root); in hpfs_fill_super()
702 s->s_root = d_make_root(root); in hpfs_fill_super()
703 if (!s->s_root) in hpfs_fill_super()
710 root_dno = hpfs_fnode_dno(s, sbi->sb_root); in hpfs_fill_super()
714 hpfs_error(s, "unable to find root dir"); in hpfs_fill_super()
716 root->i_atime.tv_sec = local_to_gmt(s, le32_to_cpu(de->read_date)); in hpfs_fill_super()
718 root->i_mtime.tv_sec = local_to_gmt(s, le32_to_cpu(de->write_date)); in hpfs_fill_super()
720 root->i_ctime.tv_sec = local_to_gmt(s, le32_to_cpu(de->creation_date)); in hpfs_fill_super()
730 hpfs_unlock(s); in hpfs_fill_super()
738 hpfs_unlock(s); in hpfs_fill_super()